From 20234cfe3a204eda5abb4ed757ae775e82619ba7 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Fri, 3 Mar 2017 16:59:48 +1100 Subject: st/mesa: don't propagate uniforms when restoring from cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We will have already loaded the uniforms when the parameter list was restored from cache. Reviewed-by: Marek Olšák --- src/mesa/program/ir_to_mesa.cpp | 14 +++++++++----- src/mesa/program/ir_to_mesa.h | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src/mesa/program') diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index a4f61ac23ef..3898cb8d09a 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2532,7 +2532,8 @@ _mesa_generate_parameters_list_for_uniforms(struct gl_shader_program void _mesa_associate_uniform_storage(struct gl_context *ctx, struct gl_shader_program *shader_program, - struct gl_program_parameter_list *params) + struct gl_program_parameter_list *params, + bool propagate_to_storage) { /* After adding each uniform to the parameter list, connect the storage for * the parameter with the tracking structure used by the API for the @@ -2622,9 +2623,11 @@ _mesa_associate_uniform_storage(struct gl_context *ctx, * data from the linker's backing store. This will cause values from * initializers in the source code to be copied over. */ - _mesa_propagate_uniforms_to_driver_storage(storage, - 0, - MAX2(1, storage->array_elements)); + if (propagate_to_storage) { + unsigned array_elements = MAX2(1, storage->array_elements); + _mesa_propagate_uniforms_to_driver_storage(storage, 0, + array_elements); + } last_location = location; } @@ -2984,7 +2987,8 @@ get_mesa_program(struct gl_context *ctx, * prog->ParameterValues to get reallocated (e.g., anything that adds a * program constant) has to happen before creating this linkage. */ - _mesa_associate_uniform_storage(ctx, shader_program, prog->Parameters); + _mesa_associate_uniform_storage(ctx, shader_program, prog->Parameters, + true); if (!shader_program->data->LinkStatus) { goto fail_exit; } diff --git a/src/mesa/program/ir_to_mesa.h b/src/mesa/program/ir_to_mesa.h index be45ba0ebca..c46d090b774 100644 --- a/src/mesa/program/ir_to_mesa.h +++ b/src/mesa/program/ir_to_mesa.h @@ -45,7 +45,8 @@ _mesa_generate_parameters_list_for_uniforms(struct gl_shader_program void _mesa_associate_uniform_storage(struct gl_context *ctx, struct gl_shader_program *shader_program, - struct gl_program_parameter_list *params); + struct gl_program_parameter_list *params, + bool propagate_to_storage); #ifdef __cplusplus } -- cgit v1.2.3