Default colorRegs when lighting uniform not available

This commit is contained in:
Jack Andersen 2016-07-31 20:35:35 -10:00
parent 7e42581cf0
commit b7143c7dca
2 changed files with 28 additions and 0 deletions

View File

@ -194,6 +194,13 @@ std::string GLSL::makeFrag(const char* glslVer, bool alphaTest,
std::string lightingSrc;
if (lighting.m_source)
lightingSrc = lighting.m_source;
else
lightingSrc = "UBINDING2 uniform LightingUniform\n"
"{\n"
" vec4 colorReg0;\n"
" vec4 colorReg1;\n"
" vec4 colorReg2;\n"
"};\n";
std::string texMapDecl;
for (unsigned i=0 ; i<m_texMapEnd ; ++i)
@ -242,6 +249,13 @@ std::string GLSL::makeFrag(const char* glslVer, bool alphaTest,
std::string lightingSrc;
if (lighting.m_source)
lightingSrc = lighting.m_source;
else
lightingSrc = "UBINDING2 uniform LightingUniform\n"
"{\n"
" vec4 colorReg0;\n"
" vec4 colorReg1;\n"
" vec4 colorReg2;\n"
"};\n";
std::string postSrc;
if (post.m_source)

View File

@ -185,6 +185,13 @@ std::string HLSL::makeFrag(bool alphaTest, const ShaderFunction& lighting) const
std::string lightingSrc;
if (lighting.m_source)
lightingSrc = lighting.m_source;
else
lightingSrc = "cbuffer LightingUniform : register(b2)\n"
"{\n"
" float4 colorReg0;\n"
" float4 colorReg1;\n"
" float4 colorReg2;\n"
"};\n";
std::string texMapDecl;
if (m_texMapEnd)
@ -228,6 +235,13 @@ std::string HLSL::makeFrag(bool alphaTest, const ShaderFunction& lighting,
std::string lightingSrc;
if (lighting.m_source)
lightingSrc = lighting.m_source;
else
lightingSrc = "cbuffer LightingUniform : register(b2)\n"
"{\n"
" float4 colorReg0;\n"
" float4 colorReg1;\n"
" float4 colorReg2;\n"
"};\n";
std::string postSrc;
if (post.m_source)