Sync SDL3 wiki -> header

This commit is contained in:
SDL Wiki Bot 2024-10-04 18:30:06 +00:00
parent f3285b01c8
commit f275731e18

View File

@ -30,9 +30,9 @@
* *
* A basic workflow might be something like this: * A basic workflow might be something like this:
* *
* The app creates a GPU device with SDL_GPUCreateDevice, and assigns it to * The app creates a GPU device with SDL_GPUCreateDevice, and assigns it to a
* a window with SDL_ClaimWindowForGPUDevice--although strictly speaking you * window with SDL_ClaimWindowForGPUDevice--although strictly speaking you can
* can render offscreen entirely, perhaps for image processing, and not use a * render offscreen entirely, perhaps for image processing, and not use a
* window at all. * window at all.
* *
* Next the app prepares static data (things that are created once and used * Next the app prepares static data (things that are created once and used
@ -47,11 +47,11 @@
* SDL_CreateGPUGraphicsPipeline * SDL_CreateGPUGraphicsPipeline
* *
* To render, the app creates one or more command buffers, with * To render, the app creates one or more command buffers, with
* SDL_AcquireGPUCommandBuffer. Command buffers collect rendering * SDL_AcquireGPUCommandBuffer. Command buffers collect rendering instructions
* instructions that will be submitted to the GPU in batch. Complex scenes can * that will be submitted to the GPU in batch. Complex scenes can use multiple
* use multiple command buffers, maybe configured across multiple threads in * command buffers, maybe configured across multiple threads in parallel, as
* parallel, as long as they are submitted in the correct order, but many apps * long as they are submitted in the correct order, but many apps will just
* will just need one command buffer per frame. * need one command buffer per frame.
* *
* Rendering can happen to a texture (what other APIs call a "render target") * Rendering can happen to a texture (what other APIs call a "render target")
* or it can happen to the swapchain texture (which is just a special texture * or it can happen to the swapchain texture (which is just a special texture
@ -66,8 +66,8 @@
* simultaneously. If the set of textures being rendered to needs to change, * simultaneously. If the set of textures being rendered to needs to change,
* the Render Pass must be ended and a new one must be begun. * the Render Pass must be ended and a new one must be begun.
* *
* The app calls SDL_BeginGPURenderPass. Then it sets states it needs for * The app calls SDL_BeginGPURenderPass. Then it sets states it needs for each
* each draw: * draw:
* *
* - SDL_BindGPUGraphicsPipeline * - SDL_BindGPUGraphicsPipeline
* - SDL_SetGPUViewport * - SDL_SetGPUViewport
@ -121,15 +121,17 @@
* creates the GPU device, the app lets the device know which shader formats * creates the GPU device, the app lets the device know which shader formats
* the app can provide. It will then select the appropriate backend depending * the app can provide. It will then select the appropriate backend depending
* on the available shader formats and the backends available on the platform. * on the available shader formats and the backends available on the platform.
* When creating shaders, the app must provide the correct shader format for the * When creating shaders, the app must provide the correct shader format for
* selected backend. If you would like to learn more about why the API works * the selected backend. If you would like to learn more about why the API
* this way, there is a detailed * works this way, there is a detailed
* [blog post](https://moonside.games/posts/layers-all-the-way-down/) * [blog post](https://moonside.games/posts/layers-all-the-way-down/)
* explaining this situation. * explaining this situation.
* *
* It is optimal for apps to pre-compile the shader formats they might use, * It is optimal for apps to pre-compile the shader formats they might use,
* but for ease of use SDL provides a [satellite single-header library](https://github.com/libsdl-org/SDL_gpu_shadercross) for * but for ease of use SDL provides a
* performing runtime shader cross-compilation. * [satellite single-header library](https://github.com/libsdl-org/SDL_gpu_shadercross
* )
* for performing runtime shader cross-compilation.
* *
* This is an extremely quick overview that leaves out several important * This is an extremely quick overview that leaves out several important
* details. Already, though, one can see that GPU programming can be quite * details. Already, though, one can see that GPU programming can be quite