diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-10-14 13:28:42 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-10-14 17:16:59 -0700 |
commit | 3322fbaf3b5e305ce00c1d08c26965bb98e0cef0 (patch) | |
tree | 30aba427f916748177148fb74e495619c527e8a6 /src/mesa/program | |
parent | 4b4284c9c9b472f750663352485290c22f8c3921 (diff) |
glsl: Slightly change the semantic of _LinkedShaders
Previously _LinkedShaders was a compact array of the linked shaders
for each shader stage. Now it is arranged such that each slot,
indexed by the MESA_SHADER_* defines, refers to a specific shader
stage. As a result, some slots will be NULL. This makes things a
little more complex in the linker, but it simplifies things in other
places.
As a side effect _NumLinkedShaders is removed.
NOTE: This may be a candidate for the 7.9 branch. If there are other
patches that get backported to 7.9 that use _LinkedShader, this patch
should be cherry picked also.
Diffstat (limited to 'src/mesa/program')
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 524130ca59..bdd3fd92ff 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2238,8 +2238,12 @@ set_uniform_initializers(struct gl_context *ctx, { void *mem_ctx = NULL; - for (unsigned int i = 0; i < shader_program->_NumLinkedShaders; i++) { + for (unsigned int i = 0; i < MESA_SHADER_TYPES; i++) { struct gl_shader *shader = shader_program->_LinkedShaders[i]; + + if (shader == NULL) + continue; + foreach_iter(exec_list_iterator, iter, *shader->ir) { ir_instruction *ir = (ir_instruction *)iter.get(); ir_variable *var = ir->as_variable(); @@ -2467,7 +2471,10 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) { assert(prog->LinkStatus); - for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) { + if (prog->_LinkedShaders[i] == NULL) + continue; + bool progress; exec_list *ir = prog->_LinkedShaders[i]->ir; const struct gl_shader_compiler_options *options = @@ -2511,10 +2518,13 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) validate_ir_tree(ir); } - for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) { struct gl_program *linked_prog; bool ok = true; + if (prog->_LinkedShaders[i] == NULL) + continue; + linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]); switch (prog->_LinkedShaders[i]->Type) { |