Renamed Gpu to GPU

This commit is contained in:
Sam Lantinga 2024-08-29 16:08:10 -07:00
parent 717f4f6fb4
commit d70578b9aa
24 changed files with 2469 additions and 2469 deletions

View file

@ -233,7 +233,7 @@ endmacro()
define_sdl_subsystem(Audio) define_sdl_subsystem(Audio)
define_sdl_subsystem(Video) define_sdl_subsystem(Video)
define_sdl_subsystem(Gpu DEPS SDL_VIDEO) define_sdl_subsystem(GPU DEPS SDL_VIDEO)
define_sdl_subsystem(Render DEPS SDL_VIDEO) define_sdl_subsystem(Render DEPS SDL_VIDEO)
define_sdl_subsystem(Camera DEPS SDL_VIDEO) define_sdl_subsystem(Camera DEPS SDL_VIDEO)
define_sdl_subsystem(Joystick) define_sdl_subsystem(Joystick)
@ -332,7 +332,7 @@ dep_option(SDL_RENDER_D3D "Enable the Direct3D 9 render driver" ON "SDL
dep_option(SDL_RENDER_D3D11 "Enable the Direct3D 11 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF) dep_option(SDL_RENDER_D3D11 "Enable the Direct3D 11 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF)
dep_option(SDL_RENDER_D3D12 "Enable the Direct3D 12 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF) dep_option(SDL_RENDER_D3D12 "Enable the Direct3D 12 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF)
dep_option(SDL_RENDER_METAL "Enable the Metal render driver" ON "SDL_RENDER;${APPLE}" OFF) dep_option(SDL_RENDER_METAL "Enable the Metal render driver" ON "SDL_RENDER;${APPLE}" OFF)
set_option(SDL_RENDER_GPU "Enable the SDL_Gpu render driver" ON) set_option(SDL_RENDER_GPU "Enable the SDL_GPU render driver" ON)
dep_option(SDL_VIVANTE "Use Vivante EGL video driver" ON "${UNIX_SYS};SDL_CPU_ARM32" OFF) dep_option(SDL_VIVANTE "Use Vivante EGL video driver" ON "${UNIX_SYS};SDL_CPU_ARM32" OFF)
dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR WINDOWS" OFF) dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR WINDOWS" OFF)
dep_option(SDL_RENDER_VULKAN "Enable the Vulkan render driver" ON "SDL_RENDER;SDL_VULKAN" OFF) dep_option(SDL_RENDER_VULKAN "Enable the Vulkan render driver" ON "SDL_RENDER;SDL_VULKAN" OFF)
@ -352,7 +352,7 @@ set_option(SDL_LIBUDEV "Enable libudev support" ON)
set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF) set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF)
set_option(SDL_CCACHE "Use Ccache to speed up build" OFF) set_option(SDL_CCACHE "Use Ccache to speed up build" OFF)
set_option(SDL_CLANG_TIDY "Run clang-tidy static analysis" OFF) set_option(SDL_CLANG_TIDY "Run clang-tidy static analysis" OFF)
set_option(SDL_GPU_DXVK "Build SDL_Gpu with DXVK support" OFF) set_option(SDL_GPU_DXVK "Build SDL_GPU with DXVK support" OFF)
set(SDL_VENDOR_INFO "" CACHE STRING "Vendor name and/or version to add to SDL_REVISION") set(SDL_VENDOR_INFO "" CACHE STRING "Vendor name and/or version to add to SDL_REVISION")

File diff suppressed because it is too large Load diff

View file

