summaryrefslogtreecommitdiffstats
path: root/Tests/TestApp
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-08-10 03:39:25 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-08-10 03:39:25 +0000
commite0b21724d8ea6cef1ddc324470f19bb2166460f3 (patch)
tree9f3860c0df369376f041857ff7e7c1318042ad4a /Tests/TestApp
parentUpdated core (diff)
downloadDiligentEngine-e0b21724d8ea6cef1ddc324470f19bb2166460f3.tar.gz
DiligentEngine-e0b21724d8ea6cef1ddc324470f19bb2166460f3.zip
Updated core (enabled HLSL Buffer and RWBuffer conversion; fixed issue with resource binding)
Diffstat (limited to 'Tests/TestApp')
-rw-r--r--Tests/TestApp/assets/Shaders/CSConversionTest.fx28
-rw-r--r--Tests/TestApp/assets/Shaders/CSTest/UpdateDrawArgsBuffGL.csh16
-rw-r--r--Tests/TestApp/assets/Shaders/CSTest/UpdateVertBuffGL.csh46
-rw-r--r--Tests/TestApp/assets/Shaders/ConverterTest.fx23
-rw-r--r--Tests/TestApp/assets/TestComputeShaders.lua2
5 files changed, 68 insertions, 47 deletions
diff --git a/Tests/TestApp/assets/Shaders/CSConversionTest.fx b/Tests/TestApp/assets/Shaders/CSConversionTest.fx
index 2982065..6ebf96d 100644
--- a/Tests/TestApp/assets/Shaders/CSConversionTest.fx
+++ b/Tests/TestApp/assets/Shaders/CSConversionTest.fx
@@ -60,6 +60,10 @@ RWTexture3D< int /* format = r8i */> Tex3D_I;
RWTexture3D< uint2 /* format = rg8ui */> Tex3D_U;
RWTexture3D< float/*format = r32f*/> Tex3D_F2;
+RWBuffer</* format = r32f */ float > TexBuff_F;
+RWBuffer</* format = rg16i */ int2 > TexBuff_I;
+RWBuffer</* format = rgba16ui */ uint4 > TexBuff_U;
+
int GlobalIntVar;Texture2D Tex2D_Test1;Texture2D Tex2D_Test2;/*Comment* / *//* /** Comment2*/Texture2D Tex2D_Test3 /*Cmnt*/,
// Comment
@@ -174,6 +178,16 @@ void TestGetDimensions()
Tex3D_U.GetDimensions(fWidth,fHeight,fDepth);
Tex3D_I.GetDimensions ( fWidth , fHeight , fDepth );
}
+
+ //RWBuffer
+ {
+ uint uWidth;
+ int iWidth;
+ float fWidth;
+ TexBuff_F.GetDimensions(uWidth);
+ TexBuff_I.GetDimensions(iWidth);
+ TexBuff_U.GetDimensions(fWidth);
+ }
}
void TestLoad()
@@ -217,6 +231,13 @@ void TestLoad()
uint2 u2 = Tex3D_U.Load(Location.xyz).xy;
int i = Tex3D_I.Load(Location.xyz);
}
+
+ //Buffer
+ {
+ TexBuff_F.Load(Location.x);
+ TexBuff_I.Load(Location.x);
+ TexBuff_U.Load(Location.x);
+ }
}
@@ -262,6 +283,13 @@ void TestStore()
Tex3D_U[Location.xyz] = uint2(0,6);
Tex3D_I[Location.xyz] = -5;
}
+
+ //Buffer
+ {
+ TexBuff_F[Location.x] = 1.0;
+ TexBuff_I[Location.x] = int2(1,2);
+ TexBuff_U[Location.x] = uint4(1,2,3,4);
+ }
}
/*
diff --git a/Tests/TestApp/assets/Shaders/CSTest/UpdateDrawArgsBuffGL.csh b/Tests/TestApp/assets/Shaders/CSTest/UpdateDrawArgsBuffGL.csh
index e1f21a1..fda2387 100644
--- a/Tests/TestApp/assets/Shaders/CSTest/UpdateDrawArgsBuffGL.csh
+++ b/Tests/TestApp/assets/Shaders/CSTest/UpdateDrawArgsBuffGL.csh
@@ -1,22 +1,12 @@
-// Declare input/output buffer from/to wich we will read/write data.
-// In this particular shader we only write data into the buffer.
-// If you do not want your data to be aligned by compiler try to use:
-// packed or shared instead of std140 keyword.
-// We also bind the buffer to index 0. You need to set the buffer binding
-// in the range [0..3] – this is the minimum range approved by Khronos.
-// Notice that various platforms might support more indices than that.
-layout(std140, binding = 3) buffer bufIndirectDrawArgs
-{
- uvec4 data[];
-}g_DrawArgs;
+layout(rgba32ui, binding = 3) uniform writeonly uimageBuffer bufIndirectDrawArgs;
layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
// Declare main program function which is executed once
// glDispatchCompute is called from the application.
void main()
{
- g_DrawArgs.data[0] = uvec4(4,1,0,0);
- g_DrawArgs.data[1] = uvec4(0,0,0,0);
+ imageStore(bufIndirectDrawArgs, 0, uvec4(4,1,0,0));
+ imageStore(bufIndirectDrawArgs, 1, uvec4(0,0,0,0));
}
diff --git a/Tests/TestApp/assets/Shaders/CSTest/UpdateVertBuffGL.csh b/Tests/TestApp/assets/Shaders/CSTest/UpdateVertBuffGL.csh
index 65d0d8a..bb3162b 100644
--- a/Tests/TestApp/assets/Shaders/CSTest/UpdateVertBuffGL.csh
+++ b/Tests/TestApp/assets/Shaders/CSTest/UpdateVertBuffGL.csh
@@ -1,20 +1,6 @@
-// Declare input/output buffer from/to wich we will read/write data.
-// In this particular shader we only write data into the buffer.
-// If you do not want your data to be aligned by compiler try to use:
-// packed or shared instead of std140 keyword.
-// We also bind the buffer to index 0. You need to set the buffer binding
-// in the range [0..3] – this is the minimum range approved by Khronos.
-// Notice that various platforms might support more indices than that.
-layout(std140, binding = 2) buffer bufPositions
-{
- vec4 data[];
-}g_Positions;
-
-layout(std140) buffer bufTexcoord
-{
- vec4 data[];
-}g_Texcoords;
+layout(rgba32f) uniform writeonly imageBuffer bufPositions;
+layout(rgba32f) uniform writeonly imageBuffer bufTexcoord;
uniform samplerBuffer Offsets;
@@ -25,13 +11,11 @@ void main()
{
int Ind = int(gl_GlobalInvocationID.x);
- vec2 pos[4] =
- {
- vec2(0.0, 0.0),
- vec2(0.0, 1.0),
- vec2(1.0, 0.0),
- vec2(1.0, 1.0)
- };
+ vec2 pos[4];
+ pos[0] = vec2(0.0, 0.0);
+ pos[1] = vec2(0.0, 1.0);
+ pos[2] = vec2(1.0, 0.0);
+ pos[3] = vec2(1.0, 1.0);
vec2 CurrPos = pos[Ind];
@@ -40,14 +24,12 @@ void main()
CurrPos = CurrPos*vec2(0.3, 0.3) + vec2(0.0, -1.0);
- vec2 uv[4] =
- {
- vec2(0.0, 1.0),
- vec2(0.0, 0.0),
- vec2(1.0, 1.0),
- vec2(1.0, 0.0)
- };
+ vec2 uv[4];
+ uv[0] = vec2(0.0, 1.0);
+ uv[1] = vec2(0.0, 0.0);
+ uv[2] = vec2(1.0, 1.0);
+ uv[3] = vec2(1.0, 0.0);
- g_Positions.data[Ind] = vec4(CurrPos.xy, 0.0, 0.0);
- g_Texcoords.data[Ind] = vec4(uv[Ind], 0.0, 0.0);
+ imageStore(bufPositions, Ind, vec4(CurrPos.xy, 0.0, 0.0));
+ imageStore(bufTexcoord, Ind, vec4(uv[Ind].xy, 0.0, 0.0));
}
diff --git a/Tests/TestApp/assets/Shaders/ConverterTest.fx b/Tests/TestApp/assets/Shaders/ConverterTest.fx
index 2bdbe3b..aa5beaa 100644
--- a/Tests/TestApp/assets/Shaders/ConverterTest.fx
+++ b/Tests/TestApp/assets/Shaders/ConverterTest.fx
@@ -149,6 +149,11 @@ TextureCubeArray <float> TexCAS2;
SamplerComparisonState TexCAS2_sampler;
#endif
+Buffer TexBuffer_F1;
+Buffer<float4>TexBuffer_F4;
+Buffer<int3>TexBuffer_I;
+Buffer<uint4>TexBuffer_U;
+
int intvar1;SamplerState Dummy;int intvar2;
int Texture2D_fake, Texture2DArray_fake, fakeTexture2D, fakeTexture2DArray;
@@ -450,6 +455,16 @@ void TestGetDimensions()
Tex2DMS_I_A.GetDimensions(iWidth, iHeight, iElems, iNumSamples);
}
#endif
+
+ // Buffer
+ {
+ uint uWidth;
+ int iWidth;
+ float fWidth;
+ TexBuffer_F1.GetDimensions(uWidth);
+ TexBuffer_F4.GetDimensions(iWidth);
+ TexBuffer_I.GetDimensions(fWidth);
+ }
}
@@ -803,6 +818,14 @@ void TestLoad()
Tex2DMS_U_A.Load(Location.xyz, 1, Offset.xy);
}
#endif
+
+ // Buffer
+ {
+ TexBuffer_F1.Load(Location.x);
+ TexBuffer_F4.Load(Location.x);
+ TexBuffer_I.Load(Location.x);
+ TexBuffer_U.Load(Location.x);
+ }
}
diff --git a/Tests/TestApp/assets/TestComputeShaders.lua b/Tests/TestApp/assets/TestComputeShaders.lua
index c5f121c..f69805d 100644
--- a/Tests/TestApp/assets/TestComputeShaders.lua
+++ b/Tests/TestApp/assets/TestComputeShaders.lua
@@ -271,8 +271,6 @@ UpdateDispatchArgsBuffPSO = PipelineState.Create
pCS = UpdateDispatchArgsBuffCS
}
}
-assert(UpdateDrawArgsBuffPSO:IsCompatibleWith(UpdateDispatchArgsBuffPSO) == true)
-assert(UpdateDispatchArgsBuffPSO:IsCompatibleWith(UpdateDrawArgsBuffPSO) == true)
UpdateDispatchArgsBuffSRB = UpdateDispatchArgsBuffPSO:CreateShaderResourceBinding()
RenderPSO = PipelineState.Create