summaryrefslogtreecommitdiff
path: root/src/mesa/shader
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-06-29 10:02:36 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-06-29 11:00:58 -0700
commit153eca98064252be4daad9cc27746f37c245b627 (patch)
tree030c1d229eb054758986d25500aa0835f797f867 /src/mesa/shader
parent59a23d7fb93603b2449db4c5d786934a07aebfcb (diff)
glsl2: Invoke preprocessor before calling the compiler proper
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/ir_to_mesa.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp
index 24b03e1be1..1232bada27 100644
--- a/src/mesa/shader/ir_to_mesa.cpp
+++ b/src/mesa/shader/ir_to_mesa.cpp
@@ -1526,9 +1526,17 @@ _mesa_get_glsl_shader(GLcontext *ctx, void *mem_ctx, struct gl_shader *sh)
state->loop_or_switch_nesting = NULL;
state->ARB_texture_rectangle_enable = true;
- _mesa_glsl_lexer_ctor(state, shader->Source);
- _mesa_glsl_parse(state);
- _mesa_glsl_lexer_dtor(state);
+ /* Create a new context for the preprocessor output. Ultimately, this
+ * should probably be the parser context, but there isn't one yet.
+ */
+ const char *source = shader->Source;
+ state->error = preprocess(shader, &source, &state->info_log);
+
+ if (!state->error) {
+ _mesa_glsl_lexer_ctor(state, source);
+ _mesa_glsl_parse(state);
+ _mesa_glsl_lexer_dtor(state);
+ }
shader->ir.make_empty();
if (!state->error && !state->translation_unit.is_empty())