mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
radeonsi: fix glTexBuffer max size handling
The spec says the number of texels must be clamped to the value of GL_MAX_TEXTURE_BUFFER_SIZE. Reviewed-by: Qiang Yu <yuq825@gmail.com> Reviewed-by: Mihai Preda <mhpreda@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16480>
This commit is contained in:
parent
2f747663c9
commit
74a172a448
7 changed files with 28 additions and 16 deletions
|
|
@ -88,13 +88,6 @@ spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail
|
||||||
spec@arb_shading_language_packing@execution@built-in-functions@fs-packhalf2x16,Fail
|
spec@arb_shading_language_packing@execution@built-in-functions@fs-packhalf2x16,Fail
|
||||||
spec@arb_shading_language_packing@execution@built-in-functions@vs-packhalf2x16,Fail
|
spec@arb_shading_language_packing@execution@built-in-functions@vs-packhalf2x16,Fail
|
||||||
spec@arb_tessellation_shader@execution@tcs-tes-levels-out-of-bounds-write,Crash
|
spec@arb_tessellation_shader@execution@tcs-tes-levels-out-of-bounds-write,Crash
|
||||||
spec@arb_texture_buffer_object@texture-buffer-size-clamp,Fail
|
|
||||||
spec@arb_texture_buffer_object@texture-buffer-size-clamp@r8ui_texture_buffer_size_via_image,Fail
|
|
||||||
spec@arb_texture_buffer_object@texture-buffer-size-clamp@r8ui_texture_buffer_size_via_sampler,Fail
|
|
||||||
spec@arb_texture_buffer_object@texture-buffer-size-clamp@rg8ui_texture_buffer_size_via_image,Fail
|
|
||||||
spec@arb_texture_buffer_object@texture-buffer-size-clamp@rg8ui_texture_buffer_size_via_sampler,Fail
|
|
||||||
spec@arb_texture_buffer_object@texture-buffer-size-clamp@rgba8ui_texture_buffer_size_via_image,Fail
|
|
||||||
spec@arb_texture_buffer_object@texture-buffer-size-clamp@rgba8ui_texture_buffer_size_via_sampler,Fail
|
|
||||||
spec@egl_ext_protected_content@conformance,Fail
|
spec@egl_ext_protected_content@conformance,Fail
|
||||||
spec@ext_framebuffer_blit@fbo-blit-check-limits,Fail
|
spec@ext_framebuffer_blit@fbo-blit-check-limits,Fail
|
||||||
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_uyvy,Fail
|
spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_uyvy,Fail
|
||||||
|
|
|
||||||
|
|
|
@ -102,13 +102,6 @@ spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail
|
||||||
spec@arb_shading_language_packing@execution@built-in-functions@fs-packhalf2x16,Fail
|
spec@arb_shading_language_packing@execution@built-in-functions@fs-packhalf2x16,Fail
|
||||||
spec@arb_shading_language_packing@execution@built-in-functions@vs-packhalf2x16,Fail
|
spec@arb_shading_language_packing@execution@built-in-functions@vs-packhalf2x16,Fail
|
||||||
spec@arb_tessellation_shader@execution@tcs-tes-levels-out-of-bounds-write,Crash
|
spec@arb_tessellation_shader@execution@tcs-tes-levels-out-of-bounds-write,Crash
|
||||||
spec@arb_texture_buffer_object@texture-buffer-size-clamp,Fail
|
|
||||||
spec@arb_texture_buffer_object@texture-buffer-size-clamp@r8ui_texture_buffer_size_via_image,Fail
|
|
||||||
spec@arb_texture_buffer_object@texture-buffer-size-clamp@r8ui_texture_buffer_size_via_sampler,Fail
|
|
||||||
spec@arb_texture_buffer_object@texture-buffer-size-clamp@rg8ui_texture_buffer_size_via_image,Fail
|
|
||||||
spec@arb_texture_buffer_object@texture-buffer-size-clamp@rg8ui_texture_buffer_size_via_sampler,Fail
|
|
||||||
spec@arb_texture_buffer_object@texture-buffer-size-clamp@rgba8ui_texture_buffer_size_via_image,Fail
|
|
||||||
spec@arb_texture_buffer_object@texture-buffer-size-clamp@rgba8ui_texture_buffer_size_via_sampler,Fail
|
|
||||||
spec@arb_texture_compression@texwrap formats bordercolor-swizzled,Fail
|
spec@arb_texture_compression@texwrap formats bordercolor-swizzled,Fail
|
||||||
spec@arb_texture_compression@texwrap formats bordercolor-swizzled@GL_COMPRESSED_RGB- swizzled- border color only,Fail
|
spec@arb_texture_compression@texwrap formats bordercolor-swizzled@GL_COMPRESSED_RGB- swizzled- border color only,Fail
|
||||||
spec@arb_texture_compression@texwrap formats bordercolor-swizzled@GL_COMPRESSED_RGBA- swizzled- border color only,Fail
|
spec@arb_texture_compression@texwrap formats bordercolor-swizzled@GL_COMPRESSED_RGBA- swizzled- border color only,Fail
|
||||||
|
|
|
||||||
|
|
|
@ -755,8 +755,10 @@ static void si_set_shader_image_desc(struct si_context *ctx, const struct pipe_i
|
||||||
if (res->b.b.target == PIPE_BUFFER) {
|
if (res->b.b.target == PIPE_BUFFER) {
|
||||||
if (view->access & PIPE_IMAGE_ACCESS_WRITE)
|
if (view->access & PIPE_IMAGE_ACCESS_WRITE)
|
||||||
si_mark_image_range_valid(view);
|
si_mark_image_range_valid(view);
|
||||||
|
uint32_t size = si_clamp_texture_texel_count(screen->max_texture_buffer_size,
|
||||||
|
view->format, view->u.buf.size);
|
||||||
|
|
||||||
si_make_buffer_descriptor(screen, res, view->format, view->u.buf.offset, view->u.buf.size,
|
si_make_buffer_descriptor(screen, res, view->format, view->u.buf.offset, size,
|
||||||
desc);
|
desc);
|
||||||
si_set_buf_desc_address(res, view->u.buf.offset, desc + 4);
|
si_set_buf_desc_address(res, view->u.buf.offset, desc + 4);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1141,6 +1141,9 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws,
|
||||||
si_init_screen_query_functions(sscreen);
|
si_init_screen_query_functions(sscreen);
|
||||||
si_init_screen_live_shader_cache(sscreen);
|
si_init_screen_live_shader_cache(sscreen);
|
||||||
|
|
||||||
|
sscreen->max_texture_buffer_size = sscreen->b.get_param(
|
||||||
|
&sscreen->b, PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE);
|
||||||
|
|
||||||
/* Set these flags in debug_flags early, so that the shader cache takes
|
/* Set these flags in debug_flags early, so that the shader cache takes
|
||||||
* them into account.
|
* them into account.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -604,6 +604,8 @@ struct si_screen {
|
||||||
/* Texture filter settings. */
|
/* Texture filter settings. */
|
||||||
int force_aniso; /* -1 = disabled */
|
int force_aniso; /* -1 = disabled */
|
||||||
|
|
||||||
|
unsigned max_texture_buffer_size;
|
||||||
|
|
||||||
/* Auxiliary context. Mainly used to initialize resources.
|
/* Auxiliary context. Mainly used to initialize resources.
|
||||||
* It must be locked prior to using and flushed before unlocking. */
|
* It must be locked prior to using and flushed before unlocking. */
|
||||||
struct pipe_context *aux_context;
|
struct pipe_context *aux_context;
|
||||||
|
|
|
||||||
|
|
@ -4556,8 +4556,11 @@ static struct pipe_sampler_view *si_create_sampler_view(struct pipe_context *ctx
|
||||||
|
|
||||||
/* Buffer resource. */
|
/* Buffer resource. */
|
||||||
if (texture->target == PIPE_BUFFER) {
|
if (texture->target == PIPE_BUFFER) {
|
||||||
|
uint32_t size = si_clamp_texture_texel_count(sctx->screen->max_texture_buffer_size,
|
||||||
|
state->format, state->u.buf.size);
|
||||||
|
|
||||||
si_make_buffer_descriptor(sctx->screen, si_resource(texture), state->format,
|
si_make_buffer_descriptor(sctx->screen, si_resource(texture), state->format,
|
||||||
state->u.buf.offset, state->u.buf.size, view->state);
|
state->u.buf.offset, size, view->state);
|
||||||
return &view->base;
|
return &view->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -650,6 +650,22 @@ static inline unsigned si_get_image_slot(unsigned slot)
|
||||||
return SI_NUM_IMAGE_SLOTS - 1 - slot;
|
return SI_NUM_IMAGE_SLOTS - 1 - slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline unsigned si_clamp_texture_texel_count(unsigned max_texture_buffer_size,
|
||||||
|
enum pipe_format format,
|
||||||
|
uint32_t size)
|
||||||
|
{
|
||||||
|
/* The spec says:
|
||||||
|
* The number of texels in the texel array is then clamped to the value of
|
||||||
|
* the implementation-dependent limit GL_MAX_TEXTURE_BUFFER_SIZE.
|
||||||
|
*
|
||||||
|
* So compute the number of texels, compare to GL_MAX_TEXTURE_BUFFER_SIZE and update it.
|
||||||
|
*/
|
||||||
|
unsigned stride = util_format_get_blocksize(format);
|
||||||
|
unsigned num_texels = MIN2(max_texture_buffer_size,
|
||||||
|
size / stride);
|
||||||
|
return num_texels * stride;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue