2 Commits 7cdf4fd7ee ... 7a827b145a

Author SHA1 Message Date
  Evan Hemsley 7a827b145a GPU: Validate that 2D textures don't have layers (#15535) 3 days ago
  Evan Hemsley a14da0d366 GPU: Allow depth texture arrays (#15534) 3 days ago
1 changed files with 5 additions and 4 deletions
  1. 5 4
      src/gpu/SDL_gpu.c

+ 5 - 4
src/gpu/SDL_gpu.c

@@ -1258,6 +1258,11 @@ SDL_GPUTexture *SDL_CreateGPUTexture(
             SDL_assert_release(!"For any texture: num_levels must be >= 1");
             failed = true;
         }
+        if (createinfo->type == SDL_GPU_TEXTURETYPE_2D && createinfo->layer_count_or_depth != 1)
+        {
+            SDL_assert_release(!"2D textures must have a layer count of 1");
+            failed = true;
+        }
         if ((createinfo->usage & SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ) && (createinfo->usage & SDL_GPU_TEXTUREUSAGE_SAMPLER)) {
             SDL_assert_release(!"For any texture: usage cannot contain both GRAPHICS_STORAGE_READ and SAMPLER");
             failed = true;
@@ -1344,10 +1349,6 @@ SDL_GPUTexture *SDL_CreateGPUTexture(
         } else {
             if (createinfo->type == SDL_GPU_TEXTURETYPE_2D_ARRAY) {
                 // Array Texture Validation
-                if (createinfo->usage & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET) {
-                    SDL_assert_release(!"For array textures: usage must not contain DEPTH_STENCIL_TARGET");
-                    failed = true;
-                }
                 if (createinfo->sample_count > SDL_GPU_SAMPLECOUNT_1) {
                     SDL_assert_release(!"For array textures: sample_count must be SDL_GPU_SAMPLECOUNT_1");
                     failed = true;