Same EffectParameter In VS and PS Doesn't Update #802

tomspilman opened this Issue Sep 24, 2012 · 5 comments


None yet

2 participants

MonoGame member

From codeplex...

"If I have an effect parameter that's used both in the Vertex Shader and the Pixel Shader, it goes in two constant buffers, but when it's set in the first buffer (probably the VS one) the dirty flag goes away and it's never updated in the PS's buffer."


I'm stepping through code right now and it's not obvious to find the real culprit... it looks like the StateKey gets tested properly, so the issue is happening deeper down..?

However I can confirm that it's caching/dirty-flagging related, and I've only seen it happen with a parameter that's both used in a VS and PS of the same shader.
If I comment out this in ConstantBuffer.Update() :

if (param.StateKey < _stateKey) 

It works as expected.


Okay, turns out the problem is unrelated to what I thought it was, but it's still a bug.

I have two clones of an Effect. This means they share the same fragment program OpenGL object, but not the same constant buffers.
The two clones set the same variable to different values once at init-time, and never change it again.
On the first Apply, each effects updates the uniform with the value from their constant buffer.
On subsequent Apply's, since there's nothing to update, both effects are stuck with whichever effect was updated last.

MonoGame member

Ah... then it is the same as this bug:


... i'll be working on these bugs this week and clearing off these tickets.


Indeed :)
Cool, I'll work around it for the moment. Thanks!

@tomspilman tomspilman was assigned Oct 15, 2012
MonoGame member

This should be fixed or is part of #780

@tomspilman tomspilman closed this Jan 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment