Parcourir la source

gpu: Validate that CopyGPUTextureToTexture formats match

Caleb Cornett il y a 1 mois
Parent
commit
9fcca83512
1 fichiers modifiés avec 7 ajouts et 0 suppressions
  1. 7 0
      src/gpu/SDL_gpu.c

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