From 0a44ea1b0b31d90bc056362b68cf0fdc16f32f29 Mon Sep 17 00:00:00 2001
From: Daniel Ludwig <[EMAIL REDACTED]>
Date: Fri, 6 Sep 2024 17:34:24 +0200
Subject: [PATCH] Amend use of non-standard compiler syntax
---
src/gpu/d3d11/SDL_gpu_d3d11.c | 13 +++++++++++--
src/gpu/d3d12/SDL_gpu_d3d12.c | 8 +++++++-
src/gpu/metal/SDL_gpu_metal.m | 7 ++++++-
src/gpu/vulkan/SDL_gpu_vulkan.c | 8 +++++++-
4 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/src/gpu/d3d11/SDL_gpu_d3d11.c b/src/gpu/d3d11/SDL_gpu_d3d11.c
index bffd91d9d115a..5f1e2f16aaaf4 100644
--- a/src/gpu/d3d11/SDL_gpu_d3d11.c
+++ b/src/gpu/d3d11/SDL_gpu_d3d11.c
@@ -3199,7 +3199,10 @@ static SDL_GPUCommandBuffer *D3D11_AcquireCommandBuffer(
commandBuffer = D3D11_INTERNAL_GetInactiveCommandBufferFromPool(renderer);
commandBuffer->graphicsPipeline = NULL;
commandBuffer->stencilRef = 0;
- commandBuffer->blendConstants = (SDL_FColor){ 1.0f, 1.0f, 1.0f, 1.0f };
+ commandBuffer->blendConstants.r = 1.0f;
+ commandBuffer->blendConstants.g = 1.0f;
+ commandBuffer->blendConstants.b = 1.0f;
+ commandBuffer->blendConstants.a = 1.0f;
commandBuffer->computePipeline = NULL;
for (i = 0; i < MAX_COLOR_TARGET_BINDINGS; i += 1) {
commandBuffer->colorTargetResolveTexture[i] = NULL;
@@ -3617,9 +3620,15 @@ static void D3D11_BeginRenderPass(
commandBuffer,
0);
+ SDL_FColor blendConstants;
+ blendConstants.r = 1.0f;
+ blendConstants.g = 1.0f;
+ blendConstants.b = 1.0f;
+ blendConstants.a = 1.0f;
+
D3D11_SetBlendConstants(
commandBuffer,
- (SDL_FColor){ 1.0f, 1.0f, 1.0f, 1.0f });
+ blendConstants);
}
static void D3D11_BindGraphicsPipeline(
diff --git a/src/gpu/d3d12/SDL_gpu_d3d12.c b/src/gpu/d3d12/SDL_gpu_d3d12.c
index 90bb64629c7fc..385d749e1b2bf 100644
--- a/src/gpu/d3d12/SDL_gpu_d3d12.c
+++ b/src/gpu/d3d12/SDL_gpu_d3d12.c
@@ -3950,9 +3950,15 @@ static void D3D12_BeginRenderPass(
commandBuffer,
0);
+ SDL_FColor blendConstants;
+ blendConstants.r = 1.0f;
+ blendConstants.g = 1.0f;
+ blendConstants.b = 1.0f;
+ blendConstants.a = 1.0f;
+
D3D12_SetBlendConstants(
commandBuffer,
- (SDL_FColor){ 1.0f, 1.0f, 1.0f, 1.0f });
+ blendConstants);
}
static void D3D12_INTERNAL_TrackUniformBuffer(
diff --git a/src/gpu/metal/SDL_gpu_metal.m b/src/gpu/metal/SDL_gpu_metal.m
index f9e9986bc629a..0a35658cd3166 100644
--- a/src/gpu/metal/SDL_gpu_metal.m
+++ b/src/gpu/metal/SDL_gpu_metal.m
@@ -2153,6 +2153,7 @@ static void METAL_BeginRenderPass(
Uint32 vpHeight = UINT_MAX;
SDL_GPUViewport viewport;
SDL_Rect scissorRect;
+ SDL_FColor blendConstants;
for (Uint32 i = 0; i < numColorTargets; i += 1) {
MetalTextureContainer *container = (MetalTextureContainer *)colorTargetInfos[i].texture;
@@ -2268,9 +2269,13 @@ static void METAL_BeginRenderPass(
scissorRect.h = vpHeight;
METAL_SetScissor(commandBuffer, &scissorRect);
+ blendConstants.r = 1.0f;
+ blendConstants.g = 1.0f;
+ blendConstants.b = 1.0f;
+ blendConstants.a = 1.0f;
METAL_SetBlendConstants(
commandBuffer,
- (SDL_FColor){ 1.0f, 1.0f, 1.0f, 1.0f });
+ blendConstants);
METAL_SetStencilReference(
commandBuffer,
diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c
index ae6bd91301429..6b13e82a6f2a4 100644
--- a/src/gpu/vulkan/SDL_gpu_vulkan.c
+++ b/src/gpu/vulkan/SDL_gpu_vulkan.c
@@ -7863,6 +7863,7 @@ static void VULKAN_BeginRenderPass(
Uint32 i;
SDL_GPUViewport defaultViewport;
SDL_Rect defaultScissor;
+ SDL_FColor defaultBlendConstants;
Uint32 framebufferWidth = UINT32_MAX;
Uint32 framebufferHeight = UINT32_MAX;
@@ -8056,9 +8057,14 @@ static void VULKAN_BeginRenderPass(
vulkanCommandBuffer,
&defaultScissor);
+ defaultBlendConstants.r = 1.0f;
+ defaultBlendConstants.g = 1.0f;
+ defaultBlendConstants.b = 1.0f;
+ defaultBlendConstants.a = 1.0f;
+
VULKAN_INTERNAL_SetCurrentBlendConstants(
vulkanCommandBuffer,
- (SDL_FColor){ 1.0f, 1.0f, 1.0f, 1.0f });
+ defaultBlendConstants);
VULKAN_INTERNAL_SetCurrentStencilReference(
vulkanCommandBuffer,