microsoft / microsoft/DirectXShaderCompiler
DXC ignores struct cast when writing to an AppendStructuredBuffer
Open
@tristanlabelle is already working on this.
Since Jan 23, 2019.
bug
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Repro:
struct I32 { int value; };
struct F32 { float value; } f32;
AppendStructuredBuffer<I32> output;
void main() { output.Append((I32)f32); }
DXC output (shortened), note the lack of fptosi:
%0 = call %dx.types.CBufRet.i32 @dx.op.cbufferLoadLegacy.i32(i32 59, %dx.types.Handle %"$Globals_cbuffer", i32 0)
%1 = extractvalue %dx.types.CBufRet.i32 %0, 0
call void @dx.op.bufferStore.i32(i32 69, %dx.types.Handle %output_UAV_structbuf, i32 %2, i32 0, i32 %1, i32 undef, i32 undef, i32 undef, i8 1)
FXC output (shortened), note the ftoi:
ftoi r0.y, cb0[0].x
store_structured u0.x, r0.x, l(0), r0.y
Note that it does not repro using an RWStructuredBuffer, so it probably has to do with the append intrinsic.
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.
Assessment
This issue has not been assessed yet.