summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2017-10-30 11:16:48 -0700
committerTimothy Arceri <[email protected]>2017-12-08 16:44:35 +1100
commit7cf1037d5af015912e84cd52a992be80f4f6092c (patch)
treedc79550f7215fd2840aa791bdd90a2e4c71d727e /src/mesa
parentebd9e789c40190862b28bbde8852c0b8b09df5ba (diff)
main, glsl: Add UniformDataDefaults which stores uniform defaults
The ARB_get_program_binary extension requires that uniform values in a program be restored to their initial value just after linking. This patch saves off the initial values just after linking. When the program is restored by glProgramBinary, we can use this to copy the initial value of uniforms into UniformDataSlots. V2 (Timothy Arceri): - Store UniformDataDefaults only when serializing GLSL as this is what we want for both disk cache and ARB_get_program_binary. This saves us having to come back later and reset the Uniforms on program binary restores. Signed-off-by: Timothy Arceri <[email protected]> Signed-off-by: Jordan Justen <[email protected]> (v1) Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/mtypes.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 397b113dfbc..40f70b067e8 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2886,6 +2886,17 @@ struct gl_shader_program_data
unsigned NumUniformDataSlots;
union gl_constant_value *UniformDataSlots;
+ /* Used to hold initial uniform values for program binary restores.
+ *
+ * From the ARB_get_program_binary spec:
+ *
+ * "A successful call to ProgramBinary will reset all uniform
+ * variables to their initial values. The initial value is either
+ * the value of the variable's initializer as specified in the
+ * original shader source, or 0 if no initializer was present.
+ */
+ union gl_constant_value *UniformDataDefaults;
+
GLboolean Validated;
/** List of all active resources after linking. */