Browse Source

Amend use of non-standard compiler syntax

Daniel Ludwig 7 months ago
parent
commit
0a44ea1b0b

+ 11 - 2
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(

+ 7 - 1
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(

+ 6 - 1
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,

+ 7 - 1
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,