summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-05-29 01:09:48 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-05-29 01:09:48 +0000
commitcd27f5affb46c349987902aa31014500d5fbef79 (patch)
tree79c39c72242c9d08a250dd35412b036f4485224a
parentUpdated shader resource layout test (diff)
downloadDiligentEngine-cd27f5affb46c349987902aa31014500d5fbef79.tar.gz
DiligentEngine-cd27f5affb46c349987902aa31014500d5fbef79.zip
Updated multiple tests
m---------DiligentCore0
-rw-r--r--Tests/TestApp/assets/Shaders/ConverterTest.fx2
-rw-r--r--Tests/TestApp/assets/Shaders/ShaderResLayoutTestGL.psh4
-rw-r--r--Tests/TestApp/assets/Shaders/ShaderResLayoutTestGL.vsh8
-rw-r--r--Tests/TestApp/assets/TestRenderScripts.lua2
-rw-r--r--Tests/TestApp/include/TestShaderResArrays.h2
-rw-r--r--Tests/TestApp/include/TestTexturing.h2
-rw-r--r--Tests/TestApp/src/TestBufferAccess.cpp8
-rw-r--r--Tests/TestApp/src/TestDrawCommands.cpp10
-rw-r--r--Tests/TestApp/src/TestPSOCompatibility.cpp4
-rw-r--r--Tests/TestApp/src/TestShaderResArrays.cpp2
-rw-r--r--Tests/TestApp/src/TestShaderResourceLayout.cpp108
-rw-r--r--Tests/TestApp/src/TestTexturing.cpp12
13 files changed, 112 insertions, 52 deletions
diff --git a/DiligentCore b/DiligentCore
-Subproject 2e3eb1a74d76eb22825d83020aae053c02139b8
+Subproject 939937b3e2abd7c473ad990f2f257d08219696c
diff --git a/Tests/TestApp/assets/Shaders/ConverterTest.fx b/Tests/TestApp/assets/Shaders/ConverterTest.fx
index 7a7faf8..906480d 100644
--- a/Tests/TestApp/assets/Shaders/ConverterTest.fx
+++ b/Tests/TestApp/assets/Shaders/ConverterTest.fx
@@ -1008,7 +1008,7 @@ void TestPS ( in VSOutput In,
{
float4 Pos = In.f4PosPS;
- Out.Color3 = float4(0.0, 1.0, 2.0, 3.0);
+ Out.Color3 = float4(0.0 + a, 1.0 + b, 2.0 + c, 3.0 + d);
Out.substr.Color4 = float4(0.0, 1.0, 2.0, 3.0);
TestFuncArgs1( Tex2D_F6,
diff --git a/Tests/TestApp/assets/Shaders/ShaderResLayoutTestGL.psh b/Tests/TestApp/assets/Shaders/ShaderResLayoutTestGL.psh
index f3d3d63..015a7f8 100644
--- a/Tests/TestApp/assets/Shaders/ShaderResLayoutTestGL.psh
+++ b/Tests/TestApp/assets/Shaders/ShaderResLayoutTestGL.psh
@@ -12,14 +12,14 @@ uniform texture2D g_sepTex2DArr_static[2];
uniform texture2D g_sepTex2D_mut;
uniform texture2D g_sepTex2DArr_mut[3];
uniform texture2D g_sepTex2D_dyn;
-uniform texture2D g_sepTex2DArr_dyn[4];
+uniform texture2D g_sepTex2DArr_dyn[8];
uniform sampler g_Sam_static;
uniform sampler g_SamArr_static[2];
uniform sampler g_Sam_mut;
uniform sampler g_SamArr_mut[3];
-uniform sampler g_Sam_dyn;
uniform sampler g_SamArr_dyn[4];
+uniform sampler g_Sam_dyn;
uniform samplerBuffer g_UniformTexelBuff;
layout(rgba32f) uniform writeonly imageBuffer g_StorageTexelBuff;
diff --git a/Tests/TestApp/assets/Shaders/ShaderResLayoutTestGL.vsh b/Tests/TestApp/assets/Shaders/ShaderResLayoutTestGL.vsh
index b850d4c..f763429 100644
--- a/Tests/TestApp/assets/Shaders/ShaderResLayoutTestGL.vsh
+++ b/Tests/TestApp/assets/Shaders/ShaderResLayoutTestGL.vsh
@@ -1,6 +1,6 @@
uniform sampler2D g_tex2D_Dyn;
-uniform sampler2D g_tex2DArr_Dyn[4];
+uniform sampler2D g_tex2DArr_Dyn[8];
uniform sampler2D g_tex2D_Static;
uniform sampler2D g_tex2DArr_Static[2];
uniform sampler2D g_tex2D_Mut;
@@ -17,8 +17,8 @@ uniform sampler g_Sam_static;
uniform sampler g_SamArr_static[2];
uniform sampler g_Sam_mut;
uniform sampler g_SamArr_mut[3];
-uniform sampler g_Sam_dyn;
uniform sampler g_SamArr_dyn[4];
+uniform sampler g_Sam_dyn;
uniform samplerBuffer g_UniformTexelBuff;
layout(rgba32f) uniform writeonly imageBuffer g_StorageTexelBuff;
@@ -116,6 +116,10 @@ void main(void)
out_Color += textureLod(g_tex2DArr_Dyn[1], g_UniformBuffArr_Dyn[1].UV + g_StorageBuffArr_Dyn[1].UV[0].xy, 0.0);
out_Color += textureLod(g_tex2DArr_Dyn[2], g_UniformBuffArr_Dyn[2].UV + g_StorageBuffArr_Dyn[2].UV[0].xy, 0.0);
out_Color += textureLod(g_tex2DArr_Dyn[3], g_UniformBuffArr_Dyn[3].UV + g_StorageBuffArr_Dyn[3].UV[0].xy, 0.0);
+ out_Color += textureLod(g_tex2DArr_Dyn[4], g_UniformBuffArr_Dyn[0].UV + g_StorageBuffArr_Dyn[0].UV[0].xy, 0.0);
+ out_Color += textureLod(g_tex2DArr_Dyn[5], g_UniformBuffArr_Dyn[1].UV + g_StorageBuffArr_Dyn[1].UV[0].xy, 0.0);
+ out_Color += textureLod(g_tex2DArr_Dyn[6], g_UniformBuffArr_Dyn[2].UV + g_StorageBuffArr_Dyn[2].UV[0].xy, 0.0);
+ out_Color += textureLod(g_tex2DArr_Dyn[7], g_UniformBuffArr_Dyn[3].UV + g_StorageBuffArr_Dyn[3].UV[0].xy, 0.0);
out_Color += textureLod(g_tex2D_Static, g_UniformBuff_Stat.UV + g_StorageBuff_Stat.UV[0].xy, 0.0);
out_Color += textureLod(g_tex2DArr_Static[0], g_UniformBuffArr_Stat[0].UV + g_StorageBuffArr_Stat[0].UV[0].xy, 0.0);
diff --git a/Tests/TestApp/assets/TestRenderScripts.lua b/Tests/TestApp/assets/TestRenderScripts.lua
index 15499e1..c3a37a3 100644
--- a/Tests/TestApp/assets/TestRenderScripts.lua
+++ b/Tests/TestApp/assets/TestRenderScripts.lua
@@ -13,7 +13,7 @@ TestSampler = Sampler.Create{
MaxLOD = 10,
MaxAnisotropy = 6,
ComparisonFunc = "COMPARISON_FUNC_GREATER_EQUAL",
- BorderColor = {r = 0.1, g = 0.2, b=0.3, a=0.4},
+ BorderColor = {r = 0.0, g = 0.0, b=0.0, a=1.0},
}
ErrorTestSampler = Sampler.Create
diff --git a/Tests/TestApp/include/TestShaderResArrays.h b/Tests/TestApp/include/TestShaderResArrays.h
index 24bd818..e65b97a 100644
--- a/Tests/TestApp/include/TestShaderResArrays.h
+++ b/Tests/TestApp/include/TestShaderResArrays.h
@@ -28,7 +28,7 @@
class TestShaderResArrays : public UnitTestBase
{
public:
- TestShaderResArrays(Diligent::IRenderDevice *pDevice, Diligent::IDeviceContext *pDeviceContext, bool bUseOpenGL, float fMinXCoord, float fMinYCoord, float fXExtent, float fYExtent);
+ TestShaderResArrays(Diligent::IRenderDevice *pDevice, Diligent::IDeviceContext *pDeviceContext, float fMinXCoord, float fMinYCoord, float fXExtent, float fYExtent);
void Draw();
diff --git a/Tests/TestApp/include/TestTexturing.h b/Tests/TestApp/include/TestTexturing.h
index 6953c74..27d934f 100644
--- a/Tests/TestApp/include/TestTexturing.h
+++ b/Tests/TestApp/include/TestTexturing.h
@@ -30,7 +30,7 @@ class TestTexturing : public UnitTestBase
public:
TestTexturing();
- void Init(Diligent::IRenderDevice *pDevice, Diligent::IDeviceContext *pDeviceContext, Diligent::TEXTURE_FORMAT TexFormat, bool bUseOpenGL, float fMinXCoord, float fMinYCoord, float fXExtent, float fYExtent);
+ void Init(Diligent::IRenderDevice *pDevice, Diligent::IDeviceContext *pDeviceContext, Diligent::TEXTURE_FORMAT TexFormat, float fMinXCoord, float fMinYCoord, float fXExtent, float fYExtent);
void Draw();
static void GenerateTextureData(Diligent::IRenderDevice *pRenderDevice, std::vector<Diligent::Uint8> &Data, std::vector<Diligent::TextureSubResData> &SubResouces, const Diligent::TextureDesc &TexDesc, const float *ColorOffset = nullptr);
diff --git a/Tests/TestApp/src/TestBufferAccess.cpp b/Tests/TestApp/src/TestBufferAccess.cpp
index 9a9e17b..f59891d 100644
--- a/Tests/TestApp/src/TestBufferAccess.cpp
+++ b/Tests/TestApp/src/TestBufferAccess.cpp
@@ -43,7 +43,7 @@ void TestBufferAccess::Init( IRenderDevice *pDevice, IDeviceContext *pContext, f
m_pRenderDevice = pDevice;
m_pDeviceContext = pContext;
auto DevType = m_pRenderDevice->GetDeviceCaps().DevType;
- bool bUseOpenGL = DevType == DeviceType::OpenGL || DevType == DeviceType::OpenGLES;
+ bool bUseGLSL = DevType == DeviceType::OpenGL || DevType == DeviceType::OpenGLES || DevType == DeviceType::Vulkan;
m_fXExtent = fXExtent;
m_fYExtent = fYExtent;
@@ -115,18 +115,18 @@ void TestBufferAccess::Init( IRenderDevice *pDevice, IDeviceContext *pContext, f
ShaderCreationAttribs CreationAttrs;
BasicShaderSourceStreamFactory BasicSSSFactory;
CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory;
- CreationAttrs.Desc.TargetProfile = bUseOpenGL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0;
+ CreationAttrs.Desc.TargetProfile = bUseGLSL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0;
RefCntAutoPtr<Diligent::IShader> pVSInst, pPS;
{
- CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\minimalInstGL.vsh" : "Shaders\\minimalInstDX.vsh";
+ CreationAttrs.FilePath = bUseGLSL ? "Shaders\\minimalInstGL.vsh" : "Shaders\\minimalInstDX.vsh";
CreationAttrs.Desc.ShaderType = SHADER_TYPE_VERTEX;
m_pRenderDevice->CreateShader( CreationAttrs, &pVSInst );
}
{
- CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\minimalGL.psh" : "Shaders\\minimalDX.psh";
+ CreationAttrs.FilePath = bUseGLSL ? "Shaders\\minimalGL.psh" : "Shaders\\minimalDX.psh";
CreationAttrs.Desc.ShaderType = SHADER_TYPE_PIXEL;
m_pRenderDevice->CreateShader( CreationAttrs, &pPS );
}
diff --git a/Tests/TestApp/src/TestDrawCommands.cpp b/Tests/TestApp/src/TestDrawCommands.cpp
index 59e5a31..82bb2ee 100644
--- a/Tests/TestApp/src/TestDrawCommands.cpp
+++ b/Tests/TestApp/src/TestDrawCommands.cpp
@@ -37,7 +37,7 @@ void TestDrawCommands::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceCont
m_pDeviceContext = pDeviceContext;
auto DevType = m_pRenderDevice->GetDeviceCaps().DevType;
- bool bUseOpenGL = DevType == DeviceType::OpenGL || DevType == DeviceType::OpenGLES;
+ bool bUseGLSL = DevType == DeviceType::OpenGL || DevType == DeviceType::OpenGLES || DevType == DeviceType::Vulkan;
std::vector<float> VertexData;
std::vector<float> VertexData2;
@@ -155,23 +155,23 @@ void TestDrawCommands::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceCont
ShaderCreationAttribs CreationAttrs;
BasicShaderSourceStreamFactory BasicSSSFactory;
CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory;
- CreationAttrs.Desc.TargetProfile = bUseOpenGL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0;
+ CreationAttrs.Desc.TargetProfile = bUseGLSL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0;
RefCntAutoPtr<IShader> pVS, pVSInst, pPS;
{
- CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\minimalGL.vsh" : "Shaders\\minimalDX.vsh";
+ CreationAttrs.FilePath = bUseGLSL ? "Shaders\\minimalGL.vsh" : "Shaders\\minimalDX.vsh";
CreationAttrs.Desc.ShaderType = SHADER_TYPE_VERTEX;
m_pRenderDevice->CreateShader( CreationAttrs, &pVS );
}
{
- CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\minimalInstGL.vsh" : "Shaders\\minimalInstDX.vsh";
+ CreationAttrs.FilePath = bUseGLSL ? "Shaders\\minimalInstGL.vsh" : "Shaders\\minimalInstDX.vsh";
CreationAttrs.Desc.ShaderType = SHADER_TYPE_VERTEX;
m_pRenderDevice->CreateShader( CreationAttrs, &pVSInst );
}
{
- CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\minimalGL.psh" : "Shaders\\minimalDX.psh";
+ CreationAttrs.FilePath = bUseGLSL ? "Shaders\\minimalGL.psh" : "Shaders\\minimalDX.psh";
CreationAttrs.Desc.ShaderType = SHADER_TYPE_PIXEL;
m_pRenderDevice->CreateShader( CreationAttrs, &pPS );
}
diff --git a/Tests/TestApp/src/TestPSOCompatibility.cpp b/Tests/TestApp/src/TestPSOCompatibility.cpp
index f14f22d..3abd3a6 100644
--- a/Tests/TestApp/src/TestPSOCompatibility.cpp
+++ b/Tests/TestApp/src/TestPSOCompatibility.cpp
@@ -268,10 +268,10 @@ TestPSOCompatibility::TestPSOCompatibility(IRenderDevice *pDevice ) :
auto PSO_TexArr = CreateTestPSO(VS0, PS_TexArr);
auto PSO_ArrOfTex = CreateTestPSO(VS0, PS_ArrOfTex);
VERIFY_EXPR(PSO_Tex->IsCompatibleWith(PSO_Tex2));
- if(DevType!=DeviceType::D3D12)
+ if(DevType!=DeviceType::D3D12 && DevType != DeviceType::Vulkan)
VERIFY_EXPR(!PSO_Tex->IsCompatibleWith(PSO_TexArr));
VERIFY_EXPR(!PSO_Tex->IsCompatibleWith(PSO_ArrOfTex));
- if (DevType != DeviceType::D3D12)
+ if (DevType != DeviceType::D3D12 && DevType != DeviceType::Vulkan)
VERIFY_EXPR(!PSO_Tex2->IsCompatibleWith(PSO_TexArr));
VERIFY_EXPR(!PSO_Tex2->IsCompatibleWith(PSO_ArrOfTex));
VERIFY_EXPR(!PSO_TexArr->IsCompatibleWith(PSO_ArrOfTex));
diff --git a/Tests/TestApp/src/TestShaderResArrays.cpp b/Tests/TestApp/src/TestShaderResArrays.cpp
index 190c13a..1f6238b 100644
--- a/Tests/TestApp/src/TestShaderResArrays.cpp
+++ b/Tests/TestApp/src/TestShaderResArrays.cpp
@@ -32,7 +32,7 @@
using namespace Diligent;
-TestShaderResArrays::TestShaderResArrays(IRenderDevice *pDevice, IDeviceContext *pDeviceContext, bool bUseOpenGL, float fMinXCoord, float fMinYCoord, float fXExtent, float fYExtent) :
+TestShaderResArrays::TestShaderResArrays(IRenderDevice *pDevice, IDeviceContext *pDeviceContext, float fMinXCoord, float fMinYCoord, float fXExtent, float fYExtent) :
UnitTestBase("Shader resource array test")
{
m_pRenderDevice = pDevice;
diff --git a/Tests/TestApp/src/TestShaderResourceLayout.cpp b/Tests/TestApp/src/TestShaderResourceLayout.cpp
index bc55428..c4aa901 100644
--- a/Tests/TestApp/src/TestShaderResourceLayout.cpp
+++ b/Tests/TestApp/src/TestShaderResourceLayout.cpp
@@ -103,11 +103,11 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev
BuffDesc.Mode = BUFFER_MODE_STRUCTURED;
BuffDesc.ElementByteStride = 16;
RefCntAutoPtr<IBuffer> pStorgeBuffs[4];
- IDeviceObject *pSBs[4];
+ IDeviceObject *pSBUAVs[4];
for (int i = 0; i < 4; ++i)
{
pDevice->CreateBuffer(BuffDesc, BufferData{}, &(pStorgeBuffs[i]));
- pSBs[i] = pStorgeBuffs[i];
+ pSBUAVs[i] = pStorgeBuffs[i]->GetDefaultView(BUFFER_VIEW_UNORDERED_ACCESS);
}
RefCntAutoPtr<IBuffer> pUniformTexelBuff, pStorageTexelBuff;
@@ -131,6 +131,46 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev
pStorageTexelBuffUAV = pStorageTexelBuff->GetDefaultView(BUFFER_VIEW_UNORDERED_ACCESS);
}
+ ResourceMappingDesc ResMappingDesc;
+ ResourceMappingEntry MappingEntries[] =
+ {
+ {"g_tex2D_Static", pSRVs[0]},
+ {"g_tex2DArr_Static", pSRVs[0], 0},
+ {"g_tex2DArr_Static", pSRVs[1], 1},
+ {"g_sepTex2D_static", pSRVs[0]},
+ {"g_sepTex2DArr_static", pSRVs[0], 0},
+ {"g_sepTex2DArr_static", pSRVs[1], 1},
+ {"g_tex2D_Mut", pSRVs[0]},
+ {"g_tex2DArr_Mut", pSRVs[0], 0},
+ {"g_tex2DArr_Mut", pSRVs[1], 1},
+ {"g_tex2DArr_Mut", pSRVs[2], 2},
+ {"g_tex2D_Dyn", pSRVs[0]},
+ {"g_tex2DArr_Dyn", pSRVs[0], 0},
+ {"g_tex2DArr_Dyn", pSRVs[1], 1},
+ {"g_tex2DArr_Dyn", pSRVs[2], 2},
+ {"g_tex2DArr_Dyn", pSRVs[3], 3},
+ {"g_tex2DArr_Dyn", pSRVs[0], 4},
+ {"g_tex2DArr_Dyn", pSRVs[1], 5},
+ {"g_tex2DArr_Dyn", pSRVs[2], 6},
+ {"g_tex2DArr_Dyn", pSRVs[3], 7},
+ {"g_sepTex2D_mut", pSRVs[0]},
+ {"g_sepTex2DArr_mut", pSRVs[0], 0},
+ {"g_sepTex2DArr_mut", pSRVs[1], 1},
+ {"g_sepTex2DArr_mut", pSRVs[2], 2},
+ {"g_sepTex2D_dyn", pSRVs[0]},
+ {"g_sepTex2DArr_dyn", pSRVs[0], 0},
+ {"g_sepTex2DArr_dyn", pSRVs[1], 1},
+ {"g_sepTex2DArr_dyn", pSRVs[2], 2},
+ {"g_sepTex2DArr_dyn", pSRVs[3], 3},
+ {"g_sepTex2DArr_dyn", pSRVs[0], 4},
+ {"g_sepTex2DArr_dyn", pSRVs[1], 5},
+ {"g_sepTex2DArr_dyn", pSRVs[2], 6},
+ {"g_sepTex2DArr_dyn", pSRVs[3], 7},
+ {}
+ };
+ ResMappingDesc.pEntries = MappingEntries;
+ RefCntAutoPtr<IResourceMapping> pResMapping;
+ pDevice->CreateResourceMapping(ResMappingDesc, &pResMapping);
RefCntAutoPtr<IShader> pVS;
{
@@ -187,18 +227,21 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev
pDevice->CreateShader(CreationAttrs, &pVS);
VERIFY_EXPR(pVS);
- pVS->GetShaderVariable("g_tex2D_Static")->Set(pSRVs[0]);
- pVS->GetShaderVariable("g_tex2DArr_Static")->SetArray(pSRVs, 0, 2);
+ //pVS->GetShaderVariable("g_tex2D_Static")->Set(pSRVs[0]);
+ //pVS->GetShaderVariable("g_tex2DArr_Static")->SetArray(pSRVs, 0, 2);
pVS->GetShaderVariable("g_sepTex2D_static")->Set(pSRVs[0]);
pVS->GetShaderVariable("g_sepTex2DArr_static")->SetArray(pSRVs, 0, 2);
pVS->GetShaderVariable("g_SamArr_static")->SetArray(pSams, 0, 2);
pVS->GetShaderVariable("UniformBuff_Stat")->Set(pUBs[0]);
pVS->GetShaderVariable("UniformBuffArr_Stat")->SetArray(pUBs, 0, 2);
- pVS->GetShaderVariable("storageBuff_Static")->Set(pSBs[0]);
- pVS->GetShaderVariable("storageBuffArr_Static")->SetArray(pSBs, 0, 2);
+ pVS->GetShaderVariable("storageBuff_Static")->Set(pSBUAVs[0]);
+ pVS->GetShaderVariable("storageBuffArr_Static")->SetArray(pSBUAVs, 0, 2);
pVS->GetShaderVariable("g_tex2DStorageImg_Stat")->Set(pUAVs[0]);
pVS->GetShaderVariable("g_UniformTexelBuff")->Set(pUniformTexelBuffSRV);
pVS->GetShaderVariable("g_StorageTexelBuff")->Set(pStorageTexelBuffUAV);
+ pVS->GetShaderVariable("g_tex2D_Mut");
+ LOG_INFO_MESSAGE("The above 2 warnings and 1 errors about missing shader resources are part of the test");
+ pVS->BindResources(pResMapping, BIND_SHADER_RESOURCES_UPDATE_UNRESOLVED | BIND_SHADER_RESOURCES_ALL_RESOLVED);
}
RefCntAutoPtr<IShader> pPS;
@@ -207,21 +250,25 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev
CreationAttrs.Desc.ShaderType = SHADER_TYPE_PIXEL;
CreationAttrs.SourceLanguage = SHADER_SOURCE_LANGUAGE_GLSL;
CreationAttrs.FilePath = "Shaders\\ShaderResLayoutTestGL.psh";
+
pDevice->CreateShader(CreationAttrs, &pPS);
VERIFY_EXPR(pPS);
pPS->GetShaderVariable("g_tex2D_Static")->Set(pSRVs[0]);
pPS->GetShaderVariable("g_tex2DArr_Static")->SetArray(pSRVs, 0, 2);
- pPS->GetShaderVariable("g_sepTex2D_static")->Set(pSRVs[0]);
- pPS->GetShaderVariable("g_sepTex2DArr_static")->SetArray(pSRVs, 0, 2);
+ //pPS->GetShaderVariable("g_sepTex2D_static")->Set(pSRVs[0]);
+ //pPS->GetShaderVariable("g_sepTex2DArr_static")->SetArray(pSRVs, 0, 2);
pPS->GetShaderVariable("g_SamArr_static")->SetArray(pSams, 0, 2);
pPS->GetShaderVariable("UniformBuff_Stat")->Set(pUBs[0]);
pPS->GetShaderVariable("UniformBuffArr_Stat")->SetArray(pUBs, 0, 2);
- pPS->GetShaderVariable("storageBuff_Static")->Set(pSBs[0]);
- pPS->GetShaderVariable("storageBuffArr_Static")->SetArray(pSBs, 0, 2);
+ pPS->GetShaderVariable("storageBuff_Static")->Set(pSBUAVs[0]);
+ pPS->GetShaderVariable("storageBuffArr_Static")->SetArray(pSBUAVs, 0, 2);
pPS->GetShaderVariable("g_tex2DStorageImg_Stat")->Set(pUAVs[0]);
pPS->GetShaderVariable("g_UniformTexelBuff")->Set(pUniformTexelBuffSRV);
pPS->GetShaderVariable("g_StorageTexelBuff")->Set(pStorageTexelBuffUAV);
+ pPS->GetShaderVariable("storageBuff_Dyn");
+ LOG_INFO_MESSAGE("The above 2 warnings and 1 errors about missing shader resources are part of the test");
+ pPS->BindResources(pResMapping, BIND_SHADER_RESOURCES_UPDATE_UNRESOLVED | BIND_SHADER_RESOURCES_ALL_RESOLVED);
}
PipelineStateDesc PSODesc;
@@ -232,6 +279,7 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev
PSODesc.GraphicsPipeline.NumRenderTargets = 1;
PSODesc.GraphicsPipeline.RTVFormats[0] = TEX_FORMAT_RGBA8_UNORM;
PSODesc.GraphicsPipeline.DSVFormat = TEX_FORMAT_UNKNOWN;
+ PSODesc.SRBAllocationGranularity = 16;
RefCntAutoPtr<IPipelineState> pTestPSO;
pDevice->CreatePipelineState(PSODesc, &pTestPSO);
@@ -240,10 +288,14 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev
RefCntAutoPtr<IShaderResourceBinding> pSRB;
pTestPSO->CreateShaderResourceBinding(&pSRB);
- pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2D_Mut")->Set(pSRVs[0]);
- pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2DArr_Mut")->SetArray(pSRVs, 0, 3);
- pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2D_Dyn")->Set(pSRVs[0]);
- pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2DArr_Dyn")->SetArray(pSRVs, 0, 4);
+ pSRB->GetVariable(SHADER_TYPE_VERTEX, "UniformBuff_Stat");
+ pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2DArr_static");
+ LOG_INFO_MESSAGE("The above 2 errors about missing shader resources are part of the test");
+
+ //pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2D_Mut")->Set(pSRVs[0]);
+ //pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2DArr_Mut")->SetArray(pSRVs, 0, 3);
+ //pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2D_Dyn")->Set(pSRVs[0]);
+ //pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2DArr_Dyn")->SetArray(pSRVs, 0, 4);
pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_sepTex2D_mut")->Set(pSRVs[0]);
pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_sepTex2DArr_mut")->SetArray(pSRVs, 0, 3);
@@ -258,10 +310,10 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev
pSRB->GetVariable(SHADER_TYPE_VERTEX, "UniformBuff_Dyn")->Set(pUBs[0]);
pSRB->GetVariable(SHADER_TYPE_VERTEX, "UniformBuffArr_Dyn")->SetArray(pUBs, 0, 4);
- pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuff_Mut")->Set(pSBs[0]);
- pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuffArr_Mut")->SetArray(pSBs, 0, 3);
- pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuff_Dyn")->Set(pSBs[0]);
- pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuffArr_Dyn")->SetArray(pSBs, 0, 4);
+ pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuff_Mut")->Set(pSBUAVs[0]);
+ pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuffArr_Mut")->SetArray(pSBUAVs, 0, 3);
+ pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuff_Dyn")->Set(pSBUAVs[0]);
+ pSRB->GetVariable(SHADER_TYPE_VERTEX, "storageBuffArr_Dyn")->SetArray(pSBUAVs, 0, 4);
pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2DStorageImgArr_Mut")->SetArray(pUAVs, 0, 2);
pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2DStorageImgArr_Dyn")->SetArray(pUAVs, 0, 2);
@@ -276,10 +328,10 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev
pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_tex2D_Dyn")->Set(pSRVs[0]);
pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_tex2DArr_Dyn")->SetArray(pSRVs, 0, 4);
- pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2D_mut")->Set(pSRVs[0]);
- pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2DArr_mut")->SetArray(pSRVs, 0, 3);
- pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2D_dyn")->Set(pSRVs[0]);
- pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2DArr_dyn")->SetArray(pSRVs, 0, 4);
+ //pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2D_mut")->Set(pSRVs[0]);
+ //pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2DArr_mut")->SetArray(pSRVs, 0, 3);
+ //pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2D_dyn")->Set(pSRVs[0]);
+ //pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_sepTex2DArr_dyn")->SetArray(pSRVs, 0, 4);
pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_Sam_mut")->Set(pSams[0]);
pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_SamArr_dyn")->SetArray(pSams, 0, 4);
@@ -289,10 +341,10 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev
pSRB->GetVariable(SHADER_TYPE_PIXEL, "UniformBuff_Dyn")->Set(pUBs[0]);
pSRB->GetVariable(SHADER_TYPE_PIXEL, "UniformBuffArr_Dyn")->SetArray(pUBs, 0, 4);
- pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuff_Mut")->Set(pSBs[0]);
- pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuffArr_Mut")->SetArray(pSBs, 0, 3);
- pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuff_Dyn")->Set(pSBs[0]);
- pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuffArr_Dyn")->SetArray(pSBs, 0, 4);
+ pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuff_Mut")->Set(pSBUAVs[0]);
+ pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuffArr_Mut")->SetArray(pSBUAVs, 0, 3);
+ pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuff_Dyn")->Set(pSBUAVs[0]);
+ pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuffArr_Dyn")->SetArray(pSBUAVs, 0, 4);
pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_tex2DStorageImgArr_Mut")->SetArray(pUAVs, 0, 2);
pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_tex2DStorageImgArr_Dyn")->SetArray(pUAVs, 0, 2);
@@ -300,6 +352,8 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev
pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_UniformTexelBuff_mut")->Set(pUniformTexelBuffSRV);
pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_StorageTexelBuff_mut")->Set(pStorageTexelBuffUAV);
+ pSRB->BindResources(SHADER_TYPE_PIXEL | SHADER_TYPE_VERTEX, pResMapping, BIND_SHADER_RESOURCES_UPDATE_UNRESOLVED | BIND_SHADER_RESOURCES_ALL_RESOLVED);
+
pContext->SetPipelineState(pTestPSO);
pContext->CommitShaderResources(pSRB, COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES);
@@ -307,7 +361,7 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev
DrawAttrs.NumVertices = 3;
pContext->Draw(DrawAttrs);
- pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuff_Dyn")->Set(pSBs[1]);
+ pSRB->GetVariable(SHADER_TYPE_PIXEL, "storageBuff_Dyn")->Set(pSBUAVs[1]);
pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_tex2D_Dyn")->Set(pSRVs[1]);
pSRB->GetVariable(SHADER_TYPE_VERTEX, "g_sepTex2D_dyn")->Set(pSRVs[1]);
pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_SamArr_dyn")->SetArray(pSams+1, 1, 3);
diff --git a/Tests/TestApp/src/TestTexturing.cpp b/Tests/TestApp/src/TestTexturing.cpp
index bcc6c30..9a9b356 100644
--- a/Tests/TestApp/src/TestTexturing.cpp
+++ b/Tests/TestApp/src/TestTexturing.cpp
@@ -132,11 +132,13 @@ void TestTexturing::GenerateTextureData(IRenderDevice *pRenderDevice, std::vecto
}
-void TestTexturing::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceContext, TEXTURE_FORMAT TexFormat, bool bUseOpenGL, float fMinXCoord, float fMinYCoord, float fXExtent, float fYExtent )
+void TestTexturing::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceContext, TEXTURE_FORMAT TexFormat, float fMinXCoord, float fMinYCoord, float fXExtent, float fYExtent )
{
m_pRenderDevice = pDevice;
m_TextureFormat = TexFormat;
m_pDeviceContext = pDeviceContext;
+ auto DevType = m_pRenderDevice->GetDeviceCaps().DevType;
+ bool bUseGLSL = DevType == DeviceType::OpenGL || DevType == DeviceType::OpenGLES || DevType == DeviceType::Vulkan;
float Vertices[] =
{
@@ -167,11 +169,11 @@ void TestTexturing::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceContext
ShaderCreationAttribs CreationAttrs;
BasicShaderSourceStreamFactory BasicSSSFactory;
CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory;
- CreationAttrs.Desc.TargetProfile = bUseOpenGL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0;
+ CreationAttrs.Desc.TargetProfile = bUseGLSL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0;
RefCntAutoPtr<Diligent::IShader> pVS, pPS;
{
- CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\TextureTestGL.vsh" : "Shaders\\TextureTestDX.vsh";
+ CreationAttrs.FilePath = bUseGLSL ? "Shaders\\TextureTestGL.vsh" : "Shaders\\TextureTestDX.vsh";
CreationAttrs.Desc.ShaderType = SHADER_TYPE_VERTEX;
m_pRenderDevice->CreateShader( CreationAttrs, &pVS );
}
@@ -180,9 +182,9 @@ void TestTexturing::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceContext
PixelFormatAttribs.ComponentType == COMPONENT_TYPE_SINT;
{
if( bIsIntTexture )
- CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\TextureIntTestGL.psh" : "Shaders\\TextureIntTestDX.psh";
+ CreationAttrs.FilePath = bUseGLSL ? "Shaders\\TextureIntTestGL.psh" : "Shaders\\TextureIntTestDX.psh";
else
- CreationAttrs.FilePath = bUseOpenGL ? "Shaders\\TextureTestGL.psh" : "Shaders\\TextureTestDX.psh";
+ CreationAttrs.FilePath = bUseGLSL ? "Shaders\\TextureTestGL.psh" : "Shaders\\TextureTestDX.psh";
CreationAttrs.Desc.ShaderType = SHADER_TYPE_PIXEL;
StaticSamplerDesc StaticSampler;