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βtrueenables the depth test. periodt.enable_depth_writeβtrueenables depth writes. but lowkey important: depth writes are always disabled whenenable_depth_testisfalse. like, no depth test, no depth writes, that's just how it is πenable_stencil_testβtrueenables 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 π
SDL_GPUGraphicsPipelineCreateInfo(3type)β go read that one next, it's the bestie of this struct fr fr π«Ά
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
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms