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) | |
piman
2016/04/22 18:23:03
nit: you can use '= default' for maintenance (if w
David Yen
2016/04/22 18:31:18
Done.
| |
103 : subpass_attachments(data.subpass_attachments) {} | |
104 | |
105 VulkanRenderPass::SubpassData::SubpassData(SubpassData&& data) | |
106 : subpass_attachments(std::move(data.subpass_attachments)) {} | |
piman
2016/04/22 18:23:03
ditto
David Yen
2016/04/22 18:31:18
Done.
| |
107 | |
102 VulkanRenderPass::SubpassData::~SubpassData() {} | 108 VulkanRenderPass::SubpassData::~SubpassData() {} |
103 | 109 |
104 bool VulkanRenderPass::SubpassData::ValidateData( | 110 bool VulkanRenderPass::SubpassData::ValidateData( |
105 uint32_t num_attachments) const { | 111 uint32_t num_attachments) const { |
106 #if DCHECK_IS_ON() | 112 #if DCHECK_IS_ON() |
107 for (const SubpassAttachment subpass_attachment : subpass_attachments) { | 113 for (const SubpassAttachment subpass_attachment : subpass_attachments) { |
108 if (subpass_attachment.attachment_index >= num_attachments) { | 114 if (subpass_attachment.attachment_index >= num_attachments) { |
109 DLOG(ERROR) << "Invalid attachment index: " | 115 DLOG(ERROR) << "Invalid attachment index: " |
110 << subpass_attachment.attachment_index << " < " | 116 << subpass_attachment.attachment_index << " < " |
111 << num_attachments; | 117 << num_attachments; |
112 return false; | 118 return false; |
113 } | 119 } |
114 | 120 |
115 const ImageLayoutType layout = subpass_attachment.subpass_layout; | 121 const ImageLayoutType layout = subpass_attachment.subpass_layout; |
116 if (layout < ImageLayoutType::IMAGE_LAYOUT_TYPE_IMAGE_VIEW || | 122 if (layout < ImageLayoutType::IMAGE_LAYOUT_TYPE_IMAGE_VIEW || |
117 layout > ImageLayoutType::IMAGE_LAYOUT_TYPE_PRESENT) { | 123 layout > ImageLayoutType::IMAGE_LAYOUT_TYPE_PRESENT) { |
118 DLOG(ERROR) << "Invalid subpass layout: " << static_cast<int>(layout); | 124 DLOG(ERROR) << "Invalid subpass layout: " << static_cast<int>(layout); |
119 return false; | 125 return false; |
120 } | 126 } |
121 } | 127 } |
122 #endif | 128 #endif |
123 | 129 |
124 return true; | 130 return true; |
125 } | 131 } |
126 | 132 |
127 VulkanRenderPass::RenderPassData::RenderPassData() {} | 133 VulkanRenderPass::RenderPassData::RenderPassData() {} |
128 | 134 |
135 VulkanRenderPass::RenderPassData::RenderPassData(const RenderPassData& data) | |
136 : attachments(data.attachments), | |
137 subpass_datas(data.subpass_datas) {} | |
piman
2016/04/22 18:23:59
Both of these as well.
David Yen
2016/04/22 18:31:19
Done.
| |
138 | |
139 VulkanRenderPass::RenderPassData::RenderPassData(RenderPassData&& data) | |
140 : attachments(std::move(data.attachments)), | |
141 subpass_datas(std::move(data.subpass_datas)) {} | |
142 | |
129 VulkanRenderPass::RenderPassData::~RenderPassData() {} | 143 VulkanRenderPass::RenderPassData::~RenderPassData() {} |
130 | 144 |
131 VulkanRenderPass::VulkanRenderPass(VulkanDeviceQueue* device_queue) | 145 VulkanRenderPass::VulkanRenderPass(VulkanDeviceQueue* device_queue) |
132 : device_queue_(device_queue) {} | 146 : device_queue_(device_queue) {} |
133 | 147 |
134 VulkanRenderPass::~VulkanRenderPass() { | 148 VulkanRenderPass::~VulkanRenderPass() { |
135 DCHECK_EQ(static_cast<VkRenderPass>(VK_NULL_HANDLE), render_pass_); | 149 DCHECK_EQ(static_cast<VkRenderPass>(VK_NULL_HANDLE), render_pass_); |
136 DCHECK(frame_buffers_.empty()); | 150 DCHECK(frame_buffers_.empty()); |
137 } | 151 } |
138 | 152 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
392 auto iter = | 406 auto iter = |
393 std::lower_bound(attachment_clear_indexes_.begin(), | 407 std::lower_bound(attachment_clear_indexes_.begin(), |
394 attachment_clear_indexes_.end(), attachment_index); | 408 attachment_clear_indexes_.end(), attachment_index); |
395 if (iter != attachment_clear_indexes_.end() && *iter == attachment_index) { | 409 if (iter != attachment_clear_indexes_.end() && *iter == attachment_index) { |
396 const uint32_t index = iter - attachment_clear_indexes_.begin(); | 410 const uint32_t index = iter - attachment_clear_indexes_.begin(); |
397 attachment_clear_values_[index] = clear_value; | 411 attachment_clear_values_[index] = clear_value; |
398 } | 412 } |
399 } | 413 } |
400 | 414 |
401 } // namespace gpu | 415 } // namespace gpu |
OLD | NEW |