diff options
-rw-r--r-- | indra/newview/llreflectionmapmanager.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llreflectionmapmanager.h | 5 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 11 |
3 files changed, 22 insertions, 13 deletions
diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index 5fe510fb56..fb98a2a6d4 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -502,12 +502,10 @@ void LLReflectionMapManager::updateNeighbors(LLReflectionMap* probe) } } -void LLReflectionMapManager::setUniforms() +void LLReflectionMapManager::updateUniforms() { LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; - // TODO -- avoid repacking UBO unnecessarily - // structure for packing uniform buffer object // see class2/deferred/softenLightF.glsl struct ReflectionProbeData @@ -578,7 +576,7 @@ void LLReflectionMapManager::setUniforms() { // out of space break; } - + GLint idx = neighbor->mProbeIndex; if (idx == -1) { @@ -589,7 +587,7 @@ void LLReflectionMapManager::setUniforms() rpd.refNeighbor[ni++] = idx; } } - + if (nc == ni) { //no neighbors, tag as empty @@ -606,8 +604,8 @@ void LLReflectionMapManager::setUniforms() nc += 4 - (nc % 4); } } - - + + count++; } @@ -625,7 +623,14 @@ void LLReflectionMapManager::setUniforms() glBufferDataARB(GL_UNIFORM_BUFFER, sizeof(ReflectionProbeData), &rpd, GL_STREAM_DRAW); glBindBufferARB(GL_UNIFORM_BUFFER, 0); } +} +void LLReflectionMapManager::setUniforms() +{ + if (mUBO == 0) + { + updateUniforms(); + } glBindBufferBase(GL_UNIFORM_BUFFER, 1, mUBO); } diff --git a/indra/newview/llreflectionmapmanager.h b/indra/newview/llreflectionmapmanager.h index 9417fe2416..e3942beaae 100644 --- a/indra/newview/llreflectionmapmanager.h +++ b/indra/newview/llreflectionmapmanager.h @@ -92,7 +92,10 @@ private: // update the neighbors of the given probe void updateNeighbors(LLReflectionMap* probe); - // update UBO used for rendering + // update UBO used for rendering (call only once per render pipe flush) + void updateUniforms(); + + // bind UBO used for rendering void setUniforms(); // render target for cube snapshots diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index b4b70a3e11..6ea519c71b 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4504,11 +4504,6 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera) LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_GEOMETRY); { - // SL-15709 -- NOTE: Tracy only allows one ZoneScoped per function. - // Solutions are: - // 1. Use a new scope - // 2. Use named zones - // 3. Use transient zones LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred pools"); //LL_RECORD_BLOCK_TIME(FTM_DEFERRED_POOLS); LLGLEnable cull(GL_CULL_FACE); @@ -4529,6 +4524,12 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera) LLGLState::checkStates(); LLGLState::checkTextureChannels(); + if (LLViewerShaderMgr::instance()->mShaderLevel[LLViewerShaderMgr::SHADER_DEFERRED] > 1) + { + //update reflection probe uniform + mReflectionMapManager.updateUniforms(); + } + U32 cur_type = 0; gGL.setColorMask(true, true); |