[Mesa-dev] [PATCH 6/8] svga: set PIPE_BIND_DEPTH_STENCIL flag for new resources when possible

Brian Paul brianp at vmware.com
Fri Sep 23 15:48:16 UTC 2016


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).
---
 src/gallium/drivers/svga/svga_resource_texture.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c
index ea26c3e..fc5c374 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -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) {
-- 
1.9.1



More information about the mesa-dev mailing list