You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The shader compilation fails with a clear error message indicating where in the source code the invalid write is.
Actual result
fatal error: generated SPIR-V is invalid: Expected Image 'Sampled' parameter to be 0 or 2
OpImageWrite %18 %17 %15 None
note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible
NOTE: the same happens with the DXIL backend but it does not ask to report a bug:
error: validation errors
Function: CSMain: error: store should be on uav resource. Use /Zi for source location.
note: at 'call void @dx.op.bufferStore.i32(i32 69, %dx.types.Handle %1, i32 %2, i32 undef, i32 %3, i32 %3, i32 %3, i32 %3, i8 15)' in block '#0' of function 'CSMain'.
Validation failed.
I tested it with the current tot 9972b66 build and confirmed it is fixed.
a.hlsl:6:20: error: cannot assign to return value because function 'operator[]<const unsigned int &>' returns a const value
MyBuffer[id.x] = id.y;
~~~~~~~~~~~~~~ ^
note: function 'operator[]<const unsigned int &>' which returns const-qualified type 'const unsigned int &' declared here
The new error message clearly pinpoints the code location causing the error.
Title
[SPIR-V] Writing to a read only Buffer<> resource produces validation errors (asks to report a bug)
Functional impact
The shader fails to compile without a clear error message which would indicate the issue. The generated message asks to report a bug.
Minimal repro steps
dxc.exe -T cs_6_0 -E CSMain -spirv issue_shader.txt
:Expected result
The shader compilation fails with a clear error message indicating where in the source code the invalid write is.
Actual result
Further technical details
Ran this on shader playground with DXC from 2020 12 16
NOTE: the same happens with the DXIL backend but it does not ask to report a bug:
shader playground
The text was updated successfully, but these errors were encountered: