diff options
author | Jason Ekstrand <[email protected]> | 2019-06-07 18:07:46 -0500 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2019-07-23 13:40:41 -0500 |
commit | ae392d73c978efcfbbe7fbfff446cabe2ab79559 (patch) | |
tree | 85754fe5afe75280d78ecb7a4480a3cc2d2b03bc /src/compiler | |
parent | 41ab92a327c63bdf97edee356e46246f4ff306bc (diff) |
nir/gather_info: Look for uses of helper invocations
The one obvious omission here is gl_HelperInvocation itself. However,
the spec doesn't require that we generate then when gl_HelperInvocation
is used, it merely mandates that we report them if they are there.
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir_gather_info.c | 19 | ||||
-rw-r--r-- | src/compiler/shader_info.h | 8 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index 51717cd6d7f..a7e258d6d9d 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -264,6 +264,14 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader, (1ull << nir_system_value_from_intrinsic(instr->intrinsic)); break; + case nir_intrinsic_quad_broadcast: + case nir_intrinsic_quad_swap_horizontal: + case nir_intrinsic_quad_swap_vertical: + case nir_intrinsic_quad_swap_diagonal: + if (shader->info.stage == MESA_SHADER_FRAGMENT) + shader->info.fs.needs_helper_invocations = true; + break; + case nir_intrinsic_end_primitive: case nir_intrinsic_end_primitive_with_counter: assert(shader->info.stage == MESA_SHADER_GEOMETRY); @@ -284,6 +292,10 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader, static void gather_tex_info(nir_tex_instr *instr, nir_shader *shader) { + if (shader->info.stage == MESA_SHADER_FRAGMENT && + nir_tex_instr_has_implicit_derivative(instr)) + shader->info.fs.needs_helper_invocations = true; + switch (instr->op) { case nir_texop_tg4: shader->info.uses_texture_gather = true; @@ -300,6 +312,13 @@ gather_alu_info(nir_alu_instr *instr, nir_shader *shader) case nir_op_fddx: case nir_op_fddy: shader->info.uses_fddx_fddy = true; + /* Fall through */ + case nir_op_fddx_fine: + case nir_op_fddy_fine: + case nir_op_fddx_coarse: + case nir_op_fddy_coarse: + if (shader->info.stage == MESA_SHADER_FRAGMENT) + shader->info.fs.needs_helper_invocations = true; break; default: break; diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h index f71b93e84d0..115dd01e2b9 100644 --- a/src/compiler/shader_info.h +++ b/src/compiler/shader_info.h @@ -189,6 +189,14 @@ typedef struct shader_info { bool uses_discard; /** + * True if this fragment shader requires helper invocations. This + * can be caused by the use of ALU derivative ops, texture + * instructions which do implicit derivatives, and the use of quad + * subgroup operations. + */ + bool needs_helper_invocations; + + /** * Whether any inputs are declared with the "sample" qualifier. */ bool uses_sample_qualifier; |