Parcourir la source

Remove SDL_GPUDepthStencilValue struct

cosmonaut il y a 7 mois
Parent
commit
d3091b9538

+ 2 - 19
include/SDL3/SDL_gpu.h

@@ -943,23 +943,6 @@ typedef enum SDL_GPUDriver
 
 /* Structures */
 
-/**
- * A structure specifying a depth-stencil clear value.
- *
- * \since This struct is available since SDL 3.0.0
- *
- * \sa SDL_GPUDepthStencilTargetInfo
- * \sa SDL_BeginGPURenderPass
- */
-typedef struct SDL_GPUDepthStencilValue
-{
-    float depth;    /**< The clear value for the depth aspect of the depth-stencil target. */
-    Uint8 stencil;  /**< The clear value for the stencil aspect of the depth-stencil target. */
-    Uint8 padding1;
-    Uint8 padding2;
-    Uint8 padding3;
-} SDL_GPUDepthStencilValue;
-
 /**
  * A structure specifying a viewport.
  *
@@ -1592,15 +1575,15 @@ typedef struct SDL_GPUColorTargetInfo
 typedef struct SDL_GPUDepthStencilTargetInfo
 {
     SDL_GPUTexture *texture;               /**< The texture that will be used as the depth stencil target by the render pass. */
-    SDL_GPUDepthStencilValue clear_value;  /**< The depth-stencil clear values. Can be ignored by the render pass if SDL_GPU_LOADOP_CLEAR is not used. */
+    float clear_depth;                     /**< The value to clear the depth component to at the beginning of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used. */
     SDL_GPULoadOp load_op;                 /**< What is done with the depth contents at the beginning of the render pass. */
     SDL_GPUStoreOp store_op;               /**< What is done with the depth results of the render pass. */
     SDL_GPULoadOp stencil_load_op;         /**< What is done with the stencil contents at the beginning of the render pass. */
     SDL_GPUStoreOp stencil_store_op;       /**< What is done with the stencil results of the render pass. */
     SDL_bool cycle;                        /**< SDL_TRUE cycles the texture if the texture is bound and any load ops are not LOAD */
+    Uint8 clear_stencil;                   /**< The value to clear the stencil component to at the beginning of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used. */
     Uint8 padding1;
     Uint8 padding2;
-    Uint8 padding3;
 } SDL_GPUDepthStencilTargetInfo;
 
 /**

+ 2 - 2
src/gpu/d3d11/SDL_gpu_d3d11.c

@@ -3561,8 +3561,8 @@ static void D3D11_BeginRenderPass(
                 d3d11CommandBuffer->context,
                 dsv,
                 dsClearFlags,
-                depthStencilTargetInfo->clear_value.depth,
-                depthStencilTargetInfo->clear_value.stencil);
+                depthStencilTargetInfo->clear_depth,
+                depthStencilTargetInfo->clear_stencil);
         }
     }
 

+ 2 - 2
src/gpu/d3d12/SDL_gpu_d3d12.c

@@ -3905,8 +3905,8 @@ static void D3D12_BeginRenderPass(
                 d3d12CommandBuffer->graphicsCommandList,
                 subresource->dsvHandle.cpuHandle,
                 clearFlags,
-                depthStencilTargetInfo->clear_value.depth,
-                depthStencilTargetInfo->clear_value.stencil,
+                depthStencilTargetInfo->clear_depth,
+                depthStencilTargetInfo->clear_stencil,
                 0,
                 NULL);
         }

+ 2 - 2
src/gpu/metal/SDL_gpu_metal.m

@@ -2204,7 +2204,7 @@ static void METAL_BeginRenderPass(
             passDescriptor.depthAttachment.storeAction = SDLToMetal_StoreOp(
                 depthStencilTargetInfo->store_op,
                 texture->msaaHandle ? 1 : 0);
-            passDescriptor.depthAttachment.clearDepth = depthStencilTargetInfo->clear_value.depth;
+            passDescriptor.depthAttachment.clearDepth = depthStencilTargetInfo->clear_depth;
 
             if (IsStencilFormat(container->header.info.format)) {
                 if (texture->msaaHandle) {
@@ -2217,7 +2217,7 @@ static void METAL_BeginRenderPass(
                 passDescriptor.stencilAttachment.storeAction = SDLToMetal_StoreOp(
                     depthStencilTargetInfo->store_op,
                     texture->msaaHandle ? 1 : 0);
-                passDescriptor.stencilAttachment.clearStencil = depthStencilTargetInfo->clear_value.stencil;
+                passDescriptor.stencilAttachment.clearStencil = depthStencilTargetInfo->clear_stencil;
             }
 
             METAL_INTERNAL_TrackTexture(metalCommandBuffer, texture);

+ 2 - 2
src/gpu/vulkan/SDL_gpu_vulkan.c

@@ -8011,9 +8011,9 @@ static void VULKAN_BeginRenderPass(
 
     if (depthStencilTargetInfo != NULL) {
         clearValues[totalColorAttachmentCount].depthStencil.depth =
-            depthStencilTargetInfo->clear_value.depth;
+            depthStencilTargetInfo->clear_depth;
         clearValues[totalColorAttachmentCount].depthStencil.stencil =
-            depthStencilTargetInfo->clear_value.stencil;
+            depthStencilTargetInfo->clear_stencil;
     }
 
     VkRenderPassBeginInfo renderPassBeginInfo;

+ 1 - 1
test/testgpu_spinning_cube.c

@@ -369,7 +369,7 @@ Render(SDL_Window *window, const int windownum)
     color_target.texture = winstate->tex_msaa ? winstate->tex_msaa : swapchain;
 
     SDL_zero(depth_target);
-    depth_target.clear_value.depth = 1.0f;
+    depth_target.clear_depth = 1.0f;
     depth_target.load_op = SDL_GPU_LOADOP_CLEAR;
     depth_target.store_op = SDL_GPU_STOREOP_DONT_CARE;
     depth_target.texture = winstate->tex_depth;