Vulkan: Always use LOAD for RenderPass attachments.
The RenderPass load/store ops allow us to specify how we want to use
the data from the attachments. Previously we had the load op set to
CLEAR always, which would prevent us from doing multiple kinds of
operation. Using LOAD should conversatively work in any situation
as long as we can ensure each Image is cleared before we use it.
To this effect this patch also inserts a preliminary clear into each
Texture or Renderbuffer Image's initialization. We already had this
for Surfaces.
In the future we'll improve this by inserting proper load/store ops,
but this unblocks a lot more functionality in the interim.
Bug: angleproject:2361
Change-Id: I7610eaa39d81b23dd74b4a24b7f28a66a6dfffc6
Reviewed-on: https://chromium-review.googlesource.com/948782
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Luc Ferron <lucferron@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp b/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp
index 6e6b915..13c7b58 100644
--- a/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp
@@ -127,6 +127,15 @@
viewInfo.subresourceRange.layerCount = 1;
ANGLE_TRY(mImageView.init(device, viewInfo));
+
+ // TODO(jmadill): Fold this into the RenderPass load/store ops. http://anglebug.com/2361
+ vk::CommandBuffer *commandBuffer = nullptr;
+ ANGLE_TRY(beginWriteResource(renderer, &commandBuffer));
+ VkClearColorValue black = {{0}};
+ mImage.changeLayoutWithStages(
+ VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
+ VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, commandBuffer);
+ commandBuffer->clearSingleColorImage(mImage, black);
}
return gl::NoError();