From da32d051b35ca1a0f3d822c088edcb83d6fc8cb4 Mon Sep 17 00:00:00 2001 From: Krzysztof Kondrak Date: Fri, 28 Aug 2020 18:53:33 +0200 Subject: [PATCH] Create MSAA color buffer only when it's actually needed. --- src/client/refresh/vk/vk_common.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/client/refresh/vk/vk_common.c b/src/client/refresh/vk/vk_common.c index 54638f49..cd72d793 100644 --- a/src/client/refresh/vk/vk_common.c +++ b/src/client/refresh/vk/vk_common.c @@ -709,10 +709,14 @@ static void CreateDrawBuffers() QVk_CreateColorBuffer(VK_SAMPLE_COUNT_1_BIT, &vk_colorbufferWarp, VK_IMAGE_USAGE_SAMPLED_BIT); R_Printf(PRINT_ALL, "...created world postpocess color buffer\n"); - QVk_CreateColorBuffer(vk_renderpasses[RP_WORLD].sampleCount, &vk_msaaColorbuffer, - 0); - R_Printf(PRINT_ALL, "...created MSAAx%d color buffer\n", - vk_renderpasses[RP_WORLD].sampleCount); + + if (vk_renderpasses[RP_WORLD].sampleCount > 1) + { + QVk_CreateColorBuffer(vk_renderpasses[RP_WORLD].sampleCount, &vk_msaaColorbuffer, + 0); + R_Printf(PRINT_ALL, "...created MSAAx%d color buffer\n", + vk_renderpasses[RP_WORLD].sampleCount); + } QVk_DebugSetObjectName((uint64_t)vk_depthbuffer.resource.image, VK_OBJECT_TYPE_IMAGE, "Depth Buffer: World"); @@ -738,12 +742,16 @@ static void CreateDrawBuffers() VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: Warp Postprocess Color Buffer"); QVk_DebugSetObjectName((uint64_t)vk_colorbufferWarp.resource.memory, VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: Warp Postprocess Color Buffer"); - QVk_DebugSetObjectName((uint64_t)vk_msaaColorbuffer.resource.image, - VK_OBJECT_TYPE_IMAGE, "Color Buffer: MSAA"); - QVk_DebugSetObjectName((uint64_t)vk_msaaColorbuffer.imageView, - VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: MSAA Color Buffer"); - QVk_DebugSetObjectName((uint64_t)vk_msaaColorbuffer.resource.memory, - VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: MSAA Color Buffer"); + + if (vk_renderpasses[RP_WORLD].sampleCount > 1) + { + QVk_DebugSetObjectName((uint64_t)vk_msaaColorbuffer.resource.image, + VK_OBJECT_TYPE_IMAGE, "Color Buffer: MSAA"); + QVk_DebugSetObjectName((uint64_t)vk_msaaColorbuffer.imageView, + VK_OBJECT_TYPE_IMAGE_VIEW, "Image View: MSAA Color Buffer"); + QVk_DebugSetObjectName((uint64_t)vk_msaaColorbuffer.resource.memory, + VK_OBJECT_TYPE_DEVICE_MEMORY, "Memory: MSAA Color Buffer"); + } } // internal helper