From 95cea62a9b7b4b2caa3835e4f5e04d83df1de0a3 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Fri, 9 Sep 2022 09:22:18 +0200 Subject: [PATCH] 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 Part-of: --- src/gallium/drivers/virgl/virgl_screen.c | 4 ++++ src/virtio/virtio-gpu/virgl_hw.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index 597521a4f42..af24d65015f 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -356,6 +356,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 a91f2ba754d..735a4145493 100644 --- a/src/virtio/virtio-gpu/virgl_hw.h +++ b/src/virtio/virtio-gpu/virgl_hw.h @@ -641,6 +641,7 @@ struct virgl_caps_v2 { uint32_t max_const_buffer_size[6]; // PIPE_SHADER_TYPES uint32_t num_video_caps; struct virgl_video_caps video_caps[32]; + uint32_t max_uniform_block_size; }; union virgl_caps {