[Mesa-dev] [PATCH 01/10] glsl/lower_clip_distance: Update symbol table.
Paul Berry
stereotype441 at gmail.com
Tue Dec 11 15:09:07 PST 2012
This patch modifies the clip distance lowering pass so that the new
symbol it generates (glClipDistanceMESA) is added to the shader's
symbol table.
This will allow a later patch to modify the linker so that it finds
transform feedback varyings using the symbol table rather than having
to iterate through all the declarations in the shader.
---
src/glsl/ir_optimization.h | 2 +-
src/glsl/linker.cpp | 5 +++--
src/glsl/lower_clip_distance.cpp | 8 ++++++--
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
index 2220d51..628096e 100644
--- a/src/glsl/ir_optimization.h
+++ b/src/glsl/ir_optimization.h
@@ -72,7 +72,7 @@ bool lower_noise(exec_list *instructions);
bool lower_variable_index_to_cond_assign(exec_list *instructions,
bool lower_input, bool lower_output, bool lower_temp, bool lower_uniform);
bool lower_quadop_vector(exec_list *instructions, bool dont_lower_swz);
-bool lower_clip_distance(exec_list *instructions);
+bool lower_clip_distance(gl_shader *shader);
void lower_output_reads(exec_list *instructions);
void lower_ubo_reference(struct gl_shader *shader, exec_list *instructions);
bool optimize_redundant_jumps(exec_list *instructions);
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 29fc5d8..802323e 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -2568,8 +2568,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
if (!prog->LinkStatus)
goto done;
- if (ctx->ShaderCompilerOptions[i].LowerClipDistance)
- lower_clip_distance(prog->_LinkedShaders[i]->ir);
+ if (ctx->ShaderCompilerOptions[i].LowerClipDistance) {
+ lower_clip_distance(prog->_LinkedShaders[i]);
+ }
unsigned max_unroll = ctx->ShaderCompilerOptions[i].MaxUnrollIterations;
diff --git a/src/glsl/lower_clip_distance.cpp b/src/glsl/lower_clip_distance.cpp
index 0316914..09bdc36 100644
--- a/src/glsl/lower_clip_distance.cpp
+++ b/src/glsl/lower_clip_distance.cpp
@@ -45,6 +45,7 @@
* LowerClipDistance flag in gl_shader_compiler_options to true.
*/
+#include "glsl_symbol_table.h"
#include "ir_hierarchical_visitor.h"
#include "ir.h"
@@ -334,11 +335,14 @@ lower_clip_distance_visitor::visit_leave(ir_call *ir)
bool
-lower_clip_distance(exec_list *instructions)
+lower_clip_distance(gl_shader *shader)
{
lower_clip_distance_visitor v;
- visit_list_elements(&v, instructions);
+ visit_list_elements(&v, shader->ir);
+
+ if (v.new_clip_distance_var)
+ shader->symbols->add_variable(v.new_clip_distance_var);
return v.progress;
}
--
1.8.0.1
More information about the mesa-dev
mailing list