microsoft / microsoft/DirectXShaderCompiler

Remainder of inout signature element not passed through when one component is modified

Open
#2,528 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug fxc-disagrees
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

In the case of an inout signature element, we do not pass through components not modified by the shader unless no components are touched.

The following test case succeeds if you do not write to pos.w, but fails with a validation error if you do since we do not output pos.xyz. Fxc does pass these through, so we should fix this.

// RUN: %dxc -E main -T vs_6_0 %s | FileCheck %s

// CHECK: call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 0,
// CHECK: call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 1,
// CHECK: call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 2,
// CHECK: call void @dx.op.storeOutput.f32(i32 5, i32 0, i32 0, i8 3,

// Should pass the rest (xyz) of SV_Position through
void main(inout float4 pos: SV_Position) {
  pos.w = 1;
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided HLSL test using %dxc -E main -T vs_6_0 and inspect the FileCheck output and validation error. The fix is complete when modifying only pos.w still produces storeOutput calls for all four SV_Position components, including pos.xyz, as expected by the checks.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.