Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
tomspilman opened this Issue · 5 comments

2 participants

@tomspilman
Owner

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."

http://monogame.codeplex.com/discussions/396601

@renaudbedard

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) 
    continue;

It works as expected.

@renaudbedard

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.

@tomspilman
Owner

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

#780

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

@renaudbedard

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

@tomspilman tomspilman was assigned
@tomspilman
Owner

This should be fixed or is part of #780

@tomspilman tomspilman closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.