SDL: Vulkan Renderer - fix validation errors:

From 011502711603074fef225134ec1b44b36e3b5c9e Mon Sep 17 00:00:00 2001
From: danginsburg <[EMAIL REDACTED]>
Date: Thu, 29 Feb 2024 13:57:56 -0500
Subject: [PATCH] Vulkan Renderer - fix validation errors: * Make sure to
 always write pointSize in VS (fixes validation error in testsprite) * Fix
 validation error from acquiring swapchain semaphore more than once * Fix
 validation error from using incorrect framebuffer size in testautomation

Now passes testautomation with validation.
---
 src/render/vulkan/SDL_render_vulkan.c         |  8 +-
 .../vulkan/VULKAN_PixelShader_Advanced.h      |  2 +-
 src/render/vulkan/VULKAN_PixelShader_Colors.h |  2 +-
 .../vulkan/VULKAN_PixelShader_Textures.h      |  2 +-
 src/render/vulkan/VULKAN_VertexShader.h       | 91 ++++++++++---------
 src/render/vulkan/VULKAN_VertexShader.hlsl    |  4 +
 6 files changed, 58 insertions(+), 51 deletions(-)

diff --git a/src/render/vulkan/SDL_render_vulkan.c b/src/render/vulkan/SDL_render_vulkan.c
index d92dce4426c61..6dd17575eeb56 100644
--- a/src/render/vulkan/SDL_render_vulkan.c
+++ b/src/render/vulkan/SDL_render_vulkan.c
@@ -1956,8 +1956,8 @@ static VkResult VULKAN_CreateFramebuffersAndRenderPasses(SDL_Renderer *renderer,
     framebufferCreateInfo.pNext = NULL;
     framebufferCreateInfo.renderPass = rendererData->renderPasses[SDL_VULKAN_RENDERPASS_LOAD];
     framebufferCreateInfo.attachmentCount = 1;
-    framebufferCreateInfo.width = rendererData->swapchainSize.width;
-    framebufferCreateInfo.height = rendererData->swapchainSize.height;
+    framebufferCreateInfo.width = w;
+    framebufferCreateInfo.height = h;
     framebufferCreateInfo.layers = 1;
 
     for (int i = 0; i < imageViewCount; i++) {
@@ -3882,9 +3882,9 @@ static int VULKAN_RenderPresent(SDL_Renderer *renderer)
             SDL_LogError(SDL_LOG_CATEGORY_RENDER, "vkWaitForFences(): %s\n", SDL_Vulkan_GetResultString(result));
             return -1;
         }
-    }
 
-    VULKAN_AcquireNextSwapchainImage(renderer);
+        VULKAN_AcquireNextSwapchainImage(renderer);
+    }
 
     return (result == VK_SUCCESS);
 }
