Possible Bug in ShaderStageDX11

Jun 2, 2013 at 4:44 AM
At the bottom of ShaderStageDX11.cpp the CurrentState is overwritten with the DesiredState. When this happens, the CurrentState's sister state property then points at itself. Doesn't this mean that updates will never be required unless a reset is performed before the next set of set calls?
Coordinator
Jun 3, 2013 at 11:05 PM
I believe the key to this is that the desired state is the one that is used to compare against its 'sister'. This is probably a situation where a dedicated method for copying the state would be a better solution, where it could clearly disallow the copying of the sister variable. That would require probably either an assignment operater + copy constructor, or perhaps a dedicated method to copy the state.

I have to admit, I didn't implement it because of the number of classes it would touch - each of the pipeline state objects would need the change. If this seems like something that should get changed, then let's create an issue for it and it will get addressed as time permits. Or if someone has some free cycles to spare, then a patch file would be great too.

Sorry for the confusion!
Jun 3, 2013 at 11:13 PM
I simply changed the bottom of ShaderStageDX11.cpp by adding another two lines:
    // After binding everything, set the current state to the desired state.
    DesiredState.ResetUpdateFlags();
    CurrentState = DesiredState;

    CurrentState.SetSisterState(nullptr);
    DesiredState.SetSisterState(&CurrentState);
The same change was added to the IA, RS, and OM stage classes, too.
This will fix things, no?