intel/compiler: add a new pass to lower shading rate into HW format

Rework:
 * Jason: Modernize brw_nir_lower_shading_rate_output:
   1. Use nir_shader_instructions_pass()
   2. Use *_imm builder helpers.
   3. Use nir_intrinsic_base() instead of ->const_index[0]

v2: Also lower loads (Caio)

v3: Update stage check to trigger lowering (Caio)

v4: Assert on != MESH (Caio)

v5: Fixup instruction insertion (Caio)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13739>
This commit is contained in:
Lionel Landwerlin
2021-02-17 13:47:36 +02:00
committed by Marge Bot
parent e227bb9fd5
commit cebf284ac1
5 changed files with 130 additions and 0 deletions

View File

@@ -98,6 +98,19 @@ gl_shader_stage_is_callable(gl_shader_stage stage)
stage == MESA_SHADER_CALLABLE;
}
static inline bool
gl_shader_stage_can_set_fragment_shading_rate(gl_shader_stage stage)
{
/* According to EXT_fragment_shading_rate :
*
* "This extension adds support for setting the fragment shading rate
* for a primitive in vertex, geometry, and mesh shading stages"
*/
return stage == MESA_SHADER_VERTEX ||
stage == MESA_SHADER_GEOMETRY ||
stage == MESA_SHADER_MESH;
}
/**
* Number of STATE_* values we need to address any GL state.
* Used to dimension arrays.