mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 02:58:05 +02:00
nir: Gather compile time constant task->mesh dispatch size.
Some GPUs such as AMD RDNA3 can use this information to optimize mesh shader dispatches. Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com> Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22222>
This commit is contained in:
parent
836204da25
commit
e42d2bd534
2 changed files with 23 additions and 1 deletions
|
|
@ -875,6 +875,17 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader,
|
|||
BITFIELD64_BIT(FRAG_RESULT_STENCIL);
|
||||
break;
|
||||
|
||||
case nir_intrinsic_launch_mesh_workgroups:
|
||||
case nir_intrinsic_launch_mesh_workgroups_with_payload_deref: {
|
||||
for (unsigned i = 0; i < 3; ++i) {
|
||||
nir_ssa_scalar dim = nir_ssa_scalar_resolved(instr->src[0].ssa, i);
|
||||
if (nir_ssa_scalar_is_const(dim))
|
||||
shader->info.mesh.ts_mesh_dispatch_dimensions[i] =
|
||||
nir_ssa_scalar_as_uint(dim);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
shader->info.uses_bindless |= intrinsic_is_bindless(instr);
|
||||
if (nir_intrinsic_writes_external_memory(instr))
|
||||
|
|
@ -1054,6 +1065,11 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
|
|||
if (shader->info.stage == MESA_SHADER_MESH) {
|
||||
shader->info.mesh.ms_cross_invocation_output_access = 0;
|
||||
}
|
||||
if (shader->info.stage == MESA_SHADER_TASK) {
|
||||
shader->info.mesh.ts_mesh_dispatch_dimensions[0] = 0;
|
||||
shader->info.mesh.ts_mesh_dispatch_dimensions[1] = 0;
|
||||
shader->info.mesh.ts_mesh_dispatch_dimensions[2] = 0;
|
||||
}
|
||||
|
||||
if (shader->info.stage != MESA_SHADER_FRAGMENT)
|
||||
shader->info.writes_memory = shader->info.has_transform_feedback_varyings;
|
||||
|
|
|
|||
|
|
@ -550,13 +550,19 @@ typedef struct shader_info {
|
|||
uint64_t tcs_cross_invocation_outputs_read;
|
||||
} tess;
|
||||
|
||||
/* Applies to MESH. */
|
||||
/* Applies to MESH and TASK. */
|
||||
struct {
|
||||
/* Bit mask of MS outputs that are used
|
||||
* with an index that is NOT the local invocation index.
|
||||
*/
|
||||
uint64_t ms_cross_invocation_output_access;
|
||||
|
||||
/* Dimensions of task->mesh dispatch (EmitMeshTasksEXT)
|
||||
* when they are known compile-time constants.
|
||||
* 0 means they are not known.
|
||||
*/
|
||||
uint32_t ts_mesh_dispatch_dimensions[3];
|
||||
|
||||
uint16_t max_vertices_out;
|
||||
uint16_t max_primitives_out;
|
||||
uint16_t primitive_type; /* GL_POINTS, GL_LINES or GL_TRIANGLES. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue