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

View file

@ -196,7 +196,7 @@ class RenderProbeMgr : public RenderBinManager
Vector<GFXCubemapHandle> cubeMaps; Vector<GFXCubemapHandle> cubeMaps;
Vector<GFXCubemapHandle> irradMaps; Vector<GFXCubemapHandle> irradMaps;
bool hasSkylight; bool mHasSkylight;
GFXCubemapHandle skylightIrradMap; GFXCubemapHandle skylightIrradMap;
GFXCubemapHandle skylightPrefilterMap; GFXCubemapHandle skylightPrefilterMap;
Point4F skylightPos; Point4F skylightPos;