microsoft / microsoft/DirectXShaderCompiler

error: Flags must match usage.

Open
#3,902 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This shader causes an error.

[numthreads(8, 8, 1)]
void computeRTAO(
	uint3 groupId : SV_GroupID,
	uint3 groupThreadId : SV_GroupThreadID,
	uint3 dispatchThreadId : SV_DispatchThreadID,
	uint groupIndex : SV_GroupIndex )
{
  RayQuery<RAY_FLAG_CULL_NON_OPAQUE |
             RAY_FLAG_SKIP_PROCEDURAL_PRIMITIVES |
             RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH |
			 RAY_FLAG_CULL_BACK_FACING_TRIANGLES> rq;
}

error: validation errors
error: Flags must match usage.
note: Flags declared=33554432, actual=0
Validation failed.

Compiler command line:

dxc /nologo /all_resources_bound /Ges /WX /O3 /T cs_6_6 /E computeRTAO /Fo shader.cso shader.hlsl

I tested with June 2021 DXC release.

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

Reproduce the failure with the provided HLSL shader and the dxc command line using the June 2021 DXC release. Start by tracing validation for RayQuery flags and compare the declared and actual values shown in the diagnostic. Done means the reported shader is validated without the erroneous “Flags must match usage” failure, with regression coverage for this case.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.