SDL_GPUTEXTURETRANSFERINFO(3type)

πŸ’– SDL_GPUTextureTransferInfo(3type) πŸ’–

okay so bestie, welcome to the SDL3 datatypes corner β€” this is the page for SDL_GPUTextureTransferInfo, and it's lowkey the little receipt you hand to SDL so it knows how to move your pixel data around. ✨


🌸 NAME 🌸

SDL_GPUTextureTransferInfo β€” a struct that specifies the parameters related to transferring data to or from a texture. that's it, that's the whole job, and it does it gorgeously πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_gpu.h>

typedef struct SDL_GPUTextureTransferInfo
{
    SDL_GPUTransferBuffer *transfer_buffer;  /**< The transfer buffer used in the transfer operation. */
    Uint32 offset;                           /**< The starting byte of the image data in the transfer buffer. */
    Uint32 pixels_per_row;                   /**< The number of pixels from one row to the next. */
    Uint32 rows_per_layer;                   /**< The number of rows from one layer/depth-slice to the next. */
} SDL_GPUTextureTransferInfo;

so we've got four fields, and every single one of them is doing its little part:

  • transfer_buffer β€” the SDL_GPUTransferBuffer * that's actually used in the transfer operation. the star of the show 🫢
  • offset β€” a Uint32, the starting byte of the image data in the transfer buffer. where the data begins, fr fr.
  • pixels_per_row β€” a Uint32, the number of pixels from one row to the next.
  • rows_per_layer β€” a Uint32, the number of rows from one layer/depth-slice to the next.

πŸ¦‹ DESCRIPTION πŸ¦‹

here's the tea β˜• if either pixels_per_row or rows_per_layer is zero, then the width and height of the SDL_GPUTextureRegion you passed to SDL_UploadToGPUTexture or SDL_DownloadFromGPUTexture get used as the default values β€” respectively β€” and the data is considered to be tightly packed. so basically you can let SDL figure out the packing for you, and she will, no cap. ✨

⚠️ WARNING ⚠️ on some older/integrated hardware, Direct3D 12 requires texture data row pitch to be 256 byte aligned, and offsets to be aligned to 512 bytes. if they're not, SDL will make a temporary copy of the data that is properly aligned β€” but bestie, that adds overhead to the transfer process. 😭 apps can avoid this by aligning their data appropriately, or by using a different GPU backend than Direct3D 12. your call, but now you know. πŸ’€

🌈 AVAILABILITY 🌈

this struct is available since SDL 3.2.0. she's not ancient, she's just iconic. πŸ‘‘


πŸŽ€ SEE ALSO πŸŽ€

go read those next, iykyk 🧚


and that's the whole vibe check, bestie β€” this page comes to you from Simple Directmedia Layer, SDL 3.4.18, SDL_GPUTextureTransferInfo(3type). stay aligned, stay slay βœ¨πŸ’–

πŸ“¦ where this page comes from