gallium: add PIPE_CAP_MAX_CONSTANT_BUFFER_SIZE_UINT for UBOs

We plan to report UINT32_MAX for UBOs.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16881>
This commit is contained in:
Marek Olšák
2022-06-05 18:56:07 -04:00
parent 406cf871b2
commit dc4a3a18e9
4 changed files with 7 additions and 6 deletions

View File

@@ -636,6 +636,7 @@ The integer capabilities:
* ``PIPE_CAP_QUERY_SPARSE_TEXTURE_RESIDENCY``: TRUE if shader sparse texture sample instruction could also return the residency information.
* ``PIPE_CAP_CLAMP_SPARSE_TEXTURE_LOD``: TRUE if shader sparse texture sample instruction support clamp the minimal lod to prevent read from un-committed pages.
* ``PIPE_CAP_ALLOW_DRAW_OUT_OF_ORDER``: TRUE if the driver allows the "draw out of order" optimization to be enabled. See _mesa_update_allow_draw_out_of_order for more details.
* ``PIPE_CAP_MAX_CONSTANT_BUFFER_SIZE_UINT``: Maximum bound constant buffer size in bytes. This is unsigned integer with the maximum of 4GB - 1. This applies to all constant buffers used by UBOs, unlike `PIPE_SHADER_CAP_MAX_CONST_BUFFER0_SIZE`, which is specifically for GLSL uniforms.
.. _pipe_capf:

View File

@@ -488,6 +488,10 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
case PIPE_CAP_CLAMP_SPARSE_TEXTURE_LOD:
return 0;
case PIPE_CAP_MAX_CONSTANT_BUFFER_SIZE_UINT:
return pscreen->get_shader_param(pscreen, PIPE_SHADER_FRAGMENT,
PIPE_SHADER_CAP_MAX_CONST_BUFFER0_SIZE);
default:
unreachable("bad PIPE_CAP_*");
}

View File

@@ -1007,6 +1007,7 @@ enum pipe_cap
PIPE_CAP_QUERY_SPARSE_TEXTURE_RESIDENCY,
PIPE_CAP_CLAMP_SPARSE_TEXTURE_LOD,
PIPE_CAP_ALLOW_DRAW_OUT_OF_ORDER,
PIPE_CAP_MAX_CONSTANT_BUFFER_SIZE_UINT,
PIPE_CAP_LAST,
/* XXX do not add caps after PIPE_CAP_LAST! */

View File

@@ -156,12 +156,7 @@ void st_init_limits(struct pipe_screen *screen,
PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION);
c->MaxUniformBlockSize =
screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
PIPE_SHADER_CAP_MAX_CONST_BUFFER0_SIZE);
/* GL45-CTS.enhanced_layouts.ssb_member_invalid_offset_alignment fails if
* this is larger than INT_MAX - 100. Use a nicely aligned limit.
*/
c->MaxUniformBlockSize = MIN2(c->MaxUniformBlockSize, INT_MAX - 127);
screen->get_param(screen, PIPE_CAP_MAX_CONSTANT_BUFFER_SIZE_UINT);
if (c->MaxUniformBlockSize < 16384) {
can_ubo = false;