mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-09 12:48:32 +09:00
[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.
This commit is contained in:
@@ -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<MG_State::GLState::ITextureObject>& textureObject,
|
||||
const char* caller) {
|
||||
if (!textureObject) return false;
|
||||
if (textureObject->GetStorageType() == TextureStorageType::Buffer) {
|
||||
MG_State::pGLContext->RecordError(
|
||||
ErrorCode::InvalidOperation,
|
||||
MakeUnique<GenericErrorInfo>("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); });
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user