Commit b74c769a by Commit Bot Committed by Gerrit Code Review

Merge "Fix Clear validation assert for default FBOs"

parents 315ecd20 59c41597
......@@ -2302,7 +2302,7 @@ bool ValidateClear(ValidationContext *context, GLbitfield mask)
constexpr GLenum validComponentTypes[] = {GL_FLOAT, GL_UNSIGNED_NORMALIZED,
GL_SIGNED_NORMALIZED};
for (GLuint drawBufferIdx = 0; drawBufferIdx < context->getCaps().maxDrawBuffers;
for (GLuint drawBufferIdx = 0; drawBufferIdx < fbo->getDrawbufferStateCount();
drawBufferIdx++)
{
if (!ValidateWebGLFramebufferAttachmentClearType(
......
......@@ -2317,8 +2317,8 @@ TEST_P(WebGL2CompatibilityTest, TextureCopyingFeedbackLoop3D)
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
// Verify that errors are generated when there isn not a defined conversion between the clear type
// and the buffer type.
// Verify that errors are generated when there isn't a defined conversion between the clear type and
// the buffer type.
TEST_P(WebGL2CompatibilityTest, ClearBufferTypeCompatibity)
{
if (IsD3D11())
......@@ -2413,6 +2413,29 @@ TEST_P(WebGL2CompatibilityTest, ClearBufferTypeCompatibity)
EXPECT_GL_NO_ERROR();
}
// Test the interaction of WebGL compatibility clears with default framebuffers
TEST_P(WebGL2CompatibilityTest, ClearBufferDefaultFramebuffer)
{
constexpr float clearFloat[] = {0.0f, 0.0f, 0.0f, 0.0f};
constexpr int clearInt[] = {0, 0, 0, 0};
constexpr unsigned int clearUint[] = {0, 0, 0, 0};
// glClear works as usual, this is also a regression test for a bug where we
// iterated on maxDrawBuffers for default framebuffers, triggering an assert
glClear(GL_COLOR_BUFFER_BIT);
EXPECT_GL_NO_ERROR();
// Default framebuffers are normalized uints, so only glClearBufferfv works.
glClearBufferfv(GL_COLOR, 0, clearFloat);
EXPECT_GL_NO_ERROR();
glClearBufferiv(GL_COLOR, 0, clearInt);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
glClearBufferuiv(GL_COLOR, 0, clearUint);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
// Verify that errors are generate when trying to blit from an image to itself
TEST_P(WebGL2CompatibilityTest, BlitFramebufferSameImage)
{
......
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