Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attributes read via GetAttributeAtVertex aren't counted as read in the signature #5417

Open
damyanp opened this issue Jul 13, 2023 · 4 comments
Labels
bug Bug, regression, crash correctness Bugs that impact shader correctness
Milestone

Comments

@damyanp
Copy link
Member

damyanp commented Jul 13, 2023

Description

float4 VCMain(
    nointerpolation float4 Color:COLOR0)
    : SV_TARGET0 
{
#ifdef USE_GET_ATTRIBUTE_AT_VERTEX
    return GetAttributeAtVertex(Color,0);
#endif
    return Color;
}

Steps to Reproduce

With above shader the generated assembly shows the input signature. When compiled without extra defines, it reports:

; Input signature:
;
; Name                 Index   Mask Register SysValue  Format   Used
; -------------------- ----- ------ -------- -------- ------- ------
; COLOR                    0   xyzw        0     NONE   float   xyzw

When compiled with -DUSE_GET_ATTRIBUTE_AT_VERTEX it shows:

; Input signature:
;
; Name                 Index   Mask Register SysValue  Format   Used
; -------------------- ----- ------ -------- -------- ------- ------
; COLOR                    0   xyzw        0     NONE   float       

My expectation here is that COLOR would show as used in both cases.

Environment

  • dxcompiler.dll: 1.7 - 1.7.2212.40 (e043f4a); dxil.dll: 1.7(101.7.2212.36)
  • Windows 11
@damyanp damyanp added bug Bug, regression, crash needs-triage Awaiting triage labels Jul 13, 2023
@llvm-beanz llvm-beanz moved this to For MSFT in HLSL Triage Jul 17, 2023
@pow2clk pow2clk added tech-debt and removed needs-triage Awaiting triage labels Sep 6, 2023
@pow2clk pow2clk moved this from For MSFT to Done in HLSL Triage Sep 6, 2023
@pow2clk
Copy link
Member

pow2clk commented Sep 6, 2023

There is some nuance here. The actual values of color are not being used rather the variable is being used to access the 0th barycentric value. I don't know necessarily if that would cause a problem here. @damyanp, did you encounter a specific bug from this? @tex3d, do you think this is a problem or working as intended?

@pow2clk pow2clk added needs-triage Awaiting triage and removed tech-debt labels Sep 6, 2023
@pow2clk pow2clk moved this from Done to For MSFT in HLSL Triage Sep 6, 2023
@python3kgae
Copy link
Contributor

If backend only depends on the value of used to decide which ps input is required, that will be a problem.

If backend collects the information when lower attributeAtVertex and loadInput, things should be fine.

@damyanp
Copy link
Member Author

damyanp commented Sep 6, 2023

This was reported by a developer who wants to use reflection to determine which vertex attributes are actually used by a shader after dead code has been eliminated.

@tex3d
Copy link
Contributor

tex3d commented Sep 7, 2023

I think this is a legitimate bug - we should be including this operation when computing the usage mask.

These masks are used when validating inter-stage signature linkage, so if the input appears unused, it would appear that the corresponding output from the upstream shader does not need to be written. That doesn't sound like the right behavior.

@pow2clk pow2clk added reflection Related to Reflection data and removed needs-triage Awaiting triage reflection Related to Reflection data labels Sep 20, 2023
@pow2clk pow2clk moved this from For MSFT to Done in HLSL Triage Sep 20, 2023
@pow2clk pow2clk added the correctness Bugs that impact shader correctness label Sep 20, 2023
@damyanp damyanp added this to the Dormant milestone Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash correctness Bugs that impact shader correctness
Projects
Status: Triaged
Development

No branches or pull requests

4 participants