From 9fcca835123d71fea52fc8f25afaaf5215c25831 Mon Sep 17 00:00:00 2001
From: Caleb Cornett <[EMAIL REDACTED]>
Date: Sun, 9 Mar 2025 11:55:22 -0400
Subject: [PATCH] gpu: Validate that CopyGPUTextureToTexture formats match
---
src/gpu/SDL_gpu.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/gpu/SDL_gpu.c b/src/gpu/SDL_gpu.c
index 0897d1c914684..7ca2590ad810c 100644
--- a/src/gpu/SDL_gpu.c
+++ b/src/gpu/SDL_gpu.c
@@ -2359,6 +2359,13 @@ void SDL_CopyGPUTextureToTexture(
SDL_assert_release(!"Destination texture cannot be NULL!");
return;
}
+
+ TextureCommonHeader *srcHeader = (TextureCommonHeader *)source->texture;
+ TextureCommonHeader *dstHeader = (TextureCommonHeader *)destination->texture;
+ if (srcHeader->info.format != dstHeader->info.format) {
+ SDL_assert_release(!"Source and destination textures must have the same format!");
+ return;
+ }
}
COPYPASS_DEVICE->CopyTextureToTexture(