Commit 93eb633c by Courtney Goeltzenleuchter Committed by Commit Bot

Inline depth/stencil clear if in middle of renderpass

Some apps have a pattern where they clear the depth & stencil buffers in the middle of the frame which causes the Vulkan backend to stop the existing render pass and start a new one. This causes more loads & stores of buffer contents than if we inline that clear with a draw. Bug: b/159808300 Bug: angleproject:4695 Change-Id: I7a15af22f47a81051fa33fa19eaa123d8b66597c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2289945 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCharlie Lao <cclao@google.com>
parent 964c4089
...@@ -374,10 +374,30 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context, ...@@ -374,10 +374,30 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context,
if (clearAnyWithRenderPassLoadOp) if (clearAnyWithRenderPassLoadOp)
{ {
// Clearing color is indicated by the set bits in this mask. If not clearing colors with vk::Framebuffer *currentFramebuffer = nullptr;
// render pass loadOp, the default value of all-zeros means the clear is not done in ANGLE_TRY(getFramebuffer(contextVk, &currentFramebuffer));
// clearWithRenderPassOp below. In that case, only clear depth/stencil with render pass bool framebufferIsCurrent = contextVk->isCurrentRenderPassOfFramebuffer(currentFramebuffer);
// loadOp.
// If we are in an active renderpass and the framebuffer hasn't changed, inline the clear
if (contextVk->hasStartedRenderPass() && framebufferIsCurrent)
{
// Have active renderpass, add inline clear
gl::DrawBufferMask clearBuffersWithInlineClear;
if (clearColorWithRenderPassLoadOp)
{
clearBuffersWithInlineClear = clearColorBuffers;
}
clearWithClearAttachment(
&contextVk->getStartedRenderPassCommands().getCommandBuffer(), scissoredRenderArea,
clearBuffersWithInlineClear, clearDepthWithRenderPassLoadOp,
clearStencilWithRenderPassLoadOp, clearColorValue, clearDepthStencilValue);
}
else
{
// Clearing color is indicated by the set bits in this mask. If not clearing colors
// with render pass loadOp, the default value of all-zeros means the clear is not done
// in clearWithRenderPassOp below. In that case, only clear depth/stencil with render
// pass loadOp.
gl::DrawBufferMask clearBuffersWithRenderPassLoadOp; gl::DrawBufferMask clearBuffersWithRenderPassLoadOp;
if (clearColorWithRenderPassLoadOp) if (clearColorWithRenderPassLoadOp)
{ {
...@@ -387,6 +407,7 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context, ...@@ -387,6 +407,7 @@ angle::Result FramebufferVk::clearImpl(const gl::Context *context,
clearWithRenderPassOp(clearBuffersWithRenderPassLoadOp, clearDepthWithRenderPassLoadOp, clearWithRenderPassOp(clearBuffersWithRenderPassLoadOp, clearDepthWithRenderPassLoadOp,
clearStencilWithRenderPassLoadOp, clearColorValue, clearStencilWithRenderPassLoadOp, clearColorValue,
clearDepthStencilValue); clearDepthStencilValue);
}
// Fallback to other methods for whatever isn't cleared here. // Fallback to other methods for whatever isn't cleared here.
if (clearColorWithRenderPassLoadOp) if (clearColorWithRenderPassLoadOp)
...@@ -1806,6 +1827,52 @@ void FramebufferVk::clearWithRenderPassOp(gl::DrawBufferMask clearColorBuffers, ...@@ -1806,6 +1827,52 @@ void FramebufferVk::clearWithRenderPassOp(gl::DrawBufferMask clearColorBuffers,
} }
} }
void FramebufferVk::clearWithClearAttachment(vk::CommandBuffer *renderPassCommandBuffer,
const gl::Rectangle &scissoredRenderArea,
gl::DrawBufferMask clearColorBuffers,
bool clearDepth,
bool clearStencil,
const VkClearColorValue &clearColorValue,
const VkClearDepthStencilValue &clearDepthStencilValue)
{
gl::DrawBuffersVector<VkClearAttachment> attachments;
// Go through clearColorBuffers and add them to the list of attachments to clear.
for (size_t colorIndexGL : clearColorBuffers)
{
ASSERT(mState.getEnabledDrawBuffers().test(colorIndexGL));
VkClearValue clearValue = getCorrectedColorClearValue(colorIndexGL, clearColorValue);
attachments.emplace_back(VkClearAttachment{
VK_IMAGE_ASPECT_COLOR_BIT, static_cast<uint32_t>(colorIndexGL), clearValue});
}
// Add depth and stencil to list of attachments as needed.
VkImageAspectFlags dsAspectFlags = 0;
VkClearValue dsClearValue = {};
if (clearDepth)
{
dsAspectFlags |= VK_IMAGE_ASPECT_DEPTH_BIT;
dsClearValue.depthStencil = clearDepthStencilValue;
}
if (clearStencil)
{
dsAspectFlags |= VK_IMAGE_ASPECT_STENCIL_BIT;
dsClearValue.depthStencil = clearDepthStencilValue;
}
if (dsAspectFlags != 0)
{
attachments.emplace_back(VkClearAttachment{dsAspectFlags, 0, dsClearValue});
}
VkClearRect rect = {};
rect.rect.extent.width = scissoredRenderArea.width;
rect.rect.extent.height = scissoredRenderArea.height;
rect.layerCount = 1;
renderPassCommandBuffer->clearAttachments(static_cast<uint32_t>(attachments.size()),
attachments.data(), 1, &rect);
}
angle::Result FramebufferVk::getSamplePosition(const gl::Context *context, angle::Result FramebufferVk::getSamplePosition(const gl::Context *context,
size_t index, size_t index,
GLfloat *xy) const GLfloat *xy) const
......
...@@ -184,6 +184,13 @@ class FramebufferVk : public FramebufferImpl ...@@ -184,6 +184,13 @@ class FramebufferVk : public FramebufferImpl
bool clearStencil, bool clearStencil,
const VkClearColorValue &clearColorValue, const VkClearColorValue &clearColorValue,
const VkClearDepthStencilValue &clearDepthStencilValue); const VkClearDepthStencilValue &clearDepthStencilValue);
void clearWithClearAttachment(vk::CommandBuffer *renderPassCommandBuffer,
const gl::Rectangle &scissoredRenderArea,
gl::DrawBufferMask clearColorBuffers,
bool clearDepth,
bool clearStencil,
const VkClearColorValue &clearColorValue,
const VkClearDepthStencilValue &clearDepthStencilValue);
void updateActiveColorMasks(size_t colorIndex, bool r, bool g, bool b, bool a); void updateActiveColorMasks(size_t colorIndex, bool r, bool g, bool b, bool a);
void updateRenderPassDesc(); void updateRenderPassDesc();
angle::Result updateColorAttachment(const gl::Context *context, angle::Result updateColorAttachment(const gl::Context *context,
......
...@@ -225,6 +225,58 @@ ...@@ -225,6 +225,58 @@
2630 GLES ANDROID : dEQP-GLES2.functional.shaders.struct.uniform.sampler_in_array_function_arg_* = FAIL 2630 GLES ANDROID : dEQP-GLES2.functional.shaders.struct.uniform.sampler_in_array_function_arg_* = FAIL
2630 GLES ANDROID : dEQP-GLES2.functional.shaders.struct.uniform.sampler_in_function_arg_* = FAIL 2630 GLES ANDROID : dEQP-GLES2.functional.shaders.struct.uniform.sampler_in_function_arg_* = FAIL
// Android Pixel 2 clear failures with Vulkan backend
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.color_clear.masked_rgb = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.color_clear.masked_rgba = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.depth_stencil_clear.depth_stencil_masked = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.5 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.7 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.23 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.54 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.57 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.67 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.71 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.83 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.4 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.7 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.11 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.13 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.14 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.16 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.19 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.20 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.24 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.30 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.34 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.35 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.37 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.38 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.42 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.44 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.46 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.47 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.48 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.55 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.58 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.60 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.61 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.64 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.65 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.66 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.67 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.68 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.69 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.71 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.74 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.79 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.80 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.82 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.83 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.86 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.87 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.94 = FAIL
161540999 VULKAN PIXEL2ORXL : dEQP-GLES2.functional.fragment_ops.random.97 = FAIL
// Nexus 5x failures // Nexus 5x failures
3309 NEXUS5X GLES : dEQP-GLES2.functional.attribute_location.bind_aliasing.cond* = FAIL 3309 NEXUS5X GLES : dEQP-GLES2.functional.attribute_location.bind_aliasing.cond* = FAIL
3309 NEXUS5X GLES : dEQP-GLES2.functional.attribute_location.bind_aliasing.max_cond* = FAIL 3309 NEXUS5X GLES : dEQP-GLES2.functional.attribute_location.bind_aliasing.max_cond* = FAIL
......
...@@ -557,6 +557,57 @@ ...@@ -557,6 +557,57 @@
4024 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.draw.random.49 = SKIP 4024 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.draw.random.49 = SKIP
4024 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.draw.random.96 = FAIL 4024 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.draw.random.96 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.color_clear.masked_rgb = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.color_clear.masked_rgba = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.depth_stencil_clear.depth_stencil_masked = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.interaction.basic_shader.5 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.interaction.basic_shader.7 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.interaction.basic_shader.23 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.interaction.basic_shader.57 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.interaction.basic_shader.67 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.interaction.basic_shader.71 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.interaction.basic_shader.83 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.lifetime.attach.deleted_output.buffer_transform_feedback = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.4 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.7 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.11 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.13 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.14 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.16 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.19 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.20 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.24 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.30 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.34 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.37 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.38 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.42 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.44 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.46 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.47 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.48 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.55 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.58 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.60 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.61 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.64 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.65 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.66 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.67 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.69 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.71 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.74 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.76 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.79 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.80 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.82 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.83 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.86 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.87 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.94 = FAIL
161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.97 = FAIL
// Fixed in later driver versions. // Fixed in later driver versions.
2727 VULKAN ANDROID : dEQP-GLES3.functional.shaders.builtin_variable.pointcoord = FAIL 2727 VULKAN ANDROID : dEQP-GLES3.functional.shaders.builtin_variable.pointcoord = FAIL
...@@ -569,11 +620,14 @@ ...@@ -569,11 +620,14 @@
4344 VULKAN ANDROID : dEQP-GLES3.functional.fragment_ops.random.56 = FAIL 4344 VULKAN ANDROID : dEQP-GLES3.functional.fragment_ops.random.56 = FAIL
4344 VULKAN ANDROID : dEQP-GLES3.functional.fragment_ops.random.62 = FAIL 4344 VULKAN ANDROID : dEQP-GLES3.functional.fragment_ops.random.62 = FAIL
4344 VULKAN ANDROID : dEQP-GLES3.functional.fragment_ops.random.68 = FAIL 4344 VULKAN ANDROID : dEQP-GLES3.functional.fragment_ops.random.68 = FAIL
// 161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.68 = FAIL
// Pixel 4 XL update (6/30/20): The previous 3 tests pass on Pixel 4 XL. The following only fail // Pixel 4 XL update (6/30/20): The previous 3 tests pass on Pixel 4 XL. The following only fail
// when the device is rotated 90 or 270 degrees, due to the same Qualcomm driver bug. As before, // when the device is rotated 90 or 270 degrees, due to the same Qualcomm driver bug. As before,
// the driver bug can be worked around by immediately ending a render pass that does a clear. // the driver bug can be worked around by immediately ending a render pass that does a clear.
4344 VULKAN ANDROID : dEQP-GLES3.functional.fragment_ops.interaction.basic_shader.54 = FAIL 4344 VULKAN ANDROID : dEQP-GLES3.functional.fragment_ops.interaction.basic_shader.54 = FAIL
// 161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.interaction.basic_shader.54 = FAIL
4344 VULKAN ANDROID : dEQP-GLES3.functional.fragment_ops.random.35 = FAIL 4344 VULKAN ANDROID : dEQP-GLES3.functional.fragment_ops.random.35 = FAIL
// 161540999 PIXEL2ORXL VULKAN : dEQP-GLES3.functional.fragment_ops.random.35 = FAIL
4344 VULKAN ANDROID : dEQP-GLES3.functional.fragment_ops.random.73 = FAIL 4344 VULKAN ANDROID : dEQP-GLES3.functional.fragment_ops.random.73 = FAIL
......
...@@ -617,6 +617,65 @@ TEST_P(ClearTest, MaskedClearThenDrawWithUniform) ...@@ -617,6 +617,65 @@ TEST_P(ClearTest, MaskedClearThenDrawWithUniform)
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green); EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
} }
// Clear with a mask to verify that masked clear is done properly
// (can't use inline or RenderOp clear when some color channels are masked)
TEST_P(ClearTestES3, ClearPlusMaskDrawAndClear)
{
// Initialize a program with a uniform.
ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), essl1_shaders::fs::UniformColor());
glUseProgram(program);
GLint uniLoc = glGetUniformLocation(program, essl1_shaders::ColorUniform());
ASSERT_NE(-1, uniLoc);
glUniform4f(uniLoc, 0.0f, 1.0f, 0.0f, 1.0f);
// Initialize position attribute.
GLint posLoc = glGetAttribLocation(program, essl1_shaders::PositionAttrib());
ASSERT_NE(-1, posLoc);
setupQuadVertexBuffer(0.5f, 1.0f);
glVertexAttribPointer(posLoc, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
glEnableVertexAttribArray(posLoc);
// Initialize a simple FBO.
constexpr GLsizei kSize = 2;
GLTexture clearTexture;
glBindTexture(GL_TEXTURE_2D, clearTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kSize, kSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
GLFramebuffer fbo;
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, clearTexture, 0);
GLRenderbuffer depthStencil;
glBindRenderbuffer(GL_RENDERBUFFER, depthStencil);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, kSize, kSize);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER,
depthStencil);
ASSERT_GL_NO_ERROR();
glViewport(0, 0, kSize, kSize);
// Clear and draw to flush out dirty bits.
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClearDepthf(1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Draw green rectangle
glDrawArrays(GL_TRIANGLES, 0, 6);
// Enable color mask and draw again to trigger the bug.
glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_TRUE);
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Draw purple-ish rectangle, green should be masked off
glUniform4f(uniLoc, 1.0f, 0.25f, 1.0f, 1.0f);
glDrawArrays(GL_TRIANGLES, 0, 6);
ASSERT_GL_NO_ERROR();
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::white);
}
// Test that clearing all buffers through glClearColor followed by a clear of a specific buffer // Test that clearing all buffers through glClearColor followed by a clear of a specific buffer
// clears to the correct values. // clears to the correct values.
TEST_P(ClearTestES3, ClearMultipleAttachmentsFollowedBySpecificOne) TEST_P(ClearTestES3, ClearMultipleAttachmentsFollowedBySpecificOne)
...@@ -687,6 +746,8 @@ TEST_P(ClearTestES3, ClearMultipleAttachmentsFollowedBySpecificOne) ...@@ -687,6 +746,8 @@ TEST_P(ClearTestES3, ClearMultipleAttachmentsFollowedBySpecificOne)
// done in a single render pass. // done in a single render pass.
TEST_P(ClearTestES3, ClearMultipleAttachmentsIndividually) TEST_P(ClearTestES3, ClearMultipleAttachmentsIndividually)
{ {
// https://issuetracker.google.com/issues/161553839
ANGLE_SKIP_TEST_IF(IsIntel() && IsVulkan());
constexpr uint32_t kSize = 16; constexpr uint32_t kSize = 16;
constexpr uint32_t kAttachmentCount = 2; constexpr uint32_t kAttachmentCount = 2;
constexpr float kDepthClearValue = 0.125f; constexpr float kDepthClearValue = 0.125f;
...@@ -925,6 +986,9 @@ TEST_P(ClearTestES3, MaskedIndexedClearMultipleAttachments) ...@@ -925,6 +986,9 @@ TEST_P(ClearTestES3, MaskedIndexedClearMultipleAttachments)
// and the relevant internal shaders. // and the relevant internal shaders.
TEST_P(ClearTestES3, MaskedClearHeterogeneousAttachments) TEST_P(ClearTestES3, MaskedClearHeterogeneousAttachments)
{ {
// https://issuetracker.google.com/issues/161553839
ANGLE_SKIP_TEST_IF(IsIntel() && IsVulkan());
constexpr uint32_t kSize = 16; constexpr uint32_t kSize = 16;
constexpr uint32_t kAttachmentCount = 3; constexpr uint32_t kAttachmentCount = 3;
constexpr float kDepthClearValue = 0.256f; constexpr float kDepthClearValue = 0.256f;
......
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