[Mesa-dev] [PATCH 16/27] i965: don't rebuild param list after cache miss
Jordan Justen
jordan.l.justen at intel.com
Sat Aug 19 07:44:32 UTC 2017
From: Timothy Arceri <timothy.arceri at collabora.com>
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 | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index 9c5b9ae310..f14b87fd56 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -224,10 +224,13 @@ 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);
+ if (!shProg->data->cache_fallback) {
+ prog->Parameters = _mesa_new_parameter_list();
+ }
+
_mesa_copy_linked_program_data(shProg, shader);
prog->ShadowSamplers = shader->shadow_samplers;
@@ -256,14 +259,16 @@ 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.
*/
- nir_foreach_variable(var, &prog->nir->uniforms) {
- if (strncmp(var->name, "gl_", 3) == 0) {
- const nir_state_slot *const slots = var->state_slots;
- assert(var->state_slots != NULL);
-
- for (unsigned int i = 0; i < var->num_state_slots; i++) {
- _mesa_add_state_reference(prog->Parameters,
- (gl_state_index *)slots[i].tokens);
+ if (!shProg->data->cache_fallback) {
+ nir_foreach_variable(var, &prog->nir->uniforms) {
+ if (strncmp(var->name, "gl_", 3) == 0) {
+ const nir_state_slot *const slots = var->state_slots;
+ assert(var->state_slots != NULL);
+
+ for (unsigned int i = 0; i < var->num_state_slots; i++) {
+ _mesa_add_state_reference(prog->Parameters,
+ (gl_state_index *)slots[i].tokens);
+ }
}
}
}
--
2.14.0
More information about the mesa-dev
mailing list