st/mesa: initialize affected_states and uniform storage earlier in deserialize
authorMarek Olšák <marek.olsak@amd.com>
Sat, 2 Nov 2019 02:09:23 +0000 (22:09 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 19 Nov 2019 23:02:06 +0000 (18:02 -0500)
This matches the uncached codepath.

affected_states was used before initialization, which was technically
a bug, but probably not reproducible due to _NEW_PROGRAM rebinding
everything.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
src/mesa/state_tracker/st_shader_cache.c

index 1d544470a9434560db782cb83685798c21b4916f..5cd969f3fe55504dc011a8cdc252c3154b801e6d 100644 (file)
@@ -182,6 +182,9 @@ st_deserialise_ir_program(struct gl_context *ctx,
    const struct nir_shader_compiler_options *options =
       ctx->Const.ShaderCompilerOptions[prog->info.stage].NirOptions;
 
+   st_set_prog_affected_state_flags(prog);
+   _mesa_associate_uniform_storage(ctx, shProg, prog);
+
    assert(prog->driver_cache_blob && prog->driver_cache_blob_size > 0);
 
    struct blob_reader blob_reader;
@@ -267,9 +270,6 @@ st_deserialise_ir_program(struct gl_context *ctx,
       }
    }
 
-   st_set_prog_affected_state_flags(prog);
-   _mesa_associate_uniform_storage(ctx, shProg, prog);
-
    st_finalize_program(st, prog);
 }