st/mesa: set compressed_data to NULL when freed
[mesa.git] / src / mesa / state_tracker / st_atom.c
index 11c8e91ce9fb66b112f97e529fde608ce21b9220..181134a2207f9b5bec274431c64ee662b72f036d 100644 (file)
@@ -84,7 +84,7 @@ static void check_program_state( struct st_context *st )
    /* 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)
@@ -125,7 +125,8 @@ static void check_program_state( struct st_context *st )
    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) {
@@ -180,7 +181,7 @@ void st_validate_state( struct st_context *st, enum st_pipeline pipeline )
     * 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) {