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: 5b683ba19a
  virgl: Only progagate the uniform numbers if the numbers are actually right

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18512>
(cherry picked from commit 95cea62a9b)

Conflicts:
	src/virtio/virtio-gpu/virgl_hw.h
This commit is contained in:
Gert Wollny 2022-09-09 09:22:18 +02:00 committed by Dylan Baker
parent e2472db43b
commit 3ae1f0120b
3 changed files with 6 additions and 1 deletions

View file

@ -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"
},

View file

@ -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);
}

View file

@ -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 {