From 3e39abf6a033cccbf2bbf85bf23785b7367cdcef Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 3 Aug 2017 10:54:18 -0600 Subject: svga: if we get nr_samples==1, store nr_samples=0 We need to be more careful not to treat nr_samples=1 as an msaa surface. This patch prevents us from errantly declaring an MSAA shader resource with 1 sample. No Piglit regressions, fixes the above-described errors. Reviewed-by: Neha Bhende --- src/gallium/drivers/svga/svga_resource_texture.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index 5b82e9eb7b6..9e4d6c9fb18 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -985,13 +985,16 @@ svga_texture_create(struct pipe_screen *screen, tex->key.arraySize = 1; tex->key.numFaces = 1; - /* single sample texture can be treated as non-multisamples texture */ - tex->key.sampleCount = template->nr_samples > 1 ? template->nr_samples : 0; - - if (template->nr_samples > 1) { + /* nr_samples=1 must be treated as a non-multisample texture */ + if (tex->b.b.nr_samples == 1) { + tex->b.b.nr_samples = 0; + } + else if (tex->b.b.nr_samples > 1) { tex->key.flags |= SVGA3D_SURFACE_MASKABLE_ANTIALIAS; } + tex->key.sampleCount = tex->b.b.nr_samples; + if (svgascreen->sws->have_vgpu10) { switch (template->target) { case PIPE_TEXTURE_1D: -- cgit v1.2.3