From 70f1603125a8cfbe3fd1f3e856b68f8e83431eb4 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 30 Oct 2025 13:33:45 +0100 Subject: [PATCH] mesa/main: do not check for ARB_texture_buffer_object for GL 3.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While OpenGL 3.1 does require texture buffer objects, the ARB spec for this requires support for texture buffers with alpha, luminance, luminance-alpha and intensity formats in addition to RGBA formats. The version of texture buffer objects that ended up in the OpenGL spec (even in the compatibility spec) does not require these formats. But, we don't even need to check this, because this is already included in the GLSL 1.40 requirement that's also checked. So this shouldn't make us expose GL 3.1 in cases where it isn't supported in the first place. Reviewed-by: Lars-Ivar Hesselberg Simonsen Reviewed-by: Iago Toral Quiroga Reviewed-by: Marek Olšák Part-of: --- docs/features.txt | 3 ++- src/mesa/main/context.h | 3 ++- src/mesa/main/get.c | 8 +++++++- src/mesa/main/version.c | 1 - src/mesa/state_tracker/st_extensions.c | 4 ++-- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/docs/features.txt b/docs/features.txt index 9d335141383..e0e2b64a958 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -76,7 +76,7 @@ GL 3.1, GLSL 1.40 --- all DONE: freedreno, nv50, nvc0, r600, radeonsi, llvmpipe, GL_ARB_copy_buffer (Buffer copying) DONE (v3d, vc4, lima, crocus) GL_NV_primitive_restart (Primitive restart) DONE (v3d, crocus) 16 vertex texture image units DONE (v3d) - GL_ARB_texture_buffer_object (Texture buffer objs) DONE (v3d) + Texture buffer objs DONE (v3d) GL_ARB_texture_rectangle (Rectangular textures) DONE (v3d, vc4, lima, crocus, etnaviv) GL_ARB_uniform_buffer_object (Uniform buffer objs) DONE (v3d, crocus) GL_EXT_texture_snorm (Signed normalized textures) DONE (v3d, crocus, etnaviv/HALTI1) @@ -316,6 +316,7 @@ Khronos, ARB, and OES extensions that are not part of any OpenGL or OpenGL ES ve GL_ARB_sparse_texture DONE (radeonsi/gfx9+, zink) GL_ARB_sparse_texture2 DONE (radeonsi/gfx9+, zink) GL_ARB_sparse_texture_clamp DONE (radeonsi/gfx9+, zink) + GL_ARB_texture_buffer_object DONE (freedreno, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe, virgl, zink, d3d12, panfrost, asahi, iris, crocus/gen6+, v3d) GL_ARB_texture_filter_minmax DONE (freedreno/a6xx, iris/gen9+, llvmpipe, nvc0/gm200+, zink) GL_ARM_shader_framebuffer_fetch_depth_stencil DONE (llvmpipe) GL_EXT_shader_framebuffer_fetch DONE (freedreno/a6xx, iris/gen9+, llvmpipe, panfrost, virgl, zink, asahi, v3d) diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 6b7cb306174..a8aa280a730 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -487,7 +487,8 @@ static inline bool _mesa_has_texture_buffer_object(const struct gl_context *ctx) { return _mesa_has_ARB_texture_buffer_object(ctx) || - _mesa_has_OES_texture_buffer(ctx); + _mesa_has_OES_texture_buffer(ctx) || + (_mesa_is_desktop_gl(ctx) && ctx->Version >= 31); } static inline bool diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 6d471a05af3..8b523790f30 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -214,6 +214,7 @@ enum value_extra { EXTRA_EXT_FB_NO_ATTACH_GS, EXTRA_EXT_ES_GS, EXTRA_EXT_PROVOKING_VERTEX_32, + EXTRA_EXT_TBO, }; #define NO_EXTRA NULL @@ -379,7 +380,7 @@ static const int extra_GLSL_130_es3_gpushader4[] = { }; static const int extra_texture_buffer_object[] = { - EXT(ARB_texture_buffer_object), + EXTRA_EXT_TBO, EXTRA_END }; @@ -1582,6 +1583,11 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d if (_mesa_is_desktop_gl_compat(ctx) || version == 32) api_found = ctx->Extensions.EXT_provoking_vertex; break; + case EXTRA_EXT_TBO: + api_check = GL_TRUE; + if (_mesa_has_texture_buffer_object(ctx)) + api_found = GL_TRUE; + break; case EXTRA_END: break; default: /* *e is a offset into the extension struct */ diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index c97a338fc30..17a53ddcd5c 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -291,7 +291,6 @@ compute_version(const struct gl_extensions *extensions, const bool ver_3_1 = (ver_3_0 && consts->GLSLVersion >= 140 && extensions->ARB_draw_instanced && - extensions->ARB_texture_buffer_object && extensions->ARB_uniform_buffer_object && extensions->EXT_texture_snorm && extensions->NV_primitive_restart && diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 00cf67af1f4..ef06d3cfc1a 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -1567,7 +1567,7 @@ void st_init_extensions(struct pipe_screen *screen, screen->caps.buffer_sampler_view_rgba_only) extensions->ARB_texture_buffer_object = GL_FALSE; - if (extensions->ARB_texture_buffer_object) { + if (screen->caps.texture_buffer_objects) { consts->MaxTextureBufferSize = screen->caps.max_texel_buffer_elements; consts->TextureBufferOffsetAlignment = @@ -1583,7 +1583,7 @@ void st_init_extensions(struct pipe_screen *screen, extensions->OES_texture_buffer = consts->Program[MESA_SHADER_COMPUTE].MaxImageUniforms && - extensions->ARB_texture_buffer_object && + screen->caps.texture_buffer_objects && extensions->ARB_texture_buffer_range && extensions->ARB_texture_buffer_object_rgb32;