From 8196ad9d32f3ddbcbfd2774a80d294febcd2d7c4 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 26 May 2019 03:13:16 -0500 Subject: [PATCH] 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. --- .../source/renderInstance/renderProbeMgr.cpp | 22 +++++-------------- Engine/source/renderInstance/renderProbeMgr.h | 4 ++-- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/Engine/source/renderInstance/renderProbeMgr.cpp b/Engine/source/renderInstance/renderProbeMgr.cpp index dfe01b332..ebc7b76d7 100644 --- a/Engine/source/renderInstance/renderProbeMgr.cpp +++ b/Engine/source/renderInstance/renderProbeMgr.cpp @@ -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); diff --git a/Engine/source/renderInstance/renderProbeMgr.h b/Engine/source/renderInstance/renderProbeMgr.h index b30d99bce..bdc0af248 100644 --- a/Engine/source/renderInstance/renderProbeMgr.h +++ b/Engine/source/renderInstance/renderProbeMgr.h @@ -196,7 +196,7 @@ class RenderProbeMgr : public RenderBinManager Vector cubeMaps; Vector 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 \ No newline at end of file +#endif // RENDER_PROBE_MGR_H