Module: Mesa Branch: staging/22.2 Commit: 3ae1f0120b550a29d41ee1ab1c086c2cdbc66f5c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ae1f0120b550a29d41ee1ab1c086c2cdbc66f5c
Author: Gert Wollny <[email protected]> Date: Fri Sep 9 09:22:18 2022 +0200 virgl: Report CONSTANT_BUFFER_SIZE according to GL_MAX_UNIFORM_BLOCK_SIZE GL_MAX_FRAGMENT_UNIFORM_COMPONENTS may not report a size that is useful to calculate the supported UBO size. Use the value GL_MAX_UNIFORM_BLOCK_SIZE instead when the host supports this. Related: https://gitlab.freedesktop.org/virgl/virglrenderer/-/issues/286 Fixes: 5b683ba19ac77d6c7dfd8de478678d0b90ba764f virgl: Only progagate the uniform numbers if the numbers are actually right Signed-off-by: Gert Wollny <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18512> (cherry picked from commit 95cea62a9b7b4b2caa3835e4f5e04d83df1de0a3) Conflicts: src/virtio/virtio-gpu/virgl_hw.h --- .pick_status.json | 2 +- src/gallium/drivers/virgl/virgl_screen.c | 4 ++++ src/virtio/virtio-gpu/virgl_hw.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 24cc6e9a182..0a97f090f3f 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -15862,7 +15862,7 @@ "description": "virgl: Report CONSTANT_BUFFER_SIZE according to GL_MAX_UNIFORM_BLOCK_SIZE", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "5b683ba19ac77d6c7dfd8de478678d0b90ba764f" }, diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index 3c113f83df4..c3b81e92d63 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -353,6 +353,10 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param) return vscreen->caps.caps.v2.capability_bits_v2 & VIRGL_CAP_V2_IMPLICIT_MSAA; case PIPE_CAP_IMAGE_STORE_FORMATTED: return 1; + case PIPE_CAP_MAX_CONSTANT_BUFFER_SIZE_UINT: + if (vscreen->caps.caps.v2.host_feature_check_version >= 13) + return vscreen->caps.caps.v2.max_uniform_block_size; + FALLTHROUGH; default: return u_pipe_screen_get_param_defaults(screen, param); } diff --git a/src/virtio/virtio-gpu/virgl_hw.h b/src/virtio/virtio-gpu/virgl_hw.h index eafc0b41912..653a4183fd4 100644 --- a/src/virtio/virtio-gpu/virgl_hw.h +++ b/src/virtio/virtio-gpu/virgl_hw.h @@ -603,6 +603,7 @@ struct virgl_caps_v2 { uint32_t max_shader_sampler_views; struct virgl_supported_format_mask supported_multisample_formats; uint32_t max_const_buffer_size[6]; // PIPE_SHADER_TYPES + uint32_t max_uniform_block_size; }; union virgl_caps {
