svga: adjust sampler view format for RGBX
authorBrian Paul <brianp@vmware.com>
Mon, 27 Jun 2016 17:16:03 +0000 (11:16 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 30 Jun 2016 20:32:07 +0000 (14:32 -0600)
We previously handled the case of a RGBX sampler view of a RGBA surface.
Add the reverse case too.  For GL_ARB_copy_image.

Acked-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
src/gallium/drivers/svga/svga_state_sampler.c

index 6e78825954f9ab1ba288de16043627b62589b543..00e8fc0e6c88857e6f8a9648a1f5d9ebaaa6545f 100644 (file)
@@ -106,12 +106,16 @@ svga_validate_pipe_sampler_view(struct svga_context *svga,
       enum pipe_format pformat = sv->base.format;
 
       /* vgpu10 cannot create a BGRX view for a BGRA resource, so force it to
-       * create a BGRA view.
+       * create a BGRA view (and vice versa).
        */
       if (pformat == PIPE_FORMAT_B8G8R8X8_UNORM &&
           sv->base.texture->format == PIPE_FORMAT_B8G8R8A8_UNORM) {
          pformat = PIPE_FORMAT_B8G8R8A8_UNORM;
       }
+      else if (pformat == PIPE_FORMAT_B8G8R8A8_UNORM &&
+          sv->base.texture->format == PIPE_FORMAT_B8G8R8X8_UNORM) {
+         pformat = PIPE_FORMAT_B8G8R8X8_UNORM;
+      }
 
       format = svga_translate_format(ss, pformat,
                                      PIPE_BIND_SAMPLER_VIEW);