summaryrefslogtreecommitdiffstats
path: root/Tests/TestApp/src
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-10-18 15:52:52 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-10-18 15:52:52 +0000
commite5d030cb921f4b967485eaea9cff9e54ff24232a (patch)
tree4ce52d4a0d3bd91933fc4cb098b0247a9242f8e9 /Tests/TestApp/src
parentUpdate README.md (diff)
downloadDiligentEngine-e5d030cb921f4b967485eaea9cff9e54ff24232a.tar.gz
DiligentEngine-e5d030cb921f4b967485eaea9cff9e54ff24232a.zip
Enabled seperate samplers
Diffstat (limited to 'Tests/TestApp/src')
-rw-r--r--Tests/TestApp/src/MTResourceCreationTest.cpp1
-rw-r--r--Tests/TestApp/src/ShaderConverterTest.cpp1
-rw-r--r--Tests/TestApp/src/TestApp.cpp25
-rw-r--r--Tests/TestApp/src/TestBrokenShader.cpp1
-rw-r--r--Tests/TestApp/src/TestBufferAccess.cpp1
-rw-r--r--Tests/TestApp/src/TestDrawCommands.cpp1
-rw-r--r--Tests/TestApp/src/TestGeometryShader.cpp1
-rw-r--r--Tests/TestApp/src/TestPSOCompatibility.cpp2
-rw-r--r--Tests/TestApp/src/TestPipelineStateBase.cpp1
-rw-r--r--Tests/TestApp/src/TestSeparateTextureSampler.cpp171
-rw-r--r--Tests/TestApp/src/TestShaderResArrays.cpp5
-rw-r--r--Tests/TestApp/src/TestShaderResourceLayout.cpp2
-rw-r--r--Tests/TestApp/src/TestShaderVarAccess.cpp1
-rw-r--r--Tests/TestApp/src/TestTessellation.cpp1
-rw-r--r--Tests/TestApp/src/TestTextureCreation.cpp39
-rw-r--r--Tests/TestApp/src/TestTexturing.cpp3
16 files changed, 226 insertions, 30 deletions
diff --git a/Tests/TestApp/src/MTResourceCreationTest.cpp b/Tests/TestApp/src/MTResourceCreationTest.cpp
index 3be401d..6449514 100644
--- a/Tests/TestApp/src/MTResourceCreationTest.cpp
+++ b/Tests/TestApp/src/MTResourceCreationTest.cpp
@@ -200,6 +200,7 @@ void MTResourceCreationTest::ThreadWorkerFunc(bool bIsMasterThread)
Attrs.Desc.ShaderType = SHADER_TYPE_VERTEX;
Attrs.Desc.Name = "TrivialVS (MTResourceCreationTest)";
Attrs.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL;
+ Attrs.UseCombinedTextureSamplers = true;
m_pDevice->CreateShader(Attrs, &pTrivialVS);
Attrs.EntryPoint = "PSMain";
diff --git a/Tests/TestApp/src/ShaderConverterTest.cpp b/Tests/TestApp/src/ShaderConverterTest.cpp
index 837d911..51ee397 100644
--- a/Tests/TestApp/src/ShaderConverterTest.cpp
+++ b/Tests/TestApp/src/ShaderConverterTest.cpp
@@ -44,6 +44,7 @@ ShaderConverterTest::ShaderConverterTest( IRenderDevice *pRenderDevice, IDeviceC
CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory;
CreationAttrs.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL;
CreationAttrs.Desc.Name = "Test converted shader";
+ CreationAttrs.UseCombinedTextureSamplers = true;
RefCntAutoPtr<IHLSL2GLSLConversionStream> pStream;
CreationAttrs.ppConversionStream = pStream.GetRawDblPtr();
diff --git a/Tests/TestApp/src/TestApp.cpp b/Tests/TestApp/src/TestApp.cpp
index e5bcefb..77709f8 100644
--- a/Tests/TestApp/src/TestApp.cpp
+++ b/Tests/TestApp/src/TestApp.cpp
@@ -66,6 +66,8 @@
#include "TestBrokenShader.h"
#include "TestShaderResourceLayout.h"
#include "TestShaderVarAccess.h"
+#include "TestSeparateTextureSampler.h"
+#include "StringTools.h"
using namespace Diligent;
@@ -110,6 +112,26 @@ TestApp::TestApp() :
VERIFY_EXPR(PlatformMisc::CountOneBits( (Uint64{1}<<63) | (Uint32{1} << 31)) == 2);
VERIFY_EXPR(PlatformMisc::CountOneBits( (Uint32{1}<<31) - 1) == 31);
VERIFY_EXPR(PlatformMisc::CountOneBits( (Uint64{1}<<63) - 1) == 63);
+
+
+ VERIFY_EXPR(StreqSuff("abc_def","abc", "_def"));
+ VERIFY_EXPR(!StreqSuff("abc","abc", "_def"));
+ VERIFY_EXPR(!StreqSuff("ab","abc", "_def"));
+ VERIFY_EXPR(!StreqSuff("abc_de","abc", "_def"));
+ VERIFY_EXPR(!StreqSuff("abc_def","ab", "_def"));
+ VERIFY_EXPR(!StreqSuff("abc_def","abd", "_def"));
+ VERIFY_EXPR(!StreqSuff("abc_def","abc", "_de"));
+ VERIFY_EXPR(!StreqSuff("abc","abc", "_def"));
+ VERIFY_EXPR(!StreqSuff("abc_def", "", "_def"));
+ VERIFY_EXPR(!StreqSuff("abc_def", "", ""));
+
+ VERIFY_EXPR(StreqSuff("abc","abc", "_def", true));
+ VERIFY_EXPR(!StreqSuff("abc","abc_", "_def", true));
+ VERIFY_EXPR(!StreqSuff("abc_","abc", "_def", true));
+ VERIFY_EXPR(StreqSuff("abc","abc", nullptr, true));
+ VERIFY_EXPR(StreqSuff("abc","abc", nullptr, false));
+ VERIFY_EXPR(!StreqSuff("ab","abc", nullptr, true));
+ VERIFY_EXPR(!StreqSuff("abc","ab", nullptr, false));
}
TestApp::~TestApp()
@@ -313,6 +335,7 @@ void TestApp::InitializeRenderers()
{
m_pMTResCreationTest.reset(new MTResourceCreationTest(m_pDevice, m_pImmediateContext, 7));
+ TestSeparateTextureSampler TestSeparateTexSampler{m_pDevice, m_pImmediateContext};
TestRasterizerState TestRS{m_pDevice, m_pImmediateContext};
TestBlendState TestBS{m_pDevice, m_pImmediateContext};
TestDepthStencilState TestDSS{m_pDevice, m_pImmediateContext};
@@ -320,7 +343,7 @@ void TestApp::InitializeRenderers()
TestTextureCreation TestTexCreation{m_pDevice, m_pImmediateContext};
TestPSOCompatibility TestPSOCompat{m_pDevice};
TestBrokenShader TestBrknShdr{m_pDevice};
-
+
m_TestGS.Init(m_pDevice, m_pImmediateContext, m_pSwapChain);
m_TestTessellation.Init(m_pDevice, m_pImmediateContext, m_pSwapChain);
m_pTestShaderResArrays.reset(new TestShaderResArrays(m_pDevice, m_pImmediateContext, m_pSwapChain, 0.4f, -0.9f, 0.5f, 0.5f));
diff --git a/Tests/TestApp/src/TestBrokenShader.cpp b/Tests/TestApp/src/TestBrokenShader.cpp
index 3ec798c..91d1914 100644
--- a/Tests/TestApp/src/TestBrokenShader.cpp
+++ b/Tests/TestApp/src/TestBrokenShader.cpp
@@ -46,6 +46,7 @@ TestBrokenShader::TestBrokenShader(IRenderDevice *pDevice) :
Attrs.Desc.ShaderType = SHADER_TYPE_VERTEX;
Attrs.Desc.Name = "Broken shader test";
Attrs.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL;
+ Attrs.UseCombinedTextureSamplers = true;
RefCntAutoPtr<IShader> pBrokenShader;
IDataBlob *pErrors = nullptr;
Attrs.ppCompilerOutput = &pErrors;
diff --git a/Tests/TestApp/src/TestBufferAccess.cpp b/Tests/TestApp/src/TestBufferAccess.cpp
index 578abf1..1f0e1c0 100644
--- a/Tests/TestApp/src/TestBufferAccess.cpp
+++ b/Tests/TestApp/src/TestBufferAccess.cpp
@@ -116,6 +116,7 @@ void TestBufferAccess::Init( IRenderDevice *pDevice, IDeviceContext *pContext, I
BasicShaderSourceStreamFactory BasicSSSFactory;
CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory;
CreationAttrs.Desc.TargetProfile = bUseGLSL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0;
+ CreationAttrs.UseCombinedTextureSamplers = true;
RefCntAutoPtr<Diligent::IShader> pVSInst, pPS;
diff --git a/Tests/TestApp/src/TestDrawCommands.cpp b/Tests/TestApp/src/TestDrawCommands.cpp
index 664ad1f..09aeb30 100644
--- a/Tests/TestApp/src/TestDrawCommands.cpp
+++ b/Tests/TestApp/src/TestDrawCommands.cpp
@@ -156,6 +156,7 @@ void TestDrawCommands::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceCont
BasicShaderSourceStreamFactory BasicSSSFactory;
CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory;
CreationAttrs.Desc.TargetProfile = bUseGLSL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0;
+ CreationAttrs.UseCombinedTextureSamplers = true;
RefCntAutoPtr<IShader> pVS, pVSInst, pPS;
{
diff --git a/Tests/TestApp/src/TestGeometryShader.cpp b/Tests/TestApp/src/TestGeometryShader.cpp
index 2dff0d6..3efc13c 100644
--- a/Tests/TestApp/src/TestGeometryShader.cpp
+++ b/Tests/TestApp/src/TestGeometryShader.cpp
@@ -45,6 +45,7 @@ void TestGeometryShader::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceCo
BasicShaderSourceStreamFactory BasicSSSFactory;
CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory;
CreationAttrs.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL;
+ CreationAttrs.UseCombinedTextureSamplers = true;
RefCntAutoPtr<Diligent::IShader> pVS, pGS, pPS;
{
diff --git a/Tests/TestApp/src/TestPSOCompatibility.cpp b/Tests/TestApp/src/TestPSOCompatibility.cpp
index 3abd3a6..24a0c5b 100644
--- a/Tests/TestApp/src/TestPSOCompatibility.cpp
+++ b/Tests/TestApp/src/TestPSOCompatibility.cpp
@@ -203,6 +203,7 @@ RefCntAutoPtr<IPipelineState> TestPSOCompatibility::CreateTestPSO(const char *VS
ShaderCreationAttribs CreationAttrs;
CreationAttrs.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL;
+ CreationAttrs.UseCombinedTextureSamplers = true;
RefCntAutoPtr<IShader> pVS;
{
CreationAttrs.Desc.ShaderType = SHADER_TYPE_VERTEX;
@@ -236,6 +237,7 @@ RefCntAutoPtr<IPipelineState> TestPSOCompatibility::CreateTestPSO(const char *CS
PSODesc.IsComputePipeline = true;
ShaderCreationAttribs CreationAttrs;
CreationAttrs.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL;
+ CreationAttrs.UseCombinedTextureSamplers = true;
RefCntAutoPtr<IShader> pCS;
{
CreationAttrs.Desc.ShaderType = SHADER_TYPE_COMPUTE;
diff --git a/Tests/TestApp/src/TestPipelineStateBase.cpp b/Tests/TestApp/src/TestPipelineStateBase.cpp
index 0674463..ecd9e72 100644
--- a/Tests/TestApp/src/TestPipelineStateBase.cpp
+++ b/Tests/TestApp/src/TestPipelineStateBase.cpp
@@ -50,6 +50,7 @@ TestPipelineStateBase::TestPipelineStateBase(Diligent::IRenderDevice *pDevice, c
Attrs.Desc.ShaderType = SHADER_TYPE_VERTEX;
Attrs.Desc.Name = "TrivialVS (TestPipelineStateBase)";
Attrs.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL;
+ Attrs.UseCombinedTextureSamplers = true;
m_pDevice->CreateShader(Attrs, &m_pTrivialVS);
Attrs.EntryPoint = "PSMain";
diff --git a/Tests/TestApp/src/TestSeparateTextureSampler.cpp b/Tests/TestApp/src/TestSeparateTextureSampler.cpp
new file mode 100644
index 0000000..7b8d529
--- /dev/null
+++ b/Tests/TestApp/src/TestSeparateTextureSampler.cpp
@@ -0,0 +1,171 @@
+/* Copyright 2015-2018 Egor Yusov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
+ *
+ * In no event and under no legal theory, whether in tort (including negligence),
+ * contract, or otherwise, unless required by applicable law (such as deliberate
+ * and grossly negligent acts) or agreed to in writing, shall any Contributor be
+ * liable for any damages, including any direct, indirect, special, incidental,
+ * or consequential damages of any character arising as a result of this License or
+ * out of the use or inability to use the software (including but not limited to damages
+ * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
+ * all other commercial damages or losses), even if such Contributor has been advised
+ * of the possibility of such damages.
+ */
+
+// EngineSandbox.cpp : Defines the entry point for the application.
+//
+
+#include "pch.h"
+#include "TestSeparateTextureSampler.h"
+
+static const char g_ShaderSource[] =
+R"(
+
+Texture2D g_Tex;
+SamplerState g_Sam;
+Texture2D g_Tex2;
+SamplerState g_Sam2;
+SamplerState g_Sam3[2];
+SamplerState g_Sam4[2];
+
+void VSMain(out float4 pos : SV_POSITION)
+{
+ pos = float4(0.0, 0.0, 0.0, 0.0);
+}
+
+void PSMain(out float4 col : SV_TARGET)
+{
+ col = g_Tex.Sample(g_Sam, float2(0.5, 0.5)) +
+ g_Tex2.Sample(g_Sam2, float2(0.5, 0.5)) +
+ g_Tex2.Sample(g_Sam3[0], float2(0.5, 0.5)) +
+ g_Tex2.Sample(g_Sam3[1], float2(0.5, 0.5)) +
+ g_Tex2.Sample(g_Sam4[0], float2(0.5, 0.5)) +
+ g_Tex2.Sample(g_Sam4[1], float2(0.5, 0.5));
+}
+)";
+
+using namespace Diligent;
+
+TestSeparateTextureSampler::TestSeparateTextureSampler(IRenderDevice *pDevice, IDeviceContext *pContext) :
+ UnitTestBase("Test separate texture sampler")
+{
+ if (pDevice->GetDeviceCaps().IsD3DDevice() /*|| pDevice->GetDeviceCaps().IsVulkanDevice()*/)
+ {
+ ShaderCreationAttribs Attrs;
+ Attrs.Source = g_ShaderSource;
+ Attrs.EntryPoint = "VSMain";
+ Attrs.Desc.ShaderType = SHADER_TYPE_VERTEX;
+ Attrs.Desc.Name = "VSMain (TestSeparateTextureSampler)";
+ Attrs.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL;
+ RefCntAutoPtr<IShader> pVS;
+ pDevice->CreateShader(Attrs, &pVS);
+
+ Attrs.EntryPoint = "PSMain";
+ Attrs.Desc.ShaderType = SHADER_TYPE_PIXEL;
+ Attrs.Desc.Name = "PSMain (TestSeparateTextureSampler)";
+ ShaderVariableDesc Vars[] =
+ {
+ {"g_Tex", SHADER_VARIABLE_TYPE_MUTABLE},
+ {"g_Sam", SHADER_VARIABLE_TYPE_DYNAMIC},
+ {"g_Tex2", SHADER_VARIABLE_TYPE_DYNAMIC},
+ {"g_Sam2", SHADER_VARIABLE_TYPE_MUTABLE},
+ {"g_Sam4", SHADER_VARIABLE_TYPE_MUTABLE}
+ };
+ Attrs.Desc.VariableDesc = Vars;
+ Attrs.Desc.NumVariables = _countof(Vars);
+
+ StaticSamplerDesc StaticSamplers[] =
+ {
+ {"g_Sam2", SamplerDesc{}}
+ };
+ Attrs.Desc.StaticSamplers = StaticSamplers;
+ Attrs.Desc.NumStaticSamplers = _countof(StaticSamplers);
+
+ RefCntAutoPtr<IShader> pPS;
+ pDevice->CreateShader(Attrs, &pPS);
+
+ PipelineStateDesc PSODesc;
+ PSODesc.GraphicsPipeline.pVS = pVS;
+ PSODesc.GraphicsPipeline.pPS = pPS;
+ PSODesc.GraphicsPipeline.PrimitiveTopology = PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
+ PSODesc.GraphicsPipeline.NumRenderTargets = 1;
+ PSODesc.GraphicsPipeline.RTVFormats[0] = TEX_FORMAT_RGBA8_UNORM;
+ PSODesc.GraphicsPipeline.DSVFormat = TEX_FORMAT_UNKNOWN;
+ PSODesc.GraphicsPipeline.DepthStencilDesc.DepthEnable = false;
+
+ RefCntAutoPtr<IPipelineState> pPSO;
+ pDevice->CreatePipelineState(PSODesc, &pPSO);
+
+ TextureDesc TexDesc;
+ TexDesc.Name = "Separate sampler texture test";
+ TexDesc.Type = RESOURCE_DIM_TEX_2D;
+ TexDesc.Width = 256;
+ TexDesc.Height = 256;
+ TexDesc.Format = TEX_FORMAT_RGBA8_UNORM;
+ TexDesc.Usage = USAGE_DEFAULT;
+ TexDesc.BindFlags = BIND_SHADER_RESOURCE;
+ RefCntAutoPtr<ITexture> pTexture;
+ pDevice->CreateTexture( TexDesc, TextureData(), &pTexture );
+
+ RefCntAutoPtr<ISampler> pSampler;
+ pDevice->CreateSampler( SamplerDesc{}, &pSampler );
+
+ RefCntAutoPtr<IShaderResourceBinding> pSRB;
+ pPSO->CreateShaderResourceBinding(&pSRB);
+
+ IDeviceObject* ppSamplers[2] = {pSampler, pSampler};
+ pPS->GetShaderVariable("g_Sam3")->SetArray(ppSamplers, 0, 2);
+ pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_Tex")->Set(pTexture->GetDefaultView(TEXTURE_VIEW_SHADER_RESOURCE));
+ pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_Sam")->Set(pSampler);
+ pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_Sam4")->SetArray(ppSamplers, 0, 2);
+ pSRB->GetVariable(SHADER_TYPE_PIXEL, "g_Tex2")->Set(pTexture->GetDefaultView(TEXTURE_VIEW_SHADER_RESOURCE));
+
+ auto VarCount = pSRB->GetVariableCount(SHADER_TYPE_PIXEL);
+ VERIFY_EXPR(VarCount == 4);
+ for(Uint32 v=0; v < VarCount; ++v)
+ {
+ auto* pVar = pSRB->GetVariable(SHADER_TYPE_PIXEL, v);
+ VERIFY_EXPR(pVar->GetIndex() == v);
+ VERIFY_EXPR(pVar->GetType() == SHADER_VARIABLE_TYPE_MUTABLE || pVar->GetType() == SHADER_VARIABLE_TYPE_DYNAMIC);
+ auto pVar2 = pSRB->GetVariable(SHADER_TYPE_PIXEL, pVar->GetName());
+ VERIFY_EXPR(pVar == pVar2);
+ }
+
+ TextureDesc RenderTargetDesc;
+ RenderTargetDesc.Type = RESOURCE_DIM_TEX_2D;
+ RenderTargetDesc.Width = 256;
+ RenderTargetDesc.Height = 256;
+ RenderTargetDesc.BindFlags = BIND_RENDER_TARGET | BIND_SHADER_RESOURCE;
+ RenderTargetDesc.Format = TEX_FORMAT_RGBA8_UNORM;
+ RenderTargetDesc.Name = "TestSeparateTextureSampler: test render target";
+ RefCntAutoPtr<ITexture> pRenderTarget;
+ pDevice->CreateTexture(RenderTargetDesc, TextureData{}, &pRenderTarget);
+
+ ITextureView* pRTV[] = {pRenderTarget->GetDefaultView(TEXTURE_VIEW_RENDER_TARGET)};
+ pContext->SetRenderTargets(1, pRTV, nullptr);
+ float Zero[4] = {};
+ pContext->ClearRenderTarget(pRTV[0], Zero);
+ pContext->SetPipelineState(pPSO);
+ pContext->CommitShaderResources(pSRB, COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES);
+ DrawAttribs DrawAttrs;
+ DrawAttrs.NumVertices = 3;
+ pContext->Draw(DrawAttrs);
+
+ pContext->SetRenderTargets(0, nullptr, nullptr);
+
+ SetStatus(TestResult::Succeeded);
+ }
+ else
+ {
+ SetStatus(TestResult::Skipped);
+ }
+}
diff --git a/Tests/TestApp/src/TestShaderResArrays.cpp b/Tests/TestApp/src/TestShaderResArrays.cpp
index d58b776..4144944 100644
--- a/Tests/TestApp/src/TestShaderResArrays.cpp
+++ b/Tests/TestApp/src/TestShaderResArrays.cpp
@@ -42,9 +42,11 @@ TestShaderResArrays::TestShaderResArrays(IRenderDevice *pDevice, IDeviceContext
BasicShaderSourceStreamFactory BasicSSSFactory;
CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory;
CreationAttrs.Desc.TargetProfile = SHADER_PROFILE_DX_5_0;
+ CreationAttrs.UseCombinedTextureSamplers = true;
RefCntAutoPtr<Diligent::IShader> pVS, pPS;
{
+ CreationAttrs.Desc.Name = "TestShaderResArrays: VS";
CreationAttrs.FilePath = "Shaders\\ShaderResArrayTest.vsh";
CreationAttrs.Desc.ShaderType = SHADER_TYPE_VERTEX;
CreationAttrs.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL;
@@ -52,13 +54,14 @@ TestShaderResArrays::TestShaderResArrays(IRenderDevice *pDevice, IDeviceContext
}
{
+ CreationAttrs.Desc.Name = "TestShaderResArrays: PS";
CreationAttrs.FilePath = "Shaders\\ShaderResArrayTest.psh";
StaticSamplerDesc StaticSampler;
StaticSampler.Desc.MinFilter = FILTER_TYPE_LINEAR;
StaticSampler.Desc.MagFilter = FILTER_TYPE_LINEAR;
StaticSampler.Desc.MipFilter = FILTER_TYPE_LINEAR;
- StaticSampler.TextureName = "g_tex2DTest";
+ StaticSampler.SamplerOrTextureName = "g_tex2DTest";
CreationAttrs.Desc.NumStaticSamplers = 1;
CreationAttrs.Desc.StaticSamplers = &StaticSampler;
CreationAttrs.Desc.ShaderType = SHADER_TYPE_PIXEL;
diff --git a/Tests/TestApp/src/TestShaderResourceLayout.cpp b/Tests/TestApp/src/TestShaderResourceLayout.cpp
index 9f00495..9e470f2 100644
--- a/Tests/TestApp/src/TestShaderResourceLayout.cpp
+++ b/Tests/TestApp/src/TestShaderResourceLayout.cpp
@@ -43,7 +43,7 @@ TestShaderResourceLayout::TestShaderResourceLayout( IRenderDevice *pDevice, IDev
BasicShaderSourceStreamFactory BasicSSSFactory("Shaders");
CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory;
CreationAttrs.EntryPoint = "main";
-
+ CreationAttrs.UseCombinedTextureSamplers = true;
RefCntAutoPtr<ISampler> pSamplers[4];
IDeviceObject *pSams[4];
diff --git a/Tests/TestApp/src/TestShaderVarAccess.cpp b/Tests/TestApp/src/TestShaderVarAccess.cpp
index aa7e9d0..1c33b03 100644
--- a/Tests/TestApp/src/TestShaderVarAccess.cpp
+++ b/Tests/TestApp/src/TestShaderVarAccess.cpp
@@ -41,6 +41,7 @@ TestShaderVarAccess::TestShaderVarAccess( IRenderDevice *pDevice, IDeviceContext
BasicShaderSourceStreamFactory BasicSSSFactory("Shaders");
CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory;
CreationAttrs.EntryPoint = "main";
+ CreationAttrs.UseCombinedTextureSamplers = true;
RefCntAutoPtr<ISampler> pSamplers[2];
IDeviceObject *pSams[2];
diff --git a/Tests/TestApp/src/TestTessellation.cpp b/Tests/TestApp/src/TestTessellation.cpp
index 502a239..fe06c41 100644
--- a/Tests/TestApp/src/TestTessellation.cpp
+++ b/Tests/TestApp/src/TestTessellation.cpp
@@ -45,6 +45,7 @@ void TestTessellation::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceCont
BasicShaderSourceStreamFactory BasicSSSFactory;
CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory;
CreationAttrs.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL;
+ CreationAttrs.UseCombinedTextureSamplers = true;
RefCntAutoPtr<Diligent::IShader> pVS, pHS, pDS, pPS;
{
diff --git a/Tests/TestApp/src/TestTextureCreation.cpp b/Tests/TestApp/src/TestTextureCreation.cpp
index e8d80c3..cfa4afd 100644
--- a/Tests/TestApp/src/TestTextureCreation.cpp
+++ b/Tests/TestApp/src/TestTextureCreation.cpp
@@ -143,9 +143,9 @@ public:
if( m_TextureFormat != TEX_FORMAT_RGB9E5_SHAREDEXP &&
PixelFormatAttribs.ComponentType != COMPONENT_TYPE_COMPRESSED )
{
- if( TexCaps.bTexture2DMSSupported && (BindFlags & (BIND_RENDER_TARGET|BIND_DEPTH_STENCIL)) != 0 )
+ if (TexCaps.bTexture2DMSSupported)
{
- if( PixelFormatAttribs.SampleCounts & 0x04 )
+ if( (PixelFormatAttribs.SampleCounts & 0x04) != 0 && (BindFlags & (BIND_RENDER_TARGET|BIND_DEPTH_STENCIL)) != 0 )
{
CreateTestTexture( RESOURCE_DIM_TEX_2D, 4 );
CreateTestTexture( RESOURCE_DIM_TEX_2D, 4 );
@@ -153,17 +153,12 @@ public:
}
else
{
- static bool FirstTime = true;
- if( FirstTime )
- {
- LOG_WARNING_MESSAGE( "Texture 2D MS is not supported\n" );
- FirstTime = false;
- }
+ LOG_WARNING_MESSAGE_ONCE("Texture 2D MS is not supported\n");
}
- if( TexCaps.bTexture2DMSArraySupported && (BindFlags & (BIND_RENDER_TARGET|BIND_DEPTH_STENCIL)) != 0 )
+ if (TexCaps.bTexture2DMSArraySupported)
{
- if( PixelFormatAttribs.SampleCounts & 0x04 )
+ if( (PixelFormatAttribs.SampleCounts & 0x04) != 0 && (BindFlags & (BIND_RENDER_TARGET|BIND_DEPTH_STENCIL)) != 0)
{
CreateTestTexture( RESOURCE_DIM_TEX_2D_ARRAY, 4 );
CreateTestTexture( RESOURCE_DIM_TEX_2D_ARRAY, 4 );
@@ -171,12 +166,7 @@ public:
}
else
{
- static bool FirstTime = true;
- if( FirstTime )
- {
- LOG_WARNING_MESSAGE( "Texture 2D MS Array is not supported\n" );
- FirstTime = false;
- }
+ LOG_WARNING_MESSAGE_ONCE( "Texture 2D MS Array is not supported\n" );
}
}
@@ -301,6 +291,12 @@ private:
const auto &DeviceCaps = m_pDevice->GetDeviceCaps();
const auto &TextureCaps = DeviceCaps.TexCaps;
+
+ if (!TextureCaps.bTextureViewSupported)
+ {
+ LOG_WARNING_MESSAGE_ONCE("Texture views are not supported!\n");
+ }
+
if (TextureCaps.bTextureViewSupported && !m_pDevice->GetTextureFormatInfo(TexDesc.Format).IsTypeless)
{
TextureViewDesc ViewDesc;
@@ -374,16 +370,7 @@ private:
pTestTex->CreateView( ViewDesc, &pUAV );
}
}
- else
- {
- static bool FirstTime = true;
- if( FirstTime )
- {
- LOG_WARNING_MESSAGE("Texture views are not supported!\n");
- FirstTime = false;
- }
- }
-
+
// It is necessary to call Flush() to force the driver to release the resources.
// Without flushing the command buffer, the memory is not released until sometimes
// later causing out-of-memory error
diff --git a/Tests/TestApp/src/TestTexturing.cpp b/Tests/TestApp/src/TestTexturing.cpp
index fdd79b8..ccbb0c6 100644
--- a/Tests/TestApp/src/TestTexturing.cpp
+++ b/Tests/TestApp/src/TestTexturing.cpp
@@ -170,6 +170,7 @@ void TestTexturing::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceContext
BasicShaderSourceStreamFactory BasicSSSFactory;
CreationAttrs.pShaderSourceStreamFactory = &BasicSSSFactory;
CreationAttrs.Desc.TargetProfile = bUseGLSL ? SHADER_PROFILE_GL_4_2 : SHADER_PROFILE_DX_5_0;
+ CreationAttrs.UseCombinedTextureSamplers = true;
RefCntAutoPtr<Diligent::IShader> pVS, pPS;
{
@@ -196,7 +197,7 @@ void TestTexturing::Init( IRenderDevice *pDevice, IDeviceContext *pDeviceContext
StaticSampler.Desc.MinFilter = FilterType;
StaticSampler.Desc.MagFilter = FilterType;
StaticSampler.Desc.MipFilter = FilterType;
- StaticSampler.TextureName = "g_tex2DTest";
+ StaticSampler.SamplerOrTextureName = "g_tex2DTest";
CreationAttrs.Desc.NumStaticSamplers = 1;
CreationAttrs.Desc.StaticSamplers = &StaticSampler;
m_pRenderDevice->CreateShader( CreationAttrs, &pPS );