/* Flag states used by both new and old shaders to unbind shader resources
* properly when transitioning to shaders that don't use them.
*/
- if (unlikely(new_vp != &old_vp->Base)) {
+ if (unlikely(new_vp != (old_vp ? &old_vp->Base : NULL))) {
if (old_vp)
dirty |= old_vp->affected_states;
if (new_vp)
struct gl_program *last_prim_shader = new_gp ? new_gp :
new_tep ? new_tep : new_vp;
if (last_prim_shader &&
- last_prim_shader->info.outputs_written & VARYING_BIT_VIEWPORT)
+ last_prim_shader->info.outputs_written & (
+ VARYING_BIT_VIEWPORT | VARYING_BIT_VIEWPORT_MASK))
num_viewports = ctx->Const.MaxViewports;
if (st->state.num_viewports != num_viewports) {
* Inactive states are shader states not used by shaders at the moment.
*/
st->dirty |= ctx->NewDriverState & st->active_states & ST_ALL_STATES_MASK;
- ctx->NewDriverState = 0;
+ ctx->NewDriverState &= ~st->dirty;
/* Get pipeline state. */
switch (pipeline) {