diff options
author | Caio Marcelo de Oliveira Filho <[email protected]> | 2019-06-07 17:29:05 -0700 |
---|---|---|
committer | Caio Marcelo de Oliveira Filho <[email protected]> | 2019-07-08 08:57:25 -0700 |
commit | a42e8f0ed1d1aa1b38282be28e4f55e246b55685 (patch) | |
tree | 054b723e5dd7764d93040d1898212bc19f96c339 /src/compiler/nir | |
parent | 9b116173b6a5e96c54ef3962546aabd505e00cfb (diff) |
nir: Add demote and is_helper_invocation intrinsics
From SPV_EXT_demote_to_helper_invocation. Demote will be implemented
as a variant of discard, so mark uses_discard if it is used.
v2: Add CAN_ELIMINATE flag to the new intrinsic. (Jason)
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r-- | src/compiler/nir/nir_gather_info.c | 1 | ||||
-rw-r--r-- | src/compiler/nir/nir_intrinsics.py | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index 36d0d23bda4..3093a035368 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -198,6 +198,7 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader, void *dead_ctx) { switch (instr->intrinsic) { + case nir_intrinsic_demote: case nir_intrinsic_discard: case nir_intrinsic_discard_if: assert(shader->info.stage == MESA_SHADER_FRAGMENT); diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py index 70ff1b99de0..e4f94257acd 100644 --- a/src/compiler/nir/nir_intrinsics.py +++ b/src/compiler/nir/nir_intrinsics.py @@ -190,6 +190,16 @@ def barrier(name): barrier("barrier") barrier("discard") +# Demote fragment shader invocation to a helper invocation. Any stores to +# memory after this instruction are suppressed and the fragment does not write +# outputs to the framebuffer. Unlike discard, demote needs to ensure that +# derivatives will still work for invocations that were not demoted. +# +# As specified by SPV_EXT_demote_to_helper_invocation. +barrier("demote") +intrinsic("is_helper_invocation", dest_comp=1, flags=[CAN_ELIMINATE]) + + # Memory barrier with semantics analogous to the memoryBarrier() GLSL # intrinsic. barrier("memory_barrier") |