svga: set PIPE_BIND_DEPTH_STENCIL flag for new resources when possible
authorBrian Paul <brianp@vmware.com>
Tue, 20 Sep 2016 23:22:42 +0000 (17:22 -0600)
committerBrian Paul <brianp@vmware.com>
Sat, 24 Sep 2016 01:54:42 +0000 (19:54 -0600)
When we create a depth/stencil texture, also check if we can render to
it and set the PIPE_BIND_DEPTH_STENCIL flag.  We were previously doing
this for color textures (PIPE_BIND_RENDER_TARGET).

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

index ea26c3e822c8d4786f58561bfcef8d56cd35c5a6..fc5c3741b544985373901891e8f23460341d9ee1 100644 (file)
@@ -975,7 +975,7 @@ svga_texture_create(struct pipe_screen *screen,
       tex->key.flags |= SVGA3D_SURFACE_BIND_SHADER_RESOURCE;
 
       if (!(bindings & PIPE_BIND_RENDER_TARGET)) {
-         /* Also check if the format is renderable */
+         /* Also check if the format is color renderable */
          if (screen->is_format_supported(screen, template->format,
                                          template->target,
                                          template->nr_samples,
@@ -983,6 +983,16 @@ svga_texture_create(struct pipe_screen *screen,
             bindings |= PIPE_BIND_RENDER_TARGET;
          }
       }
+
+      if (!(bindings & PIPE_BIND_DEPTH_STENCIL)) {
+         /* Also check if the format is depth/stencil renderable */
+         if (screen->is_format_supported(screen, template->format,
+                                         template->target,
+                                         template->nr_samples,
+                                         PIPE_BIND_DEPTH_STENCIL)) {
+            bindings |= PIPE_BIND_DEPTH_STENCIL;
+         }
+      }
    }
 
    if (bindings & PIPE_BIND_DISPLAY_TARGET) {