summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2013-11-23 12:11:34 -0800
committerKenneth Graunke <[email protected]>2013-12-01 15:33:04 -0800
commit5b331f6fcbf226f18e0c517ffdce30a39bb92982 (patch)
tree213e292ef49855ba3165f281d2ccc40c56f82126 /src/mesa/main
parent1b557b1606ffcf05d2612d66226306e876b6b937 (diff)
glsl: Simplify the built-in function linking code.
Previously, we stored an array of up to 16 additional shaders to link, as well as a count of how many each shader actually needed. Since the built-in functions rewrite, all the built-ins are stored in a single shader. So all we need is a boolean indicating whether a shader needs to link against built-ins or not. During linking, we can avoid creating the temporary array if none of the shaders being linked need built-ins. Otherwise, it's simply a copy of the array that has one additional element. This is much simpler. This patch saves approximately 128 bytes of memory per gl_shader object. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/ff_fragment_shader.cpp2
-rw-r--r--src/mesa/main/mtypes.h4
2 files changed, 2 insertions, 4 deletions
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 01edd3ff8af..0d75702835e 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -1344,7 +1344,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
p.shader->CompileStatus = true;
p.shader->Version = state->language_version;
- p.shader->num_builtins_to_link = state->num_builtins_to_link;
+ p.shader->uses_builtin_functions = state->uses_builtin_functions;
p.shader_program->Shaders =
(gl_shader **)malloc(sizeof(*p.shader_program->Shaders));
p.shader_program->Shaders[0] = p.shader;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index b4b432f4023..05fb3d59f0b 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2352,9 +2352,7 @@ struct gl_shader
struct exec_list *ir;
struct glsl_symbol_table *symbols;
- /** Shaders containing built-in functions that are used for linking. */
- struct gl_shader *builtins_to_link[16];
- unsigned num_builtins_to_link;
+ bool uses_builtin_functions;
/**
* Geometry shader state from GLSL 1.50 layout qualifiers.