| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/vulkan/vulkan_render_pass.h" | 5 #include "gpu/vulkan/vulkan_render_pass.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "gpu/vulkan/vulkan_command_buffer.h" | 8 #include "gpu/vulkan/vulkan_command_buffer.h" |
| 9 #include "gpu/vulkan/vulkan_device_queue.h" | 9 #include "gpu/vulkan/vulkan_device_queue.h" |
| 10 #include "gpu/vulkan/vulkan_image_view.h" | 10 #include "gpu/vulkan/vulkan_image_view.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return false; | 92 return false; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 #endif | 95 #endif |
| 96 | 96 |
| 97 return true; | 97 return true; |
| 98 } | 98 } |
| 99 | 99 |
| 100 VulkanRenderPass::SubpassData::SubpassData() {} | 100 VulkanRenderPass::SubpassData::SubpassData() {} |
| 101 | 101 |
| 102 VulkanRenderPass::SubpassData::SubpassData(const SubpassData& data) = default; |
| 103 |
| 104 VulkanRenderPass::SubpassData::SubpassData(SubpassData&& data) = default; |
| 105 |
| 102 VulkanRenderPass::SubpassData::~SubpassData() {} | 106 VulkanRenderPass::SubpassData::~SubpassData() {} |
| 103 | 107 |
| 104 bool VulkanRenderPass::SubpassData::ValidateData( | 108 bool VulkanRenderPass::SubpassData::ValidateData( |
| 105 uint32_t num_attachments) const { | 109 uint32_t num_attachments) const { |
| 106 #if DCHECK_IS_ON() | 110 #if DCHECK_IS_ON() |
| 107 for (const SubpassAttachment subpass_attachment : subpass_attachments) { | 111 for (const SubpassAttachment subpass_attachment : subpass_attachments) { |
| 108 if (subpass_attachment.attachment_index >= num_attachments) { | 112 if (subpass_attachment.attachment_index >= num_attachments) { |
| 109 DLOG(ERROR) << "Invalid attachment index: " | 113 DLOG(ERROR) << "Invalid attachment index: " |
| 110 << subpass_attachment.attachment_index << " < " | 114 << subpass_attachment.attachment_index << " < " |
| 111 << num_attachments; | 115 << num_attachments; |
| 112 return false; | 116 return false; |
| 113 } | 117 } |
| 114 | 118 |
| 115 const ImageLayoutType layout = subpass_attachment.subpass_layout; | 119 const ImageLayoutType layout = subpass_attachment.subpass_layout; |
| 116 if (layout < ImageLayoutType::IMAGE_LAYOUT_TYPE_IMAGE_VIEW || | 120 if (layout < ImageLayoutType::IMAGE_LAYOUT_TYPE_IMAGE_VIEW || |
| 117 layout > ImageLayoutType::IMAGE_LAYOUT_TYPE_PRESENT) { | 121 layout > ImageLayoutType::IMAGE_LAYOUT_TYPE_PRESENT) { |
| 118 DLOG(ERROR) << "Invalid subpass layout: " << static_cast<int>(layout); | 122 DLOG(ERROR) << "Invalid subpass layout: " << static_cast<int>(layout); |
| 119 return false; | 123 return false; |
| 120 } | 124 } |
| 121 } | 125 } |
| 122 #endif | 126 #endif |
| 123 | 127 |
| 124 return true; | 128 return true; |
| 125 } | 129 } |
| 126 | 130 |
| 127 VulkanRenderPass::RenderPassData::RenderPassData() {} | 131 VulkanRenderPass::RenderPassData::RenderPassData() {} |
| 128 | 132 |
| 133 VulkanRenderPass::RenderPassData::RenderPassData(const RenderPassData& data) = |
| 134 default; |
| 135 |
| 136 VulkanRenderPass::RenderPassData::RenderPassData(RenderPassData&& data) = |
| 137 default; |
| 138 |
| 129 VulkanRenderPass::RenderPassData::~RenderPassData() {} | 139 VulkanRenderPass::RenderPassData::~RenderPassData() {} |
| 130 | 140 |
| 131 VulkanRenderPass::VulkanRenderPass(VulkanDeviceQueue* device_queue) | 141 VulkanRenderPass::VulkanRenderPass(VulkanDeviceQueue* device_queue) |
| 132 : device_queue_(device_queue) {} | 142 : device_queue_(device_queue) {} |
| 133 | 143 |
| 134 VulkanRenderPass::~VulkanRenderPass() { | 144 VulkanRenderPass::~VulkanRenderPass() { |
| 135 DCHECK_EQ(static_cast<VkRenderPass>(VK_NULL_HANDLE), render_pass_); | 145 DCHECK_EQ(static_cast<VkRenderPass>(VK_NULL_HANDLE), render_pass_); |
| 136 DCHECK(frame_buffers_.empty()); | 146 DCHECK(frame_buffers_.empty()); |
| 137 } | 147 } |
| 138 | 148 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 auto iter = | 402 auto iter = |
| 393 std::lower_bound(attachment_clear_indexes_.begin(), | 403 std::lower_bound(attachment_clear_indexes_.begin(), |
| 394 attachment_clear_indexes_.end(), attachment_index); | 404 attachment_clear_indexes_.end(), attachment_index); |
| 395 if (iter != attachment_clear_indexes_.end() && *iter == attachment_index) { | 405 if (iter != attachment_clear_indexes_.end() && *iter == attachment_index) { |
| 396 const uint32_t index = iter - attachment_clear_indexes_.begin(); | 406 const uint32_t index = iter - attachment_clear_indexes_.begin(); |
| 397 attachment_clear_values_[index] = clear_value; | 407 attachment_clear_values_[index] = clear_value; |
| 398 } | 408 } |
| 399 } | 409 } |
| 400 | 410 |
| 401 } // namespace gpu | 411 } // namespace gpu |
| OLD | NEW |