From 3bccf702118dda542da3b96990fd0bcca97f9a89 Mon Sep 17 00:00:00 2001 From: Alexandros Frantzis Date: Mon, 18 Mar 2019 16:30:29 +0200 Subject: [PATCH] virgl: Fake MSAA when max samples is 1 When the host is running on softpipe/llvmpipe the maximum number of samples for multisampling is 1. GL 3.0 requires at least 4 samples, and softpipe/llvmpipe get around this by enabling PIPE_CAP_FAKE_SW_MSAA. This patch mimics softpipe/llvmpipe behavior in virgl by enabling the same PIPE_CAP_FAKE_SW_MSAA workaround when the max sample count reported by the host is 1. This change allows virgl on a softpipe/llvmpipe host to advertise support for GL 3.0 and beyond. Signed-off-by: Alexandros Frantzis Reviewed-By: Gert Wollny --- src/gallium/drivers/virgl/virgl_screen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index 66e520eab8a..1ad8863bfca 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -265,9 +265,12 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param) if (vscreen->caps.caps.v1.glsl_level < 150) return vscreen->caps.caps.v2.max_vertex_attribs; return 32; + case PIPE_CAP_FAKE_SW_MSAA: + /* If the host supports only one sample (e.g., if it is using softpipe), + * fake multisampling to able to advertise higher GL versions. */ + return (vscreen->caps.caps.v1.max_samples == 1) ? 1 : 0; case PIPE_CAP_TEXTURE_GATHER_SM5: case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT: - case PIPE_CAP_FAKE_SW_MSAA: case PIPE_CAP_TEXTURE_GATHER_OFFSETS: case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION: case PIPE_CAP_MULTI_DRAW_INDIRECT: -- 2.30.2