| 321 | } |
| 322 | |
| 323 | VkRenderPass SimpleColorWriteRenderPass(VkDevice device, VkImageLayout initialLayout, VkImageLayout passLayout, VkImageLayout finalLayout) |
| 324 | { |
| 325 | // color RT |
| 326 | VkAttachmentDescription attachments[1]; |
| 327 | attachments[0].format = VK_FORMAT_R16G16B16A16_SFLOAT; |
| 328 | attachments[0].samples = VK_SAMPLE_COUNT_1_BIT; |
| 329 | attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; // we don't care about the previous contents, this is for a full screen pass with no blending |
| 330 | attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE; |
| 331 | attachments[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; |
| 332 | attachments[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; |
| 333 | attachments[0].initialLayout = initialLayout; |
| 334 | attachments[0].finalLayout = finalLayout; |
| 335 | attachments[0].flags = 0; |
| 336 | |
| 337 | VkAttachmentReference color_reference = { 0, passLayout }; |
| 338 | |
| 339 | VkSubpassDescription subpass = {}; |
| 340 | subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; |
| 341 | subpass.flags = 0; |
| 342 | subpass.inputAttachmentCount = 0; |
| 343 | subpass.pInputAttachments = NULL; |
| 344 | subpass.colorAttachmentCount = 1; |
| 345 | subpass.pColorAttachments = &color_reference; |
| 346 | subpass.pResolveAttachments = NULL; |
| 347 | subpass.pDepthStencilAttachment = NULL; |
| 348 | subpass.preserveAttachmentCount = 0; |
| 349 | subpass.pPreserveAttachments = NULL; |
| 350 | |
| 351 | VkSubpassDependency dep = {}; |
| 352 | dep.dependencyFlags = 0; |
| 353 | dep.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_SHADER_READ_BIT; |
| 354 | dep.dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; |
| 355 | dep.dstSubpass = VK_SUBPASS_EXTERNAL; |
| 356 | dep.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; |
| 357 | dep.srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; |
| 358 | dep.srcSubpass = 0; |
| 359 | |
| 360 | VkRenderPassCreateInfo rp_info = {}; |
| 361 | rp_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; |
| 362 | rp_info.pNext = NULL; |
| 363 | rp_info.attachmentCount = 1; |
| 364 | rp_info.pAttachments = attachments; |
| 365 | rp_info.subpassCount = 1; |
| 366 | rp_info.pSubpasses = &subpass; |
| 367 | rp_info.dependencyCount = 1; |
| 368 | rp_info.pDependencies = &dep; |
| 369 | |
| 370 | VkRenderPass renderPass; |
| 371 | VkResult res = vkCreateRenderPass(device, &rp_info, NULL, &renderPass); |
| 372 | assert(res == VK_SUCCESS); |
| 373 | |
| 374 | SetResourceName(device, VK_OBJECT_TYPE_RENDER_PASS, (uint64_t)renderPass, "SimpleColorWriteRenderPass"); |
| 375 | |
| 376 | return renderPass; |
| 377 | } |
| 378 | |
| 379 | VkRenderPass SimpleColorBlendRenderPass(VkDevice device, VkFormat format, VkImageLayout initialLayout, VkImageLayout passLayout, VkImageLayout finalLayout) |
| 380 | { |
no test coverage detected