summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2022-04-16 12:16:14 -0400
committerMarge Bot <emma+marge@anholt.net>2022-04-18 17:54:20 +0000
commitd275d6c32f672ba1fcbcb8c4cb1a6719a56b507d (patch)
treea9569047e4158e970e0ee49a52a72c69375e671e
parentb761b514513e8648b15520fd5f6b68b58a41300d (diff)
zink: clamp max shader images to 32
NO MATTER WHAT. Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16013>
-rw-r--r--src/gallium/drivers/zink/zink_compiler.c4
-rw-r--r--src/gallium/drivers/zink/zink_context.h10
-rw-r--r--src/gallium/drivers/zink/zink_screen.c2
3 files changed, 8 insertions, 8 deletions
diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c
index 08a86d629c2..7ded9703604 100644
--- a/src/gallium/drivers/zink/zink_compiler.c
+++ b/src/gallium/drivers/zink/zink_compiler.c
@@ -1749,8 +1749,8 @@ zink_binding(gl_shader_stage stage, VkDescriptorType type, int index)
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
- assert(index < PIPE_MAX_SHADER_IMAGES);
- return (stage * PIPE_MAX_SHADER_IMAGES) + index;
+ assert(index < ZINK_MAX_SHADER_IMAGES);
+ return (stage * ZINK_MAX_SHADER_IMAGES) + index;
default:
unreachable("unexpected type");
diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index 18b6f688354..2f9c2fb6038 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -29,7 +29,7 @@
#define ZINK_DEFAULT_MAX_DESCS 5000
#define ZINK_DEFAULT_DESC_CLAMP (ZINK_DEFAULT_MAX_DESCS * 0.9)
-
+#define ZINK_MAX_SHADER_IMAGES 32
#define ZINK_MAX_BINDLESS_HANDLES 1024
#include "zink_clear.h"
@@ -213,7 +213,7 @@ struct zink_context {
struct pipe_constant_buffer ubos[PIPE_SHADER_TYPES][PIPE_MAX_CONSTANT_BUFFERS];
struct pipe_shader_buffer ssbos[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_BUFFERS];
uint32_t writable_ssbos[PIPE_SHADER_TYPES];
- struct zink_image_view image_views[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_IMAGES];
+ struct zink_image_view image_views[PIPE_SHADER_TYPES][ZINK_MAX_SHADER_IMAGES];
struct pipe_framebuffer_state fb_state;
struct zink_framebuffer *(*get_framebuffer)(struct zink_context*);
@@ -329,15 +329,15 @@ struct zink_context {
uint8_t num_samplers[PIPE_SHADER_TYPES];
uint8_t num_sampler_views[PIPE_SHADER_TYPES];
- VkDescriptorImageInfo images[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_IMAGES];
- VkBufferView texel_images[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_IMAGES];
+ VkDescriptorImageInfo images[PIPE_SHADER_TYPES][ZINK_MAX_SHADER_IMAGES];
+ VkBufferView texel_images[PIPE_SHADER_TYPES][ZINK_MAX_SHADER_IMAGES];
uint8_t num_images[PIPE_SHADER_TYPES];
VkDescriptorImageInfo fbfetch;
struct zink_resource *descriptor_res[ZINK_DESCRIPTOR_TYPES][PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
struct zink_descriptor_surface sampler_surfaces[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
- struct zink_descriptor_surface image_surfaces[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_IMAGES];
+ struct zink_descriptor_surface image_surfaces[PIPE_SHADER_TYPES][ZINK_MAX_SHADER_IMAGES];
struct {
struct util_idalloc tex_slots;
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index d87d2f40207..6d9aea21cfa 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -1015,7 +1015,7 @@ zink_get_shader_param(struct pipe_screen *pscreen,
if (screen->info.feats.features.shaderStorageImageExtendedFormats &&
screen->info.feats.features.shaderStorageImageWriteWithoutFormat)
return MIN2(screen->info.props.limits.maxPerStageDescriptorStorageImages,
- PIPE_MAX_SHADER_IMAGES);
+ ZINK_MAX_SHADER_IMAGES);
return 0;
case PIPE_SHADER_CAP_LOWER_IF_THRESHOLD: