zink: do not report texture-samplers for unsupported stages
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 14 Feb 2020 14:42:51 +0000 (15:42 +0100)
committerMarge Bot <eric+marge@anholt.net>
Mon, 17 Feb 2020 10:00:18 +0000 (10:00 +0000)
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

index b3299976f8f3ddd2ae185e7d2581963c35413112..9d751d30eff94fe92e0e86eb836eb1015f8bb945 100644 (file)
@@ -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);