From d850e2a3f2feabcb622aef56537b0d66ed7ba931 Mon Sep 17 00:00:00 2001 From: Duncan Hopkins Date: Tue, 9 Apr 2019 17:22:53 +0100 Subject: [PATCH] zink: clamped limits to INT_MAX when stored as uint32_t. Acked-by: Jordan Justen --- src/gallium/drivers/zink/zink_screen.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 88b2d5088d4..c5ce0c3054e 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -361,7 +361,7 @@ zink_get_shader_param(struct pipe_screen *pscreen, PIPE_MAX_SAMPLERS); case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE: - return screen->props.limits.maxUniformBufferRange; + return MIN2(screen->props.limits.maxUniformBufferRange, INT_MAX); case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: return screen->props.limits.maxPerStageDescriptorUniformBuffers; @@ -408,7 +408,8 @@ zink_get_shader_param(struct pipe_screen *pscreen, return (1 << PIPE_SHADER_IR_NIR) | (1 << PIPE_SHADER_IR_TGSI); case PIPE_SHADER_CAP_MAX_SHADER_IMAGES: - return screen->props.limits.maxPerStageDescriptorStorageImages; + return MIN2(screen->props.limits.maxPerStageDescriptorStorageImages, + PIPE_MAX_SHADER_IMAGES); case PIPE_SHADER_CAP_LOWER_IF_THRESHOLD: case PIPE_SHADER_CAP_TGSI_SKIP_MERGE_REGISTERS: -- 2.30.2