-
Notifications
You must be signed in to change notification settings - Fork 707
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
929 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm61_barycentrics.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// RUN: %dxilver 1.8 | %dxc -T lib_6_8 %s | %D3DReflect %s | %FileCheck %s -check-prefixes=RDAT,RDAT18 | ||
// RUN: %dxilver 1.7 | %dxc -T lib_6_7 -validator-version 1.7 %s | %D3DReflect %s | FileCheck %s -check-prefixes=RDAT,RDAT17 | ||
|
||
// Ensure min shader target incorporates optional features used | ||
|
||
// RDAT: FunctionTable[{{.*}}] = { | ||
|
||
// SM 6.1+ | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// ShaderFeatureInfo_Barycentrics (0x20000) = 131072 | ||
|
||
// RDAT-LABEL: UnmangledName: "bary1" | ||
// RDAT: FeatureInfo1: 131072 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (Pixel(0) << 16) + (SM 6.1 ((6 << 4) + 1)) = 0x61 = 97 | ||
// RDAT: MinShaderTarget: 97 | ||
|
||
[shader("pixel")] | ||
void bary1(float3 barycentrics : SV_Barycentrics, out float4 target : SV_Target) { | ||
target = float4(barycentrics, 1); | ||
} | ||
|
||
// RDAT-LABEL: UnmangledName: "bary2" | ||
// RDAT: FeatureInfo1: 131072 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (Pixel(0) << 16) + (SM 6.1 ((6 << 4) + 1)) = 0x61 = 97 | ||
// RDAT: MinShaderTarget: 97 | ||
|
||
[shader("pixel")] | ||
void bary2(nointerpolation float4 color : COLOR, out float4 target : SV_Target) { | ||
target = GetAttributeAtVertex(color, 1); | ||
} |
26 changes: 26 additions & 0 deletions
26
tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm61_viewid.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// RUN: %dxilver 1.8 | %dxc -T lib_6_8 %s | %D3DReflect %s | %FileCheck %s -check-prefixes=RDAT,RDAT18 | ||
// RUN: %dxilver 1.7 | %dxc -T lib_6_7 -validator-version 1.7 %s | %D3DReflect %s | FileCheck %s -check-prefixes=RDAT,RDAT17 | ||
|
||
// Ensure min shader target incorporates optional features used | ||
|
||
// RDAT: FunctionTable[{{.*}}] = { | ||
|
||
// SM 6.1+ | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// ShaderFeatureInfo_ViewID (0x10000) = 65536 | ||
|
||
// ViewID is loaded using an intrinsic, so prior validator already adjusted SM | ||
// for it. | ||
|
||
// RDAT-LABEL: UnmangledName: "viewid" | ||
// ShaderFeatureInfo_ViewID (0x10000) = 65536 | ||
// RDAT: FeatureInfo1: 65536 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (Pixel(0) << 16) + (SM 6.1 ((6 << 4) + 1)) = 0x61 = 97 | ||
// RDAT: MinShaderTarget: 97 | ||
|
||
[shader("pixel")] | ||
void viewid(uint vid : SV_ViewID, out float4 target : SV_Target) { | ||
target = vid; | ||
} |
96 changes: 96 additions & 0 deletions
96
tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm63_dxr.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// RUN: %dxilver 1.8 | %dxc -T lib_6_8 %s | %D3DReflect %s | %FileCheck %s -check-prefixes=RDAT,RDAT18 | ||
// RUN: %dxilver 1.7 | %dxc -T lib_6_7 -validator-version 1.7 %s | %D3DReflect %s | FileCheck %s -check-prefixes=RDAT,RDAT17 | ||
|
||
// Ensure min shader target incorporates shader stage of entry function | ||
// These must be minimal shaders since intrinsic usage associated with the | ||
// shader stage will cause the min target to be set that way. | ||
|
||
// This covers raytracing entry points, which should always be SM 6.3+ | ||
|
||
// RDAT: FunctionTable[{{.*}}] = { | ||
|
||
RWByteAddressBuffer BAB : register(u1, space0); | ||
|
||
// RDAT-LABEL: UnmangledName: "raygen" | ||
// RDAT: FeatureInfo1: 0 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (RayGeneration(7) << 16) + (SM 6.3 ((6 << 4) + 3)) = 0x70063 = 458851 | ||
// RDAT18: MinShaderTarget: 458851 | ||
// Old: 6.0 | ||
// RDAT17: MinShaderTarget: 458848 | ||
|
||
[shader("raygeneration")] | ||
void raygen() { | ||
BAB.Store(0, 0); | ||
} | ||
|
||
// RDAT-LABEL: UnmangledName: "intersection" | ||
// RDAT: FeatureInfo1: 0 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (Intersection(8) << 16) + (SM 6.3 ((6 << 4) + 3)) = 0x80063 = 524387 | ||
// RDAT18: MinShaderTarget: 524387 | ||
// Old: 6.0 | ||
// RDAT17: MinShaderTarget: 524384 | ||
|
||
[shader("intersection")] | ||
void intersection() { | ||
BAB.Store(0, 0); | ||
} | ||
|
||
// RDAT-LABEL: UnmangledName: "anyhit" | ||
// RDAT: FeatureInfo1: 0 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (AnyHit(9) << 16) + (SM 6.3 ((6 << 4) + 3)) = 0x90063 = 589923 | ||
// RDAT18: MinShaderTarget: 589923 | ||
// Old: 6.0 | ||
// RDAT17: MinShaderTarget: 589920 | ||
|
||
struct [raypayload] MyPayload { | ||
float2 loc : write(caller) : read(caller); | ||
}; | ||
|
||
[shader("anyhit")] | ||
void anyhit(inout MyPayload payload : SV_RayPayload, | ||
in BuiltInTriangleIntersectionAttributes attr : SV_IntersectionAttributes ) { | ||
BAB.Store(0, 0); | ||
} | ||
|
||
// RDAT-LABEL: UnmangledName: "closesthit" | ||
// RDAT: FeatureInfo1: 0 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (ClosestHit(10) << 16) + (SM 6.3 ((6 << 4) + 3)) = 0xA0063 = 655459 | ||
// RDAT18: MinShaderTarget: 655459 | ||
// Old: 6.0 | ||
// RDAT17: MinShaderTarget: 655456 | ||
|
||
[shader("closesthit")] | ||
void closesthit(inout MyPayload payload : SV_RayPayload, | ||
in BuiltInTriangleIntersectionAttributes attr : SV_IntersectionAttributes ) { | ||
BAB.Store(0, 0); | ||
} | ||
|
||
// RDAT-LABEL: UnmangledName: "miss" | ||
// RDAT: FeatureInfo1: 0 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (Miss(11) << 16) + (SM 6.3 ((6 << 4) + 3)) = 0xB0063 = 720995 | ||
// RDAT18: MinShaderTarget: 720995 | ||
// Old: 6.0 | ||
// RDAT17: MinShaderTarget: 720992 | ||
|
||
[shader("miss")] | ||
void miss(inout MyPayload payload : SV_RayPayload) { | ||
BAB.Store(0, 0); | ||
} | ||
|
||
// RDAT-LABEL: UnmangledName: "callable" | ||
// RDAT: FeatureInfo1: 0 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (Callable(12) << 16) + (SM 6.3 ((6 << 4) + 3)) = 0xC0063 = 786531 | ||
// RDAT18: MinShaderTarget: 786531 | ||
// Old: 6.0 | ||
// RDAT17: MinShaderTarget: 786528 | ||
|
||
[shader("callable")] | ||
void callable(inout MyPayload param) { | ||
BAB.Store(0, 0); | ||
} |
25 changes: 25 additions & 0 deletions
25
tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm64_shadingrate.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: %dxilver 1.8 | %dxc -T lib_6_8 %s | %D3DReflect %s | %FileCheck %s -check-prefixes=RDAT,RDAT18 | ||
// RUN: %dxilver 1.7 | %dxc -T lib_6_7 -validator-version 1.7 %s | %D3DReflect %s | FileCheck %s -check-prefixes=RDAT,RDAT17 | ||
|
||
// Ensure min shader target incorporates optional features used | ||
|
||
// RDAT: FunctionTable[{{.*}}] = { | ||
|
||
// SM 6.4+ | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// ShaderFeatureInfo_ShadingRate (0x80000) = 524288 | ||
// Not sure if already caught. | ||
|
||
// RDAT-LABEL: UnmangledName: "ps_shadingrate" | ||
// RDAT: FeatureInfo1: 524288 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (Pixel(0) << 16) + (SM 6.4 ((6 << 4) + 4)) = 0x64 = 100 | ||
// RDAT18: MinShaderTarget: 100 | ||
// Old 6.0 | ||
// RDAT17: MinShaderTarget: 96 | ||
|
||
[shader("pixel")] | ||
void ps_shadingrate(uint rate : SV_ShadingRate, out float4 target : SV_Target) { | ||
target = rate; | ||
} |
67 changes: 67 additions & 0 deletions
67
tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm65_ms_as.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// RUN: %dxilver 1.8 | %dxc -T lib_6_8 %s | %D3DReflect %s | %FileCheck %s -check-prefixes=RDAT,RDAT18 | ||
// RUN: %dxilver 1.7 | %dxc -T lib_6_7 -validator-version 1.7 %s | %D3DReflect %s | FileCheck %s -check-prefixes=RDAT,RDAT17 | ||
|
||
// Ensure min shader target incorporates shader stage of entry function | ||
// These must be minimal shaders since intrinsic usage associated with the | ||
// shader stage will cause the min target to be set that way. | ||
|
||
// This covers mesh and amplification shaders, which should always be SM 6.5+ | ||
|
||
// RDAT: FunctionTable[{{.*}}] = { | ||
|
||
RWByteAddressBuffer BAB : register(u1, space0); | ||
|
||
//////////////////////////////////////// | ||
// Mesh shader | ||
// Currently, mesh shader is not requiring output vertices or indices, so this | ||
// works. If that requirement were to be enforced, we would have to declare | ||
// these outputs. However, if we do, there should also be a requirement that | ||
// mesh shader vertex output has SV_Position (not enforced currently either). | ||
// If that were to be enforced, and added to the struct, then the validator | ||
// will fail unless you write to all components of SV_Position. This should | ||
// probably only be the case if OutputCounts are set to anything other than 0. | ||
// In any case, all this means that if some rules start to be enforced, we | ||
// will be forced to use things which will produce intrinsic calls in the mesh | ||
// shader which will cause the min target to be set to SM 6.5+ even for | ||
// validator version 1.7 and below. | ||
|
||
// RDAT-LABEL: UnmangledName: "mesh" | ||
// RDAT: FeatureInfo1: 0 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (Mesh(13) << 16) + (SM 6.5 ((6 << 4) + 5)) = 0xD0065 = 852069 | ||
// RDAT18: MinShaderTarget: 852069 | ||
// Old: 6.0 | ||
// RDAT17: MinShaderTarget: 852064 | ||
|
||
struct Vertex { | ||
float4 val : UNUSED; | ||
}; | ||
|
||
[shader("mesh")] | ||
[numthreads(1, 1, 1)] | ||
[outputtopology("triangle")] | ||
void mesh(//out vertices Vertex verts[1], | ||
//out indices uint3 tris[1] | ||
) { | ||
BAB.Store(0, 0); | ||
} | ||
|
||
//////////////////////////////////////// | ||
// Amplification shader | ||
// It turns out that amplification shaders require exactly one DispatchMesh | ||
// call, which causes the entry to get the correct min target without basing | ||
// it on the shader type. | ||
|
||
// RDAT-LABEL: UnmangledName: "amplification" | ||
// RDAT: FeatureInfo1: 0 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (Amplification(14) << 16) + (SM 6.5 ((6 << 4) + 5)) = 0xE0065 = 917605 | ||
// RDAT: MinShaderTarget: 917605 | ||
|
||
groupshared Vertex pld; | ||
|
||
[shader("amplification")] | ||
[numthreads(8, 8, 1)] | ||
void amplification(uint3 DTid : SV_DispatchThreadID) { | ||
DispatchMesh(1, 1, 1, pld); | ||
} |
96 changes: 96 additions & 0 deletions
96
tools/clang/test/HLSLFileCheck/d3dreflect/rdat_mintarget/sm66_atomicint64.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// RUN: %dxilver 1.8 | %dxc -T lib_6_8 %s | %D3DReflect %s | %FileCheck %s -check-prefixes=RDAT,RDAT18 | ||
// RUN: %dxilver 1.7 | %dxc -T lib_6_7 -validator-version 1.7 %s | %D3DReflect %s | FileCheck %s -check-prefixes=RDAT,RDAT17 | ||
|
||
// Ensure min shader target incorporates optional features used | ||
|
||
// RDAT: FunctionTable[{{.*}}] = { | ||
|
||
// SM 6.6+ | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// ShaderFeatureInfo_AtomicInt64OnTypedResource (0x400000) = 4194304 | ||
|
||
// RDAT-LABEL: UnmangledName: "atomic_typed" | ||
// ShaderFeatureInfo_AtomicInt64OnTypedResource (0x400000) = 4194304 | ||
// + ShaderFeatureInfo_Int64Ops (0x8000) = 0x408000 = 4227072 | ||
// RDAT: FeatureInfo1: 4227072 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (Library(6) << 16) + (SM 6.6 ((6 << 4) + 6)) = 0x60066 = 393318 | ||
// RDAT: MinShaderTarget: 393318 | ||
|
||
RWBuffer<uint64_t> RWBuf : register(u0, space0); | ||
|
||
[noinline] export | ||
void atomic_typed() { | ||
uint64_t original; | ||
InterlockedExchange(RWBuf[0], 12, original); | ||
} | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// ShaderFeatureInfo_AtomicInt64OnGroupShared (0x800000) = 8388608 | ||
|
||
// RDAT-LABEL: UnmangledName: "atomic_groupshared" | ||
// ShaderFeatureInfo_AtomicInt64OnGroupShared (0x800000) = 8388608 | ||
// + ShaderFeatureInfo_Int64Ops (0x8000) = 0x808000 = 8421376 | ||
// RDAT: FeatureInfo1: 8421376 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (Compute(5) << 16) + (SM 6.6 ((6 << 4) + 6)) = 0x50066 = 327782 | ||
// RDAT18: MinShaderTarget: 327782 | ||
// Old: 6.0 | ||
// RDAT17: MinShaderTarget: 327776 | ||
|
||
RWByteAddressBuffer BAB : register(u1, space0); | ||
groupshared int64_t gs; | ||
|
||
[shader("compute")] | ||
[numthreads(1,1,1)] | ||
void atomic_groupshared(uint tidx : SV_GroupIndex) { | ||
if (tidx == 0) | ||
gs = 0; | ||
GroupMemoryBarrierWithGroupSync(); | ||
uint64_t original; | ||
InterlockedExchange(gs, tidx, original); | ||
BAB.Store(tidx * 4, original); | ||
} | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// ShaderFeatureInfo_AtomicInt64OnHeapResource (0x10000000) = 268435456 | ||
|
||
// TBD: should it be set on bound heap resource? | ||
//RWStructuredBuffer<uint64_t> SB64 : register(u2, space0); | ||
|
||
// RDAT-LABEL: UnmangledName: "atomic_heap" | ||
// ShaderFeatureInfo_AtomicInt64OnHeapResource (0x10000000) = 268435456 | ||
// + ResourceDescriptorHeapIndexing (0x2000000) | ||
// + ShaderFeatureInfo_Int64Ops (0x8000) | ||
// = 0x12008000 = 302022656 | ||
// RDAT: FeatureInfo1: 302022656 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (Library(6) << 16) + (SM 6.6 ((6 << 4) + 6)) = 0x60066 = 393318 | ||
// RDAT: MinShaderTarget: 393318 | ||
|
||
[noinline] export | ||
void atomic_heap() { | ||
uint64_t original; | ||
RWStructuredBuffer<uint64_t> SB64 = ResourceDescriptorHeap[0]; | ||
InterlockedExchange(SB64[0], 12, original); | ||
} | ||
|
||
// RDAT-LABEL: UnmangledName: "atomic_heap_raygen" | ||
// ShaderFeatureInfo_AtomicInt64OnHeapResource (0x10000000) = 268435456 | ||
// + ResourceDescriptorHeapIndexing (0x2000000) | ||
// + ShaderFeatureInfo_Int64Ops (0x8000) | ||
// = 0x12008000 = 302022656 | ||
// RDAT18: FeatureInfo1: 302022656 | ||
// Old: missed called function | ||
// RDAT17: FeatureInfo1: 0 | ||
// RDAT: FeatureInfo2: 0 | ||
// MinShaderTarget: (RayGeneration(7) << 16) + (SM 6.6 ((6 << 4) + 6)) = 0x70066 = 458854 | ||
// RDAT18: MinShaderTarget: 458854 | ||
// Old: 6.0 | ||
// RDAT17: MinShaderTarget: 458848 | ||
|
||
[shader("raygeneration")] | ||
void atomic_heap_raygen() { | ||
atomic_heap(); | ||
} |
Oops, something went wrong.