270 {
273 auto& colorAttachmentTextureInfo = renderPassDesc.fColorAttachment.fTextureInfo;
274 auto& colorResolveAttachmentTextureInfo = renderPassDesc.fColorResolveAttachment.fTextureInfo;
275 auto& depthStencilAttachmentTextureInfo = renderPassDesc.fDepthStencilAttachment.fTextureInfo;
276 bool hasColorAttachment = colorAttachmentTextureInfo.isValid();
277 bool hasColorResolveAttachment = colorResolveAttachmentTextureInfo.isValid();
278 bool hasDepthStencilAttachment = depthStencilAttachmentTextureInfo.isValid();
279
281
286
287 bool loadMSAAFromResolve = false;
288 if (hasColorAttachment) {
289 VulkanTextureInfo colorAttachTexInfo;
290 colorAttachmentTextureInfo.getVulkanTextureInfo(&colorAttachTexInfo);
291 auto& colorAttachDesc = renderPassDesc.fColorAttachment;
292
297 &vkColorAttachDesc,
298 colorAttachTexInfo,
299 colorAttachDesc,
305
306 if (hasColorResolveAttachment) {
307 loadMSAAFromResolve = renderPassDesc.fColorResolveAttachment.fLoadOp ==
LoadOp::kLoad;
309 VulkanTextureInfo resolveAttachTexInfo;
310 colorResolveAttachmentTextureInfo.getVulkanTextureInfo(&resolveAttachTexInfo);
311 auto& resolveAttachDesc = renderPassDesc.fColorResolveAttachment;
312
317 &vkResolveAttachDesc,
318 resolveAttachTexInfo,
319 resolveAttachDesc,
326 } else {
329 }
330 } else {
336 }
337
338 if (hasDepthStencilAttachment) {
339 VulkanTextureInfo depthStencilTexInfo;
340 depthStencilAttachmentTextureInfo.getVulkanTextureInfo(&depthStencilTexInfo);
341 auto& depthStencilAttachDesc = renderPassDesc.fDepthStencilAttachment;
342
346 &vkDepthStencilAttachDesc,
347 depthStencilTexInfo,
348 depthStencilAttachDesc,
354 } else {
357 }
358
359
363 renderPassInfo.
pNext =
nullptr;
364 renderPassInfo.
flags = 0;
365 renderPassInfo.
subpassCount = loadMSAAFromResolve ? 2 : 1;
366
369
370
372 if (loadMSAAFromResolve) {
375
378 loadSubpassDesc.
flags = 0;
388
389
390 const int mainSubpassIdx = loadMSAAFromResolve ? 1 : 0;
399 }
400
403 mainSubpassDesc.
flags = 0;
413
414 renderPassInfo.
pSubpasses = subpassDescs.begin();
419
423 CreateRenderPass(context->device(), &renderPassInfo,
nullptr, &
renderPass));
425 return nullptr;
426 }
428 VULKAN_CALL(context->interface(), GetRenderAreaGranularity(context->device(),
432}
void setup_vk_attachment_description(VkAttachmentDescription *attachment, const AttachmentDesc &desc, VkImageLayout startLayout, VkImageLayout endLayout)
#define VULKAN_CALL(IFACE, X)
#define VULKAN_CALL_RESULT(SHARED_CONTEXT, RESULT, X)
VkRenderPass renderPass() const
const VkSubpassDescription * pSubpasses
const VkSubpassDependency * pDependencies
const VkAttachmentDescription * pAttachments
VkRenderPassCreateFlags flags
const VkAttachmentReference * pDepthStencilAttachment
VkSubpassDescriptionFlags flags
uint32_t inputAttachmentCount
const VkAttachmentReference * pResolveAttachments
const uint32_t * pPreserveAttachments
const VkAttachmentReference * pInputAttachments
uint32_t colorAttachmentCount
const VkAttachmentReference * pColorAttachments
VkPipelineBindPoint pipelineBindPoint
uint32_t preserveAttachmentCount
@ VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
@ VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
@ VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL
@ VK_IMAGE_LAYOUT_UNDEFINED
@ VK_DEPENDENCY_BY_REGION_BIT
@ VK_PIPELINE_BIND_POINT_GRAPHICS
#define VK_ATTACHMENT_UNUSED
@ VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT
@ VK_ACCESS_COLOR_ATTACHMENT_READ_BIT
@ VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT
@ VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO