From fe387c97e11efff45eb21895199421ad2825e3e3 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 5 Apr 2023 10:24:51 +0200 Subject: vkgears: follow best-practices While I'm not convinced this should have been considered a best practice in the first place, the benefits from not having noise like this when running with validation layers is enough to convince me that it's better to do this than not to. Acked-by: Hoe Hao Cheng --- src/vulkan/vkgears.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vulkan/vkgears.c b/src/vulkan/vkgears.c index 55ca4d73..d598e12b 100644 --- a/src/vulkan/vkgears.c +++ b/src/vulkan/vkgears.c @@ -1478,6 +1478,7 @@ main(int argc, char *argv[]) if (!check_sample_count_support(sample_count)) error("Sample count not supported"); + int attachment_count = sample_count != VK_SAMPLE_COUNT_1_BIT ? 3 : 2; image_format = VK_FORMAT_B8G8R8A8_SRGB; if (printInfo) @@ -1574,7 +1575,7 @@ main(int argc, char *argv[]) .renderPass = render_pass, .framebuffer = swap_chain_data[index].framebuffer, .renderArea = { { 0, 0 }, { width, height } }, - .clearValueCount = 3, + .clearValueCount = attachment_count, .pClearValues = (VkClearValue []) { { .color = { .float32 = { 0.0f, 0.0f, 0.0f, 1.0f } } }, { .depthStencil.depth = 1.0f }, -- cgit v1.2.1