nir: Add new variable mode for task/mesh payload.

Task shader outputs work differently than other shaders, so they
need special consideration. Essentially, they have two kinds of
outputs:

1. Number of mesh shader workgroups to launch.
Will be still represented by a shader output.

2. Optional payload of up to (at least) 16K bytes.
These payload variables behave similarly to shared memory, but
the spec doesn't actually define them as shared memory (also, they
may be implemented differently by each backend), so we need to add
a new NIR variable mode for them.

These payload variables can't be represented by shader outputs
because the 16K bytes don't fit the 32x vec4 model that NIR uses
for its output variables.

This patch adds a new NIR variable mode: nir_var_mem_task_payload
and corresponding explicit I/O intrinsics, as well as support for
this new mode in nir_lower_io.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14930>
This commit is contained in:
Timur Kristóf
2022-02-08 02:55:18 +01:00
committed by Marge Bot
parent d2d6eca081
commit f629fbd778
7 changed files with 51 additions and 10 deletions

View File

@@ -215,6 +215,11 @@ typedef struct shader_info {
*/
unsigned shared_size;
/**
* Size of task payload variables accessed by task/mesh shaders.
*/
unsigned task_payload_size;
/**
* Number of ray tracing queries in the shader (counts all elements of all
* variables).