From: Marek Olšák Date: Mon, 6 Aug 2018 12:38:54 +0000 (-0400) Subject: gallium: add PIPE_CAP_MAX_SHADER_BUFFER_SIZE X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d3c1b212bc72494bdcca617115cda4e0b55d2dbe;p=mesa.git gallium: add PIPE_CAP_MAX_SHADER_BUFFER_SIZE Tested-by: Dieter Nützel --- diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index a4d71b3a849..6caa7d5f351 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -454,6 +454,8 @@ subpixel precision bias in bits during conservative rasterization. ```set_sample_locations```. * ``PIPE_CAP_MAX_GS_INVOCATIONS``: Maximum supported value of TGSI_PROPERTY_GS_INVOCATIONS. +* ``PIPE_CAP_MAX_SHADER_BUFFER_SIZE``: Maximum supported size for binding + with set_shader_buffers. .. _pipe_capf: diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index e8bc6a5cae8..03449778c70 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -288,6 +288,9 @@ etna_screen_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: + return 1 << 27; + /* Stream output. */ case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS: case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME: diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 96d4adaa73d..d0d202d5b07 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -375,6 +375,9 @@ fd_screen_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: + return 1 << 27; + case PIPE_CAP_CONTEXT_PRIORITY_MASK: return screen->priority_mask; diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 6b850064019..fcca8b99813 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -340,6 +340,9 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_MAX_GS_INVOCATIONS: return 32; + case PIPE_CAP_MAX_SHADER_BUFFER_SIZE: + return 1 << 27; + case PIPE_CAP_MAX_VIEWPORTS: return 1; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 1181f1c0a6e..d0f3ce9aeb8 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -375,6 +375,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) return 0; case PIPE_CAP_MAX_GS_INVOCATIONS: return 32; + case PIPE_CAP_MAX_SHADER_BUFFER_SIZE: + return 1 << 27; } /* should only get here on unhandled cases */ debug_printf("Unexpected PIPE_CAP %d query\n", param); diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index fc89bfbc1b2..613d7161533 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -242,6 +242,8 @@ nv30_screen_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: + return 1 << 27; 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 6f3fdf34951..cdd2771baa1 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -296,6 +296,8 @@ nv50_screen_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: + return 1 << 27; 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 8c1cd878bd0..0c3ade35170 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -269,6 +269,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return class_3d >= GM200_3D_CLASS; case PIPE_CAP_MAX_GS_INVOCATIONS: return 32; + case PIPE_CAP_MAX_SHADER_BUFFER_SIZE: + return 1 << 27; 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 73e80f2dd4c..8477379a213 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -264,6 +264,8 @@ 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: + return 1 << 27; /* 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 69cfb8028a8..cf9324df35d 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -378,6 +378,8 @@ static int r600_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: + return 1 << 27; /* 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 d27ce474b05..e2e53514239 100644 --- a/src/gallium/drivers/radeonsi/si_get.c +++ b/src/gallium/drivers/radeonsi/si_get.c @@ -189,6 +189,7 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 420; 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_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 1fe807d81f1..984efb810f4 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -327,6 +327,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) return 0; case PIPE_CAP_MAX_GS_INVOCATIONS: return 32; + case PIPE_CAP_MAX_SHADER_BUFFER_SIZE: + return 1 << 27; case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT: return 4; } diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 884aa595ae9..098d9d71b24 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -473,6 +473,8 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param) return 0; case PIPE_CAP_MAX_GS_INVOCATIONS: return 32; + case PIPE_CAP_MAX_SHADER_BUFFER_SIZE: + return 1 << 27; } debug_printf("Unexpected PIPE_CAP_ query %u\n", param); diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp index f6d1f1c5f71..53275939b9e 100644 --- a/src/gallium/drivers/swr/swr_screen.cpp +++ b/src/gallium/drivers/swr/swr_screen.cpp @@ -364,6 +364,8 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param) return 0; case PIPE_CAP_MAX_GS_INVOCATIONS: return 32; + case PIPE_CAP_MAX_SHADER_BUFFER_SIZE: + return 1 << 27; case PIPE_CAP_VENDOR_ID: return 0xFFFFFFFF; diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c index e54e9802ecf..03e0195a9f3 100644 --- a/src/gallium/drivers/v3d/v3d_screen.c +++ b/src/gallium/drivers/v3d/v3d_screen.c @@ -279,6 +279,8 @@ 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; /* 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 89ebc84477b..0a10d898fe1 100644 --- a/src/gallium/drivers/vc4/vc4_screen.c +++ b/src/gallium/drivers/vc4/vc4_screen.c @@ -315,6 +315,8 @@ 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; /* 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 257cc147bf8..d016d22670c 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -310,6 +310,8 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param) return 0; case PIPE_CAP_MAX_GS_INVOCATIONS: return 32; + case PIPE_CAP_MAX_SHADER_BUFFER_SIZE: + return 1 << 27; 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 c008f9d66f2..f7ca1a97709 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -816,6 +816,7 @@ enum pipe_cap PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE, PIPE_CAP_PROGRAMMABLE_SAMPLE_LOCATIONS, PIPE_CAP_MAX_GS_INVOCATIONS, + PIPE_CAP_MAX_SHADER_BUFFER_SIZE, }; /** diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index ba0e89c700c..8efd281eaad 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -468,7 +468,8 @@ void st_init_limits(struct pipe_screen *screen, c->MaxCombinedAtomicBuffers; c->MaxCombinedShaderOutputResources += c->MaxCombinedShaderStorageBlocks; - c->MaxShaderStorageBlockSize = 1 << 27; + c->MaxShaderStorageBlockSize = + screen->get_param(screen, PIPE_CAP_MAX_SHADER_BUFFER_SIZE); extensions->ARB_shader_storage_buffer_object = GL_TRUE; }