Commit e33c1582 by shrekshao Committed by Commit Bot

Fix EXT_texture_norm16

* Add norm16 format info for OpenGL backend * Add validation for newly introduced norm16 formats * Fix some logic of texture tests Bug: chromium:1000354, angleproject:1365 Change-Id: Ie6d6e5e276da4df4b7c667be28d324d4976b35ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1902720Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarShrek Shao <shrekshao@google.com> Commit-Queue: Shrek Shao <shrekshao@google.com>
parent 82fd2540
...@@ -875,7 +875,7 @@ const ExtensionInfoMap &GetExtensionInfoMap() ...@@ -875,7 +875,7 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_CHROMIUM_color_buffer_float_rgba"] = enableableExtension(&Extensions::colorBufferFloatRGBA); map["GL_CHROMIUM_color_buffer_float_rgba"] = enableableExtension(&Extensions::colorBufferFloatRGBA);
map["GL_EXT_multisample_compatibility"] = esOnlyExtension(&Extensions::multisampleCompatibility); map["GL_EXT_multisample_compatibility"] = esOnlyExtension(&Extensions::multisampleCompatibility);
map["GL_CHROMIUM_framebuffer_mixed_samples"] = esOnlyExtension(&Extensions::framebufferMixedSamples); map["GL_CHROMIUM_framebuffer_mixed_samples"] = esOnlyExtension(&Extensions::framebufferMixedSamples);
map["GL_EXT_texture_norm16"] = esOnlyExtension(&Extensions::textureNorm16); map["GL_EXT_texture_norm16"] = enableableExtension(&Extensions::textureNorm16);
map["GL_CHROMIUM_path_rendering"] = esOnlyExtension(&Extensions::pathRendering); map["GL_CHROMIUM_path_rendering"] = esOnlyExtension(&Extensions::pathRendering);
map["GL_OES_surfaceless_context"] = esOnlyExtension(&Extensions::surfacelessContext); map["GL_OES_surfaceless_context"] = esOnlyExtension(&Extensions::surfacelessContext);
map["GL_ANGLE_client_arrays"] = esOnlyExtension(&Extensions::clientArrays); map["GL_ANGLE_client_arrays"] = esOnlyExtension(&Extensions::clientArrays);
......
...@@ -209,6 +209,16 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() ...@@ -209,6 +209,16 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
InsertFormatMapping(&map, GL_RGBA32I, VersionOrExts(3, 0, "GL_EXT_texture_integer"), NeverSupported(), VersionOrExts(3, 0, "GL_EXT_texture_integer"), VersionOnly(3, 0), NeverSupported(), VersionOnly(3, 0), VersionOnly(3, 0) ); InsertFormatMapping(&map, GL_RGBA32I, VersionOrExts(3, 0, "GL_EXT_texture_integer"), NeverSupported(), VersionOrExts(3, 0, "GL_EXT_texture_integer"), VersionOnly(3, 0), NeverSupported(), VersionOnly(3, 0), VersionOnly(3, 0) );
InsertFormatMapping(&map, GL_RGBA32UI, VersionOrExts(3, 0, "GL_EXT_texture_integer"), NeverSupported(), VersionOrExts(3, 0, "GL_EXT_texture_integer"), VersionOnly(3, 0), NeverSupported(), VersionOnly(3, 0), VersionOnly(3, 0) ); InsertFormatMapping(&map, GL_RGBA32UI, VersionOrExts(3, 0, "GL_EXT_texture_integer"), NeverSupported(), VersionOrExts(3, 0, "GL_EXT_texture_integer"), VersionOnly(3, 0), NeverSupported(), VersionOnly(3, 0), VersionOnly(3, 0) );
InsertFormatMapping(&map, GL_R16, VersionOrExts(3, 0, "GL_ARB_texture_rg"), AlwaysSupported(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), ExtsOnly("GL_EXT_texture_norm16"), AlwaysSupported(), ExtsOnly("GL_EXT_texture_norm16"), ExtsOnly("GL_EXT_texture_norm16") );
InsertFormatMapping(&map, GL_RG16, VersionOrExts(3, 0, "GL_ARB_texture_rg"), AlwaysSupported(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), ExtsOnly("GL_EXT_texture_norm16"), AlwaysSupported(), ExtsOnly("GL_EXT_texture_norm16"), ExtsOnly("GL_EXT_texture_norm16") );
InsertFormatMapping(&map, GL_RGB16, AlwaysSupported(), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_norm16"), AlwaysSupported(), NeverSupported(), NeverSupported() );
InsertFormatMapping(&map, GL_RGBA16, AlwaysSupported(), AlwaysSupported(), AlwaysSupported(), ExtsOnly("GL_EXT_texture_norm16"), AlwaysSupported(), ExtsOnly("GL_EXT_texture_norm16"), ExtsOnly("GL_EXT_texture_norm16") );
InsertFormatMapping(&map, GL_R16_SNORM, VersionOnly(3, 1), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_norm16"), AlwaysSupported(), NeverSupported(), NeverSupported() );
InsertFormatMapping(&map, GL_RG16_SNORM, VersionOnly(3, 1), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_norm16"), AlwaysSupported(), NeverSupported(), NeverSupported() );
InsertFormatMapping(&map, GL_RGB16_SNORM, VersionOnly(3, 1), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_norm16"), AlwaysSupported(), NeverSupported(), NeverSupported() );
InsertFormatMapping(&map, GL_RGBA16_SNORM, VersionOnly(3, 1), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_norm16"), AlwaysSupported(), NeverSupported(), NeverSupported() );
// Unsized formats // Unsized formats
InsertFormatMapping(&map, GL_ALPHA, NeverSupported(), NeverSupported(), NeverSupported(), AlwaysSupported(), AlwaysSupported(), NeverSupported(), NeverSupported() ); InsertFormatMapping(&map, GL_ALPHA, NeverSupported(), NeverSupported(), NeverSupported(), AlwaysSupported(), AlwaysSupported(), NeverSupported(), NeverSupported() );
InsertFormatMapping(&map, GL_LUMINANCE, NeverSupported(), NeverSupported(), NeverSupported(), AlwaysSupported(), AlwaysSupported(), NeverSupported(), NeverSupported() ); InsertFormatMapping(&map, GL_LUMINANCE, NeverSupported(), NeverSupported(), NeverSupported(), AlwaysSupported(), AlwaysSupported(), NeverSupported(), NeverSupported() );
......
...@@ -1429,6 +1429,14 @@ bool ValidateES2TexImageParametersBase(Context *context, ...@@ -1429,6 +1429,14 @@ bool ValidateES2TexImageParametersBase(Context *context,
return false; return false;
} }
break; break;
case GL_SHORT:
case GL_UNSIGNED_SHORT:
if (!context->getExtensions().textureNorm16)
{
context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false;
}
break;
default: default:
context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
return false; return false;
...@@ -1443,6 +1451,15 @@ bool ValidateES2TexImageParametersBase(Context *context, ...@@ -1443,6 +1451,15 @@ bool ValidateES2TexImageParametersBase(Context *context,
case GL_FLOAT: case GL_FLOAT:
case GL_HALF_FLOAT_OES: case GL_HALF_FLOAT_OES:
break; break;
case GL_SHORT:
case GL_UNSIGNED_SHORT:
if (!context->getExtensions().textureNorm16)
{
context->validationError(GL_INVALID_OPERATION,
kMismatchedTypeAndFormat);
return false;
}
break;
default: default:
context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
return false; return false;
...@@ -1458,6 +1475,15 @@ bool ValidateES2TexImageParametersBase(Context *context, ...@@ -1458,6 +1475,15 @@ bool ValidateES2TexImageParametersBase(Context *context,
case GL_HALF_FLOAT_OES: case GL_HALF_FLOAT_OES:
case GL_UNSIGNED_INT_2_10_10_10_REV_EXT: case GL_UNSIGNED_INT_2_10_10_10_REV_EXT:
break; break;
case GL_SHORT:
case GL_UNSIGNED_SHORT:
if (!context->getExtensions().textureNorm16)
{
context->validationError(GL_INVALID_OPERATION,
kMismatchedTypeAndFormat);
return false;
}
break;
default: default:
context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
return false; return false;
...@@ -1780,6 +1806,20 @@ bool ValidateES2TexImageParametersBase(Context *context, ...@@ -1780,6 +1806,20 @@ bool ValidateES2TexImageParametersBase(Context *context,
break; break;
case GL_R16_EXT:
case GL_RG16_EXT:
case GL_RGB16_EXT:
case GL_RGBA16_EXT:
case GL_R16_SNORM_EXT:
case GL_RG16_SNORM_EXT:
case GL_RGB16_SNORM_EXT:
case GL_RGBA16_SNORM_EXT:
if (!context->getExtensions().textureNorm16)
{
context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false;
}
break;
default: default:
context->validationError(GL_INVALID_VALUE, kInvalidInternalFormat); context->validationError(GL_INVALID_VALUE, kInvalidInternalFormat);
return false; return false;
......
...@@ -4014,8 +4014,13 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3 ...@@ -4014,8 +4014,13 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3
glClearColor(1.0f, 1.0f, 1.0f, 1.0f); glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
EXPECT_PIXEL_COLOR_EQ(0, 0, SliceFormatColor(format, GLColor::white));
glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTextures[1],
0);
EXPECT_PIXEL_COLOR_EQ(0, 0, SliceFormatColor(format, GLColor::white)); EXPECT_PIXEL_COLOR_EQ(0, 0, SliceFormatColor(format, GLColor::white));
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
...@@ -4031,6 +4036,11 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3 ...@@ -4031,6 +4036,11 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3
// Test texture formats enabled by the GL_EXT_texture_norm16 extension. // Test texture formats enabled by the GL_EXT_texture_norm16 extension.
TEST_P(Texture2DNorm16TestES3, TextureNorm16Test) TEST_P(Texture2DNorm16TestES3, TextureNorm16Test)
{ {
// TODO(crbug.com/angleproject/4089) Fails on Nexus5X Adreno
ANGLE_SKIP_TEST_IF(IsNexus5X());
// TODO(crbug.com/angleproject/4089) Fails on Win Intel OpenGL driver
ANGLE_SKIP_TEST_IF(IsIntel() && IsOpenGL());
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_texture_norm16")); ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_texture_norm16"));
testNorm16Texture(GL_R16_EXT, GL_RED, GL_UNSIGNED_SHORT); testNorm16Texture(GL_R16_EXT, GL_RED, GL_UNSIGNED_SHORT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment