microsoft / microsoft/DirectXShaderCompiler
[SPIR-V] OpCopyLogical with same Result and Operand Type for arrays in cbuffer
Open
Nobody has claimed this yet.
bug
spirv
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
When compiling a cbuffer with an array, an invalid OpCopyLogical instruction is generated where the result type is the same as the operand type.
HLSL Source:
cbuffer CBArrays : register(b0) {
float c1[2];
int4 c2[2][2];
bool c3[2];
}
struct Arrays {
float c1[2];
int4 c2[2][2];
bool c3[2];
};
RWStructuredBuffer<Arrays> Out : register(u1);
[numthreads(1,1,1)]
void main() {
Out[0].c1 = c1;
Out[0].c2 = c2;
Out[0].c3 = c3;
}
Compilation Command:
dxc -spirv -fspv-target-env=vulkan1.3 -fvk-use-dx-layout -T cs_6_5 source.hlsl
Error:
fatal error: generated SPIR-V is invalid: Result Type must not equal the Operand type
%41 = OpCopyLogical %_arr__arr_v4int_uint_2_uint_2 %39
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the supplied HLSL source and the dxc SPIR-V compilation command, then inspect the generated OpCopyLogical instruction for the nested array assignment. Done means the compiler no longer emits an OpCopyLogical whose result type equals its operand type, and the generated SPIR-V passes validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100