SDL: Verify that we can create pipeline state objects for the D3D12 renderer

From 2b0e7c40ef7d4cfb729d1a19d526219ac0ca1136 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 24 Feb 2024 19:55:10 -0800
Subject: [PATCH] Verify that we can create pipeline state objects for the
 D3D12 renderer

Fixes https://github.com/libsdl-org/SDL/issues/9093
---
 src/render/direct3d12/SDL_render_d3d12.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c
index 43f7a8c360d84..212916e6f9992 100644
--- a/src/render/direct3d12/SDL_render_d3d12.c
+++ b/src/render/direct3d12/SDL_render_d3d12.c
@@ -1080,32 +1080,23 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
         }
     }
 
-#if 0 /* Actually, don't do this, it causes a huge startup time on some systems */
     {
         const SDL_BlendMode defaultBlendModes[] = {
-            SDL_BLENDMODE_NONE,
             SDL_BLENDMODE_BLEND,
-            SDL_BLENDMODE_ADD,
-            SDL_BLENDMODE_MOD,
-            SDL_BLENDMODE_MUL
         };
         const DXGI_FORMAT defaultRTVFormats[] = {
-            DXGI_FORMAT_R16G16B16A16_FLOAT,
-            DXGI_FORMAT_R10G10B10A2_UNORM,
             DXGI_FORMAT_B8G8R8A8_UNORM,
-            DXGI_FORMAT_B8G8R8X8_UNORM,
-            DXGI_FORMAT_R8_UNORM
         };
         int i, j, k, l;
 
-        /* Create all the default pipeline state objects
-           (will add everything except custom blend states) */
+        /* Create a few default pipeline state objects, to verify that this renderer will work */
         for (i = 0; i < NUM_SHADERS; ++i) {
             for (j = 0; j < SDL_arraysize(defaultBlendModes); ++j) {
                 for (k = D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT; k < D3D12_PRIMITIVE_TOPOLOGY_TYPE_PATCH; ++k) {
                     for (l = 0; l < SDL_arraysize(defaultRTVFormats); ++l) {
                         if (!D3D12_CreatePipelineState(renderer, (D3D12_Shader)i, defaultBlendModes[j], (D3D12_PRIMITIVE_TOPOLOGY_TYPE)k, defaultRTVFormats[l])) {
                             /* D3D12_CreatePipelineState will set the SDL error, if it fails */
+                            result = E_FAIL;
                             goto done;
                         }
                     }
@@ -1113,7 +1104,6 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
             }
         }
     }
-#endif /* 0 */
 
     /* Create default vertex buffers  */
     for (i = 0; i < SDL_D3D12_NUM_VERTEX_BUFFERS; ++i) {