mirror of https://github.com/AxioDL/metaforce.git
GLSL generation fixes
This commit is contained in:
parent
d43087247f
commit
e17d5c0b83
|
@ -1 +1 @@
|
|||
Subproject commit 6c12cd0ce83e23dcc90ebcb1f89e2feb30a16353
|
||||
Subproject commit 758be7d76cc6fac9fddab6c075dd6bd5f79c0ace
|
|
@ -72,11 +72,21 @@ private:
|
|||
return hecl::Format("sampling%u.a", samplingIdx);
|
||||
}
|
||||
|
||||
virtual std::string EmitColorRegUse(unsigned idx) const
|
||||
virtual std::string EmitColorRegUseRaw(unsigned idx) const
|
||||
{
|
||||
return hecl::Format("colorReg%u", idx);
|
||||
}
|
||||
|
||||
virtual std::string EmitColorRegUseRGB(unsigned idx) const
|
||||
{
|
||||
return hecl::Format("colorReg%u.rgb", idx);
|
||||
}
|
||||
|
||||
virtual std::string EmitColorRegUseAlpha(unsigned idx) const
|
||||
{
|
||||
return hecl::Format("colorReg%u.a", idx);
|
||||
}
|
||||
|
||||
std::string EmitLightingRaw() const
|
||||
{
|
||||
return std::string("lighting");
|
||||
|
|
|
@ -195,12 +195,10 @@ std::string GLSL::makeFrag(const char* glslVer, bool alphaTest,
|
|||
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";
|
||||
lightingSrc = "const vec4 colorReg0 = vec4(1.0);\n"
|
||||
"const vec4 colorReg1 = vec4(1.0);\n"
|
||||
"const vec4 colorReg2 = vec4(1.0);\n"
|
||||
"\n";
|
||||
|
||||
std::string texMapDecl;
|
||||
for (unsigned i=0 ; i<m_texMapEnd ; ++i)
|
||||
|
@ -250,12 +248,10 @@ std::string GLSL::makeFrag(const char* glslVer, bool alphaTest,
|
|||
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";
|
||||
lightingSrc = "const vec4 colorReg0 = vec4(1.0);\n"
|
||||
"const vec4 colorReg1 = vec4(1.0);\n"
|
||||
"const vec4 colorReg2 = vec4(1.0);\n"
|
||||
"\n";
|
||||
|
||||
std::string postSrc;
|
||||
if (post.m_source)
|
||||
|
|
|
@ -104,7 +104,7 @@ std::string ProgrammableCommon::RecursiveTraceColor(const IR& ir, Diagnostics& d
|
|||
{
|
||||
const IR::Instruction& idxInst = inst.getChildInst(ir, 0);
|
||||
unsigned idx = unsigned(idxInst.getImmVec().vec[0]);
|
||||
return EmitColorRegUse(idx);
|
||||
return toSwizzle ? EmitColorRegUseRaw(idx) : EmitColorRegUseRGB(idx);
|
||||
}
|
||||
else if (!name.compare("Lighting"))
|
||||
{
|
||||
|
@ -191,7 +191,7 @@ std::string ProgrammableCommon::RecursiveTraceAlpha(const IR& ir, Diagnostics& d
|
|||
{
|
||||
const IR::Instruction& idxInst = inst.getChildInst(ir, 0);
|
||||
unsigned idx = unsigned(idxInst.getImmVec().vec[0]);
|
||||
return EmitColorRegUse(idx);
|
||||
return EmitColorRegUseAlpha(idx);
|
||||
}
|
||||
else if (!name.compare("Lighting"))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue