[Mesa-dev] [PATCH 42/77] i965: add shader cache support for pull param pointers
Timothy Arceri
timothy.arceri at collabora.com
Mon Oct 3 06:05:01 UTC 2016
---
src/mesa/drivers/dri/i965/brw_shader_cache.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 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 a3dc2a3..0452641 100644
--- a/src/mesa/drivers/dri/i965/brw_shader_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_shader_cache.c
@@ -149,7 +149,29 @@ load_program_data(struct gl_shader_program *prog, 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 =
+ 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;
+ }
}
}
@@ -352,6 +374,10 @@ write_program_data(struct brw_context *brw, struct gl_shader_program *prog,
}
blob_write_uint32(binary, stage_prog_data->nr_pull_params);
+ for (unsigned i = 0; i < stage_prog_data->nr_pull_params; i++) {
+ blob_write_uint64(binary,
+ ptr_to_uint64_t((void *) stage_prog_data->pull_param[i]));
+ }
if (brw->ctx._Shader->Flags & GLSL_CACHE_INFO) {
fprintf(stderr, "putting binary in cache: %s\n",
--
2.7.4
More information about the mesa-dev
mailing list