SDL_CopyGPUTextureToTexture(3)

πŸ’– SDL_CopyGPUTextureToTexture πŸ’–

okay bestie, so this is a page from the SDL3 FUNCTIONS manual, and the function we're obsessing over today is SDL_CopyGPUTextureToTexture. it's a whole vibe. let's get into it 🫢


✨ NAME ✨

SDL_CopyGPUTextureToTexture β€” Performs a texture-to-texture copy. that's it. that's the girl. πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_gpu.h>

void SDL_CopyGPUTextureToTexture(
    SDL_GPUCopyPass *copy_pass,
    const SDL_GPUTextureLocation *source,
    const SDL_GPUTextureLocation *destination,
    Uint32 w,
    Uint32 h,
    Uint32 d,
    bool cycle);

like, look at her. no return value, she just does it. main character energy fr fr πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so the tea is: this copy happens on the GPU timeline. which means β€” and this is the important bit β€” you may assume the copy has finished in subsequent commands. no waiting around, no drama, it's done by the time the next thing rolls up. slay. ✨

⚠️ not me being the bearer of bad news β€” this function does not support copying between depth and color textures. nope. not happening. for those you gotta do the two-step: copy the texture to a buffer, and then copy that buffer to the destination texture. annoying? lowkey. but that's the rules, bestie 😭

πŸ’œ FUNCTION PARAMETERS πŸ’œ

  • copy_pass β€” a copy pass handle. your little ticket into the copy zone πŸŽ€
  • source β€” a source texture region. where the goods are coming from.
  • destination β€” a destination texture region. where the goods are going.
  • w β€” the width of the region to copy. πŸ“
  • h β€” the height of the region to copy. πŸ“
  • d β€” the depth of the region to copy. 🧊
  • cycle β€” if true, cycles the destination texture if the destination texture is bound, otherwise overwrites the data. so: cycle or overwrite, your call, iykyk πŸ”„

🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0. so if you're on anything older, sorry babe, no copy for you πŸ™ˆ


and that's the whole page, no cap. this was Simple Directmedia Layer, SDL 3.4.18, dated with all the love in the world β€” go forth and copy those textures, bestie, you're gonna eat πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from