-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebGPU: fixed most of the pipeline resource signature tests
- Loading branch information
1 parent
d37b321
commit 4a010cd
Showing
6 changed files
with
283 additions
and
41 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
76 changes: 76 additions & 0 deletions
76
...PITest/assets/shaders/PipelineResourceSignature/CombinedImageSamplers_EmulatedArrays.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,76 @@ | ||
Texture2D g_tex2D_Static; | ||
Texture2D g_tex2D_Mut; | ||
Texture2D g_tex2D_MutArr_0; | ||
Texture2D g_tex2D_MutArr_1; | ||
Texture2D g_tex2D_Dyn; | ||
Texture2D g_tex2D_DynArr_0; | ||
Texture2D g_tex2D_DynArr_1; | ||
Texture2D g_tex2D_StaticArr_0; | ||
Texture2D g_tex2D_StaticArr_1; | ||
|
||
SamplerState g_tex2D_Static_sampler; | ||
SamplerState g_tex2D_Mut_sampler; | ||
SamplerState g_tex2D_MutArr_sampler_0; | ||
SamplerState g_tex2D_MutArr_sampler_1; | ||
SamplerState g_tex2D_Dyn_sampler; | ||
SamplerState g_tex2D_DynArr_sampler_0; | ||
SamplerState g_tex2D_DynArr_sampler_1; | ||
SamplerState g_tex2D_StaticArr_sampler_0; | ||
SamplerState g_tex2D_StaticArr_sampler_1; | ||
|
||
float4 CheckValue(float4 Val, float4 Expected) | ||
{ | ||
return float4(Val.x == Expected.x ? 1.0 : 0.0, | ||
Val.y == Expected.y ? 1.0 : 0.0, | ||
Val.z == Expected.z ? 1.0 : 0.0, | ||
Val.w == Expected.w ? 1.0 : 0.0); | ||
} | ||
|
||
float4 VerifyResources() | ||
{ | ||
float4 AllCorrect = float4(1.0, 1.0, 1.0, 1.0); | ||
|
||
float2 UV = float2(0.5, 0.5); | ||
|
||
AllCorrect *= CheckValue(g_tex2D_Static.SampleLevel(g_tex2D_Static_sampler, UV, 0.0), Tex2D_Static_Ref); | ||
AllCorrect *= CheckValue(g_tex2D_Mut. SampleLevel(g_tex2D_Mut_sampler, UV, 0.0), Tex2D_Mut_Ref); | ||
AllCorrect *= CheckValue(g_tex2D_Dyn. SampleLevel(g_tex2D_Dyn_sampler, UV, 0.0), Tex2D_Dyn_Ref); | ||
|
||
AllCorrect *= CheckValue(g_tex2D_StaticArr_0.SampleLevel(g_tex2D_StaticArr_sampler_0, UV, 0.0), Tex2DArr_Static_Ref0); | ||
AllCorrect *= CheckValue(g_tex2D_StaticArr_1.SampleLevel(g_tex2D_StaticArr_sampler_1, UV, 0.0), Tex2DArr_Static_Ref1); | ||
|
||
AllCorrect *= CheckValue(g_tex2D_MutArr_0.SampleLevel(g_tex2D_MutArr_sampler_0, UV, 0.0), Tex2DArr_Mut_Ref0); | ||
AllCorrect *= CheckValue(g_tex2D_MutArr_1.SampleLevel(g_tex2D_MutArr_sampler_1, UV, 0.0), Tex2DArr_Mut_Ref1); | ||
|
||
AllCorrect *= CheckValue(g_tex2D_DynArr_0.SampleLevel(g_tex2D_DynArr_sampler_0, UV, 0.0), Tex2DArr_Dyn_Ref0); | ||
AllCorrect *= CheckValue(g_tex2D_DynArr_1.SampleLevel(g_tex2D_DynArr_sampler_1, UV, 0.0), Tex2DArr_Dyn_Ref1); | ||
|
||
return AllCorrect; | ||
} | ||
|
||
void VSMain(in uint VertId : SV_VertexID, | ||
out float4 f4Color : COLOR, | ||
out float4 f4Position : SV_Position) | ||
{ | ||
float4 Pos[6]; | ||
Pos[0] = float4(-1.0, -0.5, 0.0, 1.0); | ||
Pos[1] = float4(-0.5, +0.5, 0.0, 1.0); | ||
Pos[2] = float4( 0.0, -0.5, 0.0, 1.0); | ||
|
||
Pos[3] = float4(+0.0, -0.5, 0.0, 1.0); | ||
Pos[4] = float4(+0.5, +0.5, 0.0, 1.0); | ||
Pos[5] = float4(+1.0, -0.5, 0.0, 1.0); | ||
|
||
f4Color = float4(VertId % 3 == 0 ? 1.0 : 0.0, | ||
VertId % 3 == 1 ? 1.0 : 0.0, | ||
VertId % 3 == 2 ? 1.0 : 0.0, | ||
1.0) * VerifyResources(); | ||
|
||
f4Position = Pos[VertId]; | ||
} | ||
|
||
float4 PSMain(in float4 f4Color : COLOR, | ||
in float4 f4Position : SV_Position) : SV_Target | ||
{ | ||
return f4Color * VerifyResources(); | ||
} |
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
70 changes: 70 additions & 0 deletions
70
Tests/DiligentCoreAPITest/assets/shaders/ShaderResourceLayout/StructuredBuffers_WGPU.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,70 @@ | ||
struct BufferData | ||
{ | ||
float4 data; | ||
}; | ||
|
||
StructuredBuffer<BufferData> g_Buff_Static; | ||
StructuredBuffer<BufferData> g_Buff_Mut; | ||
StructuredBuffer<BufferData> g_Buff_Dyn; | ||
|
||
StructuredBuffer<BufferData> g_BuffArr_Static_0; | ||
StructuredBuffer<BufferData> g_BuffArr_Static_1; | ||
|
||
StructuredBuffer<BufferData> g_BuffArr_Mut_0; | ||
StructuredBuffer<BufferData> g_BuffArr_Mut_1; | ||
|
||
StructuredBuffer<BufferData> g_BuffArr_Dyn_0; | ||
|
||
float4 CheckValue(float4 Val, float4 Expected) | ||
{ | ||
return float4(Val.x == Expected.x ? 1.0 : 0.0, | ||
Val.y == Expected.y ? 1.0 : 0.0, | ||
Val.z == Expected.z ? 1.0 : 0.0, | ||
Val.w == Expected.w ? 1.0 : 0.0); | ||
} | ||
|
||
float4 VerifyResources() | ||
{ | ||
float4 AllCorrect = float4(1.0, 1.0, 1.0, 1.0); | ||
|
||
AllCorrect *= CheckValue(g_Buff_Static[0].data, Buff_Static_Ref); | ||
AllCorrect *= CheckValue(g_Buff_Mut [0].data, Buff_Mut_Ref); | ||
AllCorrect *= CheckValue(g_Buff_Dyn [0].data, Buff_Dyn_Ref); | ||
|
||
AllCorrect *= CheckValue(g_BuffArr_Static_0[0].data, BuffArr_Static_Ref0); | ||
AllCorrect *= CheckValue(g_BuffArr_Static_1[0].data, BuffArr_Static_Ref1); | ||
|
||
AllCorrect *= CheckValue(g_BuffArr_Mut_0[0].data, BuffArr_Mut_Ref0); | ||
AllCorrect *= CheckValue(g_BuffArr_Mut_1[0].data, BuffArr_Mut_Ref1); | ||
|
||
AllCorrect *= CheckValue(g_BuffArr_Dyn_0[0].data, BuffArr_Dyn_Ref0); | ||
|
||
return AllCorrect; | ||
} | ||
|
||
void VSMain(in uint VertId : SV_VertexID, | ||
out float4 f4Color : COLOR, | ||
out float4 f4Position : SV_Position) | ||
{ | ||
float4 Pos[6]; | ||
Pos[0] = float4(-1.0, -0.5, 0.0, 1.0); | ||
Pos[1] = float4(-0.5, +0.5, 0.0, 1.0); | ||
Pos[2] = float4( 0.0, -0.5, 0.0, 1.0); | ||
|
||
Pos[3] = float4(+0.0, -0.5, 0.0, 1.0); | ||
Pos[4] = float4(+0.5, +0.5, 0.0, 1.0); | ||
Pos[5] = float4(+1.0, -0.5, 0.0, 1.0); | ||
|
||
f4Color = float4(VertId % 3 == 0 ? 1.0 : 0.0, | ||
VertId % 3 == 1 ? 1.0 : 0.0, | ||
VertId % 3 == 2 ? 1.0 : 0.0, | ||
1.0) * VerifyResources(); | ||
|
||
f4Position = Pos[VertId]; | ||
} | ||
|
||
float4 PSMain(in float4 in_f4Color : COLOR, | ||
in float4 f4Position : SV_Position) : SV_Target | ||
{ | ||
return in_f4Color * VerifyResources(); | ||
} |
76 changes: 76 additions & 0 deletions
76
Tests/DiligentCoreAPITest/assets/shaders/ShaderResourceLayout/Textures_EmulatedArrays.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,76 @@ | ||
Texture2D g_Tex2D_Static; | ||
Texture2D g_Tex2D_Mut; | ||
Texture2D g_Tex2D_Dyn; | ||
|
||
Texture2D g_Tex2DArr_Static_0; | ||
Texture2D g_Tex2DArr_Static_1; | ||
|
||
Texture2D g_Tex2DArr_Mut_0; | ||
Texture2D g_Tex2DArr_Mut_1; | ||
Texture2D g_Tex2DArr_Mut_2; | ||
Texture2D g_Tex2DArr_Mut_3; | ||
|
||
Texture2D g_Tex2DArr_Dyn_0; | ||
Texture2D g_Tex2DArr_Dyn_1; | ||
Texture2D g_Tex2DArr_Dyn_2; | ||
|
||
SamplerState g_Sampler; | ||
|
||
float4 CheckValue(float4 Val, float4 Expected) | ||
{ | ||
return float4(Val.x == Expected.x ? 1.0 : 0.0, | ||
Val.y == Expected.y ? 1.0 : 0.0, | ||
Val.z == Expected.z ? 1.0 : 0.0, | ||
Val.w == Expected.w ? 1.0 : 0.0); | ||
} | ||
|
||
float4 VerifyResources() | ||
{ | ||
float4 AllCorrect = float4(1.0, 1.0, 1.0, 1.0); | ||
|
||
float2 UV = float2(0.5, 0.5); | ||
AllCorrect *= CheckValue(g_Tex2D_Static.SampleLevel(g_Sampler, UV.xy, 0.0), Tex2D_Static_Ref); | ||
AllCorrect *= CheckValue(g_Tex2D_Mut. SampleLevel(g_Sampler, UV.xy, 0.0), Tex2D_Mut_Ref); | ||
AllCorrect *= CheckValue(g_Tex2D_Dyn. SampleLevel(g_Sampler, UV.xy, 0.0), Tex2D_Dyn_Ref); | ||
|
||
AllCorrect *= CheckValue(g_Tex2DArr_Static_0.SampleLevel(g_Sampler, UV.xy, 0.0), Tex2DArr_Static_Ref0); | ||
AllCorrect *= CheckValue(g_Tex2DArr_Static_1.SampleLevel(g_Sampler, UV.xy, 0.0), Tex2DArr_Static_Ref1); | ||
|
||
AllCorrect *= CheckValue(g_Tex2DArr_Mut_0.SampleLevel(g_Sampler, UV.xy, 0.0), Tex2DArr_Mut_Ref0); | ||
AllCorrect *= CheckValue(g_Tex2DArr_Mut_1.SampleLevel(g_Sampler, UV.xy, 0.0), Tex2DArr_Mut_Ref1); | ||
AllCorrect *= CheckValue(g_Tex2DArr_Mut_2.SampleLevel(g_Sampler, UV.xy, 0.0), Tex2DArr_Mut_Ref2); | ||
AllCorrect *= CheckValue(g_Tex2DArr_Mut_3.SampleLevel(g_Sampler, UV.xy, 0.0), Tex2DArr_Mut_Ref3); | ||
|
||
AllCorrect *= CheckValue(g_Tex2DArr_Dyn_0.SampleLevel(g_Sampler, UV.xy, 0.0), Tex2DArr_Dyn_Ref0); | ||
AllCorrect *= CheckValue(g_Tex2DArr_Dyn_1.SampleLevel(g_Sampler, UV.xy, 0.0), Tex2DArr_Dyn_Ref1); | ||
AllCorrect *= CheckValue(g_Tex2DArr_Dyn_2.SampleLevel(g_Sampler, UV.xy, 0.0), Tex2DArr_Dyn_Ref2); | ||
|
||
return AllCorrect; | ||
} | ||
|
||
void VSMain(in uint VertId : SV_VertexID, | ||
out float4 f4Color : COLOR, | ||
out float4 f4Position : SV_Position) | ||
{ | ||
float4 Pos[6]; | ||
Pos[0] = float4(-1.0, -0.5, 0.0, 1.0); | ||
Pos[1] = float4(-0.5, +0.5, 0.0, 1.0); | ||
Pos[2] = float4( 0.0, -0.5, 0.0, 1.0); | ||
|
||
Pos[3] = float4(+0.0, -0.5, 0.0, 1.0); | ||
Pos[4] = float4(+0.5, +0.5, 0.0, 1.0); | ||
Pos[5] = float4(+1.0, -0.5, 0.0, 1.0); | ||
|
||
f4Color = float4(VertId % 3 == 0 ? 1.0 : 0.0, | ||
VertId % 3 == 1 ? 1.0 : 0.0, | ||
VertId % 3 == 2 ? 1.0 : 0.0, | ||
1.0) * VerifyResources(); | ||
|
||
f4Position = Pos[VertId]; | ||
} | ||
|
||
float4 PSMain(in float4 f4Color : COLOR, // Name must match VS output | ||
in float4 f4Position : SV_Position) : SV_Target | ||
{ | ||
return f4Color * VerifyResources(); | ||
} |
Oops, something went wrong.