[Mesa-dev] [RFC] i965: Don't consider uniform value locations in program uploads

Topi Pohjolainen topi.pohjolainen at intel.com
Wed Jun 3 11:21:11 PDT 2015


Shader programs are cached per stage (FS, VS, GS) using the
corresponding shader source identifier and compile time choices
as key. However, one not only stores the program binary but
a pair consisting of program binary and program data. The latter
represents the store of constants (such as uniforms) used by
the program.

However, when programs are searched in the cache for reloading
only the program key representing the binary is considered
(see for example, brw_upload_wm_prog() and brw_search_cache()).
Hence, when programs are re-loaded from cache the first program
binary, program data pair is extracted without considering if
the program data matches the currently in use uniform storage
as well.

My reasoning Why this actually works is because the key
contains the identifier of the corresponding gl_program that
represents the source code for the shader program. Hence,
two programs having identical source code still have unique
keys.
And therefore brw_try_upload_using_copy() never encounters
a case where a matching binary is found but the program data
doesn't match.

My ultimate goal is to stop storing pointers to the individual
components of a uniform but to store only a pointer to the
"struct gl_uniform_storage" instead, and allow
gen6_upload_push_constants() to iterate over individual
components and array elements. This is needed to be able to
convert 32-bits floats to fp16 - otherwise there is only
pointer to 32-bits without knowing its type (int, float, etc)
let alone its target precision.

No regression in jenkins. However, we talked about this with
Ken and this doesn't really tell much as piglit doesn't really
re-use shader sources during one execution.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
CC: Kenneth Graunke <kenneth at whitecape.org>
CC: Tapani P\344lli <tapani.palli at intel.com>
---
 src/mesa/drivers/dri/i965/brw_program.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index e5c0d3c..7f5fde8 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -576,12 +576,6 @@ brw_stage_prog_data_compare(const struct brw_stage_prog_data *a,
    if (memcmp(a, b, offsetof(struct brw_stage_prog_data, param)))
       return false;
 
-   if (memcmp(a->param, b->param, a->nr_params * sizeof(void *)))
-      return false;
-
-   if (memcmp(a->pull_param, b->pull_param, a->nr_pull_params * sizeof(void *)))
-      return false;
-
    return true;
 }
 
-- 
1.9.3



More information about the mesa-dev mailing list