From 3311e6034a0b487167794bf9627a9efa0026edb6 Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Wed, 5 Aug 2026 02:36:31 +0000 Subject: [PATCH] [Fix] (MG_Impl): report a buffer texture as the wrong object, not the wrong token glGetTextureParameter* resolve the texture by name and then hand the work to the target-based getter, which validates the target it was given. For a buffer texture that is GL_TEXTURE_BUFFER, and the target form correctly calls that an unaccepted token - INVALID_ENUM. By name there is no token to blame. The application named an object that carries none of the sampler or level state the query reports, which is INVALID_OPERATION (GL 4.6 core 8.11). The four by-name getters check the resolved object before delegating, so the error describes what the caller actually got wrong. Fixes direct_state_access.textures_parameter_errors on both backends, taking the group to 74.93% on Espryt and 73.32% on Magma. --- .../MG_Impl/GLImpl/Texture/GL_Texture.cpp | 20 +++++++++++++++++++ tools/cts/README.md | 4 ++-- .../skills/linux-gl-cts-on-mobilegl/SKILL.md | 4 ++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/MobileGL/MG_Impl/GLImpl/Texture/GL_Texture.cpp b/MobileGL/MG_Impl/GLImpl/Texture/GL_Texture.cpp index 2c950ff8..19878b9c 100644 --- a/MobileGL/MG_Impl/GLImpl/Texture/GL_Texture.cpp +++ b/MobileGL/MG_Impl/GLImpl/Texture/GL_Texture.cpp @@ -3793,23 +3793,43 @@ namespace MobileGL::MG_Impl::GLImpl { GetTextureImage(texture, level, format, type, bufSize, pixels); } + // A buffer texture carries none of the sampler or level state these queries report. Reached by + // name there is no target token to blame, so the wrong object is INVALID_OPERATION rather than + // the INVALID_ENUM the target forms report for an unaccepted target (GL 4.6 core 8.11). + static Bool ValidateNamedTextureHasParameters(const SharedPtr& textureObject, + const char* caller) { + if (!textureObject) return false; + if (textureObject->GetStorageType() == TextureStorageType::Buffer) { + MG_State::pGLContext->RecordError( + ErrorCode::InvalidOperation, + MakeUnique("MG_Impl/GLImpl", caller, + "The effective target of `texture` has no texture parameters.")); + return false; + } + return true; + } + void GetTextureParameteriv(GLuint texture, GLenum pname, GLint* params) { auto textureObject = GetTextureObjectByName(texture, __func__); + if (!ValidateNamedTextureHasParameters(textureObject, __func__)) return; WithTemporarilyBoundNamedTexture(textureObject, [&](GLenum target) { GetTexParameteriv_State(target, pname, params); }); } void GetTextureParameterfv(GLuint texture, GLenum pname, GLfloat* params) { auto textureObject = GetTextureObjectByName(texture, __func__); + if (!ValidateNamedTextureHasParameters(textureObject, __func__)) return; WithTemporarilyBoundNamedTexture(textureObject, [&](GLenum target) { GetTexParameterfv_State(target, pname, params); }); } void GetTextureParameterIiv(GLuint texture, GLenum pname, GLint* params) { auto textureObject = GetTextureObjectByName(texture, __func__); + if (!ValidateNamedTextureHasParameters(textureObject, __func__)) return; WithTemporarilyBoundNamedTexture(textureObject, [&](GLenum target) { GetTexParameterIiv_State(target, pname, params); }); } void GetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint* params) { auto textureObject = GetTextureObjectByName(texture, __func__); + if (!ValidateNamedTextureHasParameters(textureObject, __func__)) return; WithTemporarilyBoundNamedTexture(textureObject, [&](GLenum target) { GetTexParameterIuiv_State(target, pname, params); }); } diff --git a/tools/cts/README.md b/tools/cts/README.md index acce48aa..67cd586d 100644 --- a/tools/cts/README.md +++ b/tools/cts/README.md @@ -77,8 +77,8 @@ mustpass list, lavapipe / Mesa 25.2.8, `--deqp-surface-type=fbo`. | backend | conformance | strict Pass | Fail | InternalError | Crash | | --- | ---: | ---: | ---: | ---: | ---: | -| DirectGLES | **74.66%** | 67.12% | 86 | 8 | 0 | -| DirectVulkan | **73.05%** | 72.78% | 89 | 8 | 3 | +| DirectGLES | **74.93%** | 67.39% | 85 | 8 | 0 | +| DirectVulkan | **73.32%** | 73.05% | 88 | 8 | 3 | `textures_storage_multisample_*` is 54 of what remains on either backend and needs a feature rather than a fix: a multisample texture has to be attachable to diff --git a/tools/cts/skills/linux-gl-cts-on-mobilegl/SKILL.md b/tools/cts/skills/linux-gl-cts-on-mobilegl/SKILL.md index f151b9cd..c0e5ff03 100644 --- a/tools/cts/skills/linux-gl-cts-on-mobilegl/SKILL.md +++ b/tools/cts/skills/linux-gl-cts-on-mobilegl/SKILL.md @@ -147,8 +147,8 @@ mustpass list, Mesa 25.2.8, `--deqp-surface-type=fbo`. | backend | renderer | conformance | strict Pass | Fail | InternalError | Crash | | --- | --- | ---: | ---: | ---: | ---: | ---: | -| DirectGLES | Espryt | **74.66%** | 67.12% | 86 | 8 | 0 | -| DirectVulkan | Magma | **73.05%** | 72.78% | 89 | 8 | 3 | +| DirectGLES | Espryt | **74.93%** | 67.39% | 85 | 8 | 0 | +| DirectVulkan | Magma | **73.32%** | 73.05% | 88 | 8 | 3 | ## Contents