aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/ir_set_program_inouts.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-31 10:00:43 +0200
committermarha <marha@users.sourceforge.net>2012-07-31 10:00:43 +0200
commitbd27b3d008b0abf9ae2edcb127302728808533e4 (patch)
treea73a74f04a31a0f44465ed82bcf58b180ca53dbd /mesalib/src/glsl/ir_set_program_inouts.cpp
parent2ff5448bcca8cba4b62026d5493cb08aaf2838d8 (diff)
downloadvcxsrv-bd27b3d008b0abf9ae2edcb127302728808533e4.tar.gz
vcxsrv-bd27b3d008b0abf9ae2edcb127302728808533e4.tar.bz2
vcxsrv-bd27b3d008b0abf9ae2edcb127302728808533e4.zip
fontconfig libXext mesa xserver pixman git update 31 Jul 2012
Diffstat (limited to 'mesalib/src/glsl/ir_set_program_inouts.cpp')
-rw-r--r--mesalib/src/glsl/ir_set_program_inouts.cpp36
1 files changed, 31 insertions, 5 deletions
diff --git a/mesalib/src/glsl/ir_set_program_inouts.cpp b/mesalib/src/glsl/ir_set_program_inouts.cpp
index a7415c7e3..e5de07e01 100644
--- a/mesalib/src/glsl/ir_set_program_inouts.cpp
+++ b/mesalib/src/glsl/ir_set_program_inouts.cpp
@@ -26,8 +26,8 @@
*
* Sets the InputsRead and OutputsWritten of Mesa programs.
*
- * Additionally, for fragment shaders, sets the InterpQualifier array and
- * IsCentroid bitfield.
+ * Additionally, for fragment shaders, sets the InterpQualifier array, the
+ * IsCentroid bitfield, and the UsesDFdy flag.
*
* Mesa programs (gl_program, not gl_shader_program) have a set of
* flags indicating which varyings are read and written. Computing
@@ -61,6 +61,8 @@ public:
virtual ir_visitor_status visit_enter(ir_dereference_array *);
virtual ir_visitor_status visit_enter(ir_function_signature *);
+ virtual ir_visitor_status visit_enter(ir_expression *);
+ virtual ir_visitor_status visit_enter(ir_discard *);
virtual ir_visitor_status visit(ir_dereference_variable *);
virtual ir_visitor_status visit(ir_variable *);
@@ -169,6 +171,28 @@ ir_set_program_inouts_visitor::visit_enter(ir_function_signature *ir)
return visit_continue_with_parent;
}
+ir_visitor_status
+ir_set_program_inouts_visitor::visit_enter(ir_expression *ir)
+{
+ if (is_fragment_shader && ir->operation == ir_unop_dFdy) {
+ gl_fragment_program *fprog = (gl_fragment_program *) prog;
+ fprog->UsesDFdy = true;
+ }
+ return visit_continue;
+}
+
+ir_visitor_status
+ir_set_program_inouts_visitor::visit_enter(ir_discard *)
+{
+ /* discards are only allowed in fragment shaders. */
+ assert(is_fragment_shader);
+
+ gl_fragment_program *fprog = (gl_fragment_program *) prog;
+ fprog->UsesKill = true;
+
+ return visit_continue;
+}
+
void
do_set_program_inouts(exec_list *instructions, struct gl_program *prog,
bool is_fragment_shader)
@@ -179,9 +203,11 @@ do_set_program_inouts(exec_list *instructions, struct gl_program *prog,
prog->OutputsWritten = 0;
prog->SystemValuesRead = 0;
if (is_fragment_shader) {
- memset(((gl_fragment_program *) prog)->InterpQualifier, 0,
- sizeof(((gl_fragment_program *) prog)->InterpQualifier));
- ((gl_fragment_program *) prog)->IsCentroid = 0;
+ gl_fragment_program *fprog = (gl_fragment_program *) prog;
+ memset(fprog->InterpQualifier, 0, sizeof(fprog->InterpQualifier));
+ fprog->IsCentroid = 0;
+ fprog->UsesDFdy = false;
+ fprog->UsesKill = false;
}
visit_list_elements(&v, instructions);
}