svga: set render target flag for snorm surfaces
authorBrian Paul <brianp@vmware.com>
Mon, 27 Jun 2016 17:18:10 +0000 (11:18 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 30 Jun 2016 20:32:07 +0000 (14:32 -0600)
We don't normally support rendering to SNORM surfaces, but with
GL_ARB_copy_image we can copy to them if we treat them as typeless
and use a UNORM surface view.

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

index 3f91c86e64cffbeb16e83105c57d3ac80b53146b..9e1aaabd18c75452de3a488f769a79ac13cc1140 100644 (file)
@@ -963,6 +963,16 @@ svga_texture_create(struct pipe_screen *screen,
                       svga_format_name(typeless),
                       bindings);
       }
+
+      if (svga_format_is_uncompressed_snorm(tex->key.format)) {
+         /* We can't normally render to snorm surfaces, but once we
+          * substitute a typeless format, we can if the rendertarget view
+          * is unorm.  This can happen with GL_ARB_copy_image.
+          */
+         tex->key.flags |= SVGA3D_SURFACE_HINT_RENDERTARGET;
+         tex->key.flags |= SVGA3D_SURFACE_BIND_RENDER_TARGET;
+      }
+
       tex->key.format = typeless;
    }