From 17062f3e3e96412ef8b1a5b68b993767806d6615 Mon Sep 17 00:00:00 2001 From: assiduous Date: Mon, 1 Mar 2021 20:41:41 -0800 Subject: Fixed few issues with run-time sized arrays in D3D12; enabled test. --- Graphics/GraphicsEngineD3DBase/src/ShaderD3DBase.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Graphics/GraphicsEngineD3DBase') diff --git a/Graphics/GraphicsEngineD3DBase/src/ShaderD3DBase.cpp b/Graphics/GraphicsEngineD3DBase/src/ShaderD3DBase.cpp index 345eb9cf..49566626 100644 --- a/Graphics/GraphicsEngineD3DBase/src/ShaderD3DBase.cpp +++ b/Graphics/GraphicsEngineD3DBase/src/ShaderD3DBase.cpp @@ -29,6 +29,9 @@ #include #include +#ifndef NOMINMAX +# define NOMINMAX +#endif #include #include @@ -40,6 +43,7 @@ #include "ShaderD3DBase.hpp" #include "DXCompiler.hpp" #include "HLSLUtils.hpp" +#include "BasicMath.hpp" namespace Diligent { @@ -105,6 +109,21 @@ static HRESULT CompileShader(const char* Source, // dwShaderFlags |= D3D10_SHADER_OPTIMIZATION_LEVEL3; #endif + for (auto CompileFlags = ShaderCI.CompileFlags; CompileFlags != SHADER_COMPILE_FLAG_NONE;) + { + auto Flag = ExtractLSB(CompileFlags); + static_assert(SHADER_COMPILE_FLAG_LAST == 1, "Please updated the switch below to handle the new shader flag"); + switch (Flag) + { + case SHADER_COMPILE_FLAG_ENABLE_UNBOUNDED_ARRAYS: + dwShaderFlags |= D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES; + break; + + default: + UNEXPECTED("Unexpected shader compile flag"); + } + } + D3DIncludeImpl IncludeImpl{ShaderCI.pShaderSourceStreamFactory}; return D3DCompile(Source, SourceLength, NULL, nullptr, &IncludeImpl, ShaderCI.EntryPoint, profile, dwShaderFlags, 0, ppBlobOut, ppCompilerOutput); } -- cgit v1.2.3