SDL_GPUStoreOp(3type)

πŸ’– SDL_GPUStoreOp πŸ’–

okay bestie, pull up a chair, we're talking about SDL_GPUStoreOp β€” it's a 3type from the SDL3 DATATYPES crew. it lives in the SDL3 GPU world and it's basically the answer to one very specific question: what happens to the contents of a texture attached to a render pass when the render pass ends? πŸ‘‘

that's it. that's the whole job. it decides whether your pixels get saved, yeeted, or resolved. and honestly? iconic. πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_gpu.h>

typedef enum SDL_GPUStoreOp
{
    SDL_GPU_STOREOP_STORE,             /**< The contents generated during the render pass will be written to memory. */
    SDL_GPU_STOREOP_DONT_CARE,         /**< The contents generated during the render pass are not needed and may be discarded. The contents will be undefined. */
    SDL_GPU_STOREOP_RESOLVE,           /**< The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture may then be discarded and will be undefined. */
    SDL_GPU_STOREOP_RESOLVE_AND_STORE  /**< The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture will be written to memory. */
} SDL_GPUStoreOp;

🌸 DESCRIPTION 🌸

so you know how a render pass makes a whole bunch of pretty pixels and then just... ends? yeah. SDL_GPUStoreOp is the vibe check for those pixels. it tells the GPU how the contents of a texture attached to a render pass are treated at the end of the render pass. πŸ’–

here's the lineup, no skips, every single one:

  • SDL_GPU_STOREOP_STORE β€” the contents generated during the render pass will be written to memory. classic. responsible. your pixels are safe and saved. 🫢
  • SDL_GPU_STOREOP_DONT_CARE β€” the contents generated during the render pass are not needed and may be discarded. heads up bestie, the contents will be undefined. 😭 it's not "empty", it's undefined, which is the scarier word. don't go reading that texture afterwards and expect anything, fr fr.
  • SDL_GPU_STOREOP_RESOLVE β€” the multisample contents generated during the render pass will be resolved to a non-multisample texture. and then, plot twist: the contents in the multisample texture may then be discarded and will be undefined. so the resolve target is good, the multisample one is giving chaos. πŸ’€
  • SDL_GPU_STOREOP_RESOLVE_AND_STORE β€” the multisample contents generated during the render pass will be resolved to a non-multisample texture, AND the contents in the multisample texture will be written to memory. it's the resolve but make it extra. both things kept. obsessed. ✨
lowkey important: those "undefined" ones are not a suggestion. if it says undefined, it means undefined. don't build your whole pipeline on it and then act surprised. πŸ™ˆ

πŸ’« AVAILABILITY πŸ’«

this enum has been out here serving since SDL 3.2.0. so if your SDL is older than that, sorry babe, no store ops for you. πŸŽ€


πŸ¦‹ SEE ALSO πŸ¦‹


and that's the whole page, bestie. go forth and resolve your multisample textures responsibly. 🌈⭐

this lil tutorial came to you from Simple Directmedia Layer, version SDL 3.4.18 β€” mwah, take care of her πŸ’œπŸŽ€

πŸ“¦ where this page comes from