Skip to content

Commit a614c8a

Browse files
Shufen MaAngle LUCI CQ
Shufen Ma
authored and
Angle LUCI CQ
committed
Check alpha in ColorMask for YUV target
ColorMask is used to mask the writing of R, G, B and A values to all active draw buffers. r, g, b, and a indicate whether R, G, B, or A values, respectively, are written or not (a value of TRUE means that the corresponding value is written) except when the color buffer is in YUV color space, in that case setting any one of the r, g, b, and a values as false would generate draw time INVALID_OPERATION error. Bug: angleproject:383174962 Change-Id: I38c2510c307dd8158e71c920986cb497ca923ff9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6083471 Reviewed-by: Shahbaz Youssefi <[email protected]> Reviewed-by: Charlie Lao <[email protected]> Commit-Queue: Charlie Lao <[email protected]>
1 parent aa263d1 commit a614c8a

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

CONTRIBUTORS

+1
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ Arm Ltd.
207207
Guoxing Wu
208208
Min Zhang
209209
Yuxiang Qian
210+
Shufen Ma
210211

211212
Broadcom Inc.
212213
Gary Sweet

src/libANGLE/ErrorStrings.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ MSG kInvalidBufferUsageFlags = "Invalid buffer usage flags.";
265265
MSG kInvalidClearMask = "Invalid mask bits.";
266266
MSG kInvalidClientState = "Invalid client vertex array type.";
267267
MSG kInvalidClipPlane = "Invalid clip plane.";
268-
MSG kInvalidColorMaskForYUV = "Red, green and blue color writes must be enabled when writing to YUV framebuffers.";
268+
MSG kInvalidColorMaskForYUV = "Red, green, blue color and alpha writes must be enabled when writing to YUV framebuffers.";
269269
MSG kInvalidCombinedImageUnit = "Specified unit must be in [GL_TEXTURE0, GL_TEXTURE0 + GL_MAX_COMBINED_IMAGE_UNITS)";
270270
MSG kInvalidComponents = "Invalid components.";
271271
MSG kInvalidCompressedFormat = "Not a valid compressed texture format.";

src/libANGLE/validationES.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -4313,10 +4313,11 @@ const char *ValidateDrawStates(const Context *context, GLenum *outErrorCode)
43134313
if (framebufferIsYUV)
43144314
{
43154315
const BlendState &blendState = state.getBlendState();
4316-
if (!blendState.colorMaskRed || !blendState.colorMaskGreen || !blendState.colorMaskBlue)
4316+
if (!blendState.colorMaskRed || !blendState.colorMaskGreen || !blendState.colorMaskBlue ||
4317+
!blendState.colorMaskAlpha)
43174318
{
4318-
// When rendering into a YUV framebuffer, the color mask must have r g and b set to
4319-
// true.
4319+
// When rendering into a YUV framebuffer, the color mask must have r g b and alpha set
4320+
// to true.
43204321
return kInvalidColorMaskForYUV;
43214322
}
43224323

src/tests/gl_tests/ImageTest.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -3737,6 +3737,11 @@ TEST_P(ImageTestES3, RenderToYUVAHB)
37373737
glUseProgram(mRenderYUVProgram);
37383738
glUniform4f(mRenderYUVUniformLocation, drawColor[0] / 255.0f, drawColor[1] / 255.0f,
37393739
drawColor[2] / 255.0f, drawColor[3] / 255.0f);
3740+
3741+
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
3742+
drawQuad(mRenderYUVProgram, "position", 0.0f);
3743+
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
3744+
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
37403745
drawQuad(mRenderYUVProgram, "position", 0.0f);
37413746
ASSERT_GL_NO_ERROR();
37423747

0 commit comments

Comments
 (0)