Commit d84a00b9 by Geoff Lang Committed by Commit Bot

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: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 163965d5
...@@ -617,7 +617,7 @@ const ExtensionInfoMap &GetExtensionInfoMap() ...@@ -617,7 +617,7 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_OES_element_index_uint"] = enableableExtension(&Extensions::elementIndexUint); map["GL_OES_element_index_uint"] = enableableExtension(&Extensions::elementIndexUint);
map["GL_OES_packed_depth_stencil"] = esOnlyExtension(&Extensions::packedDepthStencil); map["GL_OES_packed_depth_stencil"] = esOnlyExtension(&Extensions::packedDepthStencil);
map["GL_OES_get_program_binary"] = esOnlyExtension(&Extensions::getProgramBinary); 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_texture_format_BGRA8888"] = enableableExtension(&Extensions::textureFormatBGRA8888);
map["GL_EXT_read_format_bgra"] = esOnlyExtension(&Extensions::readFormatBGRA); map["GL_EXT_read_format_bgra"] = esOnlyExtension(&Extensions::readFormatBGRA);
map["GL_NV_pixel_buffer_object"] = enableableExtension(&Extensions::pixelBufferObject); map["GL_NV_pixel_buffer_object"] = enableableExtension(&Extensions::pixelBufferObject);
......
...@@ -845,7 +845,7 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() ...@@ -845,7 +845,7 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
AddRGBAFormat(&map, GL_RED, false, 8, 0, 0, 0, 0, GL_RED, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported ); 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_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_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, 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_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); 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);
......
...@@ -76,6 +76,8 @@ ContextNULL::ContextNULL(const gl::ContextState &state, AllocationTrackerNULL *a ...@@ -76,6 +76,8 @@ ContextNULL::ContextNULL(const gl::ContextState &state, AllocationTrackerNULL *a
mExtensions.copyTexture = true; mExtensions.copyTexture = true;
mExtensions.copyCompressedTexture = true; mExtensions.copyCompressedTexture = true;
mExtensions.rgb8rgba8 = true;
mTextureCaps = GenerateMinimumTextureCapsMap(maxClientVersion, mExtensions); mTextureCaps = GenerateMinimumTextureCapsMap(maxClientVersion, mExtensions);
} }
......
...@@ -118,6 +118,14 @@ class WebGLCompatibilityTest : public ANGLETest ...@@ -118,6 +118,14 @@ class WebGLCompatibilityTest : public ANGLETest
ANGLE_GL_PROGRAM(samplingProgram, samplingVs, samplingFs); ANGLE_GL_PROGRAM(samplingProgram, samplingVs, samplingFs);
glUseProgram(samplingProgram.get()); 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; GLRenderbuffer rbo;
glBindRenderbuffer(GL_RENDERBUFFER, rbo.get()); glBindRenderbuffer(GL_RENDERBUFFER, rbo.get());
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 1, 1); glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 1, 1);
...@@ -816,6 +824,38 @@ TEST_P(WebGLCompatibilityTest, EnablePackPackSubImageExtension) ...@@ -816,6 +824,38 @@ TEST_P(WebGLCompatibilityTest, EnablePackPackSubImageExtension)
} }
} }
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 // Verify that the context generates the correct error when the framebuffer attachments are
// different sizes // different sizes
TEST_P(WebGLCompatibilityTest, FramebufferAttachmentSizeMismatch) TEST_P(WebGLCompatibilityTest, FramebufferAttachmentSizeMismatch)
...@@ -3344,7 +3384,7 @@ TEST_P(WebGLCompatibilityTest, DrawBuffers) ...@@ -3344,7 +3384,7 @@ TEST_P(WebGLCompatibilityTest, DrawBuffers)
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
glBindRenderbuffer(GL_RENDERBUFFER, renderbuffers[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, glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_RENDERBUFFER,
renderbuffers[i]); renderbuffers[i]);
} }
......
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