Module: Mesa Branch: staging/20.0 Commit: 5e686abe257639b82c9312de88266a0b53c979ad URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e686abe257639b82c9312de88266a0b53c979ad
Author: Marek Olšák <[email protected]> Date: Sun Apr 26 01:23:11 2020 -0400 radeonsi: unify and align down the max SSBO/TBO/UBO buffer binding size Rounding down the size fixes: KHR-GL45.enhanced_layouts.ssb_member_invalid_offset_alignment Fixes: 03e2adc990d239119619f22599204c1b37b83134 Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4761> (cherry picked from commit e58dcc47c3bd4d3f22e9d0a943e339b4866bc616) --- .pick_status.json | 2 +- src/gallium/drivers/radeonsi/si_get.c | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 378e937b727..f6b25381346 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1327,7 +1327,7 @@ "description": "radeonsi: unify and align down the max SSBO/TBO/UBO buffer binding size", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "03e2adc990d239119619f22599204c1b37b83134" }, diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c index 8d70e343396..52fc732aa9a 100644 --- a/src/gallium/drivers/radeonsi/si_get.c +++ b/src/gallium/drivers/radeonsi/si_get.c @@ -30,6 +30,7 @@ #include "vl/vl_video_buffer.h" #include "util/u_screen.h" #include "util/u_video.h" +#include "mesa/main/macros.h" #include "compiler/nir/nir.h" #include <sys/utsname.h> @@ -203,7 +204,8 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE: case PIPE_CAP_MAX_SHADER_BUFFER_SIZE: - return MIN2(sscreen->info.max_alloc_size, INT_MAX); + /* Align it down to 256 bytes. I've chosen the number randomly. */ + return ROUND_DOWN_TO(MIN2(sscreen->info.max_alloc_size, INT_MAX), 256); case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: @@ -370,14 +372,6 @@ static int si_get_shader_param(struct pipe_screen* pscreen, return ir; } - - case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE: { - uint64_t max_const_buffer_size; - pscreen->get_compute_param(pscreen, PIPE_SHADER_IR_NIR, - PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE, - &max_const_buffer_size); - return MIN2(max_const_buffer_size, INT_MAX); - } default: /* If compute shaders don't require a special value * for this cap, we can return the same value we @@ -404,7 +398,7 @@ static int si_get_shader_param(struct pipe_screen* pscreen, case PIPE_SHADER_CAP_MAX_TEMPS: return 256; /* Max native temporaries. */ case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE: - return MIN2(sscreen->info.max_alloc_size, INT_MAX - 3); /* aligned to 4 */ + return si_get_param(pscreen, PIPE_CAP_MAX_SHADER_BUFFER_SIZE); case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: return SI_NUM_CONST_BUFFERS; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
