From e7a31373c9f854c4c9fb4ad54610793c33a184d9 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Wed, 25 Sep 2024 01:50:31 +0100 Subject: [PATCH 1/3] Partially fix inventory doll when non-compute-shader ripples are used with FFP --- apps/openmw/mwrender/ripples.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwrender/ripples.cpp b/apps/openmw/mwrender/ripples.cpp index d9c1b41737..08a96d4b1b 100644 --- a/apps/openmw/mwrender/ripples.cpp +++ b/apps/openmw/mwrender/ripples.cpp @@ -206,7 +206,7 @@ namespace MWRender }; // PASS: Blot in all ripple spawners - mProgramBlobber->apply(state); + state.applyAttribute(mProgramBlobber); state.apply(frameState.mStateset); if (mUseCompute) @@ -225,7 +225,7 @@ namespace MWRender } // PASS: Wave simulation - mProgramSimulation->apply(state); + state.applyAttribute(mProgramSimulation); state.apply(frameState.mStateset); if (mUseCompute) From 95a1183ad36c8547f904c65eedee933192c8fcfa Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Wed, 25 Sep 2024 16:10:18 +0100 Subject: [PATCH 2/3] Fix OpenGL debug groups --- components/debug/gldebug.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From bd8386459a843bd7260cf382305a601a1e06240d Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Wed, 25 Sep 2024 16:14:19 +0100 Subject: [PATCH 3/3] Fix inventory doll when ripple fragment shader path is used Basically don't abuse OSG as badly. We need to let it know we've bound a shader program so it doesn't assume the FFP is still used, but it doesn't have a built-in way to apply the uniforms when doing so, so we need to do it manually. --- apps/openmw/mwrender/ripples.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwrender/ripples.cpp b/apps/openmw/mwrender/ripples.cpp index 08a96d4b1b..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 + state.pushStateSet(frameState.mStateset); + state.apply(); state.applyAttribute(mProgramBlobber); - state.apply(frameState.mStateset); + for (const auto& [name, stack] : state.getUniformMap()) + { + if (!stack.uniformVec.empty()) + state.getLastAppliedProgramObject()->apply(*(stack.uniformVec.back().first)); + } if (mUseCompute) { @@ -226,7 +232,11 @@ namespace MWRender // PASS: Wave simulation state.applyAttribute(mProgramSimulation); - state.apply(frameState.mStateset); + 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