GPU: shaders, pipelines & buffersSDL 3.2

SDL_BeginGPUCopyPass

Starts a copy pass: the part of a command buffer where data moves between buffers and textures.

Signature

SDL_GPUCopyPass * SDL_BeginGPUCopyPass(SDL_GPUCommandBuffer *command_buffer);

How it works

Uploads (SDL_UploadToGPUBuffer, SDL_UploadToGPUTexture), downloads and GPU-to-GPU copies are recorded inside a copy pass. Like a render pass it cannot overlap another pass; end it with SDL_EndGPUCopyPass. A common frame does the copy pass first, then the render pass that uses the new data.

Parameters

command_bufferSDL_GPUCommandBuffer *

The command buffer to record into.

Return value

The copy pass handle.

Example

example.cpp
1SDL_GPUCommandBuffer* cmd  = SDL_AcquireGPUCommandBuffer(device);
2SDL_GPUCopyPass*      copy = SDL_BeginGPUCopyPass(cmd);
3SDL_UploadToGPUBuffer(copy, &src, &dst, false);
4SDL_EndGPUCopyPass(copy);
5SDL_SubmitGPUCommandBuffer(cmd);
Official SDL wiki