From c0087704ea69eec2d52d4db891309b362a2c2812 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Thu, 17 May 2018 21:36:46 -0700 Subject: Reworked SPIRVShaderResources: reduced sizeof(SPIRVShaderResourceAttribs) to 32; packing resource names into the string pool --- Graphics/GraphicsEngine/include/ShaderBase.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/ShaderBase.h b/Graphics/GraphicsEngine/include/ShaderBase.h index fb5f132b..2de7a3d5 100644 --- a/Graphics/GraphicsEngine/include/ShaderBase.h +++ b/Graphics/GraphicsEngine/include/ShaderBase.h @@ -92,6 +92,26 @@ inline SHADER_VARIABLE_TYPE GetShaderVariableType(const Char* Name, SHADER_VARIA ); } +inline SHADER_VARIABLE_TYPE GetShaderVariableType(const Char* Name, const ShaderDesc& ShdrDesc) +{ + return GetShaderVariableType(Name, ShdrDesc.DefaultVariableType, ShdrDesc.VariableDesc, ShdrDesc.NumVariables); +} + +inline SHADER_VARIABLE_TYPE GetShaderVariableType(const String& Name, SHADER_VARIABLE_TYPE DefaultVariableType, const ShaderVariableDesc *VariableDesc, Uint32 NumVars) +{ + return GetShaderVariableType(DefaultVariableType, VariableDesc, NumVars, + [&](const char *VarName) + { + return Name.compare(VarName) == 0; + } + ); +} + +inline SHADER_VARIABLE_TYPE GetShaderVariableType(const String& Name, const ShaderDesc& ShdrDesc) +{ + return GetShaderVariableType(Name, ShdrDesc.DefaultVariableType, ShdrDesc.VariableDesc, ShdrDesc.NumVariables); +} + /// Base implementation of a shader variable -- cgit v1.2.3