[Mesa-dev] [PATCH 4/7] gallium: add PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS
Marek Olšák
maraeo at gmail.com
Mon Sep 3 05:31:28 UTC 2018
screen.rst is missing documentation for this cap.
Marek
On Thu, Aug 30, 2018 at 9:40 AM, Erik Faye-Lund
<erik.faye-lund at collabora.com> wrote:
> This gets rid of a r600 specific hack in the state-tracker, and prepares
> for other drivers to be able to use hw-atomics.
>
> While we're at it, clean up some indentation in the various drivers.
>
> Signed-off-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
> ---
> src/gallium/drivers/etnaviv/etnaviv_screen.c | 3 +++
> src/gallium/drivers/freedreno/freedreno_screen.c | 3 +++
> src/gallium/drivers/nouveau/nv30/nv30_screen.c | 2 ++
> src/gallium/drivers/nouveau/nv50/nv50_screen.c | 2 ++
> src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 2 ++
> src/gallium/drivers/r300/r300_screen.c | 6 +++++-
> src/gallium/drivers/r600/r600_pipe.c | 4 ++++
> src/gallium/drivers/radeonsi/si_get.c | 2 ++
> src/gallium/drivers/svga/svga_screen.c | 2 ++
> src/gallium/drivers/v3d/v3d_screen.c | 8 ++++++--
> src/gallium/drivers/vc4/vc4_screen.c | 8 ++++++--
> src/gallium/drivers/virgl/virgl_screen.c | 2 ++
> src/gallium/include/pipe/p_defines.h | 1 +
> src/mesa/state_tracker/st_extensions.c | 9 +++++----
> 14 files changed, 45 insertions(+), 9 deletions(-)
>
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> index 9669bd2f60..108b97d35c 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
> @@ -289,8 +289,11 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_MAX_GS_INVOCATIONS:
> return 32;
>
> + /* shader buffer objects */
> case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> return 1 << 27;
> + case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
> + return 0;
>
> /* Stream output. */
> case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS:
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
> index 489986703c..af44ab698e 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -376,8 +376,11 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_MAX_GS_INVOCATIONS:
> return 32;
>
> + /* shader buffer objects */
> case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> return 1 << 27;
> + case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
> + return 0;
>
> case PIPE_CAP_CONTEXT_PRIORITY_MASK:
> return screen->priority_mask;
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index da7ebecd5d..d52d8f3988 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -245,6 +245,8 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> return 32;
> case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> return 1 << 27;
> + case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
> + return 0;
> case PIPE_CAP_VENDOR_ID:
> return 0x10de;
> case PIPE_CAP_DEVICE_ID: {
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> index 0007a2b957..cd36795e56 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -299,6 +299,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> return 32;
> case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> return 1 << 27;
> + case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
> + return 0;
> case PIPE_CAP_VENDOR_ID:
> return 0x10de;
> case PIPE_CAP_DEVICE_ID: {
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index 4701b768be..446e30dcc8 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -272,6 +272,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> return 32;
> case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> return 1 << 27;
> + case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
> + return 0;
> case PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_TRIANGLES:
> return class_3d >= GP100_3D_CLASS;
> case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
> index 01a95d98dc..d27c2b8f1d 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -265,8 +265,12 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>
> case PIPE_CAP_MAX_GS_INVOCATIONS:
> return 32;
> - case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> +
> + /* shader buffer objects */
> + case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> return 1 << 27;
> + case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
> + return 0;
>
> /* SWTCL-only features. */
> case PIPE_CAP_PRIMITIVE_RESTART:
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index d9dae26d1c..cbebf748b7 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -379,8 +379,12 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>
> case PIPE_CAP_MAX_GS_INVOCATIONS:
> return 32;
> +
> + /* shader buffer objects */
> case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> return 1 << 27;
> + case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
> + return 8;
>
> /* Unsupported features. */
> case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
> diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c
> index 90f62edf47..d8fc6447b4 100644
> --- a/src/gallium/drivers/radeonsi/si_get.c
> +++ b/src/gallium/drivers/radeonsi/si_get.c
> @@ -191,6 +191,8 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
> case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> return MIN2(sscreen->info.max_alloc_size, INT_MAX);
> + case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
> + return 0;
>
> case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
> case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> index 54c49d165f..8cc1980f3a 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -476,6 +476,8 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
> return 32;
> case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> return 1 << 27;
> + case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
> + return 0;
> }
>
> debug_printf("Unexpected PIPE_CAP_ query %u\n", param);
> diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c
> index 8a166c18fa..14a40cb5b7 100644
> --- a/src/gallium/drivers/v3d/v3d_screen.c
> +++ b/src/gallium/drivers/v3d/v3d_screen.c
> @@ -280,8 +280,12 @@ v3d_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
> case PIPE_CAP_MAX_GS_INVOCATIONS:
> return 0;
> - case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> - return 1 << 27;
> +
> + /* shader buffer objects */
> + case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> + return 1 << 27;
> + case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
> + return 0;
>
> /* Texturing. */
> case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
> index b88110a86c..e22ec6754a 100644
> --- a/src/gallium/drivers/vc4/vc4_screen.c
> +++ b/src/gallium/drivers/vc4/vc4_screen.c
> @@ -316,8 +316,12 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
> case PIPE_CAP_MAX_GS_INVOCATIONS:
> return 0;
> - case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> - return 1 << 27;
> +
> + /* shader buffer objects */
> + case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> + return 1 << 27;
> + case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
> + return 0;
>
> /* Texturing. */
> case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
> diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
> index dd97b3d3f9..4fe57611cf 100644
> --- a/src/gallium/drivers/virgl/virgl_screen.c
> +++ b/src/gallium/drivers/virgl/virgl_screen.c
> @@ -321,6 +321,8 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
> return 32;
> case PIPE_CAP_MAX_SHADER_BUFFER_SIZE:
> return 1 << 27;
> + case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
> + return 0;
> case PIPE_CAP_VENDOR_ID:
> return 0x1af4;
> case PIPE_CAP_DEVICE_ID:
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index 3bc908d1a0..b7c7d8fcbd 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -818,6 +818,7 @@ enum pipe_cap
> PIPE_CAP_MAX_GS_INVOCATIONS,
> PIPE_CAP_MAX_SHADER_BUFFER_SIZE,
> PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE,
> + PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS,
> };
>
> /**
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index 9ecdd26edd..d5aad2d748 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -470,16 +470,17 @@ void st_init_limits(struct pipe_screen *screen,
> c->ShaderStorageBufferOffsetAlignment =
> screen->get_param(screen, PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT);
> if (c->ShaderStorageBufferOffsetAlignment) {
> - /* for hw atomic counters leaves these at default for now */
> - if (ssbo_atomic) {
> + c->MaxCombinedShaderStorageBlocks =
> + screen->get_param(screen, PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS);
> + if (!c->MaxCombinedShaderStorageBlocks)
> c->MaxCombinedShaderStorageBlocks =
> c->Program[MESA_SHADER_VERTEX].MaxShaderStorageBlocks +
> c->Program[MESA_SHADER_TESS_CTRL].MaxShaderStorageBlocks +
> c->Program[MESA_SHADER_TESS_EVAL].MaxShaderStorageBlocks +
> c->Program[MESA_SHADER_GEOMETRY].MaxShaderStorageBlocks +
> c->Program[MESA_SHADER_FRAGMENT].MaxShaderStorageBlocks;
> - assert(c->MaxCombinedShaderStorageBlocks < MAX_COMBINED_SHADER_STORAGE_BUFFERS);
> - }
> +
> + assert(c->MaxCombinedShaderStorageBlocks < MAX_COMBINED_SHADER_STORAGE_BUFFERS);
> c->MaxShaderStorageBufferBindings = c->MaxCombinedShaderStorageBlocks;
>
> c->MaxCombinedShaderOutputResources +=
> --
> 2.17.1
>
More information about the mesa-dev
mailing list