virgl: Add support for passing the supported number of components from virgl

Return the capabilities reported by the host. No functional change in case the
host virgl implementation doesn't implement it.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16401>
This commit is contained in:
Corentin Noël 2022-05-09 16:21:17 +02:00 committed by Marge Bot
parent 2283ac5832
commit d92c1ca01b
3 changed files with 5 additions and 1 deletions

View File

@ -421,7 +421,7 @@ virgl_get_shader_param(struct pipe_screen *screen,
case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
return 32;
case PIPE_SHADER_CAP_MAX_CONST_BUFFER0_SIZE:
return 4096 * sizeof(float[4]);
return vscreen->caps.caps.v2.max_const_buffer_size[shader];
case PIPE_SHADER_CAP_MAX_SHADER_BUFFERS:
if (shader == PIPE_SHADER_FRAGMENT || shader == PIPE_SHADER_COMPUTE)
return vscreen->caps.caps.v2.max_shader_buffer_frag_compute;

View File

@ -173,6 +173,9 @@ static inline void virgl_ws_fill_new_caps_defaults(struct virgl_drm_caps *caps)
caps->caps.v2.max_compute_shared_memory_size = 0;
caps->caps.v2.host_feature_check_version = 0;
caps->caps.v2.max_shader_sampler_views = 16;
for (int shader_type = 0; shader_type < PIPE_SHADER_TYPES; shader_type++) {
caps->caps.v2.max_const_buffer_size[shader_type] = 4096 * sizeof(float[4]);
}
}
extern enum virgl_formats pipe_to_virgl_format(enum pipe_format format);

View File

@ -601,6 +601,7 @@ struct virgl_caps_v2 {
float max_anisotropy;
uint32_t max_shader_sampler_views;
struct virgl_supported_format_mask supported_multisample_formats;
uint32_t max_const_buffer_size[6]; // PIPE_SHADER_TYPES
};
union virgl_caps {