| 4471 | } |
| 4472 | |
| 4473 | static void VulkanSetRenderTargetSize(HContext _context, HRenderTarget render_target, uint32_t width, uint32_t height) |
| 4474 | { |
| 4475 | VulkanContext* context = (VulkanContext*)_context; |
| 4476 | VulkanRenderTarget* rt = GetAssetFromContainer<VulkanRenderTarget>(context->m_BaseContext.m_AssetHandleContainer, render_target); |
| 4477 | RenderTarget* brt = &rt->m_Base; |
| 4478 | |
| 4479 | for (uint32_t i = 0; i < MAX_BUFFER_COLOR_ATTACHMENTS; ++i) |
| 4480 | { |
| 4481 | brt->m_ColorTextureParams[i].m_Width = width; |
| 4482 | brt->m_ColorTextureParams[i].m_Height = height; |
| 4483 | |
| 4484 | if (brt->m_TextureColor[i]) |
| 4485 | { |
| 4486 | VulkanTexture* texture_color = GetAssetFromContainer<VulkanTexture>(context->m_BaseContext.m_AssetHandleContainer, brt->m_TextureColor[i]); |
| 4487 | VkImageUsageFlags vk_usage_flags = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | texture_color->m_UsageFlags; |
| 4488 | VkMemoryPropertyFlags vk_memory_type = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; |
| 4489 | |
| 4490 | if (IsTextureMemoryless(texture_color)) |
| 4491 | { |
| 4492 | vk_memory_type |= VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT; |
| 4493 | } |
| 4494 | |
| 4495 | texture_color->m_ImageLayout[0] = VK_IMAGE_LAYOUT_PREINITIALIZED; |
| 4496 | |
| 4497 | DestroyResourceDeferred(context, texture_color); |
| 4498 | VkResult res = CreateTexture( |
| 4499 | context->m_PhysicalDevice.m_Device, |
| 4500 | context->m_LogicalDevice.m_Device, |
| 4501 | width, height, 1, |
| 4502 | texture_color->m_Base.m_MipMapCount, 1, VK_SAMPLE_COUNT_1_BIT, |
| 4503 | texture_color->m_Format, |
| 4504 | VK_IMAGE_TILING_OPTIMAL, |
| 4505 | vk_usage_flags, |
| 4506 | vk_memory_type, |
| 4507 | VK_IMAGE_ASPECT_COLOR_BIT, |
| 4508 | texture_color); |
| 4509 | CHECK_VK_ERROR(res); |
| 4510 | |
| 4511 | texture_color->m_Base.m_Width = width; |
| 4512 | texture_color->m_Base.m_Height = height; |
| 4513 | } |
| 4514 | } |
| 4515 | |
| 4516 | if (brt->m_TextureDepthStencil) |
| 4517 | { |
| 4518 | brt->m_DepthStencilTextureParams.m_Width = width; |
| 4519 | brt->m_DepthStencilTextureParams.m_Height = height; |
| 4520 | |
| 4521 | VulkanTexture* depth_stencil_texture = GetAssetFromContainer<VulkanTexture>(context->m_BaseContext.m_AssetHandleContainer, brt->m_TextureDepthStencil); |
| 4522 | DestroyResourceDeferred(context, depth_stencil_texture); |
| 4523 | |
| 4524 | // Check tiling support for this format |
| 4525 | VkImageTiling vk_image_tiling = VK_IMAGE_TILING_OPTIMAL; |
| 4526 | VkFormat vk_depth_stencil_format = depth_stencil_texture->m_Format; |
| 4527 | VkFormat vk_depth_format = GetSupportedTilingFormat(context->m_PhysicalDevice.m_Device, &vk_depth_stencil_format, |
| 4528 | 1, vk_image_tiling, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT); |
| 4529 | |
| 4530 | if (vk_depth_format == VK_FORMAT_UNDEFINED) |
nothing calls this directly
no test coverage detected