Skip to content

Commit 3b1a29b

Browse files
authored
[OMM] Add DXR Entry point test, non-library target test, conforming tests to spec. (microsoft#7281)
This PR adds 2 tests that were mentioned in the spec that haven't yet been added. 1. A test that makes sure that restricted flags are diagnosed in DXR entry shaders. 2. A test that makes sure that no diagnostics are emitted when a restricted flag is used for a subobject in a non-library shadaer target. Fixes microsoft#7282
1 parent 2b1c2e6 commit 3b1a29b

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %dxc -T lib_6_3 -validator-version 1.8 -verify %s
2+
3+
// expected-warning@+1{{potential misuse of built-in constant 'RAYTRACING_PIPELINE_FLAG_ALLOW_OPACITY_MICROMAPS' in shader model lib_6_3; introduced in shader model 6.9}}
4+
RaytracingPipelineConfig1 rpc = { 32, RAYTRACING_PIPELINE_FLAG_ALLOW_OPACITY_MICROMAPS };
5+
6+
RaytracingAccelerationStructure RTAS;
7+
// DXR entry to test that restricted flags are diagnosed.
8+
[shader("raygeneration")]
9+
void main(void) {
10+
RayDesc rayDesc;
11+
12+
// expected-warning@+2{{potential misuse of built-in constant 'RAY_FLAG_FORCE_OMM_2_STATE' in shader model lib_6_3; introduced in shader model 6.9}}
13+
// expected-warning@+1{{potential misuse of built-in constant 'RAYQUERY_FLAG_ALLOW_OPACITY_MICROMAPS' in shader model lib_6_3; introduced in shader model 6.9}}
14+
RayQuery<RAY_FLAG_FORCE_OMM_2_STATE, RAYQUERY_FLAG_ALLOW_OPACITY_MICROMAPS> rayQuery;
15+
// expected-warning@+1{{potential misuse of built-in constant 'RAY_FLAG_FORCE_OMM_2_STATE' in shader model lib_6_3; introduced in shader model 6.9}}
16+
rayQuery.TraceRayInline(RTAS, RAY_FLAG_FORCE_OMM_2_STATE, 2, rayDesc);
17+
}

tools/clang/test/SemaHLSL/rayquery-omm-type-diag.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %dxc -T vs_6_9 -E RayQueryTests -verify %s
2-
// RUN: %dxc -T vs_6_5 -E RayQueryTests2 -verify %s
1+
// RUN: %dxc -T vs_6_9 -verify %s
2+
// RUN: %dxc -T vs_6_5 -verify %s
33

44
// validate 2nd template argument flags
55
// expected-error@+1{{When using 'RAY_FLAG_FORCE_OMM_2_STATE' in RayFlags, RayQueryFlags must have RAYQUERY_FLAG_ALLOW_OPACITY_MICROMAPS set.}}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %dxc -T ps_6_0 -verify %s
2+
3+
// expected-no-diagnostics
4+
// No diagnostic is expected because this is a non-library target,
5+
// and SubObjects are ignored on non-library targets.
6+
7+
RaytracingPipelineConfig1 rpc = { 32, RAYTRACING_PIPELINE_FLAG_ALLOW_OPACITY_MICROMAPS };
8+
9+
[shader("pixel")]
10+
int main(int i : INDEX) : SV_Target {
11+
return 1;
12+
}

0 commit comments

Comments
 (0)