Fixed building the Vulkan renderer on Windows with Visual Studio
parent
dfd8073a8f
commit
b9a00aa88e
|
@ -388,6 +388,7 @@
|
||||||
<ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
|
<ClInclude Include="..\..\src\render\software\SDL_render_sw_c.h" />
|
||||||
<ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
|
<ClInclude Include="..\..\src\render\software\SDL_rotate.h" />
|
||||||
<ClInclude Include="..\..\src\render\software\SDL_triangle.h" />
|
<ClInclude Include="..\..\src\render\software\SDL_triangle.h" />
|
||||||
|
<ClInclude Include="..\..\src\render\vulkan\SDL_shaders_vulkan.h" />
|
||||||
<ClInclude Include="..\..\src\SDL_assert_c.h" />
|
<ClInclude Include="..\..\src\SDL_assert_c.h" />
|
||||||
<ClInclude Include="..\..\src\SDL_error_c.h" />
|
<ClInclude Include="..\..\src\SDL_error_c.h" />
|
||||||
<ClCompile Include="..\..\src\core\windows\pch.c">
|
<ClCompile Include="..\..\src\core\windows\pch.c">
|
||||||
|
@ -401,6 +402,8 @@
|
||||||
<ClCompile Include="..\..\src\camera\SDL_camera.c" />
|
<ClCompile Include="..\..\src\camera\SDL_camera.c" />
|
||||||
<ClCompile Include="..\..\src\main\generic\SDL_sysmain_callbacks.c" />
|
<ClCompile Include="..\..\src\main\generic\SDL_sysmain_callbacks.c" />
|
||||||
<ClCompile Include="..\..\src\main\SDL_main_callbacks.c" />
|
<ClCompile Include="..\..\src\main\SDL_main_callbacks.c" />
|
||||||
|
<ClCompile Include="..\..\src\render\vulkan\SDL_render_vulkan.c" />
|
||||||
|
<ClCompile Include="..\..\src\render\vulkan\SDL_shaders_vulkan.c" />
|
||||||
<ClCompile Include="..\..\src\SDL_guid.c" />
|
<ClCompile Include="..\..\src\SDL_guid.c" />
|
||||||
<ClInclude Include="..\..\src\SDL_hashtable.h" />
|
<ClInclude Include="..\..\src\SDL_hashtable.h" />
|
||||||
<ClInclude Include="..\..\src\SDL_hints_c.h" />
|
<ClInclude Include="..\..\src\SDL_hints_c.h" />
|
||||||
|
|
|
@ -187,6 +187,9 @@
|
||||||
<Filter Include="camera\mediafoundation">
|
<Filter Include="camera\mediafoundation">
|
||||||
<UniqueIdentifier>{0000fbfe2d21e4f451142e7d0e870000}</UniqueIdentifier>
|
<UniqueIdentifier>{0000fbfe2d21e4f451142e7d0e870000}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="render\vulkan">
|
||||||
|
<UniqueIdentifier>{5115ba31-20f8-4eab-a8c5-6a572ab78ff7}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\include\SDL3\SDL_begin_code.h">
|
<ClInclude Include="..\..\include\SDL3\SDL_begin_code.h">
|
||||||
|
@ -853,6 +856,9 @@
|
||||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_lsx_func.h" />
|
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_lsx_func.h" />
|
||||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_sse.h" />
|
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_sse.h" />
|
||||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_std.h" />
|
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_std.h" />
|
||||||
|
<ClInclude Include="..\..\src\render\vulkan\SDL_shaders_vulkan.h">
|
||||||
|
<Filter>render\vulkan</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi.c" />
|
<ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi.c" />
|
||||||
|
@ -1434,8 +1440,17 @@
|
||||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_lsx.c" />
|
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_lsx.c" />
|
||||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_sse.c" />
|
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_sse.c" />
|
||||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_std.c" />
|
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb_std.c" />
|
||||||
|
<ClCompile Include="..\..\src\render\vulkan\SDL_render_vulkan.c">
|
||||||
|
<Filter>render\vulkan</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\render\vulkan\SDL_shaders_vulkan.c">
|
||||||
|
<Filter>render\vulkan</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="..\..\src\core\windows\version.rc" />
|
<ResourceCompile Include="..\..\src\core\windows\version.rc" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<MASM Include="..\..\src\stdlib\SDL_mslibc_x64.masm" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -305,6 +305,10 @@ typedef unsigned int uintptr_t;
|
||||||
/* Enable Vulkan support */
|
/* Enable Vulkan support */
|
||||||
#define SDL_VIDEO_VULKAN 1
|
#define SDL_VIDEO_VULKAN 1
|
||||||
|
|
||||||
|
#ifndef SDL_VIDEO_RENDER_VULKAN
|
||||||
|
#define SDL_VIDEO_RENDER_VULKAN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Enable system power support */
|
/* Enable system power support */
|
||||||
#define SDL_POWER_WINDOWS 1
|
#define SDL_POWER_WINDOWS 1
|
||||||
|
|
||||||
|
|
|
@ -31,13 +31,12 @@
|
||||||
|
|
||||||
|
|
||||||
#define VK_NO_PROTOTYPES
|
#define VK_NO_PROTOTYPES
|
||||||
#include "SDL_vulkan.h"
|
#include "../../video/SDL_vulkan_internal.h"
|
||||||
#include "SDL_shaders_vulkan.h"
|
#include "../../video/SDL_sysvideo.h"
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
#include "../SDL_sysrender.h"
|
#include "../SDL_sysrender.h"
|
||||||
#include "../SDL_sysvideo.h"
|
|
||||||
#include "../SDL_d3dmath.h"
|
#include "../SDL_d3dmath.h"
|
||||||
#include "../../video/SDL_pixels_c.h"
|
#include "../../video/SDL_pixels_c.h"
|
||||||
|
#include "SDL_shaders_vulkan.h"
|
||||||
|
|
||||||
extern const char *SDL_Vulkan_GetResultString(VkResult result);
|
extern const char *SDL_Vulkan_GetResultString(VkResult result);
|
||||||
|
|
||||||
|
@ -526,7 +525,7 @@ static void VULKAN_DestroyAll(SDL_Renderer *renderer)
|
||||||
rendererData->pipelineLayouts[i] = VK_NULL_HANDLE;
|
rendererData->pipelineLayouts[i] = VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (uint32_t i = 0; i < rendererData->pipelineStateCount; i++) {
|
for (int i = 0; i < rendererData->pipelineStateCount; i++) {
|
||||||
vkDestroyPipeline(rendererData->device, rendererData->pipelineStates[i].pipeline, NULL);
|
vkDestroyPipeline(rendererData->device, rendererData->pipelineStates[i].pipeline, NULL);
|
||||||
}
|
}
|
||||||
SDL_free(rendererData->pipelineStates);
|
SDL_free(rendererData->pipelineStates);
|
||||||
|
@ -534,7 +533,7 @@ static void VULKAN_DestroyAll(SDL_Renderer *renderer)
|
||||||
|
|
||||||
if (rendererData->currentUploadBuffer) {
|
if (rendererData->currentUploadBuffer) {
|
||||||
for (uint32_t i = 0; i < rendererData->swapchainImageCount; ++i) {
|
for (uint32_t i = 0; i < rendererData->swapchainImageCount; ++i) {
|
||||||
for (uint32_t j = 0; j < rendererData->currentUploadBuffer[i]; ++j) {
|
for (int j = 0; j < rendererData->currentUploadBuffer[i]; ++j) {
|
||||||
VULKAN_DestroyBuffer(rendererData, &rendererData->uploadBuffers[i][j]);
|
VULKAN_DestroyBuffer(rendererData, &rendererData->uploadBuffers[i][j]);
|
||||||
}
|
}
|
||||||
SDL_free(rendererData->uploadBuffers[i]);
|
SDL_free(rendererData->uploadBuffers[i]);
|
||||||
|
@ -914,7 +913,7 @@ static void VULKAN_ResetCommandList(VULKAN_RenderData *rendererData)
|
||||||
rendererData->currentConstantBufferOffset = -1;
|
rendererData->currentConstantBufferOffset = -1;
|
||||||
|
|
||||||
/* Release any upload buffers that were inflight */
|
/* Release any upload buffers that were inflight */
|
||||||
for (uint32_t i = 0; i < rendererData->currentUploadBuffer[rendererData->currentCommandBufferIndex]; ++i) {
|
for (int i = 0; i < rendererData->currentUploadBuffer[rendererData->currentCommandBufferIndex]; ++i) {
|
||||||
VULKAN_DestroyBuffer(rendererData, &rendererData->uploadBuffers[rendererData->currentCommandBufferIndex][i]);
|
VULKAN_DestroyBuffer(rendererData, &rendererData->uploadBuffers[rendererData->currentCommandBufferIndex][i]);
|
||||||
}
|
}
|
||||||
rendererData->currentUploadBuffer[rendererData->currentCommandBufferIndex] = 0;
|
rendererData->currentUploadBuffer[rendererData->currentCommandBufferIndex] = 0;
|
||||||
|
@ -1843,7 +1842,7 @@ static VkResult VULKAN_CreateFramebuffersAndRenderPasses(SDL_Renderer *renderer,
|
||||||
framebufferCreateInfo.height = rendererData->swapchainSize.height;
|
framebufferCreateInfo.height = rendererData->swapchainSize.height;
|
||||||
framebufferCreateInfo.layers = 1;
|
framebufferCreateInfo.layers = 1;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < imageViewCount; i++) {
|
for (int i = 0; i < imageViewCount; i++) {
|
||||||
framebufferCreateInfo.pAttachments = &imageViews[i];
|
framebufferCreateInfo.pAttachments = &imageViews[i];
|
||||||
result = vkCreateFramebuffer(rendererData->device, &framebufferCreateInfo, NULL, &framebuffers[i]);
|
result = vkCreateFramebuffer(rendererData->device, &framebufferCreateInfo, NULL, &framebuffers[i]);
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
|
@ -3107,7 +3106,7 @@ static SDL_bool VULKAN_SetDrawState(SDL_Renderer *renderer, const SDL_RenderComm
|
||||||
/* Align the next address to the minUniformBufferOffsetAlignment */
|
/* Align the next address to the minUniformBufferOffsetAlignment */
|
||||||
VkDeviceSize alignment = rendererData->physicalDeviceProperties.limits.minUniformBufferOffsetAlignment;
|
VkDeviceSize alignment = rendererData->physicalDeviceProperties.limits.minUniformBufferOffsetAlignment;
|
||||||
SDL_assert(rendererData->currentConstantBufferOffset >= 0 );
|
SDL_assert(rendererData->currentConstantBufferOffset >= 0 );
|
||||||
rendererData->currentConstantBufferOffset += (sizeof(PixelShaderConstants) + alignment - 1) & ~(alignment - 1);
|
rendererData->currentConstantBufferOffset += (int32_t)(sizeof(PixelShaderConstants) + alignment - 1) & ~(alignment - 1);
|
||||||
constantBufferOffset = rendererData->currentConstantBufferOffset;
|
constantBufferOffset = rendererData->currentConstantBufferOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3303,7 +3302,7 @@ static SDL_bool VULKAN_SetCopyState(SDL_Renderer *renderer, const SDL_RenderComm
|
||||||
static void VULKAN_DrawPrimitives(SDL_Renderer *renderer, VkPrimitiveTopology primitiveTopology, const size_t vertexStart, const size_t vertexCount)
|
static void VULKAN_DrawPrimitives(SDL_Renderer *renderer, VkPrimitiveTopology primitiveTopology, const size_t vertexStart, const size_t vertexCount)
|
||||||
{
|
{
|
||||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->driverdata;
|
||||||
vkCmdDraw(rendererData->currentCommandBuffer, vertexCount, 1, vertexStart, 0);
|
vkCmdDraw(rendererData->currentCommandBuffer, (uint32_t)vertexCount, 1, (uint32_t)vertexStart, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VULKAN_InvalidateCachedState(SDL_Renderer *renderer)
|
static void VULKAN_InvalidateCachedState(SDL_Renderer *renderer)
|
||||||
|
|
Loading…
Reference in New Issue