Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Unified Diff: gpu/vulkan/vulkan_swap_chain.cc

Issue 2653533002: Initialize memory for vulkan swapchain images.
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/vulkan/vulkan_swap_chain.cc
diff --git a/gpu/vulkan/vulkan_swap_chain.cc b/gpu/vulkan/vulkan_swap_chain.cc
index a42e26ed9d8234db8ad8f180093604f93f24127d..030595602a59439232578c3455e267b3012866a8 100644
--- a/gpu/vulkan/vulkan_swap_chain.cc
+++ b/gpu/vulkan/vulkan_swap_chain.cc
@@ -203,13 +203,27 @@ bool VulkanSwapChain::InitializeSwapImages(
// Initialize the command buffer for this buffer data.
image_data->command_buffer = command_pool_->CreatePrimaryCommandBuffer();
- // Setup the Image Layout as the first command that gets issued in each
- // command buffer.
- ScopedSingleUseCommandBufferRecorder recorder(*image_data->command_buffer);
- image_memory_barrier.image = images[i];
- vkCmdPipelineBarrier(recorder.handle(), VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
- VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, 0, nullptr, 0,
- nullptr, 1, &image_memory_barrier);
+ {
+ // Setup the Image Layout as the first command that gets issued in each
+ // command buffer.
+ ScopedSingleUseCommandBufferRecorder recorder(
+ *image_data->command_buffer);
+ image_memory_barrier.image = images[i];
+ vkCmdPipelineBarrier(recorder.handle(), VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
+ VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, 0, nullptr, 0,
+ nullptr, 1, &image_memory_barrier);
+
+ VkClearColorValue clear_color = { { 0.0f, 0.0f, 0.0f, 0.0f } };
+ vkCmdClearColorImage(recorder.handle(), images[i],
+ VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
+ &clear_color, 1, &image_subresource_range);
+ }
+
+ // First submit to fill the image memory.
+ if (!image_data->command_buffer->Submit(0, VK_NULL_HANDLE,
+ 1, &image_data->render_semaphore)) {
+ return false;
+ }
// Create the image view.
image_data->image_view.reset(new VulkanImageView(device_queue_));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698