svga: if we get nr_samples==1, store nr_samples=0
authorBrian Paul <brianp@vmware.com>
Thu, 3 Aug 2017 16:54:18 +0000 (10:54 -0600)
committerBrian Paul <brianp@vmware.com>
Tue, 3 Oct 2017 18:07:05 +0000 (12:07 -0600)
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 <bhenden@vmware.com>
src/gallium/drivers/svga/svga_resource_texture.c

index 5b82e9eb7b6c381984af9c0a896f5f7c32d4fa73..9e4d6c9fb1847f0b13620fcca82decf840244480 100644 (file)
@@ -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: