Removed old code that set the BRDF texture and caused a texture profile conflict with the probe array post effect, leading to a crash.

Renamed hasSkylight to mHasSkylight to avoid var ambiguity.
This commit is contained in:
Areloch 2019-05-26 03:13:16 -05:00
parent 0887683925
commit 8196ad9d32
2 changed files with 7 additions and 19 deletions

View file

@ -200,7 +200,7 @@ RenderProbeMgr::RenderProbeMgr()
mLastShader(nullptr),
mLastConstants(nullptr),
mProbesDirty(false),
hasSkylight(false)
mHasSkylight(false)
{
mEffectiveProbeCount = 0;
mMipCount = 0;
@ -450,7 +450,7 @@ void RenderProbeMgr::_setupStaticParameters()
skylightPos = curEntry.getPosition();
skylightPrefilterMap = curEntry.mPrefilterCubemap;
skylightIrradMap = curEntry.mIrradianceCubemap;
hasSkylight = true;
mHasSkylight = true;
continue;
}
@ -590,7 +590,6 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
S8 bestPickProbes[4] = { -1,-1,-1,-1 };
U32 effectiveProbeCount = 0;
bool hasSkylight = false;
for (U32 i = 0; i < probeCount; i++)
{
//if (effectiveProbeCount >= MAX_FORWARD_PROBES)
@ -665,17 +664,6 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
GFX->setCubeArrayTexture(probeShaderConsts->mProbeIrradianceCubemapSC->getSamplerRegister(), mIrradianceArray);
}
if (probeShaderConsts->mBRDFTextureMap->isValid())
{
if (!mBRDFTexture.isValid())
{
//try to fetch it
mBRDFTexture.set("core/art/pbr/brdfTexture.dds", &GFXStaticTextureSRGBProfile, "BRDF Texture");
}
GFX->setTexture(probeShaderConsts->mBRDFTextureMap->getSamplerRegister(), mBRDFTexture.getPointer());
}
//check for skylight action
if (probeShaderConsts->mSkylightIrradMap->isValid()
&& probeShaderConsts->mSkylightSpecularMap->isValid())
@ -763,7 +751,7 @@ void RenderProbeMgr::render( SceneRenderState *state )
_setupStaticParameters();
// Early out if nothing to draw.
if (!RenderProbeMgr::smRenderReflectionProbes || !state->isDiffusePass() || (!ProbeRenderInst::all.size() || mEffectiveProbeCount == 0 || mCubeMapCount != 0 ) && !hasSkylight)
if (!RenderProbeMgr::smRenderReflectionProbes || !state->isDiffusePass() || (!ProbeRenderInst::all.size() || mEffectiveProbeCount == 0 || mCubeMapCount != 0 ) && !mHasSkylight)
{
getProbeArrayEffect()->setSkip(true);
return;
@ -793,8 +781,8 @@ void RenderProbeMgr::render( SceneRenderState *state )
//Array rendering
//U32 probeCount = ProbeRenderInst::all.size();
mProbeArrayEffect->setShaderConst("$hasSkylight", (float)hasSkylight);
if (hasSkylight)
mProbeArrayEffect->setShaderConst("$hasSkylight", (float)mHasSkylight);
if (mHasSkylight)
{
mProbeArrayEffect->setCubemapTexture(6, skylightPrefilterMap);
mProbeArrayEffect->setCubemapTexture(7, skylightIrradMap);

View file

@ -196,7 +196,7 @@ class RenderProbeMgr : public RenderBinManager
Vector<GFXCubemapHandle> cubeMaps;
Vector<GFXCubemapHandle> irradMaps;
bool hasSkylight;
bool mHasSkylight;
GFXCubemapHandle skylightIrradMap;
GFXCubemapHandle skylightPrefilterMap;
Point4F skylightPos;
@ -312,4 +312,4 @@ RenderProbeMgr* RenderProbeMgr::getProbeManager()
#define PROBEMGR RenderProbeMgr::getProbeManager()
#endif // RENDER_PROBE_MGR_H
#endif // RENDER_PROBE_MGR_H