diff --git a/src/render/vulkan/VULKAN_PixelShader_Advanced.h b/src/render/vulkan/VULKAN_PixelShader_Advanced.h
index e9cc017589f39..f205918c5ce31 100644
--- a/src/render/vulkan/VULKAN_PixelShader_Advanced.h
+++ b/src/render/vulkan/VULKAN_PixelShader_Advanced.h
@@ -1,4 +1,4 @@
-	// 1114.0.0
+	// 1113.1.1
 	 #pragma once
 const uint32_t VULKAN_PixelShader_Advanced[] = {
 	0x07230203,0x00010000,0x0008000b,0x0000043e,0x00000000,0x00020011,0x00000001,0x0006000b,
diff --git a/src/render/vulkan/VULKAN_PixelShader_Colors.h b/src/render/vulkan/VULKAN_PixelShader_Colors.h
index fb21fd0719828..e28a83a1a16ce 100644
--- a/src/render/vulkan/VULKAN_PixelShader_Colors.h
+++ b/src/render/vulkan/VULKAN_PixelShader_Colors.h
@@ -1,4 +1,4 @@
-	// 1114.0.0
+	// 1113.1.1
 	 #pragma once
 const uint32_t VULKAN_PixelShader_Colors[] = {
 	0x07230203,0x00010000,0x0008000b,0x000000a1,0x00000000,0x00020011,0x00000001,0x0006000b,
diff --git a/src/render/vulkan/VULKAN_PixelShader_Textures.h b/src/render/vulkan/VULKAN_PixelShader_Textures.h
index c423e4ef67535..bc750d43372df 100644
--- a/src/render/vulkan/VULKAN_PixelShader_Textures.h
+++ b/src/render/vulkan/VULKAN_PixelShader_Textures.h
@@ -1,4 +1,4 @@
-	// 1114.0.0
+	// 1113.1.1
 	 #pragma once
 const uint32_t VULKAN_PixelShader_Textures[] = {
 	0x07230203,0x00010000,0x0008000b,0x000000a8,0x00000000,0x00020011,0x00000001,0x0006000b,
diff --git a/src/render/vulkan/VULKAN_VertexShader.h b/src/render/vulkan/VULKAN_VertexShader.h
index 3f5b76741a294..cb95262468418 100644
--- a/src/render/vulkan/VULKAN_VertexShader.h
+++ b/src/render/vulkan/VULKAN_VertexShader.h
@@ -1,48 +1,51 @@
-	// 1114.0.0
+	// 1113.1.1
 	 #pragma once
 const uint32_t VULKAN_VertexShader[] = {
-	0x07230203,0x00010000,0x0008000b,0x000000a1,0x00000000,0x00020011,0x00000001,0x0006000b,
+	0x07230203,0x00010000,0x0008000b,0x000000af,0x00000000,0x00020011,0x00000001,0x0006000b,
 	0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
-	0x000b000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000003c,0x00000040,0x00000044,
-	0x00000056,0x00000059,0x0000005c,0x00030003,0x00000005,0x000001f4,0x00040005,0x00000004,
-	0x6e69616d,0x00000000,0x00060005,0x0000001e,0x68737570,0x736e6f43,0x746e6174,0x00000073,
-	0x00050006,0x0000001e,0x00000000,0x65646f6d,0x0000006c,0x00080006,0x0000001e,0x00000001,
-	0x6a6f7270,0x69746365,0x6e416e6f,0x65695664,0x00000077,0x00060005,0x00000020,0x68737570,
-	0x736e6f43,0x746e6174,0x00000073,0x00050005,0x0000003c,0x75706e69,0x6f702e74,0x00000073,
-	0x00050005,0x00000040,0x75706e69,0x65742e74,0x00000078,0x00050005,0x00000044,0x75706e69,
-	0x6f632e74,0x00726f6c,0x00080005,0x00000056,0x746e6540,0x6f507972,0x4f746e69,0x75707475,
-	0x6f702e74,0x00000073,0x00080005,0x00000059,0x746e6540,0x6f507972,0x4f746e69,0x75707475,
-	0x65742e74,0x00000078,0x00080005,0x0000005c,0x746e6540,0x6f507972,0x4f746e69,0x75707475,
-	0x6f632e74,0x00726f6c,0x00040048,0x0000001e,0x00000000,0x00000005,0x00050048,0x0000001e,
-	0x00000000,0x00000023,0x00000000,0x00050048,0x0000001e,0x00000000,0x00000007,0x00000010,
-	0x00040048,0x0000001e,0x00000001,0x00000005,0x00050048,0x0000001e,0x00000001,0x00000023,
-	0x00000040,0x00050048,0x0000001e,0x00000001,0x00000007,0x00000010,0x00030047,0x0000001e,
-	0x00000002,0x00040047,0x0000003c,0x0000001e,0x00000000,0x00040047,0x00000040,0x0000001e,
-	0x00000001,0x00040047,0x00000044,0x0000001e,0x00000002,0x00040047,0x00000056,0x0000000b,
-	0x00000000,0x00040047,0x00000059,0x0000001e,0x00000000,0x00040047,0x0000005c,0x0000001e,
-	0x00000001,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,
-	0x00000020,0x00040017,0x00000007,0x00000006,0x00000003,0x00040017,0x00000008,0x00000006,
-	0x00000002,0x00040017,0x00000009,0x00000006,0x00000004,0x00040015,0x00000013,0x00000020,
-	0x00000001,0x0004002b,0x00000013,0x00000014,0x00000000,0x0004002b,0x00000006,0x00000018,
-	0x3f800000,0x00040018,0x0000001d,0x00000009,0x00000004,0x0004001e,0x0000001e,0x0000001d,
-	0x0000001d,0x00040020,0x0000001f,0x00000009,0x0000001e,0x0004003b,0x0000001f,0x00000020,
-	0x00000009,0x00040020,0x00000021,0x00000009,0x0000001d,0x0004002b,0x00000013,0x00000026,
-	0x00000001,0x00040020,0x0000003b,0x00000001,0x00000007,0x0004003b,0x0000003b,0x0000003c,
-	0x00000001,0x00040020,0x0000003f,0x00000001,0x00000008,0x0004003b,0x0000003f,0x00000040,
-	0x00000001,0x00040020,0x00000043,0x00000001,0x00000009,0x0004003b,0x00000043,0x00000044,
-	0x00000001,0x00040020,0x00000055,0x00000003,0x00000009,0x0004003b,0x00000055,0x00000056,
-	0x00000003,0x00040020,0x00000058,0x00000003,0x00000008,0x0004003b,0x00000058,0x00000059,
-	0x00000003,0x0004003b,0x00000055,0x0000005c,0x00000003,0x00050036,0x00000002,0x00000004,
-	0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003d,0x00000007,0x0000003d,0x0000003c,
-	0x0004003d,0x00000008,0x00000041,0x00000040,0x0004003d,0x00000009,0x00000045,0x00000044,
-	0x00050051,0x00000006,0x00000065,0x0000003d,0x00000000,0x00050051,0x00000006,0x00000066,
-	0x0000003d,0x00000001,0x00050051,0x00000006,0x00000067,0x0000003d,0x00000002,0x00070050,
-	0x00000009,0x00000068,0x00000065,0x00000066,0x00000067,0x00000018,0x00050041,0x00000021,
-	0x00000069,0x00000020,0x00000014,0x0004003d,0x0000001d,0x0000006a,0x00000069,0x00050091,
-	0x00000009,0x0000006c,0x0000006a,0x00000068,0x00050041,0x00000021,0x0000006d,0x00000020,
-	0x00000026,0x0004003d,0x0000001d,0x0000006e,0x0000006d,0x00050091,0x00000009,0x00000070,
-	0x0000006e,0x0000006c,0x00050051,0x00000006,0x00000052,0x00000070,0x00000001,0x0004007f,
-	0x00000006,0x00000053,0x00000052,0x00060052,0x00000009,0x000000a0,0x00000053,0x00000070,
-	0x00000001,0x0003003e,0x00000056,0x000000a0,0x0003003e,0x00000059,0x00000041,0x0003003e,
-	0x0000005c,0x00000045,0x000100fd,0x00010038
+	0x000c000f,0x00000000,0x00000004,0x6e69616d,0x00000000,0x0000003f,0x00000043,0x00000047,
+	0x00000058,0x0000005b,0x0000005e,0x00000062,0x00030003,0x00000005,0x000001f4,0x00040005,
+	0x00000004,0x6e69616d,0x00000000,0x00060005,0x0000001e,0x68737570,0x736e6f43,0x746e6174,
+	0x00000073,0x00050006,0x0000001e,0x00000000,0x65646f6d,0x0000006c,0x00080006,0x0000001e,
+	0x00000001,0x6a6f7270,0x69746365,0x6e416e6f,0x65695664,0x00000077,0x00060005,0x00000020,
+	0x68737570,0x736e6f43,0x746e6174,0x00000073,0x00050005,0x0000003f,0x75706e69,0x6f702e74,
+	0x00000073,0x00050005,0x00000043,0x75706e69,0x65742e74,0x00000078,0x00050005,0x00000047,
+	0x75706e69,0x6f632e74,0x00726f6c,0x00080005,0x00000058,0x746e6540,0x6f507972,0x4f746e69,
+	0x75707475,0x6f702e74,0x00000073,0x00080005,0x0000005b,0x746e6540,0x6f507972,0x4f746e69,
+	0x75707475,0x65742e74,0x00000078,0x00080005,0x0000005e,0x746e6540,0x6f507972,0x4f746e69,
+	0x75707475,0x6f632e74,0x00726f6c,0x00090005,0x00000062,0x746e6540,0x6f507972,0x4f746e69,
+	0x75707475,0x6f702e74,0x53746e69,0x00657a69,0x00040048,0x0000001e,0x00000000,0x00000005,
+	0x00050048,0x0000001e,0x00000000,0x00000023,0x00000000,0x00050048,0x0000001e,0x00000000,
+	0x00000007,0x00000010,0x00040048,0x0000001e,0x00000001,0x00000005,0x00050048,0x0000001e,
+	0x00000001,0x00000023,0x00000040,0x00050048,0x0000001e,0x00000001,0x00000007,0x00000010,
+	0x00030047,0x0000001e,0x00000002,0x00040047,0x0000003f,0x0000001e,0x00000000,0x00040047,
+	0x00000043,0x0000001e,0x00000001,0x00040047,0x00000047,0x0000001e,0x00000002,0x00040047,
+	0x00000058,0x0000000b,0x00000000,0x00040047,0x0000005b,0x0000001e,0x00000000,0x00040047,
+	0x0000005e,0x0000001e,0x00000001,0x00040047,0x00000062,0x0000000b,0x00000001,0x00020013,
+	0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,
+	0x00000007,0x00000006,0x00000003,0x00040017,0x00000008,0x00000006,0x00000002,0x00040017,
+	0x00000009,0x00000006,0x00000004,0x00040015,0x00000013,0x00000020,0x00000001,0x0004002b,
+	0x00000013,0x00000014,0x00000000,0x0004002b,0x00000006,0x00000018,0x3f800000,0x00040018,
+	0x0000001d,0x00000009,0x00000004,0x0004001e,0x0000001e,0x0000001d,0x0000001d,0x00040020,
+	0x0000001f,0x00000009,0x0000001e,0x0004003b,0x0000001f,0x00000020,0x00000009,0x00040020,
+	0x00000021,0x00000009,0x0000001d,0x0004002b,0x00000013,0x00000026,0x00000001,0x00040020,
+	0x0000003e,0x00000001,0x00000007,0x0004003b,0x0000003e,0x0000003f,0x00000001,0x00040020,
+	0x00000042,0x00000001,0x00000008,0x0004003b,0x00000042,0x00000043,0x00000001,0x00040020,
+	0x00000046,0x00000001,0x00000009,0x0004003b,0x00000046,0x00000047,0x00000001,0x00040020,
+	0x00000057,0x00000003,0x00000009,0x0004003b,0x00000057,0x00000058,0x00000003,0x00040020,
+	0x0000005a,0x00000003,0x00000008,0x0004003b,0x0000005a,0x0000005b,0x00000003,0x0004003b,
+	0x00000057,0x0000005e,0x00000003,0x00040020,0x00000061,0x00000003,0x00000006,0x0004003b,
+	0x00000061,0x00000062,0x00000003,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,
+	0x000200f8,0x00000005,0x0004003d,0x00000007,0x00000040,0x0000003f,0x0004003d,0x00000008,
+	0x00000044,0x00000043,0x0004003d,0x00000009,0x00000048,0x00000047,0x00050051,0x00000006,
+	0x0000006b,0x00000040,0x00000000,0x00050051,0x00000006,0x0000006c,0x00000040,0x00000001,
+	0x00050051,0x00000006,0x0000006d,0x00000040,0x00000002,0x00070050,0x00000009,0x0000006e,
+	0x0000006b,0x0000006c,0x0000006d,0x00000018,0x00050041,0x00000021,0x0000006f,0x00000020,
+	0x00000014,0x0004003d,0x0000001d,0x00000070,0x0000006f,0x00050091,0x00000009,0x00000072,
+	0x00000070,0x0000006e,0x00050041,0x00000021,0x00000073,0x00000020,0x00000026,0x0004003d,
+	0x0000001d,0x00000074,0x00000073,0x00050091,0x00000009,0x00000076,0x00000074,0x00000072,
+	0x00050051,0x00000006,0x00000054,0x00000076,0x00000001,0x0004007f,0x00000006,0x00000055,
+	0x00000054,0x00060052,0x00000009,0x000000ae,0x00000055,0x00000076,0x00000001,0x0003003e,
+	0x00000058,0x000000ae,0x0003003e,0x0000005b,0x00000044,0x0003003e,0x0000005e,0x00000048,
+	0x0003003e,0x00000062,0x00000018,0x000100fd,0x00010038
 };
diff --git a/src/render/vulkan/VULKAN_VertexShader.hlsl b/src/render/vulkan/VULKAN_VertexShader.hlsl
index b7d5e46306043..d376876295a5e 100644
--- a/src/render/vulkan/VULKAN_VertexShader.hlsl
+++ b/src/render/vulkan/VULKAN_VertexShader.hlsl
@@ -20,6 +20,7 @@ struct VertexShaderOutput
     float4 pos : SV_POSITION;
     float2 tex : TEXCOORD0;
     float4 color : COLOR0;
+    [[vk::builtin("PointSize")]] float pointSize : SV_PointSize;
 };
 
 VertexShaderOutput mainColor(VertexShaderInput input)
@@ -36,6 +37,9 @@ VertexShaderOutput mainColor(VertexShaderInput input)
     output.tex = input.tex;
     output.color = input.color;
 
+    // Always output pointSize so that this VS can be used with points
+    output.pointSize = 1.0;
+
     return output;
 }