Mesa (master): gallium: do not reset buffers for unsupported stages

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Dec 7 17:58:30 UTC 2020


Module: Mesa
Branch: master
Commit: 3abac03d49b5dc4a6642fe0637da5a19ad60dd4f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3abac03d49b5dc4a6642fe0637da5a19ad60dd4f

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Mon Dec  7 17:42:43 2020 +0100

gallium: do not reset buffers for unsupported stages

There's no good reason why drivers that doesn't grok geometry,
tesselation or compute shaders needs to deal with them.

This fixes a crash on a lot of Piglit tests for Zink.

Fixes: daaf5f1d186 ("gallium: Fix leak of currently bound UBOs at CSO context destruction.")
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7971>

---

 src/gallium/auxiliary/cso_cache/cso_context.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 83ae170ad92..a7550afc033 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -370,6 +370,24 @@ void cso_destroy_context( struct cso_context *ctx )
          struct pipe_screen *scr = ctx->pipe->screen;
          enum pipe_shader_type sh;
          for (sh = 0; sh < PIPE_SHADER_TYPES; sh++) {
+            switch (sh) {
+            case PIPE_SHADER_GEOMETRY:
+               if (!ctx->has_geometry_shader)
+                  continue;
+               break;
+            case PIPE_SHADER_TESS_CTRL:
+            case PIPE_SHADER_TESS_EVAL:
+               if (!ctx->has_tessellation)
+                  continue;
+               break;
+            case PIPE_SHADER_COMPUTE:
+               if (!ctx->has_compute_shader)
+                  continue;
+               break;
+            default:
+               break;
+            }
+
             int maxsam = scr->get_shader_param(scr, sh,
                                                PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS);
             int maxview = scr->get_shader_param(scr, sh,



More information about the mesa-commit mailing list