Make GL_OES_rgb8_rgba8 enableable.
Allow unsized RGB/UNSIGNED_BYTE without the rgb8rgba8 extension.
BUG=angleproject:1523
Change-Id: Ic7b4236c7b8389952b093719f26840ea2bbd01bf
Reviewed-on: https://chromium-review.googlesource.com/742501
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/Caps.cpp b/src/libANGLE/Caps.cpp
index 6bb8020..0ac6ee5 100644
--- a/src/libANGLE/Caps.cpp
+++ b/src/libANGLE/Caps.cpp
@@ -617,7 +617,7 @@
map["GL_OES_element_index_uint"] = enableableExtension(&Extensions::elementIndexUint);
map["GL_OES_packed_depth_stencil"] = esOnlyExtension(&Extensions::packedDepthStencil);
map["GL_OES_get_program_binary"] = esOnlyExtension(&Extensions::getProgramBinary);
- map["GL_OES_rgb8_rgba8"] = esOnlyExtension(&Extensions::rgb8rgba8);
+ map["GL_OES_rgb8_rgba8"] = enableableExtension(&Extensions::rgb8rgba8);
map["GL_EXT_texture_format_BGRA8888"] = enableableExtension(&Extensions::textureFormatBGRA8888);
map["GL_EXT_read_format_bgra"] = esOnlyExtension(&Extensions::readFormatBGRA);
map["GL_NV_pixel_buffer_object"] = enableableExtension(&Extensions::pixelBufferObject);
diff --git a/src/libANGLE/formatutils.cpp b/src/libANGLE/formatutils.cpp
index cf4a2fb..047c547 100644
--- a/src/libANGLE/formatutils.cpp
+++ b/src/libANGLE/formatutils.cpp
@@ -845,7 +845,7 @@
AddRGBAFormat(&map, GL_RED, false, 8, 0, 0, 0, 0, GL_RED, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported );
AddRGBAFormat(&map, GL_RG, false, 8, 8, 0, 0, 0, GL_RG, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureRG>, AlwaysSupported, AlwaysSupported);
AddRGBAFormat(&map, GL_RG, false, 8, 8, 0, 0, 0, GL_RG, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported );
- AddRGBAFormat(&map, GL_RGB, false, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::rgb8rgba8>, RequireESOrExt<3, 0, &Extensions::rgb8rgba8>, AlwaysSupported);
+ AddRGBAFormat(&map, GL_RGB, false, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, AlwaysSupported, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB, false, 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB, false, 8, 8, 8, 0, 0, GL_RGB, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported );
AddRGBAFormat(&map, GL_RGBA, false, 4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
diff --git a/src/libANGLE/renderer/null/ContextNULL.cpp b/src/libANGLE/renderer/null/ContextNULL.cpp
index c0a4035..eaabfb5 100644
--- a/src/libANGLE/renderer/null/ContextNULL.cpp
+++ b/src/libANGLE/renderer/null/ContextNULL.cpp
@@ -76,6 +76,8 @@
mExtensions.copyTexture = true;
mExtensions.copyCompressedTexture = true;
+ mExtensions.rgb8rgba8 = true;
+
mTextureCaps = GenerateMinimumTextureCapsMap(maxClientVersion, mExtensions);
}
diff --git a/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
index a024b2c..cad6283 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -118,6 +118,14 @@
ANGLE_GL_PROGRAM(samplingProgram, samplingVs, samplingFs);
glUseProgram(samplingProgram.get());
+ // Need RGBA8 renderbuffers for enough precision on the readback
+ if (extensionRequestable("GL_OES_rgb8_rgba8"))
+ {
+ glRequestExtensionANGLE("GL_OES_rgb8_rgba8");
+ }
+ ANGLE_SKIP_TEST_IF(!extensionEnabled("GL_OES_rgb8_rgba8") && getClientMajorVersion() < 3);
+ ASSERT_GL_NO_ERROR();
+
GLRenderbuffer rbo;
glBindRenderbuffer(GL_RENDERBUFFER, rbo.get());
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 1, 1);
@@ -816,6 +824,38 @@
}
}
+TEST_P(WebGLCompatibilityTest, EnableRGB8RGBA8Extension)
+{
+ EXPECT_FALSE(extensionEnabled("GL_OES_rgb8_rgba8"));
+
+ // This extensions become core in in ES3/WebGL2.
+ ANGLE_SKIP_TEST_IF(getClientMajorVersion() >= 3);
+
+ GLRenderbuffer renderbuffer;
+ glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
+ EXPECT_GL_NO_ERROR();
+
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB8_OES, 1, 1);
+ EXPECT_GL_ERROR(GL_INVALID_ENUM);
+
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8_OES, 1, 1);
+ EXPECT_GL_ERROR(GL_INVALID_ENUM);
+
+ if (extensionRequestable("GL_OES_rgb8_rgba8"))
+ {
+ glRequestExtensionANGLE("GL_OES_rgb8_rgba8");
+ EXPECT_GL_NO_ERROR();
+
+ EXPECT_TRUE(extensionEnabled("GL_OES_rgb8_rgba8"));
+
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB8_OES, 1, 1);
+ EXPECT_GL_NO_ERROR();
+
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8_OES, 1, 1);
+ EXPECT_GL_NO_ERROR();
+ }
+}
+
// Verify that the context generates the correct error when the framebuffer attachments are
// different sizes
TEST_P(WebGLCompatibilityTest, FramebufferAttachmentSizeMismatch)
@@ -3344,7 +3384,7 @@
for (int i = 0; i < 4; ++i)
{
glBindRenderbuffer(GL_RENDERBUFFER, renderbuffers[i]);
- glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 1, 1);
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA4, 1, 1);
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_RENDERBUFFER,
renderbuffers[i]);
}