SDL_SetGPUScissor(3)

πŸ’… SDL_SetGPUScissor πŸ’…

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we learn how to crop our little render world. this one is SDL_SetGPUScissor β€” and no, it is not about cutting paper with fancy scissors, it is literally setting the current scissor state on a command buffer. it's giving pixel boundaries, but make it fashion. βœ‚οΈβœ¨


🌸 NAME 🌸

SDL_SetGPUScissor β€” sets the current scissor state on a command buffer. that's it, that's the whole job, and she does it flawlessly. periodt. πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

first things first, you gotta invite her in:

#include <SDL3/SDL_gpu.h>

and here's the signature, copied exactly because we do not mess with the source of truth:

void SDL_SetGPUScissor(
    SDL_GPURenderPass *render_pass,
    const SDL_Rect *scissor);

yeah she returns void. she doesn't need to report back, she just does the thing and moves on. main character energy fr fr. πŸ‘‘


πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

two little besties walk into a function call:

  • render_pass β€” a render pass handle. this is the vibe holder, the one that says "hey, we're rendering right now, in this pass." 🫢
  • scissor β€” the scissor area to set. an SDL_Rect, aka the rectangle where your drawing is allowed to live. everything outside? not invited to the party. πŸ’€

🌈 AVAILABILITY 🌈

this function has been available since SDL 3.2.0. so if your SDL is older than that... bestie, it's giving vintage, and not in the cute way. upgrade. 🧚


heads up: scissor is a pointer to a const SDL_Rect, so you're handing her a rectangle to read, not to keep and scribble on. no cap. πŸ“Œ

and that's the whole page!! slay πŸ’…πŸŒΈπŸ¦‹

this cutie was brought to you by Simple Directmedia Layer, version SDL 3.4.18 β€” shoutout to the SDL_SetGPUScissor(3) era, we love her, we respect her, we clip our pixels with her. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from