broadcom/compiler: Update comment clarifying OpTerminate implementation

Explain why the driver uses demote instead of an immediate jump to the
end of the shader for OpTerminate, noting that the jump approach showed
no performance gains.

Reference: !38381

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39703>
This commit is contained in:
Daivik Bhatia 2026-02-05 01:02:57 +05:30 committed by Marge Bot
parent 0966743943
commit 026fa1799b

View file

@ -3638,13 +3638,16 @@ ntq_emit_intrinsic(struct v3d_compile *c, nir_intrinsic_instr *instr)
ntq_emit_image_size(c, instr);
break;
/* FIXME: the Vulkan and SPIR-V specs specify that OpTerminate (which
/* The Vulkan and SPIR-V specs specify that OpTerminate (which
* is intended to match the semantics of GLSL's discard) should
* terminate the invocation immediately. Our implementation doesn't
* do that. What we do is actually a demote by removing the invocations
* from the sample mask. Maybe we could be more strict and force an
* early termination by emitting a (maybe conditional) jump to the
* end section of the fragment shader for affected invocations.
* terminate the invocation immediately but our implementation
* doesn't do that. We could implement it by emitting a jump to
* the end of the shader, however, we have not observed any gains
* from this in real use cases, and doing that would require us to
* always emit additional instructions for terminates, so we discarded
* that approach. See
* https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38381
* for more details.
*/
case nir_intrinsic_terminate:
c->emitted_discard = true;