OPCODE(1, 1, REPL, EX2)
OPCODE(1, 1, REPL, LG2)
OPCODE(1, 2, REPL, POW)
-OPCODE_GAP(31) /* removed */
+OPCODE(0, 0, NONE, DEMOTE)
OPCODE(1, 1, COMP, U2I64)
OPCODE(1, 0, OTHR, CLOCK)
OPCODE(1, 1, COMP, I2I64)
-OPCODE_GAP(35) /* removed */
+OPCODE(1, 0, COMP, READ_HELPER)
OPCODE(1, 1, REPL, COS)
OPCODE(1, 1, COMP, DDX)
OPCODE(1, 1, COMP, DDY)
Unconditional discard. Allowed in fragment shaders only.
+.. opcode:: DEMOTE - Demote Invocation to a Helper
+
+ This demotes the current invocation to a helper, but continues
+ execution (while KILL may or may not terminate the
+ invocation). After this runs, all the usual helper invocation rules
+ apply about discarding buffer and render target writes. This is
+ useful for having accurate derivatives in the other invocations
+ which have not been demoted.
+
+ Allowed in fragment shaders only.
+
+
+.. opcode:: READ_HELPER - Reads Invocation Helper Status
+
+ This is identical to ``TGSI_SEMANTIC_HELPER_INVOCATION``, except
+ this will read the current value, which might change as a result of
+ a ``DEMOTE`` instruction.
+
+ Allowed in fragment shaders only.
+
+
.. opcode:: TXB - Texture Lookup With Bias
for cube map array textures and shadow cube maps, the bias value
TGSI_OPCODE_EX2 = 28,
TGSI_OPCODE_LG2 = 29,
TGSI_OPCODE_POW = 30,
- /* gap */
+ TGSI_OPCODE_DEMOTE = 31,
TGSI_OPCODE_U2I64 = 32,
TGSI_OPCODE_CLOCK = 33,
TGSI_OPCODE_I2I64 = 34,
- /* gap */
+ TGSI_OPCODE_READ_HELPER = 35,
TGSI_OPCODE_COS = 36,
TGSI_OPCODE_DDX = 37,
TGSI_OPCODE_DDY = 38,
visit_generic_intrinsic(ir, TGSI_OPCODE_READ_INVOC);
return;
+ case ir_intrinsic_helper_invocation:
+ visit_generic_intrinsic(ir, TGSI_OPCODE_READ_HELPER);
+ return;
+
case ir_intrinsic_invalid:
case ir_intrinsic_generic_load:
case ir_intrinsic_generic_store:
case ir_intrinsic_generic_atomic_comp_swap:
case ir_intrinsic_begin_invocation_interlock:
case ir_intrinsic_end_invocation_interlock:
- case ir_intrinsic_helper_invocation:
unreachable("Invalid intrinsic");
}
}
void
glsl_to_tgsi_visitor::visit(ir_demote *ir)
{
- assert(!"demote statement unsupported");
+ emit_asm(ir, TGSI_OPCODE_DEMOTE);
}
void