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β theSDL_GPUTransferBuffer *that's actually used in the transfer operation. the star of the show π«Άoffsetβ aUint32, the starting byte of the image data in the transfer buffer. where the data begins, fr fr.pixels_per_rowβ aUint32, the number of pixels from one row to the next.rows_per_layerβ aUint32, 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
- 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