summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/slang_compile.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-05-14 16:09:46 -0600
committerBrian Paul <[email protected]>2008-05-14 16:09:46 -0600
commitade508312c701ce89d3c2cd717994dbbabb4f207 (patch)
tree7c7a35935143d90c99820025a8887c5606041db6 /src/mesa/shader/slang/slang_compile.c
parentc807c1a23fc918591e9d2f6f26c4e071a725bced (diff)
Updated GLSL uniform/sampler handling from gallium-0.1 branch
Previously, the shader linker combined the uniforms used by the vertex and fragment shaders into a combined set of uniforms. This made the implementation of glUniform*() simple, but was rather inefficient otherwise. Now each shader gets its own set of uniforms (no more modelview matrix showing up in the fragment shader uniforms, for example). cherry-picked by hand from gallium-0.1 branch
Diffstat (limited to 'src/mesa/shader/slang/slang_compile.c')
-rw-r--r--src/mesa/shader/slang/slang_compile.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index 2be89a5ce05..1449888f9f8 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -31,6 +31,8 @@
#include "main/imports.h"
#include "main/context.h"
#include "shader/program.h"
+#include "shader/programopt.h"
+#include "shader/prog_print.h"
#include "shader/prog_parameter.h"
#include "shader/grammar/grammar_mesa.h"
#include "slang_codegen.h"
@@ -1618,6 +1620,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
A.program = O->program;
A.vartable = O->vartable;
A.curFuncEndLabel = NULL;
+ A.numSamplers = 0;
if (!_slang_codegen_global_variable(&A, var, C->type))
return 0;
}
@@ -1640,6 +1643,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
A.space.funcs = O->funs;
A.space.structs = O->structs;
A.space.vars = O->vars;
+ A.numSamplers = 0;
if (!initialize_global(&A, var))
return 0;
}
@@ -1773,6 +1777,7 @@ parse_function(slang_parse_ctx * C, slang_output_ctx * O, int definition,
A.program = O->program;
A.vartable = O->vartable;
A.log = C->L;
+ A.numSamplers = 0;
_slang_codegen_function(&A, *parsed_func_ret);
}
@@ -2180,6 +2185,19 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
_slang_delete_mempool((slang_mempool *) ctx->Shader.MemPool);
ctx->Shader.MemPool = NULL;
+ if (shader->Type == GL_VERTEX_SHADER) {
+ /* remove any reads of varying (output) registers */
+#if 0
+ printf("Pre-remove output reads:\n");
+ _mesa_print_program(shader->Programs[0]);
+#endif
+ _mesa_remove_varying_reads(shader->Programs[0]);
+#if 0
+ printf("Post-remove output reads:\n");
+ _mesa_print_program(shader->Programs[0]);
+#endif
+ }
+
return success;
}