SDL_GPUDepthStencilState(3type)

πŸ’– SDL_GPUDepthStencilState πŸ’–

okay so bestie, welcome to the SDL3 DATATYPES section of the manual, and today's main character is SDL_GPUDepthStencilState πŸŽ€ literally the glow-up blueprint for how your graphics pipeline handles depth and stencil testing. it's giving "struct that decides who gets drawn and who gets yeeted" ✨


🌸 NAME 🌸

SDL_GPUDepthStencilState β€” a structure specifying the parameters of the graphics pipeline depth stencil state. no cap, that's the whole vibe.


✨ SYNOPSIS ✨

#include <SDL3/SDL_gpu.h>

typedef struct SDL_GPUDepthStencilState
{
    SDL_GPUCompareOp compare_op;                /**< The comparison operator used for depth testing. */
    SDL_GPUStencilOpState back_stencil_state;   /**< The stencil op state for back-facing triangles. */
    SDL_GPUStencilOpState front_stencil_state;  /**< The stencil op state for front-facing triangles. */
    Uint8 compare_mask;                         /**< Selects the bits of the stencil values participating in the stencil test. */
    Uint8 write_mask;                           /**< Selects the bits of the stencil values updated by the stencil test. */
    bool enable_depth_test;                     /**< true enables the depth test. */
    bool enable_depth_write;                    /**< true enables depth writes. Depth writes are always disabled when enable_depth_test is false. */
    bool enable_stencil_test;                   /**< true enables the stencil test. */
    Uint8 padding1;
    Uint8 padding2;
    Uint8 padding3;
} SDL_GPUDepthStencilState;

πŸ‘‘ DESCRIPTION πŸ‘‘

so like, this struct is the whole mood board for your pipeline's depth + stencil behaviour 🫢 every field is doing its own little job and honestly? they ate.

  • compare_op β€” the comparison operator used for depth testing. this is the "is this pixel closer than what's already there?" decision-maker πŸ’…
  • back_stencil_state β€” the stencil op state for back-facing triangles. yes, back faces get their own separate settings. equality ✨
  • front_stencil_state β€” the stencil op state for front-facing triangles. front faces get theirs too, because why should they share πŸŽ€
  • compare_mask β€” selects the bits of the stencil values participating in the stencil test. bit-level gatekeeping, iconic.
  • write_mask β€” selects the bits of the stencil values updated by the stencil test. so the test can only touch the bits you allow πŸ™ˆ
  • enable_depth_test β€” true enables the depth test. periodt.
  • enable_depth_write β€” true enables depth writes. but lowkey important: depth writes are always disabled when enable_depth_test is false. like, no depth test, no depth writes, that's just how it is πŸ’€
  • enable_stencil_test β€” true enables the stencil test. flip it and the stencil test is off, simple as that.
  • padding1 β€” padding. just padding bestie, it's there for layout reasons.
  • padding2 β€” more padding 🌈
  • padding3 β€” and the third padding. trio complete, they're a unit now ✨

πŸ¦‹ AVAILABILITY πŸ¦‹

this struct has been available since SDL 3.2.0. vintage but make it fresh πŸ’–


🌟 SEE ALSO 🌟


and that's the whole page, you understood it perfectly, I'm so proud of you πŸ₯ΉπŸ’œ

this was brought to you by Simple Directmedia Layer, running SDL 3.4.18 β€” mwah, ily, go write a graphics pipeline now πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from