[Mesa-dev] [PATCH 46/87] i965: add shader cache support for pull param pointers

Timothy Arceri timothy.arceri at collabora.com
Wed Jul 13 02:47:41 UTC 2016


---
 src/mesa/drivers/dri/i965/brw_shader_cache.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_shader_cache.c b/src/mesa/drivers/dri/i965/brw_shader_cache.c
index d37d5e0..19c8b99 100644
--- a/src/mesa/drivers/dri/i965/brw_shader_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_shader_cache.c
@@ -151,7 +151,28 @@ load_program_data(struct gl_shader_program *prog, struct blob_reader *binary,
 
    for (unsigned i = 0; i < nr_pull_params; i++) {
       intptr_t pull_param = blob_read_intptr(binary);
-      /* FIXME: We need to fixup pull_params pointers here. */
+      struct gl_program_parameter_list *param_list =
+         prog->_LinkedShaders[stage]->Program->Parameters;
+
+      ptrdiff_t u_offset =
+         (pull_param - uniform_data_slots_base) / sizeof(gl_constant_value);
+      ptrdiff_t i_offset =
+         (pull_param - image_params_base) / sizeof(gl_constant_value);
+      ptrdiff_t p_offset =
+         (pull_param - parameter_values_base) / sizeof(gl_constant_value);
+
+      if (param_list && p_offset >= 0 &&
+          p_offset < 4 * param_list->NumParameters) {
+         prog_data->pull_param[i] =
+            ((gl_constant_value *) param_list->ParameterValues) + p_offset;
+      } else if (u_offset >= 0 && u_offset < prog->NumUniformDataSlots) {
+         prog_data->pull_param[i] = prog->UniformDataSlots + u_offset;
+      } else if (i_offset >= 0 && i_offset < image_upper_boundary) {
+         prog_data->pull_param[i] =
+            ((gl_constant_value *) prog_data->image_param) + i_offset;
+      } else {
+         prog_data->pull_param[i] = &zero;
+      }
    }
 
 }
-- 
2.7.4



More information about the mesa-dev mailing list