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

Jordan Justen jordan.l.justen at intel.com
Sat Aug 19 07:44:30 UTC 2017


From: Timothy Arceri <timothy.arceri at collabora.com>

---
 src/mesa/drivers/dri/i965/brw_disk_cache.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_disk_cache.c b/src/mesa/drivers/dri/i965/brw_disk_cache.c
index 4a6f3f340e..793f946af2 100644
--- a/src/mesa/drivers/dri/i965/brw_disk_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_disk_cache.c
@@ -162,7 +162,30 @@ load_program_data(struct gl_program *glprog, struct blob_reader *binary,
                                          nr_pull_params);
 
    for (unsigned i = 0; i < nr_pull_params; i++) {
-      /* FIXME: We need to fixup pull_params pointers here. */
+      uint64_t pull_param = blob_read_uint64(binary);
+      struct gl_program_parameter_list *param_list = glprog->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 < glprog->sh.data->NumUniformDataSlots) {
+         prog_data->pull_param[i] =
+            glprog->sh.data->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;
+      }
    }
 }
 
@@ -431,6 +454,10 @@ write_program_data(struct brw_context *brw, struct gl_program *prog,
    }
 
    blob_write_uint32(binary, prog_data->nr_pull_params);
+   for (unsigned i = 0; i < prog_data->nr_pull_params; i++) {
+      blob_write_uint64(binary,
+                        ptr_to_uint64_t((void *) prog_data->pull_param[i]));
+   }
 
    _mesa_sha1_format(buf, sha1);
    if (brw->ctx._Shader->Flags & GLSL_CACHE_INFO) {
-- 
2.14.0



More information about the mesa-dev mailing list