@ -1014,7 +1014,7 @@ extern "C" {
* force a specific target, such as "d3d11" if, say, your hardware supports * force a specific target, such as "d3d11" if, say, your hardware supports
* D3D12 but want to try using D3D11 instead. * D3D12 but want to try using D3D11 instead.
* *
* This hint should be set before SDL_GpuSelectBackend() is called. * This hint should be set before SDL_GPUSelectBackend() is called.
* *
* \since This hint is available since SDL 3.0.0. * \since This hint is available since SDL 3.0.0.
*/ */

View file

@ -9807,15 +9807,15 @@ typedef void (APIENTRYP PFNGLUPLOADGPUMASKNVXPROC) (GLbitfield mask);
typedef void (APIENTRYP PFNGLMULTICASTVIEWPORTARRAYVNVXPROC) (GLuint gpu, GLuint first, GLsizei count, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTICASTVIEWPORTARRAYVNVXPROC) (GLuint gpu, GLuint first, GLsizei count, const GLfloat *v);
typedef void (APIENTRYP PFNGLMULTICASTVIEWPORTPOSITIONWSCALENVXPROC) (GLuint gpu, GLuint index, GLfloat xcoeff, GLfloat ycoeff); typedef void (APIENTRYP PFNGLMULTICASTVIEWPORTPOSITIONWSCALENVXPROC) (GLuint gpu, GLuint index, GLfloat xcoeff, GLfloat ycoeff);
typedef void (APIENTRYP PFNGLMULTICASTSCISSORARRAYVNVXPROC) (GLuint gpu, GLuint first, GLsizei count, const GLint *v); typedef void (APIENTRYP PFNGLMULTICASTSCISSORARRAYVNVXPROC) (GLuint gpu, GLuint first, GLsizei count, const GLint *v);
typedef GLuint (APIENTRYP PFNGLASYNCCOPYBUFFERSUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray); typedef GLuint (APIENTRYP PFNGLASYNCCOPYBUFFERSUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGPU, GLbitfield writeGPUMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
typedef GLuint (APIENTRYP PFNGLASYNCCOPYIMAGESUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray); typedef GLuint (APIENTRYP PFNGLASYNCCOPYIMAGESUBDATANVXPROC) (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGPU, GLbitfield dstGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
#ifdef GL_GLEXT_PROTOTYPES #ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glUploadGpuMaskNVX (GLbitfield mask); GLAPI void APIENTRY glUploadGPUMaskNVX (GLbitfield mask);
GLAPI void APIENTRY glMulticastViewportArrayvNVX (GLuint gpu, GLuint first, GLsizei count, const GLfloat *v); GLAPI void APIENTRY glMulticastViewportArrayvNVX (GLuint gpu, GLuint first, GLsizei count, const GLfloat *v);
GLAPI void APIENTRY glMulticastViewportPositionWScaleNVX (GLuint gpu, GLuint index, GLfloat xcoeff, GLfloat ycoeff); GLAPI void APIENTRY glMulticastViewportPositionWScaleNVX (GLuint gpu, GLuint index, GLfloat xcoeff, GLfloat ycoeff);
GLAPI void APIENTRY glMulticastScissorArrayvNVX (GLuint gpu, GLuint first, GLsizei count, const GLint *v); GLAPI void APIENTRY glMulticastScissorArrayvNVX (GLuint gpu, GLuint first, GLsizei count, const GLint *v);
GLAPI GLuint APIENTRY glAsyncCopyBufferSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray); GLAPI GLuint APIENTRY glAsyncCopyBufferSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *fenceValueArray, GLuint readGPU, GLbitfield writeGPUMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
GLAPI GLuint APIENTRY glAsyncCopyImageSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray); GLAPI GLuint APIENTRY glAsyncCopyImageSubDataNVX (GLsizei waitSemaphoreCount, const GLuint *waitSemaphoreArray, const GLuint64 *waitValueArray, GLuint srcGPU, GLbitfield dstGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth, GLsizei signalSemaphoreCount, const GLuint *signalSemaphoreArray, const GLuint64 *signalValueArray);
#endif #endif
#endif /* GL_NVX_gpu_multicast2 */ #endif /* GL_NVX_gpu_multicast2 */
@ -9824,11 +9824,11 @@ GLAPI GLuint APIENTRY glAsyncCopyImageSubDataNVX (GLsizei waitSemaphoreCount, co
#define GL_LGPU_SEPARATE_STORAGE_BIT_NVX 0x0800 #define GL_LGPU_SEPARATE_STORAGE_BIT_NVX 0x0800
#define GL_MAX_LGPU_GPUS_NVX 0x92BA #define GL_MAX_LGPU_GPUS_NVX 0x92BA
typedef void (APIENTRYP PFNGLLGPUNAMEDBUFFERSUBDATANVXPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); typedef void (APIENTRYP PFNGLLGPUNAMEDBUFFERSUBDATANVXPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
typedef void (APIENTRYP PFNGLLGPUCOPYIMAGESUBDATANVXPROC) (GLuint sourceGpu, GLbitfield destinationGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); typedef void (APIENTRYP PFNGLLGPUCOPYIMAGESUBDATANVXPROC) (GLuint sourceGPU, GLbitfield destinationGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
typedef void (APIENTRYP PFNGLLGPUINTERLOCKNVXPROC) (void); typedef void (APIENTRYP PFNGLLGPUINTERLOCKNVXPROC) (void);
#ifdef GL_GLEXT_PROTOTYPES #ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glLGPUNamedBufferSubDataNVX (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); GLAPI void APIENTRY glLGPUNamedBufferSubDataNVX (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
GLAPI void APIENTRY glLGPUCopyImageSubDataNVX (GLuint sourceGpu, GLbitfield destinationGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); GLAPI void APIENTRY glLGPUCopyImageSubDataNVX (GLuint sourceGPU, GLbitfield destinationGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
GLAPI void APIENTRY glLGPUInterlockNVX (void); GLAPI void APIENTRY glLGPUInterlockNVX (void);
#endif #endif
#endif /* GL_NVX_linked_gpu_multicast */ #endif /* GL_NVX_linked_gpu_multicast */
@ -9836,13 +9836,13 @@ GLAPI void APIENTRY glLGPUInterlockNVX (void);
#ifndef GL_NVX_progress_fence #ifndef GL_NVX_progress_fence
#define GL_NVX_progress_fence 1 #define GL_NVX_progress_fence 1
typedef GLuint (APIENTRYP PFNGLCREATEPROGRESSFENCENVXPROC) (void); typedef GLuint (APIENTRYP PFNGLCREATEPROGRESSFENCENVXPROC) (void);
typedef void (APIENTRYP PFNGLSIGNALSEMAPHOREUI64NVXPROC) (GLuint signalGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); typedef void (APIENTRYP PFNGLSIGNALSEMAPHOREUI64NVXPROC) (GLuint signalGPU, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
typedef void (APIENTRYP PFNGLWAITSEMAPHOREUI64NVXPROC) (GLuint waitGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); typedef void (APIENTRYP PFNGLWAITSEMAPHOREUI64NVXPROC) (GLuint waitGPU, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
typedef void (APIENTRYP PFNGLCLIENTWAITSEMAPHOREUI64NVXPROC) (GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); typedef void (APIENTRYP PFNGLCLIENTWAITSEMAPHOREUI64NVXPROC) (GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
#ifdef GL_GLEXT_PROTOTYPES #ifdef GL_GLEXT_PROTOTYPES
GLAPI GLuint APIENTRY glCreateProgressFenceNVX (void); GLAPI GLuint APIENTRY glCreateProgressFenceNVX (void);
GLAPI void APIENTRY glSignalSemaphoreui64NVX (GLuint signalGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); GLAPI void APIENTRY glSignalSemaphoreui64NVX (GLuint signalGPU, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
GLAPI void APIENTRY glWaitSemaphoreui64NVX (GLuint waitGpu, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); GLAPI void APIENTRY glWaitSemaphoreui64NVX (GLuint waitGPU, GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
GLAPI void APIENTRY glClientWaitSemaphoreui64NVX (GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray); GLAPI void APIENTRY glClientWaitSemaphoreui64NVX (GLsizei fenceObjectCount, const GLuint *semaphoreArray, const GLuint64 *fenceValueArray);
#endif #endif
#endif /* GL_NVX_progress_fence */ #endif /* GL_NVX_progress_fence */
@ -10433,25 +10433,25 @@ GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachmen
#define GL_MULTICAST_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9549 #define GL_MULTICAST_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9549
typedef void (APIENTRYP PFNGLRENDERGPUMASKNVPROC) (GLbitfield mask); typedef void (APIENTRYP PFNGLRENDERGPUMASKNVPROC) (GLbitfield mask);
typedef void (APIENTRYP PFNGLMULTICASTBUFFERSUBDATANVPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); typedef void (APIENTRYP PFNGLMULTICASTBUFFERSUBDATANVPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
typedef void (APIENTRYP PFNGLMULTICASTCOPYBUFFERSUBDATANVPROC) (GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); typedef void (APIENTRYP PFNGLMULTICASTCOPYBUFFERSUBDATANVPROC) (GLuint readGPU, GLbitfield writeGPUMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
typedef void (APIENTRYP PFNGLMULTICASTCOPYIMAGESUBDATANVPROC) (GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); typedef void (APIENTRYP PFNGLMULTICASTCOPYIMAGESUBDATANVPROC) (GLuint srcGPU, GLbitfield dstGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
typedef void (APIENTRYP PFNGLMULTICASTBLITFRAMEBUFFERNVPROC) (GLuint srcGpu, GLuint dstGpu, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); typedef void (APIENTRYP PFNGLMULTICASTBLITFRAMEBUFFERNVPROC) (GLuint srcGPU, GLuint dstGPU, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
typedef void (APIENTRYP PFNGLMULTICASTFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); typedef void (APIENTRYP PFNGLMULTICASTFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
typedef void (APIENTRYP PFNGLMULTICASTBARRIERNVPROC) (void); typedef void (APIENTRYP PFNGLMULTICASTBARRIERNVPROC) (void);
typedef void (APIENTRYP PFNGLMULTICASTWAITSYNCNVPROC) (GLuint signalGpu, GLbitfield waitGpuMask); typedef void (APIENTRYP PFNGLMULTICASTWAITSYNCNVPROC) (GLuint signalGPU, GLbitfield waitGPUMask);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTUIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint *params); typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTUIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint *params);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint64 *params); typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint64 *params);
typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTUI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint64 *params); typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTUI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint64 *params);
#ifdef GL_GLEXT_PROTOTYPES #ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glRenderGpuMaskNV (GLbitfield mask); GLAPI void APIENTRY glRenderGPUMaskNV (GLbitfield mask);
GLAPI void APIENTRY glMulticastBufferSubDataNV (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); GLAPI void APIENTRY glMulticastBufferSubDataNV (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
GLAPI void APIENTRY glMulticastCopyBufferSubDataNV (GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); GLAPI void APIENTRY glMulticastCopyBufferSubDataNV (GLuint readGPU, GLbitfield writeGPUMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
GLAPI void APIENTRY glMulticastCopyImageSubDataNV (GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); GLAPI void APIENTRY glMulticastCopyImageSubDataNV (GLuint srcGPU, GLbitfield dstGPUMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
GLAPI void APIENTRY glMulticastBlitFramebufferNV (GLuint srcGpu, GLuint dstGpu, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); GLAPI void APIENTRY glMulticastBlitFramebufferNV (GLuint srcGPU, GLuint dstGPU, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
GLAPI void APIENTRY glMulticastFramebufferSampleLocationsfvNV (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); GLAPI void APIENTRY glMulticastFramebufferSampleLocationsfvNV (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
GLAPI void APIENTRY glMulticastBarrierNV (void); GLAPI void APIENTRY glMulticastBarrierNV (void);
GLAPI void APIENTRY glMulticastWaitSyncNV (GLuint signalGpu, GLbitfield waitGpuMask); GLAPI void APIENTRY glMulticastWaitSyncNV (GLuint signalGPU, GLbitfield waitGPUMask);
GLAPI void APIENTRY glMulticastGetQueryObjectivNV (GLuint gpu, GLuint id, GLenum pname, GLint *params); GLAPI void APIENTRY glMulticastGetQueryObjectivNV (GLuint gpu, GLuint id, GLenum pname, GLint *params);
GLAPI void APIENTRY glMulticastGetQueryObjectuivNV (GLuint gpu, GLuint id, GLenum pname, GLuint *params); GLAPI void APIENTRY glMulticastGetQueryObjectuivNV (GLuint gpu, GLuint id, GLenum pname, GLuint *params);
GLAPI void APIENTRY glMulticastGetQueryObjecti64vNV (GLuint gpu, GLuint id, GLenum pname, GLint64 *params); GLAPI void APIENTRY glMulticastGetQueryObjecti64vNV (GLuint gpu, GLuint id, GLenum pname, GLint64 *params);

View file

@ -64,13 +64,13 @@ SDL_bool SDL_GetGDKDefaultUser(void *outUserHandle)
return SDL_Unsupported(); return SDL_Unsupported();
} }
SDL_DECLSPEC void SDLCALL SDL_GDKSuspendGpu(SDL_GpuDevice *device); SDL_DECLSPEC void SDLCALL SDL_GDKSuspendGPU(SDL_GPUDevice *device);
void SDL_GDKSuspendGpu(SDL_GpuDevice *device) void SDL_GDKSuspendGPU(SDL_GPUDevice *device)
{ {
} }
SDL_DECLSPEC void SDLCALL SDL_GDKResumeGpu(SDL_GpuDevice *device); SDL_DECLSPEC void SDLCALL SDL_GDKResumeGPU(SDL_GPUDevice *device);
void SDL_GDKResumeGpu(SDL_GpuDevice *device) void SDL_GDKResumeGPU(SDL_GPUDevice *device)
{ {
} }

View file

@ -1060,87 +1060,87 @@ SDL3_0.0.0 {
SDL_wcsnstr; SDL_wcsnstr;
SDL_wcsstr; SDL_wcsstr;
SDL_wcstol; SDL_wcstol;
SDL_CreateGpuDevice; SDL_CreateGPUDevice;
SDL_CreateGpuDeviceWithProperties; SDL_CreateGPUDeviceWithProperties;
SDL_DestroyGpuDevice; SDL_DestroyGPUDevice;
SDL_GetGpuDriver; SDL_GetGPUDriver;
SDL_CreateGpuComputePipeline; SDL_CreateGPUComputePipeline;
SDL_CreateGpuGraphicsPipeline; SDL_CreateGPUGraphicsPipeline;
SDL_CreateGpuSampler; SDL_CreateGPUSampler;
SDL_CreateGpuShader; SDL_CreateGPUShader;
SDL_CreateGpuTexture; SDL_CreateGPUTexture;
SDL_CreateGpuBuffer; SDL_CreateGPUBuffer;
SDL_CreateGpuTransferBuffer; SDL_CreateGPUTransferBuffer;
SDL_SetGpuBufferName; SDL_SetGPUBufferName;
SDL_SetGpuTextureName; SDL_SetGPUTextureName;
SDL_InsertGpuDebugLabel; SDL_InsertGPUDebugLabel;
SDL_PushGpuDebugGroup; SDL_PushGPUDebugGroup;
SDL_PopGpuDebugGroup; SDL_PopGPUDebugGroup;
SDL_ReleaseGpuTexture; SDL_ReleaseGPUTexture;
SDL_ReleaseGpuSampler; SDL_ReleaseGPUSampler;
SDL_ReleaseGpuBuffer; SDL_ReleaseGPUBuffer;
SDL_ReleaseGpuTransferBuffer; SDL_ReleaseGPUTransferBuffer;
SDL_ReleaseGpuComputePipeline; SDL_ReleaseGPUComputePipeline;
SDL_ReleaseGpuShader; SDL_ReleaseGPUShader;
SDL_ReleaseGpuGraphicsPipeline; SDL_ReleaseGPUGraphicsPipeline;
SDL_BeginGpuRenderPass; SDL_BeginGPURenderPass;
SDL_BindGpuGraphicsPipeline; SDL_BindGPUGraphicsPipeline;
SDL_SetGpuViewport; SDL_SetGPUViewport;
SDL_SetGpuScissor; SDL_SetGPUScissor;
SDL_BindGpuVertexBuffers; SDL_BindGPUVertexBuffers;
SDL_BindGpuIndexBuffer; SDL_BindGPUIndexBuffer;
SDL_BindGpuVertexSamplers; SDL_BindGPUVertexSamplers;
SDL_BindGpuVertexStorageTextures; SDL_BindGPUVertexStorageTextures;
SDL_BindGpuVertexStorageBuffers; SDL_BindGPUVertexStorageBuffers;
SDL_BindGpuFragmentSamplers; SDL_BindGPUFragmentSamplers;
SDL_BindGpuFragmentStorageTextures; SDL_BindGPUFragmentStorageTextures;
SDL_BindGpuFragmentStorageBuffers; SDL_BindGPUFragmentStorageBuffers;
SDL_PushGpuVertexUniformData; SDL_PushGPUVertexUniformData;
SDL_PushGpuFragmentUniformData; SDL_PushGPUFragmentUniformData;
SDL_DrawGpuIndexedPrimitives; SDL_DrawGPUIndexedPrimitives;
SDL_DrawGpuPrimitives; SDL_DrawGPUPrimitives;
SDL_DrawGpuPrimitivesIndirect; SDL_DrawGPUPrimitivesIndirect;
SDL_DrawGpuIndexedPrimitivesIndirect; SDL_DrawGPUIndexedPrimitivesIndirect;
SDL_EndGpuRenderPass; SDL_EndGPURenderPass;
SDL_BeginGpuComputePass; SDL_BeginGPUComputePass;
SDL_BindGpuComputePipeline; SDL_BindGPUComputePipeline;
SDL_BindGpuComputeStorageTextures; SDL_BindGPUComputeStorageTextures;
SDL_BindGpuComputeStorageBuffers; SDL_BindGPUComputeStorageBuffers;
SDL_PushGpuComputeUniformData; SDL_PushGPUComputeUniformData;
SDL_DispatchGpuCompute; SDL_DispatchGPUCompute;
SDL_DispatchGpuComputeIndirect; SDL_DispatchGPUComputeIndirect;
SDL_EndGpuComputePass; SDL_EndGPUComputePass;
SDL_MapGpuTransferBuffer; SDL_MapGPUTransferBuffer;
SDL_UnmapGpuTransferBuffer; SDL_UnmapGPUTransferBuffer;
SDL_BeginGpuCopyPass; SDL_BeginGPUCopyPass;
SDL_UploadToGpuTexture; SDL_UploadToGPUTexture;
SDL_UploadToGpuBuffer; SDL_UploadToGPUBuffer;
SDL_CopyGpuTextureToTexture; SDL_CopyGPUTextureToTexture;
SDL_CopyGpuBufferToBuffer; SDL_CopyGPUBufferToBuffer;
SDL_GenerateGpuMipmaps; SDL_GenerateGPUMipmaps;
SDL_DownloadFromGpuTexture; SDL_DownloadFromGPUTexture;
SDL_DownloadFromGpuBuffer; SDL_DownloadFromGPUBuffer;
SDL_EndGpuCopyPass; SDL_EndGPUCopyPass;
SDL_BlitGpu; SDL_BlitGPU;
SDL_SupportsGpuSwapchainComposition; SDL_SupportsGPUSwapchainComposition;
SDL_SupportsGpuPresentMode; SDL_SupportsGPUPresentMode;
SDL_ClaimGpuWindow; SDL_ClaimGPUWindow;
SDL_UnclaimGpuWindow; SDL_UnclaimGPUWindow;
SDL_SetGpuSwapchainParameters; SDL_SetGPUSwapchainParameters;
SDL_GetGpuSwapchainTextureFormat; SDL_GetGPUSwapchainTextureFormat;
SDL_AcquireGpuCommandBuffer; SDL_AcquireGPUCommandBuffer;
SDL_AcquireGpuSwapchainTexture; SDL_AcquireGPUSwapchainTexture;
SDL_SubmitGpu; SDL_SubmitGPU;
SDL_SubmitGpuAndAcquireFence; SDL_SubmitGPUAndAcquireFence;
SDL_WaitGpu; SDL_WaitGPU;
SDL_WaitGpuForFences; SDL_WaitGPUForFences;
SDL_QueryGpuFence; SDL_QueryGPUFence;
SDL_ReleaseGpuFence; SDL_ReleaseGPUFence;
SDL_GpuTextureFormatTexelBlockSize; SDL_GPUTextureFormatTexelBlockSize;
SDL_SupportsGpuTextureFormat; SDL_SupportsGPUTextureFormat;
SDL_SupportsGpuSampleCount; SDL_SupportsGPUSampleCount;
SDL_GDKSuspendGpu; SDL_GDKSuspendGPU;
SDL_GDKResumeGpu; SDL_GDKResumeGPU;
# extra symbols go here (don't modify this line) # extra symbols go here (don't modify this line)
local: *; local: *;
}; };

View file

@ -1085,84 +1085,84 @@
#define SDL_wcsnstr SDL_wcsnstr_REAL #define SDL_wcsnstr SDL_wcsnstr_REAL
#define SDL_wcsstr SDL_wcsstr_REAL #define SDL_wcsstr SDL_wcsstr_REAL
#define SDL_wcstol SDL_wcstol_REAL #define SDL_wcstol SDL_wcstol_REAL
#define SDL_CreateGpuDevice SDL_CreateGpuDevice_REAL #define SDL_CreateGPUDevice SDL_CreateGPUDevice_REAL
#define SDL_CreateGpuDeviceWithProperties SDL_CreateGpuDeviceWithProperties_REAL #define SDL_CreateGPUDeviceWithProperties SDL_CreateGPUDeviceWithProperties_REAL
#define SDL_DestroyGpuDevice SDL_DestroyGpuDevice_REAL #define SDL_DestroyGPUDevice SDL_DestroyGPUDevice_REAL
#define SDL_GetGpuDriver SDL_GetGpuDriver_REAL #define SDL_GetGPUDriver SDL_GetGPUDriver_REAL
#define SDL_CreateGpuComputePipeline SDL_CreateGpuComputePipeline_REAL #define SDL_CreateGPUComputePipeline SDL_CreateGPUComputePipeline_REAL
#define SDL_CreateGpuGraphicsPipeline SDL_CreateGpuGraphicsPipeline_REAL #define SDL_CreateGPUGraphicsPipeline SDL_CreateGPUGraphicsPipeline_REAL
#define SDL_CreateGpuSampler SDL_CreateGpuSampler_REAL #define SDL_CreateGPUSampler SDL_CreateGPUSampler_REAL
#define SDL_CreateGpuShader SDL_CreateGpuShader_REAL #define SDL_CreateGPUShader SDL_CreateGPUShader_REAL
#define SDL_CreateGpuTexture SDL_CreateGpuTexture_REAL #define SDL_CreateGPUTexture SDL_CreateGPUTexture_REAL
#define SDL_CreateGpuBuffer SDL_CreateGpuBuffer_REAL #define SDL_CreateGPUBuffer SDL_CreateGPUBuffer_REAL
#define SDL_CreateGpuTransferBuffer SDL_CreateGpuTransferBuffer_REAL #define SDL_CreateGPUTransferBuffer SDL_CreateGPUTransferBuffer_REAL
#define SDL_SetGpuBufferName SDL_SetGpuBufferName_REAL #define SDL_SetGPUBufferName SDL_SetGPUBufferName_REAL
#define SDL_SetGpuTextureName SDL_SetGpuTextureName_REAL #define SDL_SetGPUTextureName SDL_SetGPUTextureName_REAL
#define SDL_InsertGpuDebugLabel SDL_InsertGpuDebugLabel_REAL #define SDL_InsertGPUDebugLabel SDL_InsertGPUDebugLabel_REAL
#define SDL_PushGpuDebugGroup SDL_PushGpuDebugGroup_REAL #define SDL_PushGPUDebugGroup SDL_PushGPUDebugGroup_REAL
#define SDL_PopGpuDebugGroup SDL_PopGpuDebugGroup_REAL #define SDL_PopGPUDebugGroup SDL_PopGPUDebugGroup_REAL
#define SDL_ReleaseGpuTexture SDL_ReleaseGpuTexture_REAL #define SDL_ReleaseGPUTexture SDL_ReleaseGPUTexture_REAL
#define SDL_ReleaseGpuSampler SDL_ReleaseGpuSampler_REAL #define SDL_ReleaseGPUSampler SDL_ReleaseGPUSampler_REAL
#define SDL_ReleaseGpuBuffer SDL_ReleaseGpuBuffer_REAL #define SDL_ReleaseGPUBuffer SDL_ReleaseGPUBuffer_REAL
#define SDL_ReleaseGpuTransferBuffer SDL_ReleaseGpuTransferBuffer_REAL #define SDL_ReleaseGPUTransferBuffer SDL_ReleaseGPUTransferBuffer_REAL
#define SDL_ReleaseGpuComputePipeline SDL_ReleaseGpuComputePipeline_REAL #define SDL_ReleaseGPUComputePipeline SDL_ReleaseGPUComputePipeline_REAL
#define SDL_ReleaseGpuShader SDL_ReleaseGpuShader_REAL #define SDL_ReleaseGPUShader SDL_ReleaseGPUShader_REAL
#define SDL_ReleaseGpuGraphicsPipeline SDL_ReleaseGpuGraphicsPipeline_REAL #define SDL_ReleaseGPUGraphicsPipeline SDL_ReleaseGPUGraphicsPipeline_REAL
#define SDL_BeginGpuRenderPass SDL_BeginGpuRenderPass_REAL #define SDL_BeginGPURenderPass SDL_BeginGPURenderPass_REAL
#define SDL_BindGpuGraphicsPipeline SDL_BindGpuGraphicsPipeline_REAL #define SDL_BindGPUGraphicsPipeline SDL_BindGPUGraphicsPipeline_REAL
#define SDL_SetGpuViewport SDL_SetGpuViewport_REAL #define SDL_SetGPUViewport SDL_SetGPUViewport_REAL
#define SDL_SetGpuScissor SDL_SetGpuScissor_REAL #define SDL_SetGPUScissor SDL_SetGPUScissor_REAL
#define SDL_BindGpuVertexBuffers SDL_BindGpuVertexBuffers_REAL #define SDL_BindGPUVertexBuffers SDL_BindGPUVertexBuffers_REAL
#define SDL_BindGpuIndexBuffer SDL_BindGpuIndexBuffer_REAL #define SDL_BindGPUIndexBuffer SDL_BindGPUIndexBuffer_REAL
#define SDL_BindGpuVertexSamplers SDL_BindGpuVertexSamplers_REAL #define SDL_BindGPUVertexSamplers SDL_BindGPUVertexSamplers_REAL
#define SDL_BindGpuVertexStorageTextures SDL_BindGpuVertexStorageTextures_REAL #define SDL_BindGPUVertexStorageTextures SDL_BindGPUVertexStorageTextures_REAL
#define SDL_BindGpuVertexStorageBuffers SDL_BindGpuVertexStorageBuffers_REAL #define SDL_BindGPUVertexStorageBuffers SDL_BindGPUVertexStorageBuffers_REAL
#define SDL_BindGpuFragmentSamplers SDL_BindGpuFragmentSamplers_REAL #define SDL_BindGPUFragmentSamplers SDL_BindGPUFragmentSamplers_REAL
#define SDL_BindGpuFragmentStorageTextures SDL_BindGpuFragmentStorageTextures_REAL #define SDL_BindGPUFragmentStorageTextures SDL_BindGPUFragmentStorageTextures_REAL
#define SDL_BindGpuFragmentStorageBuffers SDL_BindGpuFragmentStorageBuffers_REAL #define SDL_BindGPUFragmentStorageBuffers SDL_BindGPUFragmentStorageBuffers_REAL
#define SDL_PushGpuVertexUniformData SDL_PushGpuVertexUniformData_REAL #define SDL_PushGPUVertexUniformData SDL_PushGPUVertexUniformData_REAL
#define SDL_PushGpuFragmentUniformData SDL_PushGpuFragmentUniformData_REAL #define SDL_PushGPUFragmentUniformData SDL_PushGPUFragmentUniformData_REAL
#define SDL_DrawGpuIndexedPrimitives SDL_DrawGpuIndexedPrimitives_REAL #define SDL_DrawGPUIndexedPrimitives SDL_DrawGPUIndexedPrimitives_REAL
#define SDL_DrawGpuPrimitives SDL_DrawGpuPrimitives_REAL #define SDL_DrawGPUPrimitives SDL_DrawGPUPrimitives_REAL
#define SDL_DrawGpuPrimitivesIndirect SDL_DrawGpuPrimitivesIndirect_REAL #define SDL_DrawGPUPrimitivesIndirect SDL_DrawGPUPrimitivesIndirect_REAL
#define SDL_DrawGpuIndexedPrimitivesIndirect SDL_DrawGpuIndexedPrimitivesIndirect_REAL #define SDL_DrawGPUIndexedPrimitivesIndirect SDL_DrawGPUIndexedPrimitivesIndirect_REAL
#define SDL_EndGpuRenderPass SDL_EndGpuRenderPass_REAL #define SDL_EndGPURenderPass SDL_EndGPURenderPass_REAL
#define SDL_BeginGpuComputePass SDL_BeginGpuComputePass_REAL #define SDL_BeginGPUComputePass SDL_BeginGPUComputePass_REAL
#define SDL_BindGpuComputePipeline SDL_BindGpuComputePipeline_REAL #define SDL_BindGPUComputePipeline SDL_BindGPUComputePipeline_REAL
#define SDL_BindGpuComputeStorageTextures SDL_BindGpuComputeStorageTextures_REAL #define SDL_BindGPUComputeStorageTextures SDL_BindGPUComputeStorageTextures_REAL
#define SDL_BindGpuComputeStorageBuffers SDL_BindGpuComputeStorageBuffers_REAL #define SDL_BindGPUComputeStorageBuffers SDL_BindGPUComputeStorageBuffers_REAL
#define SDL_PushGpuComputeUniformData SDL_PushGpuComputeUniformData_REAL #define SDL_PushGPUComputeUniformData SDL_PushGPUComputeUniformData_REAL
#define SDL_DispatchGpuCompute SDL_DispatchGpuCompute_REAL #define SDL_DispatchGPUCompute SDL_DispatchGPUCompute_REAL
#define SDL_DispatchGpuComputeIndirect SDL_DispatchGpuComputeIndirect_REAL #define SDL_DispatchGPUComputeIndirect SDL_DispatchGPUComputeIndirect_REAL
#define SDL_EndGpuComputePass SDL_EndGpuComputePass_REAL #define SDL_EndGPUComputePass SDL_EndGPUComputePass_REAL
#define SDL_MapGpuTransferBuffer SDL_MapGpuTransferBuffer_REAL #define SDL_MapGPUTransferBuffer SDL_MapGPUTransferBuffer_REAL
#define SDL_UnmapGpuTransferBuffer SDL_UnmapGpuTransferBuffer_REAL #define SDL_UnmapGPUTransferBuffer SDL_UnmapGPUTransferBuffer_REAL
#define SDL_BeginGpuCopyPass SDL_BeginGpuCopyPass_REAL #define SDL_BeginGPUCopyPass SDL_BeginGPUCopyPass_REAL
#define SDL_UploadToGpuTexture SDL_UploadToGpuTexture_REAL #define SDL_UploadToGPUTexture SDL_UploadToGPUTexture_REAL
#define SDL_UploadToGpuBuffer SDL_UploadToGpuBuffer_REAL #define SDL_UploadToGPUBuffer SDL_UploadToGPUBuffer_REAL
#define SDL_CopyGpuTextureToTexture SDL_CopyGpuTextureToTexture_REAL #define SDL_CopyGPUTextureToTexture SDL_CopyGPUTextureToTexture_REAL
#define SDL_CopyGpuBufferToBuffer SDL_CopyGpuBufferToBuffer_REAL #define SDL_CopyGPUBufferToBuffer SDL_CopyGPUBufferToBuffer_REAL
#define SDL_GenerateGpuMipmaps SDL_GenerateGpuMipmaps_REAL #define SDL_GenerateGPUMipmaps SDL_GenerateGPUMipmaps_REAL
#define SDL_DownloadFromGpuTexture SDL_DownloadFromGpuTexture_REAL #define SDL_DownloadFromGPUTexture SDL_DownloadFromGPUTexture_REAL
#define SDL_DownloadFromGpuBuffer SDL_DownloadFromGpuBuffer_REAL #define SDL_DownloadFromGPUBuffer SDL_DownloadFromGPUBuffer_REAL
#define SDL_EndGpuCopyPass SDL_EndGpuCopyPass_REAL #define SDL_EndGPUCopyPass SDL_EndGPUCopyPass_REAL
#define SDL_BlitGpu SDL_BlitGpu_REAL #define SDL_BlitGPU SDL_BlitGPU_REAL
#define SDL_SupportsGpuSwapchainComposition SDL_SupportsGpuSwapchainComposition_REAL #define SDL_SupportsGPUSwapchainComposition SDL_SupportsGPUSwapchainComposition_REAL
#define SDL_SupportsGpuPresentMode SDL_SupportsGpuPresentMode_REAL #define SDL_SupportsGPUPresentMode SDL_SupportsGPUPresentMode_REAL
#define SDL_ClaimGpuWindow SDL_ClaimGpuWindow_REAL #define SDL_ClaimGPUWindow SDL_ClaimGPUWindow_REAL
#define SDL_UnclaimGpuWindow SDL_UnclaimGpuWindow_REAL #define SDL_UnclaimGPUWindow SDL_UnclaimGPUWindow_REAL
#define SDL_SetGpuSwapchainParameters SDL_SetGpuSwapchainParameters_REAL #define SDL_SetGPUSwapchainParameters SDL_SetGPUSwapchainParameters_REAL
#define SDL_GetGpuSwapchainTextureFormat SDL_GetGpuSwapchainTextureFormat_REAL #define SDL_GetGPUSwapchainTextureFormat SDL_GetGPUSwapchainTextureFormat_REAL
#define SDL_AcquireGpuCommandBuffer SDL_AcquireGpuCommandBuffer_REAL #define SDL_AcquireGPUCommandBuffer SDL_AcquireGPUCommandBuffer_REAL
#define SDL_AcquireGpuSwapchainTexture SDL_AcquireGpuSwapchainTexture_REAL #define SDL_AcquireGPUSwapchainTexture SDL_AcquireGPUSwapchainTexture_REAL
#define SDL_SubmitGpu SDL_SubmitGpu_REAL #define SDL_SubmitGPU SDL_SubmitGPU_REAL
#define SDL_SubmitGpuAndAcquireFence SDL_SubmitGpuAndAcquireFence_REAL #define SDL_SubmitGPUAndAcquireFence SDL_SubmitGPUAndAcquireFence_REAL
#define SDL_WaitGpu SDL_WaitGpu_REAL #define SDL_WaitGPU SDL_WaitGPU_REAL
#define SDL_WaitGpuForFences SDL_WaitGpuForFences_REAL #define SDL_WaitGPUForFences SDL_WaitGPUForFences_REAL
#define SDL_QueryGpuFence SDL_QueryGpuFence_REAL #define SDL_QueryGPUFence SDL_QueryGPUFence_REAL
#define SDL_ReleaseGpuFence SDL_ReleaseGpuFence_REAL #define SDL_ReleaseGPUFence SDL_ReleaseGPUFence_REAL
#define SDL_GpuTextureFormatTexelBlockSize SDL_GpuTextureFormatTexelBlockSize_REAL #define SDL_GPUTextureFormatTexelBlockSize SDL_GPUTextureFormatTexelBlockSize_REAL
#define SDL_SupportsGpuTextureFormat SDL_SupportsGpuTextureFormat_REAL #define SDL_SupportsGPUTextureFormat SDL_SupportsGPUTextureFormat_REAL
#define SDL_SupportsGpuSampleCount SDL_SupportsGpuSampleCount_REAL #define SDL_SupportsGPUSampleCount SDL_SupportsGPUSampleCount_REAL
#define SDL_GDKSuspendGpu SDL_GDKSuspendGpu_REAL #define SDL_GDKSuspendGPU SDL_GDKSuspendGPU_REAL
#define SDL_GDKResumeGpu SDL_GDKResumeGpu_REAL #define SDL_GDKResumeGPU SDL_GDKResumeGPU_REAL

View file

@ -1091,84 +1091,84 @@ SDL_DYNAPI_PROC(size_t,SDL_wcsnlen,(const wchar_t *a, size_t b),(a,b),return)
SDL_DYNAPI_PROC(wchar_t*,SDL_wcsnstr,(const wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(wchar_t*,SDL_wcsnstr,(const wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return)
SDL_DYNAPI_PROC(wchar_t*,SDL_wcsstr,(const wchar_t *a, const wchar_t *b),(a,b),return) SDL_DYNAPI_PROC(wchar_t*,SDL_wcsstr,(const wchar_t *a, const wchar_t *b),(a,b),return)
SDL_DYNAPI_PROC(long,SDL_wcstol,(const wchar_t *a, wchar_t **b, int c),(a,b,c),return) SDL_DYNAPI_PROC(long,SDL_wcstol,(const wchar_t *a, wchar_t **b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_GpuDevice*,SDL_CreateGpuDevice,(SDL_GpuShaderFormat a, SDL_bool b, SDL_bool c, const char *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_GPUDevice*,SDL_CreateGPUDevice,(SDL_GPUShaderFormat a, SDL_bool b, SDL_bool c, const char *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(SDL_GpuDevice*,SDL_CreateGpuDeviceWithProperties,(SDL_PropertiesID a),(a),return) SDL_DYNAPI_PROC(SDL_GPUDevice*,SDL_CreateGPUDeviceWithProperties,(SDL_PropertiesID a),(a),return)
SDL_DYNAPI_PROC(void,SDL_DestroyGpuDevice,(SDL_GpuDevice *a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroyGPUDevice,(SDL_GPUDevice *a),(a),)
SDL_DYNAPI_PROC(SDL_GpuDriver,SDL_GetGpuDriver,(SDL_GpuDevice *a),(a),return) SDL_DYNAPI_PROC(SDL_GPUDriver,SDL_GetGPUDriver,(SDL_GPUDevice *a),(a),return)
SDL_DYNAPI_PROC(SDL_GpuComputePipeline*,SDL_CreateGpuComputePipeline,(SDL_GpuDevice *a, SDL_GpuComputePipelineCreateInfo *b),(a,b),return) SDL_DYNAPI_PROC(SDL_GPUComputePipeline*,SDL_CreateGPUComputePipeline,(SDL_GPUDevice *a, SDL_GPUComputePipelineCreateInfo *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_GpuGraphicsPipeline*,SDL_CreateGpuGraphicsPipeline,(SDL_GpuDevice *a, SDL_GpuGraphicsPipelineCreateInfo *b),(a,b),return) SDL_DYNAPI_PROC(SDL_GPUGraphicsPipeline*,SDL_CreateGPUGraphicsPipeline,(SDL_GPUDevice *a, SDL_GPUGraphicsPipelineCreateInfo *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_GpuSampler*,SDL_CreateGpuSampler,(SDL_GpuDevice *a, SDL_GpuSamplerCreateInfo *b),(a,b),return) SDL_DYNAPI_PROC(SDL_GPUSampler*,SDL_CreateGPUSampler,(SDL_GPUDevice *a, SDL_GPUSamplerCreateInfo *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_GpuShader*,SDL_CreateGpuShader,(SDL_GpuDevice *a, SDL_GpuShaderCreateInfo *b),(a,b),return) SDL_DYNAPI_PROC(SDL_GPUShader*,SDL_CreateGPUShader,(SDL_GPUDevice *a, SDL_GPUShaderCreateInfo *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_GpuTexture*,SDL_CreateGpuTexture,(SDL_GpuDevice *a, SDL_GpuTextureCreateInfo *b),(a,b),return) SDL_DYNAPI_PROC(SDL_GPUTexture*,SDL_CreateGPUTexture,(SDL_GPUDevice *a, SDL_GPUTextureCreateInfo *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_GpuBuffer*,SDL_CreateGpuBuffer,(SDL_GpuDevice *a, SDL_GpuBufferCreateInfo* b),(a,b),return) SDL_DYNAPI_PROC(SDL_GPUBuffer*,SDL_CreateGPUBuffer,(SDL_GPUDevice *a, SDL_GPUBufferCreateInfo* b),(a,b),return)
SDL_DYNAPI_PROC(SDL_GpuTransferBuffer*,SDL_CreateGpuTransferBuffer,(SDL_GpuDevice *a, SDL_GpuTransferBufferCreateInfo *b),(a,b),return) SDL_DYNAPI_PROC(SDL_GPUTransferBuffer*,SDL_CreateGPUTransferBuffer,(SDL_GPUDevice *a, SDL_GPUTransferBufferCreateInfo *b),(a,b),return)
SDL_DYNAPI_PROC(void,SDL_SetGpuBufferName,(SDL_GpuDevice *a, SDL_GpuBuffer *b, const char *c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_SetGPUBufferName,(SDL_GPUDevice *a, SDL_GPUBuffer *b, const char *c),(a,b,c),)
SDL_DYNAPI_PROC(void,SDL_SetGpuTextureName,(SDL_GpuDevice *a, SDL_GpuTexture *b, const char *c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_SetGPUTextureName,(SDL_GPUDevice *a, SDL_GPUTexture *b, const char *c),(a,b,c),)
SDL_DYNAPI_PROC(void,SDL_InsertGpuDebugLabel,(SDL_GpuCommandBuffer *a, const char *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_InsertGPUDebugLabel,(SDL_GPUCommandBuffer *a, const char *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_PushGpuDebugGroup,(SDL_GpuCommandBuffer *a, const char *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_PushGPUDebugGroup,(SDL_GPUCommandBuffer *a, const char *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_PopGpuDebugGroup,(SDL_GpuCommandBuffer *a),(a),) SDL_DYNAPI_PROC(void,SDL_PopGPUDebugGroup,(SDL_GPUCommandBuffer *a),(a),)
SDL_DYNAPI_PROC(void,SDL_ReleaseGpuTexture,(SDL_GpuDevice *a, SDL_GpuTexture *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_ReleaseGPUTexture,(SDL_GPUDevice *a, SDL_GPUTexture *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_ReleaseGpuSampler,(SDL_GpuDevice *a, SDL_GpuSampler *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_ReleaseGPUSampler,(SDL_GPUDevice *a, SDL_GPUSampler *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_ReleaseGpuBuffer,(SDL_GpuDevice *a, SDL_GpuBuffer *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_ReleaseGPUBuffer,(SDL_GPUDevice *a, SDL_GPUBuffer *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_ReleaseGpuTransferBuffer,(SDL_GpuDevice *a, SDL_GpuTransferBuffer *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_ReleaseGPUTransferBuffer,(SDL_GPUDevice *a, SDL_GPUTransferBuffer *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_ReleaseGpuComputePipeline,(SDL_GpuDevice *a, SDL_GpuComputePipeline *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_ReleaseGPUComputePipeline,(SDL_GPUDevice *a, SDL_GPUComputePipeline *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_ReleaseGpuShader,(SDL_GpuDevice *a, SDL_GpuShader *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_ReleaseGPUShader,(SDL_GPUDevice *a, SDL_GPUShader *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_ReleaseGpuGraphicsPipeline,(SDL_GpuDevice *a, SDL_GpuGraphicsPipeline *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_ReleaseGPUGraphicsPipeline,(SDL_GPUDevice *a, SDL_GPUGraphicsPipeline *b),(a,b),)
SDL_DYNAPI_PROC(SDL_GpuCommandBuffer*,SDL_AcquireGpuCommandBuffer,(SDL_GpuDevice *a),(a),return) SDL_DYNAPI_PROC(SDL_GPUCommandBuffer*,SDL_AcquireGPUCommandBuffer,(SDL_GPUDevice *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_PushGpuVertexUniformData,(SDL_GpuCommandBuffer *a, Uint32 b, const void *c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_PushGPUVertexUniformData,(SDL_GPUCommandBuffer *a, Uint32 b, const void *c, Uint32 d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_PushGpuFragmentUniformData,(SDL_GpuCommandBuffer *a, Uint32 b, const void *c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_PushGPUFragmentUniformData,(SDL_GPUCommandBuffer *a, Uint32 b, const void *c, Uint32 d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_PushGpuComputeUniformData,(SDL_GpuCommandBuffer *a, Uint32 b, const void *c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_PushGPUComputeUniformData,(SDL_GPUCommandBuffer *a, Uint32 b, const void *c, Uint32 d),(a,b,c,d),)
SDL_DYNAPI_PROC(SDL_GpuRenderPass*,SDL_BeginGpuRenderPass,(SDL_GpuCommandBuffer *a, SDL_GpuColorAttachmentInfo *b, Uint32 c, SDL_GpuDepthStencilAttachmentInfo *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_GPURenderPass*,SDL_BeginGPURenderPass,(SDL_GPUCommandBuffer *a, SDL_GPUColorAttachmentInfo *b, Uint32 c, SDL_GPUDepthStencilAttachmentInfo *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(void,SDL_BindGpuGraphicsPipeline,(SDL_GpuRenderPass *a, SDL_GpuGraphicsPipeline *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_BindGPUGraphicsPipeline,(SDL_GPURenderPass *a, SDL_GPUGraphicsPipeline *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_SetGpuViewport,(SDL_GpuRenderPass *a, SDL_GpuViewport *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_SetGPUViewport,(SDL_GPURenderPass *a, SDL_GPUViewport *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_SetGpuScissor,(SDL_GpuRenderPass *a, SDL_Rect *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_SetGPUScissor,(SDL_GPURenderPass *a, SDL_Rect *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_BindGpuVertexBuffers,(SDL_GpuRenderPass *a, Uint32 b, SDL_GpuBufferBinding *c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_BindGPUVertexBuffers,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUBufferBinding *c, Uint32 d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_BindGpuIndexBuffer,(SDL_GpuRenderPass *a, SDL_GpuBufferBinding *b, SDL_GpuIndexElementSize c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_BindGPUIndexBuffer,(SDL_GPURenderPass *a, SDL_GPUBufferBinding *b, SDL_GPUIndexElementSize c),(a,b,c),)
SDL_DYNAPI_PROC(void,SDL_BindGpuVertexSamplers,(SDL_GpuRenderPass *a, Uint32 b, SDL_GpuTextureSamplerBinding *c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_BindGPUVertexSamplers,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUTextureSamplerBinding *c, Uint32 d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_BindGpuVertexStorageTextures,(SDL_GpuRenderPass *a, Uint32 b, SDL_GpuTexture **c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_BindGPUVertexStorageTextures,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUTexture **c, Uint32 d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_BindGpuVertexStorageBuffers,(SDL_GpuRenderPass *a, Uint32 b, SDL_GpuBuffer **c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_BindGPUVertexStorageBuffers,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUBuffer **c, Uint32 d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_BindGpuFragmentSamplers,(SDL_GpuRenderPass *a, Uint32 b, SDL_GpuTextureSamplerBinding *c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_BindGPUFragmentSamplers,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUTextureSamplerBinding *c, Uint32 d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_BindGpuFragmentStorageTextures,(SDL_GpuRenderPass *a, Uint32 b, SDL_GpuTexture **c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_BindGPUFragmentStorageTextures,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUTexture **c, Uint32 d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_BindGpuFragmentStorageBuffers,(SDL_GpuRenderPass *a, Uint32 b, SDL_GpuBuffer **c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_BindGPUFragmentStorageBuffers,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUBuffer **c, Uint32 d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_DrawGpuIndexedPrimitives,(SDL_GpuRenderPass *a, Uint32 b, Uint32 c, Uint32 d, Sint32 e, Uint32 f),(a,b,c,d,e,f),) SDL_DYNAPI_PROC(void,SDL_DrawGPUIndexedPrimitives,(SDL_GPURenderPass *a, Uint32 b, Uint32 c, Uint32 d, Sint32 e, Uint32 f),(a,b,c,d,e,f),)
SDL_DYNAPI_PROC(void,SDL_DrawGpuPrimitives,(SDL_GpuRenderPass *a, Uint32 b, Uint32 c, Uint32 d, Uint32 e),(a,b,c,d,e),) SDL_DYNAPI_PROC(void,SDL_DrawGPUPrimitives,(SDL_GPURenderPass *a, Uint32 b, Uint32 c, Uint32 d, Uint32 e),(a,b,c,d,e),)
SDL_DYNAPI_PROC(void,SDL_DrawGpuPrimitivesIndirect,(SDL_GpuRenderPass *a, SDL_GpuBuffer *b, Uint32 c, Uint32 d, Uint32 e),(a,b,c,d,e),) SDL_DYNAPI_PROC(void,SDL_DrawGPUPrimitivesIndirect,(SDL_GPURenderPass *a, SDL_GPUBuffer *b, Uint32 c, Uint32 d, Uint32 e),(a,b,c,d,e),)
SDL_DYNAPI_PROC(void,SDL_DrawGpuIndexedPrimitivesIndirect,(SDL_GpuRenderPass *a, SDL_GpuBuffer *b, Uint32 c, Uint32 d, Uint32 e),(a,b,c,d,e),) SDL_DYNAPI_PROC(void,SDL_DrawGPUIndexedPrimitivesIndirect,(SDL_GPURenderPass *a, SDL_GPUBuffer *b, Uint32 c, Uint32 d, Uint32 e),(a,b,c,d,e),)
SDL_DYNAPI_PROC(void,SDL_EndGpuRenderPass,(SDL_GpuRenderPass *a),(a),) SDL_DYNAPI_PROC(void,SDL_EndGPURenderPass,(SDL_GPURenderPass *a),(a),)
SDL_DYNAPI_PROC(SDL_GpuComputePass*,SDL_BeginGpuComputePass,(SDL_GpuCommandBuffer *a, SDL_GpuStorageTextureWriteOnlyBinding *b, Uint32 c, SDL_GpuStorageBufferWriteOnlyBinding *d, Uint32 e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_GPUComputePass*,SDL_BeginGPUComputePass,(SDL_GPUCommandBuffer *a, SDL_GPUStorageTextureWriteOnlyBinding *b, Uint32 c, SDL_GPUStorageBufferWriteOnlyBinding *d, Uint32 e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(void,SDL_BindGpuComputePipeline,(SDL_GpuComputePass *a, SDL_GpuComputePipeline *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_BindGPUComputePipeline,(SDL_GPUComputePass *a, SDL_GPUComputePipeline *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_BindGpuComputeStorageTextures,(SDL_GpuComputePass *a, Uint32 b, SDL_GpuTexture **c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_BindGPUComputeStorageTextures,(SDL_GPUComputePass *a, Uint32 b, SDL_GPUTexture **c, Uint32 d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_BindGpuComputeStorageBuffers,(SDL_GpuComputePass *a, Uint32 b, SDL_GpuBuffer **c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_BindGPUComputeStorageBuffers,(SDL_GPUComputePass *a, Uint32 b, SDL_GPUBuffer **c, Uint32 d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_DispatchGpuCompute,(SDL_GpuComputePass *a, Uint32 b, Uint32 c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_DispatchGPUCompute,(SDL_GPUComputePass *a, Uint32 b, Uint32 c, Uint32 d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_DispatchGpuComputeIndirect,(SDL_GpuComputePass *a, SDL_GpuBuffer *b, Uint32 c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_DispatchGPUComputeIndirect,(SDL_GPUComputePass *a, SDL_GPUBuffer *b, Uint32 c),(a,b,c),)
SDL_DYNAPI_PROC(void,SDL_EndGpuComputePass,(SDL_GpuComputePass *a),(a),) SDL_DYNAPI_PROC(void,SDL_EndGPUComputePass,(SDL_GPUComputePass *a),(a),)
SDL_DYNAPI_PROC(void*,SDL_MapGpuTransferBuffer,(SDL_GpuDevice *a, SDL_GpuTransferBuffer *b, SDL_bool c),(a,b,c),return) SDL_DYNAPI_PROC(void*,SDL_MapGPUTransferBuffer,(SDL_GPUDevice *a, SDL_GPUTransferBuffer *b, SDL_bool c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_UnmapGpuTransferBuffer,(SDL_GpuDevice *a, SDL_GpuTransferBuffer *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_UnmapGPUTransferBuffer,(SDL_GPUDevice *a, SDL_GPUTransferBuffer *b),(a,b),)
SDL_DYNAPI_PROC(SDL_GpuCopyPass*,SDL_BeginGpuCopyPass,(SDL_GpuCommandBuffer *a),(a),return) SDL_DYNAPI_PROC(SDL_GPUCopyPass*,SDL_BeginGPUCopyPass,(SDL_GPUCommandBuffer *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_UploadToGpuTexture,(SDL_GpuCopyPass *a, SDL_GpuTextureTransferInfo *b, SDL_GpuTextureRegion *c, SDL_bool d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_UploadToGPUTexture,(SDL_GPUCopyPass *a, SDL_GPUTextureTransferInfo *b, SDL_GPUTextureRegion *c, SDL_bool d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_UploadToGpuBuffer,(SDL_GpuCopyPass *a, SDL_GpuTransferBufferLocation *b, SDL_GpuBufferRegion *c, SDL_bool d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_UploadToGPUBuffer,(SDL_GPUCopyPass *a, SDL_GPUTransferBufferLocation *b, SDL_GPUBufferRegion *c, SDL_bool d),(a,b,c,d),)
SDL_DYNAPI_PROC(void,SDL_CopyGpuTextureToTexture,(SDL_GpuCopyPass *a, SDL_GpuTextureLocation *b, SDL_GpuTextureLocation *c, Uint32 d, Uint32 e, Uint32 f, SDL_bool g),(a,b,c,d,e,f,g),) SDL_DYNAPI_PROC(void,SDL_CopyGPUTextureToTexture,(SDL_GPUCopyPass *a, SDL_GPUTextureLocation *b, SDL_GPUTextureLocation *c, Uint32 d, Uint32 e, Uint32 f, SDL_bool g),(a,b,c,d,e,f,g),)
SDL_DYNAPI_PROC(void,SDL_CopyGpuBufferToBuffer,(SDL_GpuCopyPass *a, SDL_GpuBufferLocation *b, SDL_GpuBufferLocation *c, Uint32 d, SDL_bool e),(a,b,c,d,e),) SDL_DYNAPI_PROC(void,SDL_CopyGPUBufferToBuffer,(SDL_GPUCopyPass *a, SDL_GPUBufferLocation *b, SDL_GPUBufferLocation *c, Uint32 d, SDL_bool e),(a,b,c,d,e),)
SDL_DYNAPI_PROC(void,SDL_GenerateGpuMipmaps,(SDL_GpuCommandBuffer *a, SDL_GpuTexture *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_GenerateGPUMipmaps,(SDL_GPUCommandBuffer *a, SDL_GPUTexture *b),(a,b),)
SDL_DYNAPI_PROC(void,SDL_DownloadFromGpuTexture,(SDL_GpuCopyPass *a, SDL_GpuTextureRegion *b, SDL_GpuTextureTransferInfo *c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_DownloadFromGPUTexture,(SDL_GPUCopyPass *a, SDL_GPUTextureRegion *b, SDL_GPUTextureTransferInfo *c),(a,b,c),)
SDL_DYNAPI_PROC(void,SDL_DownloadFromGpuBuffer,(SDL_GpuCopyPass *a, SDL_GpuBufferRegion *b, SDL_GpuTransferBufferLocation *c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_DownloadFromGPUBuffer,(SDL_GPUCopyPass *a, SDL_GPUBufferRegion *b, SDL_GPUTransferBufferLocation *c),(a,b,c),)
SDL_DYNAPI_PROC(void,SDL_EndGpuCopyPass,(SDL_GpuCopyPass *a),(a),) SDL_DYNAPI_PROC(void,SDL_EndGPUCopyPass,(SDL_GPUCopyPass *a),(a),)
SDL_DYNAPI_PROC(void,SDL_BlitGpu,(SDL_GpuCommandBuffer *a, SDL_GpuBlitRegion *b, SDL_GpuBlitRegion *c, SDL_FlipMode d, SDL_GpuFilter e, SDL_bool f),(a,b,c,d,e,f),) SDL_DYNAPI_PROC(void,SDL_BlitGPU,(SDL_GPUCommandBuffer *a, SDL_GPUBlitRegion *b, SDL_GPUBlitRegion *c, SDL_FlipMode d, SDL_GPUFilter e, SDL_bool f),(a,b,c,d,e,f),)
SDL_DYNAPI_PROC(SDL_bool,SDL_SupportsGpuSwapchainComposition,(SDL_GpuDevice *a, SDL_Window *b, SDL_GpuSwapchainComposition c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_bool,SDL_SupportsGPUSwapchainComposition,(SDL_GPUDevice *a, SDL_Window *b, SDL_GPUSwapchainComposition c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_SupportsGpuPresentMode,(SDL_GpuDevice *a, SDL_Window *b, SDL_GpuPresentMode c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_bool,SDL_SupportsGPUPresentMode,(SDL_GPUDevice *a, SDL_Window *b, SDL_GPUPresentMode c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_ClaimGpuWindow,(SDL_GpuDevice *a, SDL_Window *b),(a,b),return) SDL_DYNAPI_PROC(SDL_bool,SDL_ClaimGPUWindow,(SDL_GPUDevice *a, SDL_Window *b),(a,b),return)
SDL_DYNAPI_PROC(void,SDL_UnclaimGpuWindow,(SDL_GpuDevice *a, SDL_Window *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_UnclaimGPUWindow,(SDL_GPUDevice *a, SDL_Window *b),(a,b),)
SDL_DYNAPI_PROC(SDL_bool,SDL_SetGpuSwapchainParameters,(SDL_GpuDevice *a, SDL_Window *b, SDL_GpuSwapchainComposition c, SDL_GpuPresentMode d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_bool,SDL_SetGPUSwapchainParameters,(SDL_GPUDevice *a, SDL_Window *b, SDL_GPUSwapchainComposition c, SDL_GPUPresentMode d),(a,b,c,d),return)
SDL_DYNAPI_PROC(SDL_GpuTextureFormat,SDL_GetGpuSwapchainTextureFormat,(SDL_GpuDevice *a, SDL_Window *b),(a,b),return) SDL_DYNAPI_PROC(SDL_GPUTextureFormat,SDL_GetGPUSwapchainTextureFormat,(SDL_GPUDevice *a, SDL_Window *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_GpuTexture*,SDL_AcquireGpuSwapchainTexture,(SDL_GpuCommandBuffer *a, SDL_Window *b, Uint32 *c, Uint32 *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_GPUTexture*,SDL_AcquireGPUSwapchainTexture,(SDL_GPUCommandBuffer *a, SDL_Window *b, Uint32 *c, Uint32 *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(void,SDL_SubmitGpu,(SDL_GpuCommandBuffer *a),(a),) SDL_DYNAPI_PROC(void,SDL_SubmitGPU,(SDL_GPUCommandBuffer *a),(a),)
SDL_DYNAPI_PROC(SDL_GpuFence*,SDL_SubmitGpuAndAcquireFence,(SDL_GpuCommandBuffer *a),(a),return) SDL_DYNAPI_PROC(SDL_GPUFence*,SDL_SubmitGPUAndAcquireFence,(SDL_GPUCommandBuffer *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_WaitGpu,(SDL_GpuDevice *a),(a),) SDL_DYNAPI_PROC(void,SDL_WaitGPU,(SDL_GPUDevice *a),(a),)
SDL_DYNAPI_PROC(void,SDL_WaitGpuForFences,(SDL_GpuDevice *a, SDL_bool b, SDL_GpuFence **c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_WaitGPUForFences,(SDL_GPUDevice *a, SDL_bool b, SDL_GPUFence **c, Uint32 d),(a,b,c,d),)
SDL_DYNAPI_PROC(SDL_bool,SDL_QueryGpuFence,(SDL_GpuDevice *a, SDL_GpuFence *b),(a,b),return) SDL_DYNAPI_PROC(SDL_bool,SDL_QueryGPUFence,(SDL_GPUDevice *a, SDL_GPUFence *b),(a,b),return)
SDL_DYNAPI_PROC(void,SDL_ReleaseGpuFence,(SDL_GpuDevice *a, SDL_GpuFence *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_ReleaseGPUFence,(SDL_GPUDevice *a, SDL_GPUFence *b),(a,b),)
SDL_DYNAPI_PROC(Uint32,SDL_GpuTextureFormatTexelBlockSize,(SDL_GpuTextureFormat a),(a),return) SDL_DYNAPI_PROC(Uint32,SDL_GPUTextureFormatTexelBlockSize,(SDL_GPUTextureFormat a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_SupportsGpuTextureFormat,(SDL_GpuDevice *a, SDL_GpuTextureFormat b, SDL_GpuTextureType c, SDL_GpuTextureUsageFlags d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_bool,SDL_SupportsGPUTextureFormat,(SDL_GPUDevice *a, SDL_GPUTextureFormat b, SDL_GPUTextureType c, SDL_GPUTextureUsageFlags d),(a,b,c,d),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_SupportsGpuSampleCount,(SDL_GpuDevice *a, SDL_GpuTextureFormat b, SDL_GpuSampleCount c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_bool,SDL_SupportsGPUSampleCount,(SDL_GPUDevice *a, SDL_GPUTextureFormat b, SDL_GPUSampleCount c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_GDKSuspendGpu,(SDL_GpuDevice *a),(a),) SDL_DYNAPI_PROC(void,SDL_GDKSuspendGPU,(SDL_GPUDevice *a),(a),)
SDL_DYNAPI_PROC(void,SDL_GDKResumeGpu,(SDL_GpuDevice *a),(a),) SDL_DYNAPI_PROC(void,SDL_GDKResumeGPU,(SDL_GPUDevice *a),(a),)

File diff suppressed because it is too large Load diff

View file

@ -28,13 +28,13 @@
typedef struct Pass typedef struct Pass
{ {
SDL_GpuCommandBuffer *commandBuffer; SDL_GPUCommandBuffer *commandBuffer;
SDL_bool inProgress; SDL_bool inProgress;
} Pass; } Pass;
typedef struct CommandBufferCommonHeader typedef struct CommandBufferCommonHeader
{ {
SDL_GpuDevice *device; SDL_GPUDevice *device;
Pass renderPass; Pass renderPass;
SDL_bool graphicsPipelineBound; SDL_bool graphicsPipelineBound;
Pass computePass; Pass computePass;
@ -45,7 +45,7 @@ typedef struct CommandBufferCommonHeader
typedef struct TextureCommonHeader typedef struct TextureCommonHeader
{ {
SDL_GpuTextureCreateInfo info; SDL_GPUTextureCreateInfo info;
} TextureCommonHeader; } TextureCommonHeader;
typedef struct BlitFragmentUniforms typedef struct BlitFragmentUniforms
@ -62,9 +62,9 @@ typedef struct BlitFragmentUniforms
typedef struct BlitPipelineCacheEntry typedef struct BlitPipelineCacheEntry
{ {
SDL_GpuTextureType type; SDL_GPUTextureType type;
SDL_GpuTextureFormat format; SDL_GPUTextureFormat format;
SDL_GpuGraphicsPipeline *pipeline; SDL_GPUGraphicsPipeline *pipeline;
} BlitPipelineCacheEntry; } BlitPipelineCacheEntry;
// Internal Helper Utilities // Internal Helper Utilities
@ -74,7 +74,7 @@ typedef struct BlitPipelineCacheEntry
#define SDL_GPU_PRESENTMODE_MAX (SDL_GPU_PRESENTMODE_MAILBOX + 1) #define SDL_GPU_PRESENTMODE_MAX (SDL_GPU_PRESENTMODE_MAILBOX + 1)
static inline Sint32 Texture_GetBlockSize( static inline Sint32 Texture_GetBlockSize(
SDL_GpuTextureFormat format) SDL_GPUTextureFormat format)
{ {
switch (format) { switch (format) {
case SDL_GPU_TEXTUREFORMAT_BC1_UNORM: case SDL_GPU_TEXTUREFORMAT_BC1_UNORM:
@ -118,7 +118,7 @@ static inline Sint32 Texture_GetBlockSize(
} }
static inline SDL_bool IsDepthFormat( static inline SDL_bool IsDepthFormat(
SDL_GpuTextureFormat format) SDL_GPUTextureFormat format)
{ {
switch (format) { switch (format) {
case SDL_GPU_TEXTUREFORMAT_D16_UNORM: case SDL_GPU_TEXTUREFORMAT_D16_UNORM:
@ -134,7 +134,7 @@ static inline SDL_bool IsDepthFormat(
} }
static inline SDL_bool IsStencilFormat( static inline SDL_bool IsStencilFormat(
SDL_GpuTextureFormat format) SDL_GPUTextureFormat format)
{ {
switch (format) { switch (format) {
case SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT: case SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT:
@ -147,7 +147,7 @@ static inline SDL_bool IsStencilFormat(
} }
static inline SDL_bool IsIntegerFormat( static inline SDL_bool IsIntegerFormat(
SDL_GpuTextureFormat format) SDL_GPUTextureFormat format)
{ {
switch (format) { switch (format) {
case SDL_GPU_TEXTUREFORMAT_R8_UINT: case SDL_GPU_TEXTUREFORMAT_R8_UINT:
@ -163,14 +163,14 @@ static inline SDL_bool IsIntegerFormat(
} }
} }
static inline Uint32 IndexSize(SDL_GpuIndexElementSize size) static inline Uint32 IndexSize(SDL_GPUIndexElementSize size)
{ {
return (size == SDL_GPU_INDEXELEMENTSIZE_16BIT) ? 2 : 4; return (size == SDL_GPU_INDEXELEMENTSIZE_16BIT) ? 2 : 4;
} }
static inline Uint32 BytesPerRow( static inline Uint32 BytesPerRow(
Sint32 width, Sint32 width,
SDL_GpuTextureFormat format) SDL_GPUTextureFormat format)
{ {
Uint32 blocksPerRow = width; Uint32 blocksPerRow = width;
@ -181,13 +181,13 @@ static inline Uint32 BytesPerRow(
blocksPerRow = (width + 3) / 4; blocksPerRow = (width + 3) / 4;
} }
return blocksPerRow * SDL_GpuTextureFormatTexelBlockSize(format); return blocksPerRow * SDL_GPUTextureFormatTexelBlockSize(format);
} }
static inline Sint32 BytesPerImage( static inline Sint32 BytesPerImage(
Uint32 width, Uint32 width,
Uint32 height, Uint32 height,
SDL_GpuTextureFormat format) SDL_GPUTextureFormat format)
{ {
Uint32 blocksPerRow = width; Uint32 blocksPerRow = width;
Uint32 blocksPerColumn = height; Uint32 blocksPerColumn = height;
@ -200,7 +200,7 @@ static inline Sint32 BytesPerImage(
blocksPerColumn = (height + 3) / 4; blocksPerColumn = (height + 3) / 4;
} }
return blocksPerRow * blocksPerColumn * SDL_GpuTextureFormatTexelBlockSize(format); return blocksPerRow * blocksPerColumn * SDL_GPUTextureFormatTexelBlockSize(format);
} }
// GraphicsDevice Limits // GraphicsDevice Limits
@ -233,33 +233,33 @@ static inline Sint32 BytesPerImage(
extern "C" { extern "C" {
#endif // __cplusplus #endif // __cplusplus
SDL_GpuGraphicsPipeline *SDL_Gpu_FetchBlitPipeline( SDL_GPUGraphicsPipeline *SDL_GPU_FetchBlitPipeline(
SDL_GpuDevice *device, SDL_GPUDevice *device,
SDL_GpuTextureType sourceTextureType, SDL_GPUTextureType sourceTextureType,
SDL_GpuTextureFormat destinationFormat, SDL_GPUTextureFormat destinationFormat,
SDL_GpuShader *blitVertexShader, SDL_GPUShader *blitVertexShader,
SDL_GpuShader *blitFrom2DShader, SDL_GPUShader *blitFrom2DShader,
SDL_GpuShader *blitFrom2DArrayShader, SDL_GPUShader *blitFrom2DArrayShader,
SDL_GpuShader *blitFrom3DShader, SDL_GPUShader *blitFrom3DShader,
SDL_GpuShader *blitFromCubeShader, SDL_GPUShader *blitFromCubeShader,
BlitPipelineCacheEntry **blitPipelines, BlitPipelineCacheEntry **blitPipelines,
Uint32 *blitPipelineCount, Uint32 *blitPipelineCount,
Uint32 *blitPipelineCapacity); Uint32 *blitPipelineCapacity);
void SDL_Gpu_BlitCommon( void SDL_GPU_BlitCommon(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuBlitRegion *source, SDL_GPUBlitRegion *source,
SDL_GpuBlitRegion *destination, SDL_GPUBlitRegion *destination,
SDL_FlipMode flipMode, SDL_FlipMode flipMode,
SDL_GpuFilter filterMode, SDL_GPUFilter filterMode,
SDL_bool cycle, SDL_bool cycle,
SDL_GpuSampler *blitLinearSampler, SDL_GPUSampler *blitLinearSampler,
SDL_GpuSampler *blitNearestSampler, SDL_GPUSampler *blitNearestSampler,
SDL_GpuShader *blitVertexShader, SDL_GPUShader *blitVertexShader,
SDL_GpuShader *blitFrom2DShader, SDL_GPUShader *blitFrom2DShader,
SDL_GpuShader *blitFrom2DArrayShader, SDL_GPUShader *blitFrom2DArrayShader,
SDL_GpuShader *blitFrom3DShader, SDL_GPUShader *blitFrom3DShader,
SDL_GpuShader *blitFromCubeShader, SDL_GPUShader *blitFromCubeShader,
BlitPipelineCacheEntry **blitPipelines, BlitPipelineCacheEntry **blitPipelines,
Uint32 *blitPipelineCount, Uint32 *blitPipelineCount,
Uint32 *blitPipelineCapacity); Uint32 *blitPipelineCapacity);
@ -268,182 +268,182 @@ void SDL_Gpu_BlitCommon(
} }
#endif // __cplusplus #endif // __cplusplus
// SDL_GpuDevice Definition // SDL_GPUDevice Definition
typedef struct SDL_GpuRenderer SDL_GpuRenderer; typedef struct SDL_GPURenderer SDL_GPURenderer;
struct SDL_GpuDevice struct SDL_GPUDevice
{ {
// Quit // Quit
void (*DestroyDevice)(SDL_GpuDevice *device); void (*DestroyDevice)(SDL_GPUDevice *device);
// State Creation // State Creation
SDL_GpuComputePipeline *(*CreateComputePipeline)( SDL_GPUComputePipeline *(*CreateComputePipeline)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuComputePipelineCreateInfo *pipelineCreateInfo); SDL_GPUComputePipelineCreateInfo *pipelineCreateInfo);
SDL_GpuGraphicsPipeline *(*CreateGraphicsPipeline)( SDL_GPUGraphicsPipeline *(*CreateGraphicsPipeline)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuGraphicsPipelineCreateInfo *pipelineCreateInfo); SDL_GPUGraphicsPipelineCreateInfo *pipelineCreateInfo);
SDL_GpuSampler *(*CreateSampler)( SDL_GPUSampler *(*CreateSampler)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuSamplerCreateInfo *samplerCreateInfo); SDL_GPUSamplerCreateInfo *samplerCreateInfo);
SDL_GpuShader *(*CreateShader)( SDL_GPUShader *(*CreateShader)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuShaderCreateInfo *shaderCreateInfo); SDL_GPUShaderCreateInfo *shaderCreateInfo);
SDL_GpuTexture *(*CreateTexture)( SDL_GPUTexture *(*CreateTexture)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuTextureCreateInfo *textureCreateInfo); SDL_GPUTextureCreateInfo *textureCreateInfo);
SDL_GpuBuffer *(*CreateBuffer)( SDL_GPUBuffer *(*CreateBuffer)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuBufferUsageFlags usageFlags, SDL_GPUBufferUsageFlags usageFlags,
Uint32 sizeInBytes); Uint32 sizeInBytes);
SDL_GpuTransferBuffer *(*CreateTransferBuffer)( SDL_GPUTransferBuffer *(*CreateTransferBuffer)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuTransferBufferUsage usage, SDL_GPUTransferBufferUsage usage,
Uint32 sizeInBytes); Uint32 sizeInBytes);
// Debug Naming // Debug Naming
void (*SetBufferName)( void (*SetBufferName)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuBuffer *buffer, SDL_GPUBuffer *buffer,
const char *text); const char *text);
void (*SetTextureName)( void (*SetTextureName)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuTexture *texture, SDL_GPUTexture *texture,
const char *text); const char *text);
void (*InsertDebugLabel)( void (*InsertDebugLabel)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
const char *text); const char *text);
void (*PushDebugGroup)( void (*PushDebugGroup)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
const char *name); const char *name);
void (*PopDebugGroup)( void (*PopDebugGroup)(
SDL_GpuCommandBuffer *commandBuffer); SDL_GPUCommandBuffer *commandBuffer);
// Disposal // Disposal
void (*ReleaseTexture)( void (*ReleaseTexture)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuTexture *texture); SDL_GPUTexture *texture);
void (*ReleaseSampler)( void (*ReleaseSampler)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuSampler *sampler); SDL_GPUSampler *sampler);
void (*ReleaseBuffer)( void (*ReleaseBuffer)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuBuffer *buffer); SDL_GPUBuffer *buffer);
void (*ReleaseTransferBuffer)( void (*ReleaseTransferBuffer)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuTransferBuffer *transferBuffer); SDL_GPUTransferBuffer *transferBuffer);
void (*ReleaseShader)( void (*ReleaseShader)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuShader *shader); SDL_GPUShader *shader);
void (*ReleaseComputePipeline)( void (*ReleaseComputePipeline)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuComputePipeline *computePipeline); SDL_GPUComputePipeline *computePipeline);
void (*ReleaseGraphicsPipeline)( void (*ReleaseGraphicsPipeline)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuGraphicsPipeline *graphicsPipeline); SDL_GPUGraphicsPipeline *graphicsPipeline);
// Render Pass // Render Pass
void (*BeginRenderPass)( void (*BeginRenderPass)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuColorAttachmentInfo *colorAttachmentInfos, SDL_GPUColorAttachmentInfo *colorAttachmentInfos,
Uint32 colorAttachmentCount, Uint32 colorAttachmentCount,
SDL_GpuDepthStencilAttachmentInfo *depthStencilAttachmentInfo); SDL_GPUDepthStencilAttachmentInfo *depthStencilAttachmentInfo);
void (*BindGraphicsPipeline)( void (*BindGraphicsPipeline)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuGraphicsPipeline *graphicsPipeline); SDL_GPUGraphicsPipeline *graphicsPipeline);
void (*SetViewport)( void (*SetViewport)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuViewport *viewport); SDL_GPUViewport *viewport);
void (*SetScissor)( void (*SetScissor)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_Rect *scissor); SDL_Rect *scissor);
void (*BindVertexBuffers)( void (*BindVertexBuffers)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 firstBinding, Uint32 firstBinding,
SDL_GpuBufferBinding *pBindings, SDL_GPUBufferBinding *pBindings,
Uint32 bindingCount); Uint32 bindingCount);
void (*BindIndexBuffer)( void (*BindIndexBuffer)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuBufferBinding *pBinding, SDL_GPUBufferBinding *pBinding,
SDL_GpuIndexElementSize indexElementSize); SDL_GPUIndexElementSize indexElementSize);
void (*BindVertexSamplers)( void (*BindVertexSamplers)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 firstSlot, Uint32 firstSlot,
SDL_GpuTextureSamplerBinding *textureSamplerBindings, SDL_GPUTextureSamplerBinding *textureSamplerBindings,
Uint32 bindingCount); Uint32 bindingCount);
void (*BindVertexStorageTextures)( void (*BindVertexStorageTextures)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 firstSlot, Uint32 firstSlot,
SDL_GpuTexture **storageTextures, SDL_GPUTexture **storageTextures,
Uint32 bindingCount); Uint32 bindingCount);
void (*BindVertexStorageBuffers)( void (*BindVertexStorageBuffers)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 firstSlot, Uint32 firstSlot,
SDL_GpuBuffer **storageBuffers, SDL_GPUBuffer **storageBuffers,
Uint32 bindingCount); Uint32 bindingCount);
void (*BindFragmentSamplers)( void (*BindFragmentSamplers)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 firstSlot, Uint32 firstSlot,
SDL_GpuTextureSamplerBinding *textureSamplerBindings, SDL_GPUTextureSamplerBinding *textureSamplerBindings,
Uint32 bindingCount); Uint32 bindingCount);
void (*BindFragmentStorageTextures)( void (*BindFragmentStorageTextures)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 firstSlot, Uint32 firstSlot,
SDL_GpuTexture **storageTextures, SDL_GPUTexture **storageTextures,
Uint32 bindingCount); Uint32 bindingCount);
void (*BindFragmentStorageBuffers)( void (*BindFragmentStorageBuffers)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 firstSlot, Uint32 firstSlot,
SDL_GpuBuffer **storageBuffers, SDL_GPUBuffer **storageBuffers,
Uint32 bindingCount); Uint32 bindingCount);
void (*PushVertexUniformData)( void (*PushVertexUniformData)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 slotIndex, Uint32 slotIndex,
const void *data, const void *data,
Uint32 dataLengthInBytes); Uint32 dataLengthInBytes);
void (*PushFragmentUniformData)( void (*PushFragmentUniformData)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 slotIndex, Uint32 slotIndex,
const void *data, const void *data,
Uint32 dataLengthInBytes); Uint32 dataLengthInBytes);
void (*DrawIndexedPrimitives)( void (*DrawIndexedPrimitives)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 indexCount, Uint32 indexCount,
Uint32 instanceCount, Uint32 instanceCount,
Uint32 firstIndex, Uint32 firstIndex,
@ -451,227 +451,227 @@ struct SDL_GpuDevice
Uint32 firstInstance); Uint32 firstInstance);
void (*DrawPrimitives)( void (*DrawPrimitives)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 vertexCount, Uint32 vertexCount,
Uint32 instanceCount, Uint32 instanceCount,
Uint32 firstVertex, Uint32 firstVertex,
Uint32 firstInstance); Uint32 firstInstance);
void (*DrawPrimitivesIndirect)( void (*DrawPrimitivesIndirect)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuBuffer *buffer, SDL_GPUBuffer *buffer,
Uint32 offsetInBytes, Uint32 offsetInBytes,
Uint32 drawCount, Uint32 drawCount,
Uint32 stride); Uint32 stride);
void (*DrawIndexedPrimitivesIndirect)( void (*DrawIndexedPrimitivesIndirect)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuBuffer *buffer, SDL_GPUBuffer *buffer,
Uint32 offsetInBytes, Uint32 offsetInBytes,
Uint32 drawCount, Uint32 drawCount,
Uint32 stride); Uint32 stride);
void (*EndRenderPass)( void (*EndRenderPass)(
SDL_GpuCommandBuffer *commandBuffer); SDL_GPUCommandBuffer *commandBuffer);
// Compute Pass // Compute Pass
void (*BeginComputePass)( void (*BeginComputePass)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuStorageTextureWriteOnlyBinding *storageTextureBindings, SDL_GPUStorageTextureWriteOnlyBinding *storageTextureBindings,
Uint32 storageTextureBindingCount, Uint32 storageTextureBindingCount,
SDL_GpuStorageBufferWriteOnlyBinding *storageBufferBindings, SDL_GPUStorageBufferWriteOnlyBinding *storageBufferBindings,
Uint32 storageBufferBindingCount); Uint32 storageBufferBindingCount);
void (*BindComputePipeline)( void (*BindComputePipeline)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuComputePipeline *computePipeline); SDL_GPUComputePipeline *computePipeline);
void (*BindComputeStorageTextures)( void (*BindComputeStorageTextures)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 firstSlot, Uint32 firstSlot,
SDL_GpuTexture **storageTextures, SDL_GPUTexture **storageTextures,
Uint32 bindingCount); Uint32 bindingCount);
void (*BindComputeStorageBuffers)( void (*BindComputeStorageBuffers)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 firstSlot, Uint32 firstSlot,
SDL_GpuBuffer **storageBuffers, SDL_GPUBuffer **storageBuffers,
Uint32 bindingCount); Uint32 bindingCount);
void (*PushComputeUniformData)( void (*PushComputeUniformData)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 slotIndex, Uint32 slotIndex,
const void *data, const void *data,
Uint32 dataLengthInBytes); Uint32 dataLengthInBytes);
void (*DispatchCompute)( void (*DispatchCompute)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
Uint32 groupCountX, Uint32 groupCountX,
Uint32 groupCountY, Uint32 groupCountY,
Uint32 groupCountZ); Uint32 groupCountZ);
void (*DispatchComputeIndirect)( void (*DispatchComputeIndirect)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuBuffer *buffer, SDL_GPUBuffer *buffer,
Uint32 offsetInBytes); Uint32 offsetInBytes);
void (*EndComputePass)( void (*EndComputePass)(
SDL_GpuCommandBuffer *commandBuffer); SDL_GPUCommandBuffer *commandBuffer);
// TransferBuffer Data // TransferBuffer Data
void *(*MapTransferBuffer)( void *(*MapTransferBuffer)(
SDL_GpuRenderer *device, SDL_GPURenderer *device,
SDL_GpuTransferBuffer *transferBuffer, SDL_GPUTransferBuffer *transferBuffer,
SDL_bool cycle); SDL_bool cycle);
void (*UnmapTransferBuffer)( void (*UnmapTransferBuffer)(
SDL_GpuRenderer *device, SDL_GPURenderer *device,
SDL_GpuTransferBuffer *transferBuffer); SDL_GPUTransferBuffer *transferBuffer);
// Copy Pass // Copy Pass
void (*BeginCopyPass)( void (*BeginCopyPass)(
SDL_GpuCommandBuffer *commandBuffer); SDL_GPUCommandBuffer *commandBuffer);
void (*UploadToTexture)( void (*UploadToTexture)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuTextureTransferInfo *source, SDL_GPUTextureTransferInfo *source,
SDL_GpuTextureRegion *destination, SDL_GPUTextureRegion *destination,
SDL_bool cycle); SDL_bool cycle);
void (*UploadToBuffer)( void (*UploadToBuffer)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuTransferBufferLocation *source, SDL_GPUTransferBufferLocation *source,
SDL_GpuBufferRegion *destination, SDL_GPUBufferRegion *destination,
SDL_bool cycle); SDL_bool cycle);
void (*CopyTextureToTexture)( void (*CopyTextureToTexture)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuTextureLocation *source, SDL_GPUTextureLocation *source,
SDL_GpuTextureLocation *destination, SDL_GPUTextureLocation *destination,
Uint32 w, Uint32 w,
Uint32 h, Uint32 h,
Uint32 d, Uint32 d,
SDL_bool cycle); SDL_bool cycle);
void (*CopyBufferToBuffer)( void (*CopyBufferToBuffer)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuBufferLocation *source, SDL_GPUBufferLocation *source,
SDL_GpuBufferLocation *destination, SDL_GPUBufferLocation *destination,
Uint32 size, Uint32 size,
SDL_bool cycle); SDL_bool cycle);
void (*GenerateMipmaps)( void (*GenerateMipmaps)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuTexture *texture); SDL_GPUTexture *texture);
void (*DownloadFromTexture)( void (*DownloadFromTexture)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuTextureRegion *source, SDL_GPUTextureRegion *source,
SDL_GpuTextureTransferInfo *destination); SDL_GPUTextureTransferInfo *destination);
void (*DownloadFromBuffer)( void (*DownloadFromBuffer)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuBufferRegion *source, SDL_GPUBufferRegion *source,
SDL_GpuTransferBufferLocation *destination); SDL_GPUTransferBufferLocation *destination);
void (*EndCopyPass)( void (*EndCopyPass)(
SDL_GpuCommandBuffer *commandBuffer); SDL_GPUCommandBuffer *commandBuffer);
void (*Blit)( void (*Blit)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_GpuBlitRegion *source, SDL_GPUBlitRegion *source,
SDL_GpuBlitRegion *destination, SDL_GPUBlitRegion *destination,
SDL_FlipMode flipMode, SDL_FlipMode flipMode,
SDL_GpuFilter filterMode, SDL_GPUFilter filterMode,
SDL_bool cycle); SDL_bool cycle);
// Submission/Presentation // Submission/Presentation
SDL_bool (*SupportsSwapchainComposition)( SDL_bool (*SupportsSwapchainComposition)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_Window *window, SDL_Window *window,
SDL_GpuSwapchainComposition swapchainComposition); SDL_GPUSwapchainComposition swapchainComposition);
SDL_bool (*SupportsPresentMode)( SDL_bool (*SupportsPresentMode)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_Window *window, SDL_Window *window,
SDL_GpuPresentMode presentMode); SDL_GPUPresentMode presentMode);
SDL_bool (*ClaimWindow)( SDL_bool (*ClaimWindow)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_Window *window); SDL_Window *window);
void (*UnclaimWindow)( void (*UnclaimWindow)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_Window *window); SDL_Window *window);
SDL_bool (*SetSwapchainParameters)( SDL_bool (*SetSwapchainParameters)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_Window *window, SDL_Window *window,
SDL_GpuSwapchainComposition swapchainComposition, SDL_GPUSwapchainComposition swapchainComposition,
SDL_GpuPresentMode presentMode); SDL_GPUPresentMode presentMode);
SDL_GpuTextureFormat (*GetSwapchainTextureFormat)( SDL_GPUTextureFormat (*GetSwapchainTextureFormat)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_Window *window); SDL_Window *window);
SDL_GpuCommandBuffer *(*AcquireCommandBuffer)( SDL_GPUCommandBuffer *(*AcquireCommandBuffer)(
SDL_GpuRenderer *driverData); SDL_GPURenderer *driverData);
SDL_GpuTexture *(*AcquireSwapchainTexture)( SDL_GPUTexture *(*AcquireSwapchainTexture)(
SDL_GpuCommandBuffer *commandBuffer, SDL_GPUCommandBuffer *commandBuffer,
SDL_Window *window, SDL_Window *window,
Uint32 *pWidth, Uint32 *pWidth,
Uint32 *pHeight); Uint32 *pHeight);
void (*Submit)( void (*Submit)(
SDL_GpuCommandBuffer *commandBuffer); SDL_GPUCommandBuffer *commandBuffer);
SDL_GpuFence *(*SubmitAndAcquireFence)( SDL_GPUFence *(*SubmitAndAcquireFence)(
SDL_GpuCommandBuffer *commandBuffer); SDL_GPUCommandBuffer *commandBuffer);
void (*Wait)( void (*Wait)(
SDL_GpuRenderer *driverData); SDL_GPURenderer *driverData);
void (*WaitForFences)( void (*WaitForFences)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_bool waitAll, SDL_bool waitAll,
SDL_GpuFence **pFences, SDL_GPUFence **pFences,
Uint32 fenceCount); Uint32 fenceCount);
SDL_bool (*QueryFence)( SDL_bool (*QueryFence)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuFence *fence); SDL_GPUFence *fence);
void (*ReleaseFence)( void (*ReleaseFence)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuFence *fence); SDL_GPUFence *fence);
// Feature Queries // Feature Queries
SDL_bool (*SupportsTextureFormat)( SDL_bool (*SupportsTextureFormat)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuTextureFormat format, SDL_GPUTextureFormat format,
SDL_GpuTextureType type, SDL_GPUTextureType type,
SDL_GpuTextureUsageFlags usage); SDL_GPUTextureUsageFlags usage);
SDL_bool (*SupportsSampleCount)( SDL_bool (*SupportsSampleCount)(
SDL_GpuRenderer *driverData, SDL_GPURenderer *driverData,
SDL_GpuTextureFormat format, SDL_GPUTextureFormat format,
SDL_GpuSampleCount desiredSampleCount); SDL_GPUSampleCount desiredSampleCount);
// Opaque pointer for the Driver // Opaque pointer for the Driver
SDL_GpuRenderer *driverData; SDL_GPURenderer *driverData;
// Store this for SDL_GetGpuDriver() // Store this for SDL_GetGPUDriver()
SDL_GpuDriver backend; SDL_GPUDriver backend;
// Store this for SDL_gpu.c's debug layer // Store this for SDL_gpu.c's debug layer
SDL_bool debugMode; SDL_bool debugMode;
SDL_GpuShaderFormat shaderFormats; SDL_GPUShaderFormat shaderFormats;
}; };
#define ASSIGN_DRIVER_FUNC(func, name) \ #define ASSIGN_DRIVER_FUNC(func, name) \
@ -753,24 +753,24 @@ struct SDL_GpuDevice
ASSIGN_DRIVER_FUNC(SupportsTextureFormat, name) \ ASSIGN_DRIVER_FUNC(SupportsTextureFormat, name) \
ASSIGN_DRIVER_FUNC(SupportsSampleCount, name) ASSIGN_DRIVER_FUNC(SupportsSampleCount, name)
typedef struct SDL_GpuBootstrap typedef struct SDL_GPUBootstrap
{ {
const char *Name; const char *Name;
const SDL_GpuDriver backendflag; const SDL_GPUDriver backendflag;
const SDL_GpuShaderFormat shaderFormats; const SDL_GPUShaderFormat shaderFormats;
SDL_bool (*PrepareDriver)(SDL_VideoDevice *_this); SDL_bool (*PrepareDriver)(SDL_VideoDevice *_this);
SDL_GpuDevice *(*CreateDevice)(SDL_bool debugMode, SDL_bool preferLowPower, SDL_PropertiesID props); SDL_GPUDevice *(*CreateDevice)(SDL_bool debugMode, SDL_bool preferLowPower, SDL_PropertiesID props);
} SDL_GpuBootstrap; } SDL_GPUBootstrap;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
extern SDL_GpuBootstrap VulkanDriver; extern SDL_GPUBootstrap VulkanDriver;
extern SDL_GpuBootstrap D3D11Driver; extern SDL_GPUBootstrap D3D11Driver;
extern SDL_GpuBootstrap D3D12Driver; extern SDL_GPUBootstrap D3D12Driver;
extern SDL_GpuBootstrap MetalDriver; extern SDL_GPUBootstrap MetalDriver;
extern SDL_GpuBootstrap PS5Driver; extern SDL_GPUBootstrap PS5Driver;
#ifdef __cplusplus #ifdef __cplusplus
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -891,7 +891,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
D3D_GUID(SDL_IID_IDXGIAdapter4), D3D_GUID(SDL_IID_IDXGIAdapter4),
(void **)&data->dxgiAdapter); (void **)&data->dxgiAdapter);
if (FAILED(result)) { if (FAILED(result)) {
WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory6::EnumAdapterByGpuPreference"), result); WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("IDXGIFactory6::EnumAdapterByGPUPreference"), result);
goto done; goto done;
} }

View file

@ -22,10 +22,10 @@
#ifndef SDL_gpu_util_h_ #ifndef SDL_gpu_util_h_
#define SDL_gpu_util_h_ #define SDL_gpu_util_h_
#define SDL_GPU_BLENDOP_INVALID ((SDL_GpuBlendOp)0x7fffffff) #define SDL_GPU_BLENDOP_INVALID ((SDL_GPUBlendOp)0x7fffffff)
#define SDL_GPU_BLENDFACTOR_INVALID ((SDL_GpuBlendFactor)0x7fffffff) #define SDL_GPU_BLENDFACTOR_INVALID ((SDL_GPUBlendFactor)0x7fffffff)
static SDL_INLINE SDL_GpuBlendFactor GPU_ConvertBlendFactor(SDL_BlendFactor factor) static SDL_INLINE SDL_GPUBlendFactor GPU_ConvertBlendFactor(SDL_BlendFactor factor)
{ {
switch (factor) { switch (factor) {
case SDL_BLENDFACTOR_ZERO: case SDL_BLENDFACTOR_ZERO:
@ -53,7 +53,7 @@ static SDL_INLINE SDL_GpuBlendFactor GPU_ConvertBlendFactor(SDL_BlendFactor fact
} }
} }
static SDL_INLINE SDL_GpuBlendOp GPU_ConvertBlendOperation(SDL_BlendOperation operation) static SDL_INLINE SDL_GPUBlendOp GPU_ConvertBlendOperation(SDL_BlendOperation operation)
{ {
switch (operation) { switch (operation) {
case SDL_BLENDOPERATION_ADD: case SDL_BLENDOPERATION_ADD:

View file

@ -47,7 +47,7 @@ SDL_COMPILE_TIME_ASSERT(GPU_PipelineCacheKey_Size, sizeof(GPU_PipelineCacheKey)
typedef struct GPU_PipelineCacheEntry typedef struct GPU_PipelineCacheEntry
{ {
GPU_PipelineCacheKey key; GPU_PipelineCacheKey key;
SDL_GpuGraphicsPipeline *pipeline; SDL_GPUGraphicsPipeline *pipeline;
} GPU_PipelineCacheEntry; } GPU_PipelineCacheEntry;
static Uint32 HashPipelineCacheKey(const GPU_PipelineCacheKey *key) static Uint32 HashPipelineCacheKey(const GPU_PipelineCacheKey *key)
@ -74,13 +74,13 @@ static bool MatchPipelineCacheKey(const void *a, const void *b, void *data)
static void NukePipelineCacheEntry(const void *key, const void *value, void *data) static void NukePipelineCacheEntry(const void *key, const void *value, void *data)
{ {
GPU_PipelineCacheEntry *entry = (GPU_PipelineCacheEntry *)value; GPU_PipelineCacheEntry *entry = (GPU_PipelineCacheEntry *)value;
SDL_GpuDevice *device = data; SDL_GPUDevice *device = data;
SDL_ReleaseGpuGraphicsPipeline(device, entry->pipeline); SDL_ReleaseGPUGraphicsPipeline(device, entry->pipeline);
SDL_free(entry); SDL_free(entry);
} }
bool GPU_InitPipelineCache(GPU_PipelineCache *cache, SDL_GpuDevice *device) bool GPU_InitPipelineCache(GPU_PipelineCache *cache, SDL_GPUDevice *device)
{ {
// FIXME how many buckets do we need? // FIXME how many buckets do we need?
cache->table = SDL_CreateHashTable(device, 32, HashPassthrough, MatchPipelineCacheKey, NukePipelineCacheEntry, true); cache->table = SDL_CreateHashTable(device, 32, HashPassthrough, MatchPipelineCacheKey, NukePipelineCacheEntry, true);
@ -93,9 +93,9 @@ void GPU_DestroyPipelineCache(GPU_PipelineCache *cache)
SDL_DestroyHashTable(cache->table); SDL_DestroyHashTable(cache->table);
} }
static SDL_GpuGraphicsPipeline *MakePipeline(SDL_GpuDevice *device, GPU_Shaders *shaders, const GPU_PipelineParameters *params) static SDL_GPUGraphicsPipeline *MakePipeline(SDL_GPUDevice *device, GPU_Shaders *shaders, const GPU_PipelineParameters *params)
{ {
SDL_GpuColorAttachmentDescription ad; SDL_GPUColorAttachmentDescription ad;
SDL_zero(ad); SDL_zero(ad);
ad.format = params->attachment_format; ad.format = params->attachment_format;
@ -109,7 +109,7 @@ static SDL_GpuGraphicsPipeline *MakePipeline(SDL_GpuDevice *device, GPU_Shaders
ad.blendState.dstColorBlendFactor = GPU_ConvertBlendFactor(SDL_GetBlendModeDstColorFactor(blend)); ad.blendState.dstColorBlendFactor = GPU_ConvertBlendFactor(SDL_GetBlendModeDstColorFactor(blend));
ad.blendState.srcColorBlendFactor = GPU_ConvertBlendFactor(SDL_GetBlendModeSrcColorFactor(blend)); ad.blendState.srcColorBlendFactor = GPU_ConvertBlendFactor(SDL_GetBlendModeSrcColorFactor(blend));
SDL_GpuGraphicsPipelineCreateInfo pci; SDL_GPUGraphicsPipelineCreateInfo pci;
SDL_zero(pci); SDL_zero(pci);
pci.attachmentInfo.hasDepthStencilAttachment = false; pci.attachmentInfo.hasDepthStencilAttachment = false;
pci.attachmentInfo.colorAttachmentCount = 1; pci.attachmentInfo.colorAttachmentCount = 1;
@ -124,11 +124,11 @@ static SDL_GpuGraphicsPipeline *MakePipeline(SDL_GpuDevice *device, GPU_Shaders
pci.rasterizerState.fillMode = SDL_GPU_FILLMODE_FILL; pci.rasterizerState.fillMode = SDL_GPU_FILLMODE_FILL;
pci.rasterizerState.frontFace = SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE; pci.rasterizerState.frontFace = SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE;
SDL_GpuVertexBinding bind; SDL_GPUVertexBinding bind;
SDL_zero(bind); SDL_zero(bind);
Uint32 num_attribs = 0; Uint32 num_attribs = 0;
SDL_GpuVertexAttribute attribs[4]; SDL_GPUVertexAttribute attribs[4];
SDL_zero(attribs); SDL_zero(attribs);
bool have_attr_color = false; bool have_attr_color = false;
@ -175,7 +175,7 @@ static SDL_GpuGraphicsPipeline *MakePipeline(SDL_GpuDevice *device, GPU_Shaders
pci.vertexInputState.vertexBindingCount = 1; pci.vertexInputState.vertexBindingCount = 1;
pci.vertexInputState.vertexBindings = &bind; pci.vertexInputState.vertexBindings = &bind;
return SDL_CreateGpuGraphicsPipeline(device, &pci); return SDL_CreateGPUGraphicsPipeline(device, &pci);
} }
static GPU_PipelineCacheKey MakePipelineCacheKey(const GPU_PipelineParameters *params) static GPU_PipelineCacheKey MakePipelineCacheKey(const GPU_PipelineParameters *params)
@ -190,11 +190,11 @@ static GPU_PipelineCacheKey MakePipelineCacheKey(const GPU_PipelineParameters *p
return key; return key;
} }
SDL_GpuGraphicsPipeline *GPU_GetPipeline(GPU_PipelineCache *cache, GPU_Shaders *shaders, SDL_GpuDevice *device, const GPU_PipelineParameters *params) SDL_GPUGraphicsPipeline *GPU_GetPipeline(GPU_PipelineCache *cache, GPU_Shaders *shaders, SDL_GPUDevice *device, const GPU_PipelineParameters *params)
{ {
GPU_PipelineCacheKey key = MakePipelineCacheKey(params); GPU_PipelineCacheKey key = MakePipelineCacheKey(params);
void *keyval = (void *)(uintptr_t)HashPipelineCacheKey(&key); void *keyval = (void *)(uintptr_t)HashPipelineCacheKey(&key);
SDL_GpuGraphicsPipeline *pipeline = NULL; SDL_GPUGraphicsPipeline *pipeline = NULL;
void *iter = NULL; void *iter = NULL;
GPU_PipelineCacheEntry *entry = NULL; GPU_PipelineCacheEntry *entry = NULL;

View file

@ -33,8 +33,8 @@ typedef struct GPU_PipelineParameters
SDL_BlendMode blend_mode; SDL_BlendMode blend_mode;
GPU_FragmentShaderID frag_shader; GPU_FragmentShaderID frag_shader;
GPU_VertexShaderID vert_shader; GPU_VertexShaderID vert_shader;
SDL_GpuTextureFormat attachment_format; SDL_GPUTextureFormat attachment_format;
SDL_GpuPrimitiveType primitive_type; SDL_GPUPrimitiveType primitive_type;
} GPU_PipelineParameters; } GPU_PipelineParameters;
typedef struct GPU_PipelineCache typedef struct GPU_PipelineCache
@ -42,8 +42,8 @@ typedef struct GPU_PipelineCache
SDL_HashTable *table; SDL_HashTable *table;
} GPU_PipelineCache; } GPU_PipelineCache;
extern bool GPU_InitPipelineCache(GPU_PipelineCache *cache, SDL_GpuDevice *device); extern bool GPU_InitPipelineCache(GPU_PipelineCache *cache, SDL_GPUDevice *device);
extern void GPU_DestroyPipelineCache(GPU_PipelineCache *cache); extern void GPU_DestroyPipelineCache(GPU_PipelineCache *cache);
extern SDL_GpuGraphicsPipeline *GPU_GetPipeline(GPU_PipelineCache *cache, GPU_Shaders *shaders, SDL_GpuDevice *device, const GPU_PipelineParameters *params); extern SDL_GPUGraphicsPipeline *GPU_GetPipeline(GPU_PipelineCache *cache, GPU_Shaders *shaders, SDL_GPUDevice *device, const GPU_PipelineParameters *params);
#endif // SDL_pipeline_gpu_h_ #endif // SDL_pipeline_gpu_h_

View file

@ -37,39 +37,39 @@ typedef struct GPU_ShaderUniformData
typedef struct GPU_RenderData typedef struct GPU_RenderData
{ {
SDL_GpuDevice *device; SDL_GPUDevice *device;
GPU_Shaders shaders; GPU_Shaders shaders;
GPU_PipelineCache pipeline_cache; GPU_PipelineCache pipeline_cache;
SDL_GpuFence *present_fence; SDL_GPUFence *present_fence;
struct struct
{ {
SDL_GpuTexture *texture; SDL_GPUTexture *texture;
SDL_GpuTextureFormat format; SDL_GPUTextureFormat format;
Uint32 width; Uint32 width;
Uint32 height; Uint32 height;
} backbuffer; } backbuffer;
struct struct
{ {
SDL_GpuSwapchainComposition composition; SDL_GPUSwapchainComposition composition;
SDL_GpuPresentMode present_mode; SDL_GPUPresentMode present_mode;
} swapchain; } swapchain;
struct struct
{ {
SDL_GpuTransferBuffer *transfer_buf; SDL_GPUTransferBuffer *transfer_buf;
SDL_GpuBuffer *buffer; SDL_GPUBuffer *buffer;
Uint32 buffer_size; Uint32 buffer_size;
} vertices; } vertices;
struct struct
{ {
SDL_GpuRenderPass *render_pass; SDL_GPURenderPass *render_pass;
SDL_Texture *render_target; SDL_Texture *render_target;
SDL_GpuCommandBuffer *command_buffer; SDL_GPUCommandBuffer *command_buffer;
SDL_GpuColorAttachmentInfo color_attachment; SDL_GPUColorAttachmentInfo color_attachment;
SDL_GpuViewport viewport; SDL_GPUViewport viewport;
SDL_Rect scissor; SDL_Rect scissor;
SDL_FColor draw_color; SDL_FColor draw_color;
bool scissor_enabled; bool scissor_enabled;
@ -77,13 +77,13 @@ typedef struct GPU_RenderData
GPU_ShaderUniformData shader_data; GPU_ShaderUniformData shader_data;
} state; } state;
SDL_GpuSampler *samplers[3][2]; SDL_GPUSampler *samplers[3][2];
} GPU_RenderData; } GPU_RenderData;
typedef struct GPU_TextureData typedef struct GPU_TextureData
{ {
SDL_GpuTexture *texture; SDL_GPUTexture *texture;
SDL_GpuTextureFormat format; SDL_GPUTextureFormat format;
GPU_FragmentShaderID shader; GPU_FragmentShaderID shader;
void *pixels; void *pixels;
int pitch; int pitch;
@ -111,7 +111,7 @@ static bool GPU_SupportsBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMod
return true; return true;
} }
static SDL_GpuTextureFormat PixFormatToTexFormat(SDL_PixelFormat pixel_format) static SDL_GPUTextureFormat PixFormatToTexFormat(SDL_PixelFormat pixel_format)
{ {
switch (pixel_format) { switch (pixel_format) {
case SDL_PIXELFORMAT_BGRA32: case SDL_PIXELFORMAT_BGRA32:
@ -132,7 +132,7 @@ static SDL_GpuTextureFormat PixFormatToTexFormat(SDL_PixelFormat pixel_format)
} }
} }
static SDL_PixelFormat TexFormatToPixFormat(SDL_GpuTextureFormat tex_format) static SDL_PixelFormat TexFormatToPixFormat(SDL_GPUTextureFormat tex_format)
{ {
switch (tex_format) { switch (tex_format) {
case SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM: case SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM:
@ -172,13 +172,13 @@ static bool GPU_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_
{ {
GPU_RenderData *renderdata = (GPU_RenderData *)renderer->internal; GPU_RenderData *renderdata = (GPU_RenderData *)renderer->internal;
GPU_TextureData *data; GPU_TextureData *data;
SDL_GpuTextureFormat format; SDL_GPUTextureFormat format;
SDL_GpuTextureUsageFlags usage = SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT; SDL_GPUTextureUsageFlags usage = SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT;
format = PixFormatToTexFormat(texture->format); format = PixFormatToTexFormat(texture->format);
if (format == SDL_GPU_TEXTUREFORMAT_INVALID) { if (format == SDL_GPU_TEXTUREFORMAT_INVALID) {
return SDL_SetError("Texture format %s not supported by SDL_Gpu", return SDL_SetError("Texture format %s not supported by SDL_GPU",
SDL_GetPixelFormatName(texture->format)); SDL_GetPixelFormatName(texture->format));
} }
@ -215,7 +215,7 @@ static bool GPU_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_
} }
texture->internal = data; texture->internal = data;
SDL_GpuTextureCreateInfo tci; SDL_GPUTextureCreateInfo tci;
SDL_zero(tci); SDL_zero(tci);
tci.format = format; tci.format = format;
tci.layerCountOrDepth = 1; tci.layerCountOrDepth = 1;
@ -226,7 +226,7 @@ static bool GPU_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_
tci.sampleCount = SDL_GPU_SAMPLECOUNT_1; tci.sampleCount = SDL_GPU_SAMPLECOUNT_1;
data->format = format; data->format = format;
data->texture = SDL_CreateGpuTexture(renderdata->device, &tci); data->texture = SDL_CreateGPUTexture(renderdata->device, &tci);
if (!data->texture) { if (!data->texture) {
return false; return false;
@ -251,24 +251,24 @@ static bool GPU_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
Uint32 row_size = texturebpp * rect->w; Uint32 row_size = texturebpp * rect->w;
Uint32 data_size = row_size * rect->h; Uint32 data_size = row_size * rect->h;
SDL_GpuTransferBufferCreateInfo tbci; SDL_GPUTransferBufferCreateInfo tbci;
SDL_zero(tbci); SDL_zero(tbci);
tbci.sizeInBytes = data_size; tbci.sizeInBytes = data_size;
tbci.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD; tbci.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
SDL_GpuTransferBuffer *tbuf = SDL_CreateGpuTransferBuffer(renderdata->device, &tbci); SDL_GPUTransferBuffer *tbuf = SDL_CreateGPUTransferBuffer(renderdata->device, &tbci);
if (tbuf == NULL) { if (tbuf == NULL) {
return false; return false;
} }
Uint8 *output = SDL_MapGpuTransferBuffer(renderdata->device, tbuf, false); Uint8 *output = SDL_MapGPUTransferBuffer(renderdata->device, tbuf, false);
if (pitch == row_size) { if (pitch == row_size) {
memcpy(output, pixels, data_size); memcpy(output, pixels, data_size);
} else { } else {
// FIXME is negative pitch supposed to work? // FIXME is negative pitch supposed to work?
// If not, maybe use SDL_GpuTextureTransferInfo::imagePitch instead of this // If not, maybe use SDL_GPUTextureTransferInfo::imagePitch instead of this
const Uint8 *input = pixels; const Uint8 *input = pixels;
for (int i = 0; i < rect->h; ++i) { for (int i = 0; i < rect->h; ++i) {
@ -278,18 +278,18 @@ static bool GPU_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
} }
} }
SDL_UnmapGpuTransferBuffer(renderdata->device, tbuf); SDL_UnmapGPUTransferBuffer(renderdata->device, tbuf);
SDL_GpuCommandBuffer *cbuf = renderdata->state.command_buffer; SDL_GPUCommandBuffer *cbuf = renderdata->state.command_buffer;
SDL_GpuCopyPass *cpass = SDL_BeginGpuCopyPass(cbuf); SDL_GPUCopyPass *cpass = SDL_BeginGPUCopyPass(cbuf);
SDL_GpuTextureTransferInfo tex_src; SDL_GPUTextureTransferInfo tex_src;
SDL_zero(tex_src); SDL_zero(tex_src);
tex_src.transferBuffer = tbuf; tex_src.transferBuffer = tbuf;
tex_src.imageHeight = rect->h; tex_src.imageHeight = rect->h;
tex_src.imagePitch = rect->w; tex_src.imagePitch = rect->w;
SDL_GpuTextureRegion tex_dst; SDL_GPUTextureRegion tex_dst;
SDL_zero(tex_dst); SDL_zero(tex_dst);
tex_dst.texture = data->texture; tex_dst.texture = data->texture;
tex_dst.x = rect->x; tex_dst.x = rect->x;
@ -298,9 +298,9 @@ static bool GPU_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
tex_dst.h = rect->h; tex_dst.h = rect->h;
tex_dst.d = 1; tex_dst.d = 1;
SDL_UploadToGpuTexture(cpass, &tex_src, &tex_dst, true); SDL_UploadToGPUTexture(cpass, &tex_src, &tex_dst, true);
SDL_EndGpuCopyPass(cpass); SDL_EndGPUCopyPass(cpass);
SDL_ReleaseGpuTransferBuffer(renderdata->device, tbuf); SDL_ReleaseGPUTransferBuffer(renderdata->device, tbuf);
return true; return true;
} }
@ -449,13 +449,13 @@ static void GPU_InvalidateCachedState(SDL_Renderer *renderer)
data->state.scissor_enabled = false; data->state.scissor_enabled = false;
} }
static SDL_GpuRenderPass *RestartRenderPass(GPU_RenderData *data) static SDL_GPURenderPass *RestartRenderPass(GPU_RenderData *data)
{ {
if (data->state.render_pass) { if (data->state.render_pass) {
SDL_EndGpuRenderPass(data->state.render_pass); SDL_EndGPURenderPass(data->state.render_pass);
} }
data->state.render_pass = SDL_BeginGpuRenderPass( data->state.render_pass = SDL_BeginGPURenderPass(
data->state.command_buffer, &data->state.color_attachment, 1, NULL); data->state.command_buffer, &data->state.color_attachment, 1, NULL);
// *** FIXME *** // *** FIXME ***
@ -486,10 +486,10 @@ static void PushUniforms(GPU_RenderData *data, SDL_RenderCommand *cmd)
uniforms.texture_size[1] = cmd->data.draw.texture->h; uniforms.texture_size[1] = cmd->data.draw.texture->h;
} }
SDL_PushGpuVertexUniformData(data->state.command_buffer, 0, &uniforms, sizeof(uniforms)); SDL_PushGPUVertexUniformData(data->state.command_buffer, 0, &uniforms, sizeof(uniforms));
} }
static SDL_GpuSampler **SamplerPointer( static SDL_GPUSampler **SamplerPointer(
GPU_RenderData *data, SDL_TextureAddressMode address_mode, SDL_ScaleMode scale_mode) GPU_RenderData *data, SDL_TextureAddressMode address_mode, SDL_ScaleMode scale_mode)
{ {
return &data->samplers[scale_mode][address_mode - 1]; return &data->samplers[scale_mode][address_mode - 1];
@ -497,10 +497,10 @@ static SDL_GpuSampler **SamplerPointer(
static void SetViewportAndScissor(GPU_RenderData *data) static void SetViewportAndScissor(GPU_RenderData *data)
{ {
SDL_SetGpuViewport(data->state.render_pass, &data->state.viewport); SDL_SetGPUViewport(data->state.render_pass, &data->state.viewport);
if (data->state.scissor_enabled) { if (data->state.scissor_enabled) {
SDL_SetGpuScissor(data->state.render_pass, &data->state.scissor); SDL_SetGPUScissor(data->state.render_pass, &data->state.scissor);
data->state.scissor_was_enabled = true; data->state.scissor_was_enabled = true;
} else if (data->state.scissor_was_enabled) { } else if (data->state.scissor_was_enabled) {
SDL_Rect r; SDL_Rect r;
@ -508,7 +508,7 @@ static void SetViewportAndScissor(GPU_RenderData *data)
r.y = (int)data->state.viewport.y; r.y = (int)data->state.viewport.y;
r.w = (int)data->state.viewport.w; r.w = (int)data->state.viewport.w;
r.h = (int)data->state.viewport.h; r.h = (int)data->state.viewport.h;
SDL_SetGpuScissor(data->state.render_pass, &r); SDL_SetGPUScissor(data->state.render_pass, &r);
data->state.scissor_was_enabled = false; data->state.scissor_was_enabled = false;
} }
} }
@ -517,7 +517,7 @@ static void Draw(
GPU_RenderData *data, SDL_RenderCommand *cmd, GPU_RenderData *data, SDL_RenderCommand *cmd,
Uint32 num_verts, Uint32 num_verts,
Uint32 offset, Uint32 offset,
SDL_GpuPrimitiveType prim) SDL_GPUPrimitiveType prim)
{ {
if (!data->state.render_pass || data->state.color_attachment.loadOp == SDL_GPU_LOADOP_CLEAR) { if (!data->state.render_pass || data->state.color_attachment.loadOp == SDL_GPU_LOADOP_CLEAR) {
RestartRenderPass(data); RestartRenderPass(data);
@ -525,7 +525,7 @@ static void Draw(
GPU_VertexShaderID v_shader; GPU_VertexShaderID v_shader;
GPU_FragmentShaderID f_shader; GPU_FragmentShaderID f_shader;
SDL_GpuRenderPass *pass = data->state.render_pass; SDL_GPURenderPass *pass = data->state.render_pass;
GPU_TextureData *tdata = NULL; GPU_TextureData *tdata = NULL;
if (cmd->data.draw.texture) { if (cmd->data.draw.texture) {
@ -558,41 +558,41 @@ static void Draw(
pipe_params.attachment_format = data->backbuffer.format; pipe_params.attachment_format = data->backbuffer.format;
} }
SDL_GpuGraphicsPipeline *pipe = GPU_GetPipeline(&data->pipeline_cache, &data->shaders, data->device, &pipe_params); SDL_GPUGraphicsPipeline *pipe = GPU_GetPipeline(&data->pipeline_cache, &data->shaders, data->device, &pipe_params);
if (!pipe) { if (!pipe) {
return; return;
} }
SetViewportAndScissor(data); SetViewportAndScissor(data);
SDL_BindGpuGraphicsPipeline(data->state.render_pass, pipe); SDL_BindGPUGraphicsPipeline(data->state.render_pass, pipe);
if (tdata) { if (tdata) {
SDL_GpuTextureSamplerBinding sampler_bind; SDL_GPUTextureSamplerBinding sampler_bind;
SDL_zero(sampler_bind); SDL_zero(sampler_bind);
sampler_bind.sampler = *SamplerPointer(data, cmd->data.draw.texture_address_mode, cmd->data.draw.texture->scaleMode); sampler_bind.sampler = *SamplerPointer(data, cmd->data.draw.texture_address_mode, cmd->data.draw.texture->scaleMode);
sampler_bind.texture = tdata->texture; sampler_bind.texture = tdata->texture;
SDL_BindGpuFragmentSamplers(pass, 0, &sampler_bind, 1); SDL_BindGPUFragmentSamplers(pass, 0, &sampler_bind, 1);
} }
SDL_GpuBufferBinding buffer_bind; SDL_GPUBufferBinding buffer_bind;
SDL_zero(buffer_bind); SDL_zero(buffer_bind);
buffer_bind.buffer = data->vertices.buffer; buffer_bind.buffer = data->vertices.buffer;
buffer_bind.offset = offset; buffer_bind.offset = offset;
SDL_BindGpuVertexBuffers(pass, 0, &buffer_bind, 1); SDL_BindGPUVertexBuffers(pass, 0, &buffer_bind, 1);
PushUniforms(data, cmd); PushUniforms(data, cmd);
SDL_DrawGpuPrimitives(data->state.render_pass, num_verts, 1, 0, 0); SDL_DrawGPUPrimitives(data->state.render_pass, num_verts, 1, 0, 0);
} }
static void ReleaseVertexBuffer(GPU_RenderData *data) static void ReleaseVertexBuffer(GPU_RenderData *data)
{ {
if (data->vertices.buffer) { if (data->vertices.buffer) {
SDL_ReleaseGpuBuffer(data->device, data->vertices.buffer); SDL_ReleaseGPUBuffer(data->device, data->vertices.buffer);
} }
if (data->vertices.transfer_buf) { if (data->vertices.transfer_buf) {
SDL_ReleaseGpuTransferBuffer(data->device, data->vertices.transfer_buf); SDL_ReleaseGPUTransferBuffer(data->device, data->vertices.transfer_buf);
} }
data->vertices.buffer_size = 0; data->vertices.buffer_size = 0;
@ -600,23 +600,23 @@ static void ReleaseVertexBuffer(GPU_RenderData *data)
static bool InitVertexBuffer(GPU_RenderData *data, Uint32 size) static bool InitVertexBuffer(GPU_RenderData *data, Uint32 size)
{ {
SDL_GpuBufferCreateInfo bci; SDL_GPUBufferCreateInfo bci;
SDL_zero(bci); SDL_zero(bci);
bci.sizeInBytes = size; bci.sizeInBytes = size;
bci.usageFlags = SDL_GPU_BUFFERUSAGE_VERTEX_BIT; bci.usageFlags = SDL_GPU_BUFFERUSAGE_VERTEX_BIT;
data->vertices.buffer = SDL_CreateGpuBuffer(data->device, &bci); data->vertices.buffer = SDL_CreateGPUBuffer(data->device, &bci);
if (!data->vertices.buffer) { if (!data->vertices.buffer) {
return -1; return -1;
} }
SDL_GpuTransferBufferCreateInfo tbci; SDL_GPUTransferBufferCreateInfo tbci;
SDL_zero(tbci); SDL_zero(tbci);
tbci.sizeInBytes = size; tbci.sizeInBytes = size;
tbci.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD; tbci.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
data->vertices.transfer_buf = SDL_CreateGpuTransferBuffer(data->device, &tbci); data->vertices.transfer_buf = SDL_CreateGPUTransferBuffer(data->device, &tbci);
return (bool)data->vertices.transfer_buf; return (bool)data->vertices.transfer_buf;
} }
@ -633,27 +633,27 @@ static bool UploadVertices(GPU_RenderData *data, void *vertices, size_t vertsize
} }
} }
void *staging_buf = SDL_MapGpuTransferBuffer(data->device, data->vertices.transfer_buf, true); void *staging_buf = SDL_MapGPUTransferBuffer(data->device, data->vertices.transfer_buf, true);
memcpy(staging_buf, vertices, vertsize); memcpy(staging_buf, vertices, vertsize);
SDL_UnmapGpuTransferBuffer(data->device, data->vertices.transfer_buf); SDL_UnmapGPUTransferBuffer(data->device, data->vertices.transfer_buf);
SDL_GpuCopyPass *pass = SDL_BeginGpuCopyPass(data->state.command_buffer); SDL_GPUCopyPass *pass = SDL_BeginGPUCopyPass(data->state.command_buffer);
if (!pass) { if (!pass) {
return false; return false;
} }
SDL_GpuTransferBufferLocation src; SDL_GPUTransferBufferLocation src;
SDL_zero(src); SDL_zero(src);
src.transferBuffer = data->vertices.transfer_buf; src.transferBuffer = data->vertices.transfer_buf;
SDL_GpuBufferRegion dst; SDL_GPUBufferRegion dst;
SDL_zero(dst); SDL_zero(dst);
dst.buffer = data->vertices.buffer; dst.buffer = data->vertices.buffer;
dst.size = (Uint32)vertsize; dst.size = (Uint32)vertsize;
SDL_UploadToGpuBuffer(pass, &src, &dst, true); SDL_UploadToGPUBuffer(pass, &src, &dst, true);
SDL_EndGpuCopyPass(pass); SDL_EndGPUCopyPass(pass);
return true; return true;
} }
@ -795,7 +795,7 @@ static bool GPU_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
nextcmd = nextcmd->next; nextcmd = nextcmd->next;
} }
SDL_GpuPrimitiveType prim = SDL_GPU_PRIMITIVETYPE_TRIANGLELIST; // SDL_RENDERCMD_GEOMETRY SDL_GPUPrimitiveType prim = SDL_GPU_PRIMITIVETYPE_TRIANGLELIST; // SDL_RENDERCMD_GEOMETRY
if (thiscmdtype == SDL_RENDERCMD_DRAW_POINTS) { if (thiscmdtype == SDL_RENDERCMD_DRAW_POINTS) {
prim = SDL_GPU_PRIMITIVETYPE_POINTLIST; prim = SDL_GPU_PRIMITIVETYPE_POINTLIST;
} }
@ -818,7 +818,7 @@ static bool GPU_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
} }
if (data->state.render_pass) { if (data->state.render_pass) {
SDL_EndGpuRenderPass(data->state.render_pass); SDL_EndGPURenderPass(data->state.render_pass);
data->state.render_pass = NULL; data->state.render_pass = NULL;
} }
@ -828,7 +828,7 @@ static bool GPU_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
static SDL_Surface *GPU_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect) static SDL_Surface *GPU_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
{ {
GPU_RenderData *data = (GPU_RenderData *)renderer->internal; GPU_RenderData *data = (GPU_RenderData *)renderer->internal;
SDL_GpuTexture *gpu_tex; SDL_GPUTexture *gpu_tex;
SDL_PixelFormat pixfmt; SDL_PixelFormat pixfmt;
if (data->state.render_target) { if (data->state.render_target) {
@ -856,20 +856,20 @@ static SDL_Surface *GPU_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect
return NULL; return NULL;
} }
SDL_GpuTransferBufferCreateInfo tbci; SDL_GPUTransferBufferCreateInfo tbci;
SDL_zero(tbci); SDL_zero(tbci);
tbci.sizeInBytes = image_size; tbci.sizeInBytes = image_size;
tbci.usage = SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD; tbci.usage = SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD;
SDL_GpuTransferBuffer *tbuf = SDL_CreateGpuTransferBuffer(data->device, &tbci); SDL_GPUTransferBuffer *tbuf = SDL_CreateGPUTransferBuffer(data->device, &tbci);
if (!tbuf) { if (!tbuf) {
return NULL; return NULL;
} }
SDL_GpuCopyPass *pass = SDL_BeginGpuCopyPass(data->state.command_buffer); SDL_GPUCopyPass *pass = SDL_BeginGPUCopyPass(data->state.command_buffer);
SDL_GpuTextureRegion src; SDL_GPUTextureRegion src;
SDL_zero(src); SDL_zero(src);
src.texture = gpu_tex; src.texture = gpu_tex;
src.x = rect->x; src.x = rect->x;
@ -878,21 +878,21 @@ static SDL_Surface *GPU_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect
src.h = rect->h; src.h = rect->h;
src.d = 1; src.d = 1;
SDL_GpuTextureTransferInfo dst; SDL_GPUTextureTransferInfo dst;
SDL_zero(dst); SDL_zero(dst);
dst.transferBuffer = tbuf; dst.transferBuffer = tbuf;
dst.imageHeight = rect->h; dst.imageHeight = rect->h;
dst.imagePitch = rect->w; dst.imagePitch = rect->w;
SDL_DownloadFromGpuTexture(pass, &src, &dst); SDL_DownloadFromGPUTexture(pass, &src, &dst);
SDL_EndGpuCopyPass(pass); SDL_EndGPUCopyPass(pass);
SDL_GpuFence *fence = SDL_SubmitGpuAndAcquireFence(data->state.command_buffer); SDL_GPUFence *fence = SDL_SubmitGPUAndAcquireFence(data->state.command_buffer);
SDL_WaitGpuForFences(data->device, true, &fence, 1); SDL_WaitGPUForFences(data->device, true, &fence, 1);
SDL_ReleaseGpuFence(data->device, fence); SDL_ReleaseGPUFence(data->device, fence);
data->state.command_buffer = SDL_AcquireGpuCommandBuffer(data->device); data->state.command_buffer = SDL_AcquireGPUCommandBuffer(data->device);
void *mapped_tbuf = SDL_MapGpuTransferBuffer(data->device, tbuf, false); void *mapped_tbuf = SDL_MapGPUTransferBuffer(data->device, tbuf, false);
if (surface->pitch == row_size) { if (surface->pitch == row_size) {
memcpy(surface->pixels, mapped_tbuf, image_size); memcpy(surface->pixels, mapped_tbuf, image_size);
@ -907,15 +907,15 @@ static SDL_Surface *GPU_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect
} }
} }
SDL_UnmapGpuTransferBuffer(data->device, tbuf); SDL_UnmapGPUTransferBuffer(data->device, tbuf);
SDL_ReleaseGpuTransferBuffer(data->device, tbuf); SDL_ReleaseGPUTransferBuffer(data->device, tbuf);
return surface; return surface;
} }
static bool CreateBackbuffer(GPU_RenderData *data, Uint32 w, Uint32 h, SDL_GpuTextureFormat fmt) static bool CreateBackbuffer(GPU_RenderData *data, Uint32 w, Uint32 h, SDL_GPUTextureFormat fmt)
{ {
SDL_GpuTextureCreateInfo tci; SDL_GPUTextureCreateInfo tci;
SDL_zero(tci); SDL_zero(tci);
tci.width = w; tci.width = w;
tci.height = h; tci.height = h;
@ -925,7 +925,7 @@ static bool CreateBackbuffer(GPU_RenderData *data, Uint32 w, Uint32 h, SDL_GpuTe
tci.sampleCount = SDL_GPU_SAMPLECOUNT_1; tci.sampleCount = SDL_GPU_SAMPLECOUNT_1;
tci.usageFlags = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET_BIT | SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT; tci.usageFlags = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET_BIT | SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT;
data->backbuffer.texture = SDL_CreateGpuTexture(data->device, &tci); data->backbuffer.texture = SDL_CreateGPUTexture(data->device, &tci);
data->backbuffer.width = w; data->backbuffer.width = w;
data->backbuffer.height = h; data->backbuffer.height = h;
data->backbuffer.format = fmt; data->backbuffer.format = fmt;
@ -939,42 +939,42 @@ static bool GPU_RenderPresent(SDL_Renderer *renderer)
Uint32 swapchain_w, swapchain_h; Uint32 swapchain_w, swapchain_h;
SDL_GpuTexture *swapchain = SDL_AcquireGpuSwapchainTexture(data->state.command_buffer, renderer->window, &swapchain_w, &swapchain_h); SDL_GPUTexture *swapchain = SDL_AcquireGPUSwapchainTexture(data->state.command_buffer, renderer->window, &swapchain_w, &swapchain_h);
if (swapchain == NULL) { if (swapchain == NULL) {
goto submit; goto submit;
} }
SDL_GpuTextureFormat swapchain_fmt = SDL_GetGpuSwapchainTextureFormat(data->device, renderer->window); SDL_GPUTextureFormat swapchain_fmt = SDL_GetGPUSwapchainTextureFormat(data->device, renderer->window);
if (swapchain_w != data->backbuffer.width || swapchain_h != data->backbuffer.height || swapchain_fmt != data->backbuffer.format) { if (swapchain_w != data->backbuffer.width || swapchain_h != data->backbuffer.height || swapchain_fmt != data->backbuffer.format) {
SDL_GpuBlitRegion src; SDL_GPUBlitRegion src;
SDL_zero(src); SDL_zero(src);
src.texture = data->backbuffer.texture; src.texture = data->backbuffer.texture;
src.w = data->backbuffer.width; src.w = data->backbuffer.width;
src.h = data->backbuffer.height; src.h = data->backbuffer.height;
SDL_GpuBlitRegion dst; SDL_GPUBlitRegion dst;
SDL_zero(dst); SDL_zero(dst);
dst.texture = swapchain; dst.texture = swapchain;
dst.w = swapchain_w; dst.w = swapchain_w;
dst.h = swapchain_h; dst.h = swapchain_h;
SDL_BlitGpu(data->state.command_buffer, &src, &dst, SDL_FLIP_NONE, SDL_GPU_FILTER_LINEAR, true); SDL_BlitGPU(data->state.command_buffer, &src, &dst, SDL_FLIP_NONE, SDL_GPU_FILTER_LINEAR, true);
SDL_ReleaseGpuTexture(data->device, data->backbuffer.texture); SDL_ReleaseGPUTexture(data->device, data->backbuffer.texture);
CreateBackbuffer(data, swapchain_w, swapchain_h, swapchain_fmt); CreateBackbuffer(data, swapchain_w, swapchain_h, swapchain_fmt);
} else { } else {
SDL_GpuTextureLocation src; SDL_GPUTextureLocation src;
SDL_zero(src); SDL_zero(src);
src.texture = data->backbuffer.texture; src.texture = data->backbuffer.texture;
SDL_GpuTextureLocation dst; SDL_GPUTextureLocation dst;
SDL_zero(dst); SDL_zero(dst);
dst.texture = swapchain; dst.texture = swapchain;
SDL_GpuCopyPass *pass = SDL_BeginGpuCopyPass(data->state.command_buffer); SDL_GPUCopyPass *pass = SDL_BeginGPUCopyPass(data->state.command_buffer);
SDL_CopyGpuTextureToTexture(pass, &src, &dst, swapchain_w, swapchain_h, 1, true); SDL_CopyGPUTextureToTexture(pass, &src, &dst, swapchain_w, swapchain_h, 1, true);
SDL_EndGpuCopyPass(pass); SDL_EndGPUCopyPass(pass);
} }
// *** FIXME *** // *** FIXME ***
@ -986,16 +986,16 @@ static bool GPU_RenderPresent(SDL_Renderer *renderer)
submit: submit:
#if 1 #if 1
if (data->present_fence) { if (data->present_fence) {
SDL_WaitGpuForFences(data->device, true, &data->present_fence, 1); SDL_WaitGPUForFences(data->device, true, &data->present_fence, 1);
SDL_ReleaseGpuFence(data->device, data->present_fence); SDL_ReleaseGPUFence(data->device, data->present_fence);
} }
data->present_fence = SDL_SubmitGpuAndAcquireFence(data->state.command_buffer); data->present_fence = SDL_SubmitGPUAndAcquireFence(data->state.command_buffer);
#else #else
SDL_SubmitGpu(data->state.command_buffer); SDL_SubmitGPU(data->state.command_buffer);
#endif #endif
data->state.command_buffer = SDL_AcquireGpuCommandBuffer(data->device); data->state.command_buffer = SDL_AcquireGPUCommandBuffer(data->device);
return true; return true;
} }
@ -1013,7 +1013,7 @@ static void GPU_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
return; return;
} }
SDL_ReleaseGpuTexture(renderdata->device, data->texture); SDL_ReleaseGPUTexture(renderdata->device, data->texture);
SDL_free(data->pixels); SDL_free(data->pixels);
SDL_free(data); SDL_free(data);
texture->internal = NULL; texture->internal = NULL;
@ -1028,47 +1028,47 @@ static void GPU_DestroyRenderer(SDL_Renderer *renderer)
} }
if (data->present_fence) { if (data->present_fence) {
SDL_WaitGpuForFences(data->device, true, &data->present_fence, 1); SDL_WaitGPUForFences(data->device, true, &data->present_fence, 1);
SDL_ReleaseGpuFence(data->device, data->present_fence); SDL_ReleaseGPUFence(data->device, data->present_fence);
} }
if (data->state.command_buffer) { if (data->state.command_buffer) {
SDL_SubmitGpu(data->state.command_buffer); SDL_SubmitGPU(data->state.command_buffer);
data->state.command_buffer = NULL; data->state.command_buffer = NULL;
} }
for (Uint32 i = 0; i < sizeof(data->samplers) / sizeof(SDL_GpuSampler *); ++i) { for (Uint32 i = 0; i < sizeof(data->samplers) / sizeof(SDL_GPUSampler *); ++i) {
SDL_ReleaseGpuSampler(data->device, ((SDL_GpuSampler **)data->samplers)[i]); SDL_ReleaseGPUSampler(data->device, ((SDL_GPUSampler **)data->samplers)[i]);
} }
if (data->backbuffer.texture) { if (data->backbuffer.texture) {
SDL_ReleaseGpuTexture(data->device, data->backbuffer.texture); SDL_ReleaseGPUTexture(data->device, data->backbuffer.texture);
} }
if (renderer->window) { if (renderer->window) {
SDL_UnclaimGpuWindow(data->device, renderer->window); SDL_UnclaimGPUWindow(data->device, renderer->window);
} }
ReleaseVertexBuffer(data); ReleaseVertexBuffer(data);
GPU_DestroyPipelineCache(&data->pipeline_cache); GPU_DestroyPipelineCache(&data->pipeline_cache);
GPU_ReleaseShaders(&data->shaders, data->device); GPU_ReleaseShaders(&data->shaders, data->device);
SDL_DestroyGpuDevice(data->device); SDL_DestroyGPUDevice(data->device);
SDL_free(data); SDL_free(data);
} }
static bool ChoosePresentMode(SDL_GpuDevice *device, SDL_Window *window, const int vsync, SDL_GpuPresentMode *out_mode) static bool ChoosePresentMode(SDL_GPUDevice *device, SDL_Window *window, const int vsync, SDL_GPUPresentMode *out_mode)
{ {
SDL_GpuPresentMode mode; SDL_GPUPresentMode mode;
switch (vsync) { switch (vsync) {
case 0: case 0:
mode = SDL_GPU_PRESENTMODE_MAILBOX; mode = SDL_GPU_PRESENTMODE_MAILBOX;
if (!SDL_SupportsGpuPresentMode(device, window, mode)) { if (!SDL_SupportsGPUPresentMode(device, window, mode)) {
mode = SDL_GPU_PRESENTMODE_IMMEDIATE; mode = SDL_GPU_PRESENTMODE_IMMEDIATE;
if (!SDL_SupportsGpuPresentMode(device, window, mode)) { if (!SDL_SupportsGPUPresentMode(device, window, mode)) {
mode = SDL_GPU_PRESENTMODE_VSYNC; mode = SDL_GPU_PRESENTMODE_VSYNC;
} }
} }
@ -1091,7 +1091,7 @@ static bool ChoosePresentMode(SDL_GpuDevice *device, SDL_Window *window, const i
static bool GPU_SetVSync(SDL_Renderer *renderer, const int vsync) static bool GPU_SetVSync(SDL_Renderer *renderer, const int vsync)
{ {
GPU_RenderData *data = (GPU_RenderData *)renderer->internal; GPU_RenderData *data = (GPU_RenderData *)renderer->internal;
SDL_GpuPresentMode mode = SDL_GPU_PRESENTMODE_VSYNC; SDL_GPUPresentMode mode = SDL_GPU_PRESENTMODE_VSYNC;
if (!ChoosePresentMode(data->device, renderer->window, vsync, &mode)) { if (!ChoosePresentMode(data->device, renderer->window, vsync, &mode)) {
return false; return false;
@ -1099,7 +1099,7 @@ static bool GPU_SetVSync(SDL_Renderer *renderer, const int vsync)
if (mode != data->swapchain.present_mode) { if (mode != data->swapchain.present_mode) {
// XXX returns bool instead of SDL-style error code // XXX returns bool instead of SDL-style error code
if (SDL_SetGpuSwapchainParameters(data->device, renderer->window, data->swapchain.composition, mode)) { if (SDL_SetGPUSwapchainParameters(data->device, renderer->window, data->swapchain.composition, mode)) {
data->swapchain.present_mode = mode; data->swapchain.present_mode = mode;
return true; return true;
} else { } else {
@ -1121,9 +1121,9 @@ static bool InitSamplers(GPU_RenderData *data)
} sdl; } sdl;
struct struct
{ {
SDL_GpuSamplerAddressMode address_mode; SDL_GPUSamplerAddressMode address_mode;
SDL_GpuFilter filter; SDL_GPUFilter filter;
SDL_GpuSamplerMipmapMode mipmap_mode; SDL_GPUSamplerMipmapMode mipmap_mode;
Uint32 anisotropy; Uint32 anisotropy;
} gpu; } gpu;
} configs[] = { } configs[] = {
@ -1154,7 +1154,7 @@ static bool InitSamplers(GPU_RenderData *data)
}; };
for (Uint32 i = 0; i < SDL_arraysize(configs); ++i) { for (Uint32 i = 0; i < SDL_arraysize(configs); ++i) {
SDL_GpuSamplerCreateInfo sci; SDL_GPUSamplerCreateInfo sci;
SDL_zero(sci); SDL_zero(sci);
sci.maxAnisotropy = configs[i].gpu.anisotropy; sci.maxAnisotropy = configs[i].gpu.anisotropy;
sci.anisotropyEnable = configs[i].gpu.anisotropy > 0; sci.anisotropyEnable = configs[i].gpu.anisotropy > 0;
@ -1162,7 +1162,7 @@ static bool InitSamplers(GPU_RenderData *data)
sci.minFilter = sci.magFilter = configs[i].gpu.filter; sci.minFilter = sci.magFilter = configs[i].gpu.filter;
sci.mipmapMode = configs[i].gpu.mipmap_mode; sci.mipmapMode = configs[i].gpu.mipmap_mode;
SDL_GpuSampler *sampler = SDL_CreateGpuSampler(data->device, &sci); SDL_GPUSampler *sampler = SDL_CreateGPUSampler(data->device, &sci);
if (sampler == NULL) { if (sampler == NULL) {
return false; return false;
@ -1204,7 +1204,7 @@ static bool GPU_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_P
SDL_SetBooleanProperty(create_props, SDL_PROP_GPU_CREATEDEVICE_PREFERLOWPOWER_BOOL, lowpower); SDL_SetBooleanProperty(create_props, SDL_PROP_GPU_CREATEDEVICE_PREFERLOWPOWER_BOOL, lowpower);
GPU_FillSupportedShaderFormats(create_props); GPU_FillSupportedShaderFormats(create_props);
data->device = SDL_CreateGpuDeviceWithProperties(create_props); data->device = SDL_CreateGPUDeviceWithProperties(create_props);
if (!data->device) { if (!data->device) {
goto error; goto error;
@ -1250,7 +1250,7 @@ static bool GPU_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_P
renderer->window = window; renderer->window = window;
renderer->name = GPU_RenderDriver.name; renderer->name = GPU_RenderDriver.name;
if (!SDL_ClaimGpuWindow(data->device, window)) { if (!SDL_ClaimGPUWindow(data->device, window)) {
goto error; goto error;
} }
@ -1260,7 +1260,7 @@ static bool GPU_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_P
int vsync = (int)SDL_GetNumberProperty(create_props, SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER, 0); int vsync = (int)SDL_GetNumberProperty(create_props, SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER, 0);
ChoosePresentMode(data->device, window, vsync, &data->swapchain.present_mode); ChoosePresentMode(data->device, window, vsync, &data->swapchain.present_mode);
SDL_SetGpuSwapchainParameters(data->device, window, data->swapchain.composition, data->swapchain.present_mode); SDL_SetGPUSwapchainParameters(data->device, window, data->swapchain.composition, data->swapchain.present_mode);
SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_RGBA32); SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_RGBA32);
SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_BGRA32); SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_BGRA32);
@ -1280,12 +1280,12 @@ static bool GPU_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_P
data->state.draw_color.a = 1.0f; data->state.draw_color.a = 1.0f;
data->state.viewport.minDepth = 0; data->state.viewport.minDepth = 0;
data->state.viewport.maxDepth = 1; data->state.viewport.maxDepth = 1;
data->state.command_buffer = SDL_AcquireGpuCommandBuffer(data->device); data->state.command_buffer = SDL_AcquireGPUCommandBuffer(data->device);
int w, h; int w, h;
SDL_GetWindowSizeInPixels(window, &w, &h); SDL_GetWindowSizeInPixels(window, &w, &h);
if (!CreateBackbuffer(data, w, h, SDL_GetGpuSwapchainTextureFormat(data->device, window))) { if (!CreateBackbuffer(data, w, h, SDL_GetGPUSwapchainTextureFormat(data->device, window))) {
goto error; goto error;
} }

View file

@ -24,13 +24,13 @@
#include "SDL_shaders_gpu.h" #include "SDL_shaders_gpu.h"
// SDL_Gpu shader implementation // SDL_GPU shader implementation
typedef struct GPU_ShaderModuleSource typedef struct GPU_ShaderModuleSource
{ {
const unsigned char *code; const unsigned char *code;
unsigned int code_len; unsigned int code_len;
SDL_GpuShaderFormat format; SDL_GPUShaderFormat format;
} GPU_ShaderModuleSource; } GPU_ShaderModuleSource;
#ifdef SDL_GPU_VULKAN #ifdef SDL_GPU_VULKAN
@ -147,10 +147,10 @@ static const GPU_ShaderSources frag_shader_sources[NUM_FRAG_SHADERS] = {
}; };
// clang-format on // clang-format on
static SDL_GpuShader *CompileShader(const GPU_ShaderSources *sources, SDL_GpuDevice *device, SDL_GpuShaderStage stage) static SDL_GPUShader *CompileShader(const GPU_ShaderSources *sources, SDL_GPUDevice *device, SDL_GPUShaderStage stage)
{ {
const GPU_ShaderModuleSource *sms = NULL; const GPU_ShaderModuleSource *sms = NULL;
SDL_GpuDriver driver = SDL_GetGpuDriver(device); SDL_GPUDriver driver = SDL_GetGPUDriver(device);
switch (driver) { switch (driver) {
// clang-format off // clang-format off
@ -165,7 +165,7 @@ static SDL_GpuShader *CompileShader(const GPU_ShaderSources *sources, SDL_GpuDev
return NULL; return NULL;
} }
SDL_GpuShaderCreateInfo sci = { 0 }; SDL_GPUShaderCreateInfo sci = { 0 };
sci.code = sms->code; sci.code = sms->code;
sci.codeSize = sms->code_len; sci.codeSize = sms->code_len;
sci.format = sms->format; sci.format = sms->format;
@ -175,10 +175,10 @@ static SDL_GpuShader *CompileShader(const GPU_ShaderSources *sources, SDL_GpuDev
sci.uniformBufferCount = sources->num_uniform_buffers; sci.uniformBufferCount = sources->num_uniform_buffers;
sci.stage = stage; sci.stage = stage;
return SDL_CreateGpuShader(device, &sci); return SDL_CreateGPUShader(device, &sci);
} }
bool GPU_InitShaders(GPU_Shaders *shaders, SDL_GpuDevice *device) bool GPU_InitShaders(GPU_Shaders *shaders, SDL_GPUDevice *device)
{ {
for (int i = 0; i < SDL_arraysize(vert_shader_sources); ++i) { for (int i = 0; i < SDL_arraysize(vert_shader_sources); ++i) {
shaders->vert_shaders[i] = CompileShader( shaders->vert_shaders[i] = CompileShader(
@ -201,31 +201,31 @@ bool GPU_InitShaders(GPU_Shaders *shaders, SDL_GpuDevice *device)
return true; return true;
} }
void GPU_ReleaseShaders(GPU_Shaders *shaders, SDL_GpuDevice *device) void GPU_ReleaseShaders(GPU_Shaders *shaders, SDL_GPUDevice *device)
{ {
for (int i = 0; i < SDL_arraysize(shaders->vert_shaders); ++i) { for (int i = 0; i < SDL_arraysize(shaders->vert_shaders); ++i) {
SDL_ReleaseGpuShader(device, shaders->vert_shaders[i]); SDL_ReleaseGPUShader(device, shaders->vert_shaders[i]);
shaders->vert_shaders[i] = NULL; shaders->vert_shaders[i] = NULL;
} }
for (int i = 0; i < SDL_arraysize(shaders->frag_shaders); ++i) { for (int i = 0; i < SDL_arraysize(shaders->frag_shaders); ++i) {
SDL_ReleaseGpuShader(device, shaders->frag_shaders[i]); SDL_ReleaseGPUShader(device, shaders->frag_shaders[i]);
shaders->frag_shaders[i] = NULL; shaders->frag_shaders[i] = NULL;
} }
} }
SDL_GpuShader *GPU_GetVertexShader(GPU_Shaders *shaders, GPU_VertexShaderID id) SDL_GPUShader *GPU_GetVertexShader(GPU_Shaders *shaders, GPU_VertexShaderID id)
{ {
SDL_assert((unsigned int)id < SDL_arraysize(shaders->vert_shaders)); SDL_assert((unsigned int)id < SDL_arraysize(shaders->vert_shaders));
SDL_GpuShader *shader = shaders->vert_shaders[id]; SDL_GPUShader *shader = shaders->vert_shaders[id];
SDL_assert(shader != NULL); SDL_assert(shader != NULL);
return shader; return shader;
} }
SDL_GpuShader *GPU_GetFragmentShader(GPU_Shaders *shaders, GPU_FragmentShaderID id) SDL_GPUShader *GPU_GetFragmentShader(GPU_Shaders *shaders, GPU_FragmentShaderID id)
{ {
SDL_assert((unsigned int)id < SDL_arraysize(shaders->frag_shaders)); SDL_assert((unsigned int)id < SDL_arraysize(shaders->frag_shaders));
SDL_GpuShader *shader = shaders->frag_shaders[id]; SDL_GPUShader *shader = shaders->frag_shaders[id];
SDL_assert(shader != NULL); SDL_assert(shader != NULL);
return shader; return shader;
} }

View file

@ -24,7 +24,7 @@
#include "SDL_internal.h" #include "SDL_internal.h"
// SDL_Gpu shader implementation // SDL_GPU shader implementation
typedef enum typedef enum
{ {
@ -48,16 +48,16 @@ typedef enum
struct GPU_Shaders struct GPU_Shaders
{ {
SDL_GpuShader *vert_shaders[NUM_VERT_SHADERS]; SDL_GPUShader *vert_shaders[NUM_VERT_SHADERS];
SDL_GpuShader *frag_shaders[NUM_FRAG_SHADERS]; SDL_GPUShader *frag_shaders[NUM_FRAG_SHADERS];
}; };
typedef struct GPU_Shaders GPU_Shaders; typedef struct GPU_Shaders GPU_Shaders;
void GPU_FillSupportedShaderFormats(SDL_PropertiesID props); void GPU_FillSupportedShaderFormats(SDL_PropertiesID props);
extern bool GPU_InitShaders(GPU_Shaders *shaders, SDL_GpuDevice *device); extern bool GPU_InitShaders(GPU_Shaders *shaders, SDL_GPUDevice *device);
extern void GPU_ReleaseShaders(GPU_Shaders *shaders, SDL_GpuDevice *device); extern void GPU_ReleaseShaders(GPU_Shaders *shaders, SDL_GPUDevice *device);
extern SDL_GpuShader *GPU_GetVertexShader(GPU_Shaders *shaders, GPU_VertexShaderID id); extern SDL_GPUShader *GPU_GetVertexShader(GPU_Shaders *shaders, GPU_VertexShaderID id);
extern SDL_GpuShader *GPU_GetFragmentShader(GPU_Shaders *shaders, GPU_FragmentShaderID id); extern SDL_GPUShader *GPU_GetFragmentShader(GPU_Shaders *shaders, GPU_FragmentShaderID id);
#endif // SDL_shaders_gpu_h_ #endif // SDL_shaders_gpu_h_

View file

@ -691,8 +691,8 @@
( (This)->Wait(pFence,Value) ) ( (This)->Wait(pFence,Value) )
#define ID3D12CommandQueue_GetTimestampFrequency(This,pFrequency) \ #define ID3D12CommandQueue_GetTimestampFrequency(This,pFrequency) \
( (This)->GetTimestampFrequency(pFrequency) ) ( (This)->GetTimestampFrequency(pFrequency) )
#define ID3D12CommandQueue_GetClockCalibration(This,pGpuTimestamp,pCpuTimestamp) \ #define ID3D12CommandQueue_GetClockCalibration(This,pGPUTimestamp,pCpuTimestamp) \
( (This)->GetClockCalibration(pGpuTimestamp,pCpuTimestamp) ) ( (This)->GetClockCalibration(pGPUTimestamp,pCpuTimestamp) )
#define ID3D12Device_QueryInterface(This,riid,ppvObject) \ #define ID3D12Device_QueryInterface(This,riid,ppvObject) \
( (This)->QueryInterface(riid,ppvObject) ) ( (This)->QueryInterface(riid,ppvObject) )
#define ID3D12Device_AddRef(This) \ #define ID3D12Device_AddRef(This) \

View file

@ -8670,7 +8670,7 @@ EXTERN_C const IID IID_ID3D12CommandQueue;
_Out_ UINT64 *pFrequency) = 0; _Out_ UINT64 *pFrequency) = 0;
virtual HRESULT STDMETHODCALLTYPE GetClockCalibration( virtual HRESULT STDMETHODCALLTYPE GetClockCalibration(
_Out_ UINT64 *pGpuTimestamp, _Out_ UINT64 *pGPUTimestamp,
_Out_ UINT64 *pCpuTimestamp) = 0; _Out_ UINT64 *pCpuTimestamp) = 0;
#if defined(_MSC_VER) || !defined(_WIN32) #if defined(_MSC_VER) || !defined(_WIN32)
@ -8802,7 +8802,7 @@ EXTERN_C const IID IID_ID3D12CommandQueue;
DECLSPEC_XFGVIRT(ID3D12CommandQueue, GetClockCalibration) DECLSPEC_XFGVIRT(ID3D12CommandQueue, GetClockCalibration)
HRESULT ( STDMETHODCALLTYPE *GetClockCalibration )( HRESULT ( STDMETHODCALLTYPE *GetClockCalibration )(
ID3D12CommandQueue * This, ID3D12CommandQueue * This,
_Out_ UINT64 *pGpuTimestamp, _Out_ UINT64 *pGPUTimestamp,
_Out_ UINT64 *pCpuTimestamp); _Out_ UINT64 *pCpuTimestamp);
DECLSPEC_XFGVIRT(ID3D12CommandQueue, GetDesc) DECLSPEC_XFGVIRT(ID3D12CommandQueue, GetDesc)
@ -8885,8 +8885,8 @@ EXTERN_C const IID IID_ID3D12CommandQueue;
#define ID3D12CommandQueue_GetTimestampFrequency(This,pFrequency) \ #define ID3D12CommandQueue_GetTimestampFrequency(This,pFrequency) \
( (This)->lpVtbl -> GetTimestampFrequency(This,pFrequency) ) ( (This)->lpVtbl -> GetTimestampFrequency(This,pFrequency) )
#define ID3D12CommandQueue_GetClockCalibration(This,pGpuTimestamp,pCpuTimestamp) \ #define ID3D12CommandQueue_GetClockCalibration(This,pGPUTimestamp,pCpuTimestamp) \
( (This)->lpVtbl -> GetClockCalibration(This,pGpuTimestamp,pCpuTimestamp) ) ( (This)->lpVtbl -> GetClockCalibration(This,pGPUTimestamp,pCpuTimestamp) )
#if !defined(_WIN32) #if !defined(_WIN32)
#define ID3D12CommandQueue_GetDesc(This) \ #define ID3D12CommandQueue_GetDesc(This) \
@ -29176,7 +29176,7 @@ DEFINE_ENUM_FLAG_OPERATORS( D3D12_DEVICE_FLAGS )
typedef struct D3D12_DEVICE_CONFIGURATION_DESC typedef struct D3D12_DEVICE_CONFIGURATION_DESC
{ {
D3D12_DEVICE_FLAGS Flags; D3D12_DEVICE_FLAGS Flags;
UINT GpuBasedValidationFlags; UINT GPUBasedValidationFlags;
UINT SDKVersion; UINT SDKVersion;
UINT NumEnabledExperimentalFeatures; UINT NumEnabledExperimentalFeatures;
} D3D12_DEVICE_CONFIGURATION_DESC; } D3D12_DEVICE_CONFIGURATION_DESC;

View file

@ -34,40 +34,40 @@ static Uint32 frames = 0;
typedef struct RenderState typedef struct RenderState
{ {
SDL_GpuBuffer *buf_vertex; SDL_GPUBuffer *buf_vertex;
SDL_GpuGraphicsPipeline *pipeline; SDL_GPUGraphicsPipeline *pipeline;
SDL_GpuSampleCount sample_count; SDL_GPUSampleCount sample_count;
} RenderState; } RenderState;
typedef struct WindowState typedef struct WindowState
{ {
int angle_x, angle_y, angle_z; int angle_x, angle_y, angle_z;
SDL_GpuTexture *tex_depth, *tex_msaa; SDL_GPUTexture *tex_depth, *tex_msaa;
Uint32 prev_drawablew, prev_drawableh; Uint32 prev_drawablew, prev_drawableh;
} WindowState; } WindowState;
static SDL_GpuDevice *gpu_device = NULL; static SDL_GPUDevice *gpu_device = NULL;
static RenderState render_state; static RenderState render_state;
static SDLTest_CommonState *state = NULL; static SDLTest_CommonState *state = NULL;
static WindowState *window_states = NULL; static WindowState *window_states = NULL;
static void shutdownGpu(void) static void shutdownGPU(void)
{ {
if (window_states) { if (window_states) {
int i; int i;
for (i = 0; i < state->num_windows; i++) { for (i = 0; i < state->num_windows; i++) {
WindowState *winstate = &window_states[i]; WindowState *winstate = &window_states[i];
SDL_ReleaseGpuTexture(gpu_device, winstate->tex_depth); SDL_ReleaseGPUTexture(gpu_device, winstate->tex_depth);
SDL_ReleaseGpuTexture(gpu_device, winstate->tex_msaa); SDL_ReleaseGPUTexture(gpu_device, winstate->tex_msaa);
SDL_UnclaimGpuWindow(gpu_device, state->windows[i]); SDL_UnclaimGPUWindow(gpu_device, state->windows[i]);
} }
SDL_free(window_states); SDL_free(window_states);
window_states = NULL; window_states = NULL;
} }
SDL_ReleaseGpuBuffer(gpu_device, render_state.buf_vertex); SDL_ReleaseGPUBuffer(gpu_device, render_state.buf_vertex);
SDL_ReleaseGpuGraphicsPipeline(gpu_device, render_state.pipeline); SDL_ReleaseGPUGraphicsPipeline(gpu_device, render_state.pipeline);
SDL_DestroyGpuDevice(gpu_device); SDL_DestroyGPUDevice(gpu_device);
SDL_zero(render_state); SDL_zero(render_state);
gpu_device = NULL; gpu_device = NULL;
@ -78,7 +78,7 @@ static void shutdownGpu(void)
static void static void
quit(int rc) quit(int rc)
{ {
shutdownGpu(); shutdownGPU();
SDLTest_CommonQuit(state); SDLTest_CommonQuit(state);
exit(rc); exit(rc);
} }
@ -246,11 +246,11 @@ static const VertexData vertex_data[] = {
{ 0.5, -0.5, 0.5, 1.0, 0.0, 1.0 } /* magenta */ { 0.5, -0.5, 0.5, 1.0, 0.0, 1.0 } /* magenta */
}; };
static SDL_GpuTexture* static SDL_GPUTexture*
CreateDepthTexture(Uint32 drawablew, Uint32 drawableh) CreateDepthTexture(Uint32 drawablew, Uint32 drawableh)
{ {
SDL_GpuTextureCreateInfo depthtex_createinfo; SDL_GPUTextureCreateInfo depthtex_createinfo;
SDL_GpuTexture *result; SDL_GPUTexture *result;
depthtex_createinfo.type = SDL_GPU_TEXTURETYPE_2D; depthtex_createinfo.type = SDL_GPU_TEXTURETYPE_2D;
depthtex_createinfo.format = SDL_GPU_TEXTUREFORMAT_D16_UNORM; depthtex_createinfo.format = SDL_GPU_TEXTUREFORMAT_D16_UNORM;
@ -262,24 +262,24 @@ CreateDepthTexture(Uint32 drawablew, Uint32 drawableh)
depthtex_createinfo.usageFlags = SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET_BIT; depthtex_createinfo.usageFlags = SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET_BIT;
depthtex_createinfo.props = 0; depthtex_createinfo.props = 0;
result = SDL_CreateGpuTexture(gpu_device, &depthtex_createinfo); result = SDL_CreateGPUTexture(gpu_device, &depthtex_createinfo);
CHECK_CREATE(result, "Depth Texture") CHECK_CREATE(result, "Depth Texture")
return result; return result;
} }
static SDL_GpuTexture* static SDL_GPUTexture*
CreateMSAATexture(Uint32 drawablew, Uint32 drawableh) CreateMSAATexture(Uint32 drawablew, Uint32 drawableh)
{ {
SDL_GpuTextureCreateInfo msaatex_createinfo; SDL_GPUTextureCreateInfo msaatex_createinfo;
SDL_GpuTexture *result; SDL_GPUTexture *result;
if (render_state.sample_count == SDL_GPU_SAMPLECOUNT_1) { if (render_state.sample_count == SDL_GPU_SAMPLECOUNT_1) {
return NULL; return NULL;
} }
msaatex_createinfo.type = SDL_GPU_TEXTURETYPE_2D; msaatex_createinfo.type = SDL_GPU_TEXTURETYPE_2D;
msaatex_createinfo.format = SDL_GetGpuSwapchainTextureFormat(gpu_device, state->windows[0]); msaatex_createinfo.format = SDL_GetGPUSwapchainTextureFormat(gpu_device, state->windows[0]);
msaatex_createinfo.width = drawablew; msaatex_createinfo.width = drawablew;
msaatex_createinfo.height = drawableh; msaatex_createinfo.height = drawableh;
msaatex_createinfo.layerCountOrDepth = 1; msaatex_createinfo.layerCountOrDepth = 1;
@ -288,7 +288,7 @@ CreateMSAATexture(Uint32 drawablew, Uint32 drawableh)
msaatex_createinfo.usageFlags = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET_BIT | SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT; msaatex_createinfo.usageFlags = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET_BIT | SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT;
msaatex_createinfo.props = 0; msaatex_createinfo.props = 0;
result = SDL_CreateGpuTexture(gpu_device, &msaatex_createinfo); result = SDL_CreateGPUTexture(gpu_device, &msaatex_createinfo);
CHECK_CREATE(result, "MSAA Texture") CHECK_CREATE(result, "MSAA Texture")
return result; return result;
@ -298,25 +298,25 @@ static void
Render(SDL_Window *window, const int windownum) Render(SDL_Window *window, const int windownum)
{ {
WindowState *winstate = &window_states[windownum]; WindowState *winstate = &window_states[windownum];
SDL_GpuTexture *swapchain; SDL_GPUTexture *swapchain;
SDL_GpuColorAttachmentInfo color_attachment; SDL_GPUColorAttachmentInfo color_attachment;
SDL_GpuDepthStencilAttachmentInfo depth_attachment; SDL_GPUDepthStencilAttachmentInfo depth_attachment;
float matrix_rotate[16], matrix_modelview[16], matrix_perspective[16], matrix_final[16]; float matrix_rotate[16], matrix_modelview[16], matrix_perspective[16], matrix_final[16];
Uint32 drawablew, drawableh; Uint32 drawablew, drawableh;
SDL_GpuCommandBuffer *cmd; SDL_GPUCommandBuffer *cmd;
SDL_GpuRenderPass *pass; SDL_GPURenderPass *pass;
SDL_GpuBufferBinding vertex_binding; SDL_GPUBufferBinding vertex_binding;
SDL_GpuBlitRegion src_region; SDL_GPUBlitRegion src_region;
SDL_GpuBlitRegion dst_region; SDL_GPUBlitRegion dst_region;
/* Acquire the swapchain texture */ /* Acquire the swapchain texture */
cmd = SDL_AcquireGpuCommandBuffer(gpu_device); cmd = SDL_AcquireGPUCommandBuffer(gpu_device);
swapchain = SDL_AcquireGpuSwapchainTexture(cmd, state->windows[windownum], &drawablew, &drawableh); swapchain = SDL_AcquireGPUSwapchainTexture(cmd, state->windows[windownum], &drawablew, &drawableh);
if (!swapchain) { if (!swapchain) {
/* No swapchain was acquired, probably too many frames in flight */ /* No swapchain was acquired, probably too many frames in flight */
SDL_SubmitGpu(cmd); SDL_SubmitGPU(cmd);
return; return;
} }
@ -353,8 +353,8 @@ Render(SDL_Window *window, const int windownum)
/* Resize the depth buffer if the window size changed */ /* Resize the depth buffer if the window size changed */
if (winstate->prev_drawablew != drawablew || winstate->prev_drawableh != drawableh) { if (winstate->prev_drawablew != drawablew || winstate->prev_drawableh != drawableh) {
SDL_ReleaseGpuTexture(gpu_device, winstate->tex_depth); SDL_ReleaseGPUTexture(gpu_device, winstate->tex_depth);
SDL_ReleaseGpuTexture(gpu_device, winstate->tex_msaa); SDL_ReleaseGPUTexture(gpu_device, winstate->tex_msaa);
winstate->tex_depth = CreateDepthTexture(drawablew, drawableh); winstate->tex_depth = CreateDepthTexture(drawablew, drawableh);
winstate->tex_msaa = CreateMSAATexture(drawablew, drawableh); winstate->tex_msaa = CreateMSAATexture(drawablew, drawableh);
} }
@ -383,13 +383,13 @@ Render(SDL_Window *window, const int windownum)
/* Draw the cube! */ /* Draw the cube! */
SDL_PushGpuVertexUniformData(cmd, 0, matrix_final, sizeof(matrix_final)); SDL_PushGPUVertexUniformData(cmd, 0, matrix_final, sizeof(matrix_final));
pass = SDL_BeginGpuRenderPass(cmd, &color_attachment, 1, &depth_attachment); pass = SDL_BeginGPURenderPass(cmd, &color_attachment, 1, &depth_attachment);
SDL_BindGpuGraphicsPipeline(pass, render_state.pipeline); SDL_BindGPUGraphicsPipeline(pass, render_state.pipeline);
SDL_BindGpuVertexBuffers(pass, 0, &vertex_binding, 1); SDL_BindGPUVertexBuffers(pass, 0, &vertex_binding, 1);
SDL_DrawGpuPrimitives(pass, 36, 1, 0, 0); SDL_DrawGPUPrimitives(pass, 36, 1, 0, 0);
SDL_EndGpuRenderPass(pass); SDL_EndGPURenderPass(pass);
/* Blit MSAA to swapchain, if needed */ /* Blit MSAA to swapchain, if needed */
if (render_state.sample_count > SDL_GPU_SAMPLECOUNT_1) { if (render_state.sample_count > SDL_GPU_SAMPLECOUNT_1) {
@ -401,26 +401,26 @@ Render(SDL_Window *window, const int windownum)
dst_region = src_region; dst_region = src_region;
dst_region.texture = swapchain; dst_region.texture = swapchain;
SDL_BlitGpu(cmd, &src_region, &dst_region, SDL_FLIP_NONE, SDL_GPU_FILTER_LINEAR, SDL_FALSE); SDL_BlitGPU(cmd, &src_region, &dst_region, SDL_FLIP_NONE, SDL_GPU_FILTER_LINEAR, SDL_FALSE);
} }
/* Submit the command buffer! */ /* Submit the command buffer! */
SDL_SubmitGpu(cmd); SDL_SubmitGPU(cmd);
++frames; ++frames;
} }
static SDL_GpuShader* static SDL_GPUShader*
load_shader(SDL_bool is_vertex) load_shader(SDL_bool is_vertex)
{ {
SDL_GpuShaderCreateInfo createinfo; SDL_GPUShaderCreateInfo createinfo;
createinfo.samplerCount = 0; createinfo.samplerCount = 0;
createinfo.storageBufferCount = 0; createinfo.storageBufferCount = 0;
createinfo.storageTextureCount = 0; createinfo.storageTextureCount = 0;
createinfo.uniformBufferCount = is_vertex ? 1 : 0; createinfo.uniformBufferCount = is_vertex ? 1 : 0;
createinfo.props = 0; createinfo.props = 0;
SDL_GpuDriver backend = SDL_GetGpuDriver(gpu_device); SDL_GPUDriver backend = SDL_GetGPUDriver(gpu_device);
if (backend == SDL_GPU_DRIVER_D3D11) { if (backend == SDL_GPU_DRIVER_D3D11) {
createinfo.format = SDL_GPU_SHADERFORMAT_DXBC; createinfo.format = SDL_GPU_SHADERFORMAT_DXBC;
createinfo.code = is_vertex ? D3D11_CubeVert : D3D11_CubeFrag; createinfo.code = is_vertex ? D3D11_CubeVert : D3D11_CubeFrag;
@ -444,30 +444,30 @@ load_shader(SDL_bool is_vertex)
} }
createinfo.stage = is_vertex ? SDL_GPU_SHADERSTAGE_VERTEX : SDL_GPU_SHADERSTAGE_FRAGMENT; createinfo.stage = is_vertex ? SDL_GPU_SHADERSTAGE_VERTEX : SDL_GPU_SHADERSTAGE_FRAGMENT;
return SDL_CreateGpuShader(gpu_device, &createinfo); return SDL_CreateGPUShader(gpu_device, &createinfo);
} }
static void static void
init_render_state(int msaa) init_render_state(int msaa)
{ {
SDL_GpuCommandBuffer *cmd; SDL_GPUCommandBuffer *cmd;
SDL_GpuTransferBuffer *buf_transfer; SDL_GPUTransferBuffer *buf_transfer;
void *map; void *map;
SDL_GpuTransferBufferLocation buf_location; SDL_GPUTransferBufferLocation buf_location;
SDL_GpuBufferRegion dst_region; SDL_GPUBufferRegion dst_region;
SDL_GpuCopyPass *copy_pass; SDL_GPUCopyPass *copy_pass;
SDL_GpuBufferCreateInfo buffer_desc; SDL_GPUBufferCreateInfo buffer_desc;
SDL_GpuTransferBufferCreateInfo transfer_buffer_desc; SDL_GPUTransferBufferCreateInfo transfer_buffer_desc;
SDL_GpuGraphicsPipelineCreateInfo pipelinedesc; SDL_GPUGraphicsPipelineCreateInfo pipelinedesc;
SDL_GpuColorAttachmentDescription color_attachment_desc; SDL_GPUColorAttachmentDescription color_attachment_desc;
Uint32 drawablew, drawableh; Uint32 drawablew, drawableh;
SDL_GpuVertexAttribute vertex_attributes[2]; SDL_GPUVertexAttribute vertex_attributes[2];
SDL_GpuVertexBinding vertex_binding; SDL_GPUVertexBinding vertex_binding;
SDL_GpuShader *vertex_shader; SDL_GPUShader *vertex_shader;
SDL_GpuShader *fragment_shader; SDL_GPUShader *fragment_shader;
int i; int i;
gpu_device = SDL_CreateGpuDevice( gpu_device = SDL_CreateGPUDevice(
TESTGPU_SUPPORTED_FORMATS, TESTGPU_SUPPORTED_FORMATS,
1, 1,
0, 0,
@ -478,7 +478,7 @@ init_render_state(int msaa)
/* Claim the windows */ /* Claim the windows */
for (i = 0; i < state->num_windows; i++) { for (i = 0; i < state->num_windows; i++) {
SDL_ClaimGpuWindow( SDL_ClaimGPUWindow(
gpu_device, gpu_device,
state->windows[i] state->windows[i]
); );
@ -496,46 +496,46 @@ init_render_state(int msaa)
buffer_desc.usageFlags = SDL_GPU_BUFFERUSAGE_VERTEX_BIT; buffer_desc.usageFlags = SDL_GPU_BUFFERUSAGE_VERTEX_BIT;
buffer_desc.sizeInBytes = sizeof(vertex_data); buffer_desc.sizeInBytes = sizeof(vertex_data);
buffer_desc.props = 0; buffer_desc.props = 0;
render_state.buf_vertex = SDL_CreateGpuBuffer( render_state.buf_vertex = SDL_CreateGPUBuffer(
gpu_device, gpu_device,
&buffer_desc &buffer_desc
); );
CHECK_CREATE(render_state.buf_vertex, "Static vertex buffer") CHECK_CREATE(render_state.buf_vertex, "Static vertex buffer")
SDL_SetGpuBufferName(gpu_device, render_state.buf_vertex, "космонавт"); SDL_SetGPUBufferName(gpu_device, render_state.buf_vertex, "космонавт");
transfer_buffer_desc.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD; transfer_buffer_desc.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
transfer_buffer_desc.sizeInBytes = sizeof(vertex_data); transfer_buffer_desc.sizeInBytes = sizeof(vertex_data);
transfer_buffer_desc.props = 0; transfer_buffer_desc.props = 0;
buf_transfer = SDL_CreateGpuTransferBuffer( buf_transfer = SDL_CreateGPUTransferBuffer(
gpu_device, gpu_device,
&transfer_buffer_desc &transfer_buffer_desc
); );
CHECK_CREATE(buf_transfer, "Vertex transfer buffer") CHECK_CREATE(buf_transfer, "Vertex transfer buffer")
/* We just need to upload the static data once. */ /* We just need to upload the static data once. */
map = SDL_MapGpuTransferBuffer(gpu_device, buf_transfer, SDL_FALSE); map = SDL_MapGPUTransferBuffer(gpu_device, buf_transfer, SDL_FALSE);
SDL_memcpy(map, vertex_data, sizeof(vertex_data)); SDL_memcpy(map, vertex_data, sizeof(vertex_data));
SDL_UnmapGpuTransferBuffer(gpu_device, buf_transfer); SDL_UnmapGPUTransferBuffer(gpu_device, buf_transfer);
cmd = SDL_AcquireGpuCommandBuffer(gpu_device); cmd = SDL_AcquireGPUCommandBuffer(gpu_device);
copy_pass = SDL_BeginGpuCopyPass(cmd); copy_pass = SDL_BeginGPUCopyPass(cmd);
buf_location.transferBuffer = buf_transfer; buf_location.transferBuffer = buf_transfer;
buf_location.offset = 0; buf_location.offset = 0;
dst_region.buffer = render_state.buf_vertex; dst_region.buffer = render_state.buf_vertex;
dst_region.offset = 0; dst_region.offset = 0;
dst_region.size = sizeof(vertex_data); dst_region.size = sizeof(vertex_data);
SDL_UploadToGpuBuffer(copy_pass, &buf_location, &dst_region, SDL_FALSE); SDL_UploadToGPUBuffer(copy_pass, &buf_location, &dst_region, SDL_FALSE);
SDL_EndGpuCopyPass(copy_pass); SDL_EndGPUCopyPass(copy_pass);
SDL_SubmitGpu(cmd); SDL_SubmitGPU(cmd);
SDL_ReleaseGpuTransferBuffer(gpu_device, buf_transfer); SDL_ReleaseGPUTransferBuffer(gpu_device, buf_transfer);
/* Determine which sample count to use */ /* Determine which sample count to use */
render_state.sample_count = SDL_GPU_SAMPLECOUNT_1; render_state.sample_count = SDL_GPU_SAMPLECOUNT_1;
if (msaa && SDL_SupportsGpuSampleCount( if (msaa && SDL_SupportsGPUSampleCount(
gpu_device, gpu_device,
SDL_GetGpuSwapchainTextureFormat(gpu_device, state->windows[0]), SDL_GetGPUSwapchainTextureFormat(gpu_device, state->windows[0]),
SDL_GPU_SAMPLECOUNT_4)) { SDL_GPU_SAMPLECOUNT_4)) {
render_state.sample_count = SDL_GPU_SAMPLECOUNT_4; render_state.sample_count = SDL_GPU_SAMPLECOUNT_4;
} }
@ -544,7 +544,7 @@ init_render_state(int msaa)
SDL_zero(pipelinedesc); SDL_zero(pipelinedesc);
color_attachment_desc.format = SDL_GetGpuSwapchainTextureFormat(gpu_device, state->windows[0]); color_attachment_desc.format = SDL_GetGPUSwapchainTextureFormat(gpu_device, state->windows[0]);
color_attachment_desc.blendState.blendEnable = 0; color_attachment_desc.blendState.blendEnable = 0;
color_attachment_desc.blendState.alphaBlendOp = SDL_GPU_BLENDOP_ADD; color_attachment_desc.blendState.alphaBlendOp = SDL_GPU_BLENDOP_ADD;
@ -590,16 +590,16 @@ init_render_state(int msaa)
pipelinedesc.vertexInputState.vertexBindingCount = 1; pipelinedesc.vertexInputState.vertexBindingCount = 1;
pipelinedesc.vertexInputState.vertexBindings = &vertex_binding; pipelinedesc.vertexInputState.vertexBindings = &vertex_binding;
pipelinedesc.vertexInputState.vertexAttributeCount = 2; pipelinedesc.vertexInputState.vertexAttributeCount = 2;
pipelinedesc.vertexInputState.vertexAttributes = (SDL_GpuVertexAttribute*) &vertex_attributes; pipelinedesc.vertexInputState.vertexAttributes = (SDL_GPUVertexAttribute*) &vertex_attributes;
pipelinedesc.props = 0; pipelinedesc.props = 0;
render_state.pipeline = SDL_CreateGpuGraphicsPipeline(gpu_device, &pipelinedesc); render_state.pipeline = SDL_CreateGPUGraphicsPipeline(gpu_device, &pipelinedesc);
CHECK_CREATE(render_state.pipeline, "Render Pipeline") CHECK_CREATE(render_state.pipeline, "Render Pipeline")
/* These are reference-counted; once the pipeline is created, you don't need to keep these. */ /* These are reference-counted; once the pipeline is created, you don't need to keep these. */
SDL_ReleaseGpuShader(gpu_device, vertex_shader); SDL_ReleaseGPUShader(gpu_device, vertex_shader);
SDL_ReleaseGpuShader(gpu_device, fragment_shader); SDL_ReleaseGPUShader(gpu_device, fragment_shader);
/* Set up per-window state */ /* Set up per-window state */