SDL: GPU: Fix viewport assertion on depth-only pass

From 66f946e99bc58b7916e8787c207f677050140e95 Mon Sep 17 00:00:00 2001
From: Evan Hemsley <[EMAIL REDACTED]>
Date: Fri, 30 Oct 2026 16:09:34 -0700
Subject: [PATCH] GPU: Fix viewport assertion on depth-only pass

---
 src/gpu/SDL_gpu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gpu/SDL_gpu.c b/src/gpu/SDL_gpu.c
index e2729684ef578..aaa0ee93623d7 100644
--- a/src/gpu/SDL_gpu.c
+++ b/src/gpu/SDL_gpu.c
@@ -1882,6 +1882,10 @@ SDL_GPURenderPass *SDL_BeginGPURenderPass(
 
         if (depth_stencil_target_info != NULL) {
             TextureCommonHeader *textureHeader = (TextureCommonHeader *)depth_stencil_target_info->texture;
+
+            COMMAND_BUFFER_DEVICE->max_viewport_width = SDL_min(COMMAND_BUFFER_DEVICE->max_viewport_width, textureHeader->info.width);
+            COMMAND_BUFFER_DEVICE->max_viewport_height = SDL_min(COMMAND_BUFFER_DEVICE->max_viewport_height, textureHeader->info.height);
+
             if (!(textureHeader->info.usage & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET)) {
                 SDL_assert_release(!"Depth target must have been created with the DEPTH_STENCIL_TARGET usage flag!");
                 return NULL;