From 925e47a077fb7103831cce147b3751ba689d4170 Mon Sep 17 00:00:00 2001
From: cosmonaut <[EMAIL REDACTED]>
Date: Wed, 25 Sep 2024 12:47:12 -0700
Subject: [PATCH] GPU: Fix backwards LogError and SetError calls
---
src/gpu/d3d11/SDL_gpu_d3d11.c | 8 ++++----
src/gpu/vulkan/SDL_gpu_vulkan.c | 14 +++++++-------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/gpu/d3d11/SDL_gpu_d3d11.c b/src/gpu/d3d11/SDL_gpu_d3d11.c
index dad57cfa83fbc..78b77a401b7b5 100644
--- a/src/gpu/d3d11/SDL_gpu_d3d11.c
+++ b/src/gpu/d3d11/SDL_gpu_d3d11.c
@@ -831,7 +831,7 @@ static void D3D11_INTERNAL_SetError(
// No message? Screw it, just post the code.
if (dwChars == 0) {
- SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s! Error Code: " HRESULT_FMT, msg, res);
+ SDL_SetError("%s! Error Code: " HRESULT_FMT, msg, res);
return;
}
@@ -850,7 +850,7 @@ static void D3D11_INTERNAL_SetError(
// Ensure null-terminated string
wszMsgBuff[dwChars] = '\0';
- SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s! Error Code: %s " HRESULT_FMT, msg, wszMsgBuff, res);
+ SDL_SetError("%s! Error Code: %s " HRESULT_FMT, msg, wszMsgBuff, res);
}
static void D3D11_INTERNAL_LogError(
@@ -885,7 +885,7 @@ static void D3D11_INTERNAL_LogError(
// No message? Screw it, just post the code.
if (dwChars == 0) {
- SDL_SetError("%s! Error Code: " HRESULT_FMT, msg, res);
+ SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s! Error Code: " HRESULT_FMT, msg, res);
return;
}
@@ -904,7 +904,7 @@ static void D3D11_INTERNAL_LogError(
// Ensure null-terminated string
wszMsgBuff[dwChars] = '\0';
- SDL_SetError("%s! Error Code: %s " HRESULT_FMT, msg, wszMsgBuff, res);
+ SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s! Error Code: %s " HRESULT_FMT, msg, wszMsgBuff, res);
}
// Helper Functions
diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c
index 132074ca9c905..2bea8fd1b15fc 100644
--- a/src/gpu/vulkan/SDL_gpu_vulkan.c
+++ b/src/gpu/vulkan/SDL_gpu_vulkan.c
@@ -1214,18 +1214,18 @@ static inline void LogVulkanResultAsError(
}
}
-#define ERROR_LOG_RETURN(res, fn, ret) \
- if (res != VK_SUCCESS) { \
- SDL_SetError("%s %s", #fn, VkErrorMessages(res)); \
- return ret; \
- }
-
-#define ERROR_SET_RETURN(res, fn, ret) \
+#define ERROR_LOG_RETURN(res, fn, ret) \
if (res != VK_SUCCESS) { \
SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s %s", #fn, VkErrorMessages(res)); \
return ret; \
}
+#define ERROR_SET_RETURN(res, fn, ret) \
+ if (res != VK_SUCCESS) { \
+ SDL_SetError("%s %s", #fn, VkErrorMessages(res)); \
+ return ret; \
+ }
+
// Utility
static inline VkPolygonMode SDLToVK_PolygonMode(