-
Notifications
You must be signed in to change notification settings - Fork 802
Description
Description
This is a regression. In this particular shader, using an explicit [branch] attribute causes incorrect code generation.
The shader has pickIndex (from cbuffer). That is used to pick between two structs - Surface_0 and Surface_1. Which struct is picked, returns a different color (also from cbuffer). Logic is encapsulated via several structs with member functions.
If the switch statement has a [branch] attribute, most of the logic boils away - shader is incorrect.
Steps to Reproduce
See included hlsl file. Code comment has command line args.
By default, generates incorrect shader.
Changing ATTRIBUTE_BRANCH to nothing gives correct shader.
Fails on recent dxc (git head) and last official release.
Works in old 1.7.0.4353-b32b169bd. (>year old).
Files: original.hlsl -- shader code
ps_bad.spv -- spir-v of incorrect results (current dxc).
ps_good.spv -- spir-v of correct results
Removing [branch] attribute gives correct/identical to historical results.
Environment
- [DXC version](dxcompiler.dll: 1.10 - 1.8.2505.0; dxil.dll: 1.8(101.8.2405.17))
- Win11.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status