SDL: gpu: Initialize Metal stencil format even if stencil test is disabled

https://github.com/libsdl-org/SDL/commit/3df0767e348d5438429d80941909c7bca27ad4df

From 3df0767e348d5438429d80941909c7bca27ad4df Mon Sep 17 00:00:00 2001
From: Ethan Lee <[EMAIL REDACTED]>
Date: Sun, 12 Jan 2025 15:34:47 -0500
Subject: [PATCH] gpu: Initialize Metal stencil format even if stencil test is
 disabled

---
 src/gpu/metal/SDL_gpu_metal.m | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gpu/metal/SDL_gpu_metal.m b/src/gpu/metal/SDL_gpu_metal.m
index 5aa8ec3e386b1..f87e9fcfcab83 100644
--- a/src/gpu/metal/SDL_gpu_metal.m
+++ b/src/gpu/metal/SDL_gpu_metal.m
@@ -1121,10 +1121,11 @@ static void METAL_ReleaseGraphicsPipeline(
 
         if (createinfo->target_info.has_depth_stencil_target) {
             pipelineDescriptor.depthAttachmentPixelFormat = SDLToMetal_TextureFormat(createinfo->target_info.depth_stencil_format);
-
-            if (createinfo->depth_stencil_state.enable_stencil_test) {
+            if (IsStencilFormat(createinfo->target_info.depth_stencil_format)) {
                 pipelineDescriptor.stencilAttachmentPixelFormat = SDLToMetal_TextureFormat(createinfo->target_info.depth_stencil_format);
+            }
 
+            if (createinfo->depth_stencil_state.enable_stencil_test) {
                 frontStencilDescriptor = [MTLStencilDescriptor new];
                 frontStencilDescriptor.stencilCompareFunction = SDLToMetal_CompareOp[createinfo->depth_stencil_state.front_stencil_state.compare_op];
                 frontStencilDescriptor.stencilFailureOperation = SDLToMetal_StencilOp[createinfo->depth_stencil_state.front_stencil_state.fail_op];