sdlCreateGpuRenderer function render
- Pointer<
SdlGpuDevice> device, - Pointer<
SdlWindow> window
Create a 2D GPU rendering context.
The GPU device to use is passed in as a parameter. If this is NULL, then a device will be created normally and can be retrieved using SDL_GetGPURendererDevice().
The window to use is passed in as a parameter. If this is NULL, then this will become an offscreen renderer. In that case, you should call SDL_SetRenderTarget() to setup rendering to a texture, and then call SDL_RenderPresent() normally to complete drawing a frame.
\param device the GPU device to use with the renderer, or NULL to create a device. \param window the window where rendering is displayed, or NULL to create an offscreen renderer. \returns a valid rendering context or NULL if there was an error; call SDL_GetError() for more information.
\threadsafety If this function is called with a valid GPU device, it should be called on the thread that created the device. If this function is called with a valid window, it should be called on the thread that created the window.
\since This function is available since SDL 3.4.0.
\sa SDL_CreateRendererWithProperties \sa SDL_GetGPURendererDevice \sa SDL_CreateGPUShader \sa SDL_CreateGPURenderState \sa SDL_SetGPURenderState
extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateGPURenderer(SDL_GPUDevice *device, SDL_Window *window)
Implementation
Pointer<SdlRenderer> sdlCreateGpuRenderer(
Pointer<SdlGpuDevice> device,
Pointer<SdlWindow> window,
) {
final sdlCreateGpuRendererLookupFunction = _libSdl
.lookupFunction<
Pointer<SdlRenderer> Function(
Pointer<SdlGpuDevice> device,
Pointer<SdlWindow> window,
),
Pointer<SdlRenderer> Function(
Pointer<SdlGpuDevice> device,
Pointer<SdlWindow> window,
)
>('SDL_CreateGPURenderer');
return sdlCreateGpuRendererLookupFunction(device, window);
}