SDL_GPUDep...lTargetInfo(3type)

✨ SDL_GPUDepthStencilTargetInfo ✨

okay so bestie, welcome to the SDL3 DATATYPES section of the manual πŸ’– this whole page is about one little struct and honestly? it's giving backstage pass to your render pass. no cap.


🌸 NAME 🌸

SDL_GPUDepthStencilTargetInfo β€” a structure specifying the parameters of a depth-stencil target used by a render pass. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_gpu.h>

typedef struct SDL_GPUDepthStencilTargetInfo
{
    SDL_GPUTexture *texture;               /**< The texture that will be used as the depth stencil target by the render pass. */
    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. */
    bool cycle;                            /**< 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 mip_level;                       /**< The mip level to use as the depth stencil target. */
    Uint8 layer;                           /**< The layer index to use as the depth stencil target. */
} SDL_GPUDepthStencilTargetInfo;

like. look at her. ten fields. an icon. πŸ’…


πŸ’œ DESCRIPTION πŸ’œ

so the load_op field decides what happens to the depth contents of the texture at the beginning of the render pass. the options are:

  • LOAD β€” loads the depth values currently in the texture. keeping what was already there, periodt. ✨
  • CLEAR β€” clears the texture to a single depth.
  • DONT_CARE β€” the driver will do whatever it wants with the memory πŸ™ˆ this is a good option if you know that every single pixel will be touched in the render pass. (the way that's such a vibe when you're covering the whole screen anyway)

and the store_op field decides what happens to the depth results of the render pass:

  • STORE β€” stores the depth results in the texture.
  • DONT_CARE β€” the driver will do whatever it wants with the depth results. this is often a good option for depth/stencil textures that don't need to be reused again. πŸ’€ bye bye data, we never needed you.

now for the stencil half, because she has her own whole setup πŸŽ€

the stencil_load_op field decides what happens to the stencil contents of the texture at the beginning of the render pass:

  • LOAD β€” loads the stencil values currently in the texture.
  • CLEAR β€” clears the stencil values to a single value.
  • DONT_CARE β€” the driver will do whatever it wants with the memory. this is a good option if you know that every single pixel will be touched in the render pass. πŸ”₯

and the stencil_store_op field decides what happens to the stencil results of the render pass:

  • STORE β€” stores the stencil results in the texture.
  • DONT_CARE β€” the driver will do whatever it wants with the stencil results. this is often a good option for depth/stencil textures that don't need to be reused again. πŸ¦‹
⚠️ note that depth/stencil targets do not support multisample resolves. not a thing. don't ask. 😭
⚠️ also, due to ABI limitations, depth textures with more than 255 layers are not supported. so like, 255 layers max bestie, that's the ceiling. 🧚

🌈 AVAILABILITY 🌈

this struct has been available since SDL 3.2.0. she's not new new, but she's ours. πŸ‘‘


⭐ SEE ALSO ⭐


Simple Directmedia Layer 🫢 SDL 3.4.18 🫢 SDL_GPUDep...lTargetInfo(3type) β€” that's the whole page bestie, you ate, go render something iconic πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from