diff --git a/apps/openmw/mwrender/ripples.cpp b/apps/openmw/mwrender/ripples.cpp index d9c1b41737..bb8248217a 100644 --- a/apps/openmw/mwrender/ripples.cpp +++ b/apps/openmw/mwrender/ripples.cpp @@ -206,8 +206,14 @@ namespace MWRender }; // PASS: Blot in all ripple spawners - mProgramBlobber->apply(state); - state.apply(frameState.mStateset); + state.pushStateSet(frameState.mStateset); + state.apply(); + state.applyAttribute(mProgramBlobber); + for (const auto& [name, stack] : state.getUniformMap()) + { + if (!stack.uniformVec.empty()) + state.getLastAppliedProgramObject()->apply(*(stack.uniformVec.back().first)); + } if (mUseCompute) { @@ -225,8 +231,12 @@ namespace MWRender } // PASS: Wave simulation - mProgramSimulation->apply(state); - state.apply(frameState.mStateset); + state.applyAttribute(mProgramSimulation); + for (const auto& [name, stack] : state.getUniformMap()) + { + if (!stack.uniformVec.empty()) + state.getLastAppliedProgramObject()->apply(*(stack.uniformVec.back().first)); + } if (mUseCompute) { @@ -242,6 +252,8 @@ namespace MWRender state.applyTextureAttribute(0, mTextures[1]); osg::Geometry::drawImplementation(renderInfo); } + + state.popStateSet(); } osg::Texture* RipplesSurface::getColorTexture() const diff --git a/components/debug/gldebug.cpp b/components/debug/gldebug.cpp index 29036af162..482755b761 100644 --- a/components/debug/gldebug.cpp +++ b/components/debug/gldebug.cpp @@ -239,7 +239,7 @@ namespace Debug group->push(state); lastAppliedStack.push_back(group); } - if (!(lastAppliedStack.back() == this)) + if (lastAppliedStack.empty() || !(lastAppliedStack.back() == this)) { push(state); lastAppliedStack.push_back(this);