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 *);
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)
memset(fprog->InterpQualifier, 0, sizeof(fprog->InterpQualifier));
fprog->IsCentroid = 0;
fprog->UsesDFdy = false;
+ fprog->UsesKill = false;
}
visit_list_elements(&v, instructions);
}
vp->UsesClipDistance = shProg->Vert.UsesClipDistance;
}
- if (stage == 1) {
- class uses_kill_visitor : public ir_hierarchical_visitor {
- public:
- uses_kill_visitor() : uses_kill(false)
- {
- /* empty */
- }
-
- virtual ir_visitor_status visit_enter(class ir_discard *ir)
- {
- this->uses_kill = true;
- return visit_stop;
- }
-
- bool uses_kill;
- };
-
- uses_kill_visitor v;
-
- v.run(shader->base.ir);
-
- struct gl_fragment_program *fp = (struct gl_fragment_program *) prog;
- fp->UsesKill = v.uses_kill;
- }
-
void *mem_ctx = ralloc_context(NULL);
bool progress;
void
ir_to_mesa_visitor::visit(ir_discard *ir)
{
- struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog;
-
if (ir->condition) {
ir->condition->accept(this);
this->result.negate = ~this->result.negate;
} else {
emit(ir, OPCODE_KIL_NV);
}
-
- fp->UsesKill = GL_TRUE;
}
void
void
glsl_to_tgsi_visitor::visit(ir_discard *ir)
{
- struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog;
-
if (ir->condition) {
ir->condition->accept(this);
this->result.negate = ~this->result.negate;
} else {
emit(ir, TGSI_OPCODE_KILP);
}
-
- fp->UsesKill = GL_TRUE;
}
void