TexGen bug fix with diffuse-only pass

This commit is contained in:
Jack Andersen 2019-02-26 18:50:13 -10:00
parent 8e8ecaf4aa
commit 6626557cc4
3 changed files with 13 additions and 2 deletions

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit f8b22ecb13a7e2bc61e5622b47ac21e50bc78649
Subproject commit 66cf60ea558d62353fb48c753710ff84c948b013

View File

@ -42,6 +42,7 @@ struct ProgrammableCommon : IBackend {
static const char* BlendFactorToDefine(BlendFactor factor, BlendFactor defaultFactor);
private:
void resetResourceAccumulators();
unsigned addTexCoordGen(TexGenSrc src, int uvIdx, int mtx, bool normalize);
unsigned addTexSampling(unsigned mapIdx, unsigned tcgIdx);
std::string RecursiveTraceDiffuseColor(const IR& ir, Diagnostics& diag, const IR::Instruction& inst, bool toSwizzle,

View File

@ -299,6 +299,13 @@ std::string ProgrammableCommon::RecursiveTraceAlpha(const IR& ir, Diagnostics& d
return std::string();
}
void ProgrammableCommon::resetResourceAccumulators() {
m_texSamplings.clear();
m_texMapEnd = 0;
m_tcgs.clear();
m_texMtxRefs.clear();
}
void ProgrammableCommon::reset(const IR& ir, Diagnostics& diag, const char* backendName) {
m_lighting = false;
m_texSamplings.clear();
@ -330,8 +337,11 @@ void ProgrammableCommon::reset(const IR& ir, Diagnostics& diag, const char* back
/* Follow Color Chain */
const IR::Instruction& colorRoot = ir.m_instructions.at(rootCall.m_call.m_argInstIdxs.at(0));
m_diffuseColorExpr = RecursiveTraceDiffuseColor(ir, diag, colorRoot, false, false);
if (m_diffuseColorExpr.empty())
resetResourceAccumulators();
if (m_diffuseColorExpr.empty()) {
m_diffuseColorExpr = RecursiveTraceDiffuseColor(ir, diag, colorRoot, false, true);
resetResourceAccumulators();
}
m_colorExpr = RecursiveTraceColor(ir, diag, colorRoot, false);
/* Follow Alpha Chain */