Mesa (master): zink: do not report texture-samplers for unsupported stages

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Feb 17 10:22:17 UTC 2020


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

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Fri Feb 14 15:42:51 2020 +0100

zink: do not report texture-samplers for unsupported stages

This caused the max combined samplers to be reported as artificially
high.

Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3826>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3826>

---

 src/gallium/drivers/zink/zink_screen.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index b3299976f8f..9d751d30eff 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -386,9 +386,15 @@ zink_get_shader_param(struct pipe_screen *pscreen,
       }
 
    case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
-      /* this might be a bit simplistic... */
-      return MIN2(screen->props.limits.maxPerStageDescriptorSamplers,
-                  PIPE_MAX_SAMPLERS);
+      switch (shader) {
+      case PIPE_SHADER_VERTEX:
+      case PIPE_SHADER_FRAGMENT:
+         /* this might be a bit simplistic... */
+         return MIN2(screen->props.limits.maxPerStageDescriptorSamplers,
+                     PIPE_MAX_SAMPLERS);
+      default:
+         return 0; /* unsupported stage */
+      }
 
    case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
       return MIN2(screen->props.limits.maxUniformBufferRange, INT_MAX);



More information about the mesa-commit mailing list