sdlxBeginGpuRenderPass function gpu
- Pointer<
SdlGpuCommandBuffer> commandBuffer, - List<
SdlxGpuColorTargetInfo> colorTargetInfo, { - SdlxGpuDepthStencilTargetInfo? depthStencilTargetInfo,
Begins a render pass on a command buffer.
A render pass consists of a set of texture subresources (or depth slices in the 3D texture case) which will be rendered to during the render pass, along with corresponding clear values and load/store operations. All operations related to graphics pipelines must take place inside of a render pass. A default viewport and scissor state are automatically set when this is called. You cannot begin another render pass, or begin a compute pass or copy pass until you have ended the render pass.
Using SDL_GPU_LOADOP_LOAD before any contents have been written to the texture subresource will result in undefined behavior. SDL_GPU_LOADOP_CLEAR will set the contents of the texture subresource to a single value before any rendering is performed. It's fine to do an empty render pass using SDL_GPU_STOREOP_STORE to clear a texture, but in general it's better to think of clearing not as an independent operation but as something that's done as the beginning of a render pass.
\param command_buffer a command buffer. \param color_target_infos an array of texture subresources with corresponding clear values and load/store ops. \param num_color_targets the number of color targets in the color_target_infos array. \param depth_stencil_target_info a texture subresource with corresponding clear value and load/store ops, may be NULL. \returns a render pass handle.
\since This function is available since SDL 3.2.0.
\sa SDL_EndGPURenderPass
extern SDL_DECLSPEC SDL_GPURenderPass * SDLCALL SDL_BeginGPURenderPass( SDL_GPUCommandBuffer *command_buffer, const SDL_GPUColorTargetInfo *color_target_infos, Uint32 num_color_targets, const SDL_GPUDepthStencilTargetInfo *depth_stencil_target_info)
Implementation
Pointer<SdlGpuRenderPass> sdlxBeginGpuRenderPass(
Pointer<SdlGpuCommandBuffer> commandBuffer,
List<SdlxGpuColorTargetInfo> colorTargetInfo, {
SdlxGpuDepthStencilTargetInfo? depthStencilTargetInfo,
}) {
Pointer<SdlGpuRenderPass> result = nullptr;
Pointer<SdlGpuDepthStencilTargetInfo> depthStencilTargetInfoPointer = nullptr;
if (colorTargetInfo.isNotEmpty) {
final infosPointer = colorTargetInfo.calloc();
if (depthStencilTargetInfo != null) {
depthStencilTargetInfoPointer = depthStencilTargetInfo.calloc();
}
result = sdlBeginGpuRenderPass(
commandBuffer,
infosPointer,
colorTargetInfo.length,
depthStencilTargetInfoPointer,
);
infosPointer.callocFree();
if (depthStencilTargetInfoPointer != nullptr) {
depthStencilTargetInfoPointer.callocFree();
}
}
return result;
}