[Mesa-dev] [PATCH 40/56] i965: don't rebuild param list after cache miss
Timothy Arceri
timothy.arceri at collabora.com
Tue Nov 29 03:58:39 UTC 2016
Previously we ended up with the same param list but in a different
location, which will mess up the pointers stored in the new cache
object if all stages were not fully rebuilt e.g. after a fragment
program cache miss.
This also stops the list from being leaked on fallback.
---
src/mesa/drivers/dri/i965/brw_link.cpp | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index 93e38d5..be7c3d9 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -209,7 +209,6 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
continue;
struct gl_program *prog = shader->Program;
- prog->Parameters = _mesa_new_parameter_list();
process_glsl_ir(brw, shProg, shader);
@@ -222,19 +221,22 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
* too late. At that point, the values for the built-in uniforms won't
* get sent to the shader.
*/
- foreach_in_list(ir_instruction, node, shader->ir) {
- ir_variable *var = node->as_variable();
-
- if ((var == NULL) || (var->data.mode != ir_var_uniform)
- || (strncmp(var->name, "gl_", 3) != 0))
- continue;
-
- const ir_state_slot *const slots = var->get_state_slots();
- assert(slots != NULL);
-
- for (unsigned int i = 0; i < var->get_num_state_slots(); i++) {
- _mesa_add_state_reference(prog->Parameters,
- (gl_state_index *) slots[i].tokens);
+ if (!shProg->data->cache_fallback) {
+ prog->Parameters = _mesa_new_parameter_list();
+ foreach_in_list(ir_instruction, node, shader->ir) {
+ ir_variable *var = node->as_variable();
+
+ if ((var == NULL) || (var->data.mode != ir_var_uniform)
+ || (strncmp(var->name, "gl_", 3) != 0))
+ continue;
+
+ const ir_state_slot *const slots = var->get_state_slots();
+ assert(slots != NULL);
+
+ for (unsigned int i = 0; i < var->get_num_state_slots(); i++) {
+ _mesa_add_state_reference(prog->Parameters,
+ (gl_state_index *) slots[i].tokens);
+ }
}
}
--
2.7.4
More information about the mesa-dev
mailing list