Commit 6e898aa3 by Geoff Lang Committed by Commit Bot

Allow sized GL_RGB[A]_32F to be used for TexImage2D with the chromium extensions.

GL_CHROMIUM_color_buffer_float_rgb[a] allows these sized formats to be used in TexImage2D even in ES2. With this patch, the conformance/extensions/oes-texture-float and conformance/extensions/oes-texture-half-float tests now pass for WebGL1 and WebGL 2 contexts. BUG=angleproject:1958 Change-Id: I568dea5da42ba310463d2690c3e764c48598311b Reviewed-on: https://chromium-review.googlesource.com/522349Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent e7557744
...@@ -843,7 +843,16 @@ bool ValidateES2TexImageParameters(Context *context, ...@@ -843,7 +843,16 @@ bool ValidateES2TexImageParameters(Context *context,
return false; return false;
} }
if (!isSubImage && !isCompressed && internalformat != format) // From GL_CHROMIUM_color_buffer_float_rgb[a]:
// GL_RGB[A] / GL_RGB[A]32F becomes an allowable format / internalformat parameter pair for
// TexImage2D. The restriction in section 3.7.1 of the OpenGL ES 2.0 spec that the
// internalformat parameter and format parameter of TexImage2D must match is lifted for this
// case.
bool nonEqualFormatsAllowed =
(internalformat == GL_RGB32F && context->getExtensions().colorBufferFloatRGB) ||
(internalformat == GL_RGBA32F && context->getExtensions().colorBufferFloatRGBA);
if (!isSubImage && !isCompressed && internalformat != format && !nonEqualFormatsAllowed)
{ {
context->handleError(Error(GL_INVALID_OPERATION)); context->handleError(Error(GL_INVALID_OPERATION));
return false; return false;
...@@ -1260,6 +1269,59 @@ bool ValidateES2TexImageParameters(Context *context, ...@@ -1260,6 +1269,59 @@ bool ValidateES2TexImageParameters(Context *context,
break; break;
} }
if (!isSubImage)
{
switch (internalformat)
{
case GL_RGBA32F:
if (!context->getExtensions().colorBufferFloatRGBA)
{
context->handleError(Error(GL_INVALID_VALUE,
"Sized GL_RGBA32F internal format requires "
"GL_CHROMIUM_color_buffer_float_rgba"));
return false;
}
if (type != GL_FLOAT)
{
context->handleError(Error(GL_INVALID_OPERATION,
"Invalid internal format/type combination"));
return false;
}
if (format != GL_RGBA)
{
context->handleError(Error(GL_INVALID_OPERATION,
"Invalid internal format/format combination"));
return false;
}
break;
case GL_RGB32F:
if (!context->getExtensions().colorBufferFloatRGB)
{
context->handleError(Error(GL_INVALID_VALUE,
"Sized GL_RGB32F internal format requires "
"GL_CHROMIUM_color_buffer_float_rgb"));
return false;
}
if (type != GL_FLOAT)
{
context->handleError(Error(GL_INVALID_OPERATION,
"Invalid internal format/type combination"));
return false;
}
if (format != GL_RGB)
{
context->handleError(Error(GL_INVALID_OPERATION,
"Invalid internal format/format combination"));
return false;
}
break;
default:
break;
}
}
if (type == GL_FLOAT) if (type == GL_FLOAT)
{ {
if (!context->getExtensions().textureFloat) if (!context->getExtensions().textureFloat)
......
...@@ -2031,6 +2031,52 @@ TEST_P(WebGLCompatibilityTest, RGBA16FTextures) ...@@ -2031,6 +2031,52 @@ TEST_P(WebGLCompatibilityTest, RGBA16FTextures)
} }
} }
// Test that when GL_CHROMIUM_color_buffer_float_rgb[a] is enabled, sized GL_RGB[A]_32F formats are
// accepted by glTexImage2D
TEST_P(WebGLCompatibilityTest, SizedRGBA32FFormats)
{
if (getClientMajorVersion() != 2)
{
std::cout << "Test skipped because it is only valid for WebGL1 contexts." << std::endl;
return;
}
if (!extensionRequestable("GL_OES_texture_float"))
{
std::cout << "Test skipped because GL_OES_texture_float is not requestable." << std::endl;
return;
}
glRequestExtensionANGLE("GL_OES_texture_float");
ASSERT_GL_NO_ERROR();
GLTexture texture;
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 1, 1, 0, GL_RGBA, GL_FLOAT, nullptr);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, 1, 1, 0, GL_RGB, GL_FLOAT, nullptr);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
if (extensionRequestable("GL_CHROMIUM_color_buffer_float_rgba"))
{
glRequestExtensionANGLE("GL_CHROMIUM_color_buffer_float_rgba");
ASSERT_GL_NO_ERROR();
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 1, 1, 0, GL_RGBA, GL_FLOAT, nullptr);
EXPECT_GL_NO_ERROR();
}
if (extensionRequestable("GL_CHROMIUM_color_buffer_float_rgb"))
{
glRequestExtensionANGLE("GL_CHROMIUM_color_buffer_float_rgb");
ASSERT_GL_NO_ERROR();
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, 1, 1, 0, GL_RGB, GL_FLOAT, nullptr);
EXPECT_GL_NO_ERROR();
}
}
// This tests that rendering feedback loops works as expected with WebGL 2. // This tests that rendering feedback loops works as expected with WebGL 2.
// Based on WebGL test conformance2/rendering/rendering-sampling-feedback-loop.html // Based on WebGL test conformance2/rendering/rendering-sampling-feedback-loop.html
TEST_P(WebGL2CompatibilityTest, RenderingFeedbackLoopWithDrawBuffers) TEST_P(WebGL2CompatibilityTest, RenderingFeedbackLoopWithDrawBuffers)
......
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