svga: adjust render target view format for RGBX
authorBrian Paul <brianp@vmware.com>
Mon, 27 Jun 2016 17:15:07 +0000 (11:15 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 30 Jun 2016 20:32:07 +0000 (14:32 -0600)
For GL_ARB_copy_image we may be asked to create an RGBA view of
a RGBX surface.  Use an RGBX view format for that case.

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

index a0108d22253a2c84253f21206954f48781455d8b..e5943cfd437720124877f5c58784ecf7b682159a 100644 (file)
@@ -452,10 +452,22 @@ svga_validate_surface_view(struct svga_context *svga, struct svga_surface *s)
                                                     &desc);
       }
       else {
+         SVGA3dSurfaceFormat view_format = s->key.format;
+         const struct svga_texture *stex = svga_texture(s->base.texture);
+
+         /* Can't create RGBA render target view of a RGBX surface so adjust
+          * the view format.  We do something similar for texture samplers in
+          * svga_validate_pipe_sampler_view().
+          */
+         if (view_format == SVGA3D_B8G8R8A8_UNORM &&
+             stex->key.format == SVGA3D_B8G8R8X8_TYPELESS) {
+            view_format = SVGA3D_B8G8R8X8_UNORM;
+         }
+
          ret = SVGA3D_vgpu10_DefineRenderTargetView(svga->swc,
                                                     s->view_id,
                                                     s->handle,
-                                                    s->key.format,
+                                                    view_format,
                                                     resType,
                                                     &desc);
       }