summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/glsl_to_nir.cpp
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-09-20 09:27:00 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-09-30 12:44:30 -0700
commitaf1a6f0f770ae7432fd506f5f33fbe9e00e253af (patch)
treedc2216dfc44b1dbd1bbce05f27b7fd0bbc146ed1 /src/compiler/glsl/glsl_to_nir.cpp
parentc81b912eb7adff326070fc18353d51ef6dec0dcb (diff)
glsl: Add ir_demote
To represent the new `demote` keyword when using EXT_demote_to_helper_invocation extension. Most of the changes are to include it in the visitors. Demote is not considered a control flow, so also include an empty visit member function in ir_control_flow_visitor. Only NIR actually supports `demote`, so assert the translations for TGSI and Mesa's gl_program -- since the demote is not expected to appear for those. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/glsl/glsl_to_nir.cpp')
-rw-r--r--src/compiler/glsl/glsl_to_nir.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index 1e096a66c20..883cfb57601 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -63,6 +63,7 @@ public:
virtual void visit(ir_loop *);
virtual void visit(ir_if *);
virtual void visit(ir_discard *);
+ virtual void visit(ir_demote *);
virtual void visit(ir_loop_jump *);
virtual void visit(ir_return *);
virtual void visit(ir_call *);
@@ -776,6 +777,15 @@ nir_visitor::visit(ir_discard *ir)
}
void
+nir_visitor::visit(ir_demote *ir)
+{
+ nir_intrinsic_instr *demote =
+ nir_intrinsic_instr_create(this->shader, nir_intrinsic_demote);
+
+ nir_builder_instr_insert(&b, &demote->instr);
+}
+
+void
nir_visitor::visit(ir_emit_vertex *ir)
{
nir_intrinsic_instr *instr =