Skip to content

Commit

Permalink
Split up lib_mintarget.hlsl test by feature
Browse files Browse the repository at this point in the history
  • Loading branch information
tex3d committed Jan 26, 2024
1 parent 9ca6546 commit 79f021c
Show file tree
Hide file tree
Showing 12 changed files with 482 additions and 415 deletions.
415 changes: 0 additions & 415 deletions tools/clang/test/HLSLFileCheck/d3dreflect/lib_mintarget.hlsl

This file was deleted.

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);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// 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

TBD
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;
}
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();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// 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_DerivativesInMeshAndAmpShaders (0x1000000) = 16777216

// Flag used to indicate derivative use in functions, then fixed up for entry
// functions. Val. ver. 1.8 required to recursively check called functions.

// RDAT-LABEL: UnmangledName: "deriv_in_func"
// ShaderFeatureInfo_DerivativesInMeshAndAmpShaders (0x1000000) = 16777216
// RDAT18: FeatureInfo1: 16777216
// Old: missed called function
// RDAT17: FeatureInfo1: 0
// RDAT: FeatureInfo2: 0
// MinShaderTarget: (Library(6) << 16) + (SM 6.0 ((6 << 4) + 0)) = 0x60060 = 393312
// RDAT: MinShaderTarget: 393312

[noinline] export
void deriv_in_func(float2 uv) {
BAB.Store(0, ddx(uv));
}

// RDAT-LABEL: UnmangledName: "deriv_in_mesh"
// ShaderFeatureInfo_DerivativesInMeshAndAmpShaders (0x1000000) = 16777216
// RDAT18: FeatureInfo1: 16777216
// Old: missed called function
// RDAT17: FeatureInfo1: 0
// RDAT: FeatureInfo2: 0
// MinShaderTarget: (Mesh(13) << 16) + (SM 6.6 ((6 << 4) + 6)) = 0xD0066 = 852070
// RDAT18: MinShaderTarget: 852070
// Old: 6.0
// RDAT17: MinShaderTarget: 852064

[shader("mesh")]
[numthreads(8, 8, 1)]
[outputtopology("triangle")]
void deriv_in_mesh(uint3 DTid : SV_DispatchThreadID) {
float2 uv = DTid.xy/float2(8, 8);
deriv_in_func(uv);
}

// RDAT-LABEL: UnmangledName: "deriv_in_compute"
// ShaderFeatureInfo_DerivativesInMeshAndAmpShaders (0x1000000) = 16777216
// RDAT: FeatureInfo1: 0
// RDAT: FeatureInfo2: 0
// MinShaderTarget: (Compute(5) << 16) + (SM 6.6 ((6 << 4) + 6)) = 0x50066 = 327782
// RDAT18: MinShaderTarget: 327782
// Old: 6.0
// RDAT17: MinShaderTarget: 327776

[shader("compute")]
[numthreads(8, 8, 1)]
void deriv_in_compute(uint3 DTid : SV_DispatchThreadID) {
float2 uv = DTid.xy/float2(8, 8);
deriv_in_func(uv);
}

// RDAT-LABEL: UnmangledName: "deriv_in_pixel"
// ShaderFeatureInfo_DerivativesInMeshAndAmpShaders (0x1000000) = 16777216
// RDAT: FeatureInfo1: 0
// RDAT: FeatureInfo2: 0
// MinShaderTarget: (Pixel(0) << 16) + (SM 6.0 ((6 << 4) + 0)) = 0x60 = 96
// RDAT: MinShaderTarget: 96

[shader("pixel")]
void deriv_in_pixel(float2 uv : TEXCOORD) {
deriv_in_func(uv);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// 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_ResourceDescriptorHeapIndexing (0x2000000) = 33554432

// RDAT-LABEL: UnmangledName: "res_heap_index"
// ShaderFeatureInfo_ResourceDescriptorHeapIndexing (0x2000000) = 33554432
// RDAT: FeatureInfo1: 33554432
// RDAT: FeatureInfo2: 0
// MinShaderTarget: (Library(6) << 16) + (SM 6.6 ((6 << 4) + 6)) = 0x60066 = 393318
// RDAT: MinShaderTarget: 393318

[noinline] export
void res_heap_index(int i) {
RWStructuredBuffer<int> SB = ResourceDescriptorHeap[0];
SB[0] = i;
}

// RDAT-LABEL: UnmangledName: "res_heap_index_in_compute"
// ShaderFeatureInfo_ResourceDescriptorHeapIndexing (0x2000000) = 33554432
// RDAT18: FeatureInfo1: 33554432
// Old: missed called function
// RDAT17: FeatureInfo1: 0
// RDAT: FeatureInfo2: 0
// MinShaderTarget: (Compute(5) << 16) + (SM 6.6 ((6 << 4) + 6)) = 0x50066 = 327782
// RDAT18: MinShaderTarget: 327782
// Old: 6.0
// RDAT17: MinShaderTarget: 327776

[shader("compute")]
[numthreads(8, 8, 1)]
void res_heap_index_in_compute(uint3 DTid : SV_DispatchThreadID) {
res_heap_index(DTid.x);
}

// RDAT-LABEL: UnmangledName: "res_heap_index_in_raygen"
// ShaderFeatureInfo_ResourceDescriptorHeapIndexing (0x2000000) = 33554432
// RDAT18: FeatureInfo1: 33554432
// 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 res_heap_index_in_raygen() {
res_heap_index(1);
}

///////////////////////////////////////////////////////////////////////////////
// ShaderFeatureInfo_SamplerDescriptorHeapIndexing (0x4000000) = 67108864

// RDAT-LABEL: UnmangledName: "samp_heap_index"
// ShaderFeatureInfo_SamplerDescriptorHeapIndexing (0x4000000) = 67108864
// RDAT: FeatureInfo1: 67108864
// RDAT: FeatureInfo2: 0
// MinShaderTarget: (Library(6) << 16) + (SM 6.6 ((6 << 4) + 6)) = 0x60066 = 393318
// RDAT: MinShaderTarget: 393318

Texture2D<float4> T2D : register(t0, space0);

[noinline] export void samp_heap_index(int i) {
SamplerState S = SamplerDescriptorHeap[i];
BAB.Store(0, T2D.SampleLevel(S, float2(0.5, 0.5), 0.0));
}

// RDAT-LABEL: UnmangledName: "samp_heap_index_in_compute"
// ShaderFeatureInfo_SamplerDescriptorHeapIndexing (0x4000000) = 67108864
// RDAT18: FeatureInfo1: 67108864
// Old: missed called function
// RDAT17: FeatureInfo1: 0
// RDAT: FeatureInfo2: 0
// MinShaderTarget: (Compute(5) << 16) + (SM 6.6 ((6 << 4) + 6)) = 0x50066 = 327782
// RDAT18: MinShaderTarget: 327782
// Old: 6.0
// RDAT17: MinShaderTarget: 327776

[shader("compute")]
[numthreads(8, 8, 1)]
void samp_heap_index_in_compute(uint3 DTid : SV_DispatchThreadID) {
samp_heap_index(DTid.x);
}

// RDAT-LABEL: UnmangledName: "samp_heap_index_in_raygen"
// ShaderFeatureInfo_SamplerDescriptorHeapIndexing (0x4000000) = 67108864
// RDAT18: FeatureInfo1: 67108864
// 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 samp_heap_index_in_raygen() {
samp_heap_index(1);
}
Loading

0 comments on commit 79f021c

Please sign in to comment.