mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 05:38:31 +09:00
[Fix, Test] (GLImpl): answer GL_IMAGE_FORMAT_COMPATIBILITY_TYPE from glGetTexParameterfv
This commit is contained in:
@@ -3059,6 +3059,15 @@ namespace MobileGL::MG_Impl::GLImpl {
|
|||||||
*params = textureObject->GetSamplerObject()->GetMaxAnisotropy();
|
*params = textureObject->GetSamplerObject()->GetMaxAnisotropy();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
// GL 4.6 core 8.11 lists this among the parameters EVERY GetTexParameter form answers.
|
||||||
|
// It was handled by the iv/Iiv/Iuiv getters and missed by this one, so the float query
|
||||||
|
// raised GL_INVALID_ENUM and left the caller's float untouched - which is what
|
||||||
|
// KHR-GL4x.shader_image_load_store.basic-api-texParam reads back.
|
||||||
|
case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE:
|
||||||
|
if (params) {
|
||||||
|
*params = static_cast<GLfloat>(GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
||||||
if (params) {
|
if (params) {
|
||||||
*params = static_cast<GLfloat>(textureObject->GetDepthStencilTextureMode());
|
*params = static_cast<GLfloat>(textureObject->GetDepthStencilTextureMode());
|
||||||
|
|||||||
@@ -4809,3 +4809,41 @@ TEST_F(TextureTest, CopyImageSubDataDoesNotApplyMipmapCompletenessToMultisampleT
|
|||||||
EXPECT_TRUE(g_copyImageSubDataCall.Called);
|
EXPECT_TRUE(g_copyImageSubDataCall.Called);
|
||||||
EXPECT_EQ(MG_Impl::GLImpl::GetError(), GL_NO_ERROR);
|
EXPECT_EQ(MG_Impl::GLImpl::GetError(), GL_NO_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GL 4.6 core 8.11 makes GL_IMAGE_FORMAT_COMPATIBILITY_TYPE readable through every
|
||||||
|
// GetTexParameter form. Three of MobileGL's four getters answered it and glGetTexParameterfv did
|
||||||
|
// not, so the float query raised GL_INVALID_ENUM and left the caller's float uninitialised
|
||||||
|
// (KHR-GL4x.shader_image_load_store.basic-api-texParam reads it with both iv and fv and compares
|
||||||
|
// them). Asserted across all four here, because an enum present in three of four parallel
|
||||||
|
// switches is the drift shape that comes back.
|
||||||
|
TEST_F(TextureTest, ImageFormatCompatibilityTypeAgreesAcrossEveryTexParameterGetter) {
|
||||||
|
GLuint texture = 0;
|
||||||
|
MG_Impl::GLImpl::GenTextures(1, &texture);
|
||||||
|
MG_Impl::GLImpl::BindTexture(GL_TEXTURE_2D, texture);
|
||||||
|
MG_Impl::GLImpl::TexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 4, 4);
|
||||||
|
DrainPendingGlErrors();
|
||||||
|
|
||||||
|
GLint integerValue = 0;
|
||||||
|
MG_Impl::GLImpl::GetTexParameteriv(GL_TEXTURE_2D, GL_IMAGE_FORMAT_COMPATIBILITY_TYPE, &integerValue);
|
||||||
|
EXPECT_EQ(integerValue, GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE);
|
||||||
|
EXPECT_EQ(MG_Impl::GLImpl::GetError(), GL_NO_ERROR);
|
||||||
|
|
||||||
|
GLfloat floatValue = 0.0f;
|
||||||
|
MG_Impl::GLImpl::GetTexParameterfv(GL_TEXTURE_2D, GL_IMAGE_FORMAT_COMPATIBILITY_TYPE, &floatValue);
|
||||||
|
EXPECT_FLOAT_EQ(floatValue, static_cast<GLfloat>(GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE));
|
||||||
|
EXPECT_EQ(MG_Impl::GLImpl::GetError(), GL_NO_ERROR);
|
||||||
|
|
||||||
|
GLint signedValue = 0;
|
||||||
|
MG_Impl::GLImpl::GetTexParameterIiv(GL_TEXTURE_2D, GL_IMAGE_FORMAT_COMPATIBILITY_TYPE, &signedValue);
|
||||||
|
EXPECT_EQ(signedValue, GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE);
|
||||||
|
EXPECT_EQ(MG_Impl::GLImpl::GetError(), GL_NO_ERROR);
|
||||||
|
|
||||||
|
GLuint unsignedValue = 0;
|
||||||
|
MG_Impl::GLImpl::GetTexParameterIuiv(GL_TEXTURE_2D, GL_IMAGE_FORMAT_COMPATIBILITY_TYPE, &unsignedValue);
|
||||||
|
EXPECT_EQ(unsignedValue, static_cast<GLuint>(GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE));
|
||||||
|
EXPECT_EQ(MG_Impl::GLImpl::GetError(), GL_NO_ERROR);
|
||||||
|
|
||||||
|
MG_Impl::GLImpl::BindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
MG_Impl::GLImpl::DeleteTextures(1, &texture);
|
||||||
|
DrainPendingGlErrors();
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user