mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-20 04:56:07 +00:00
Began work on WGPU video backend
Currently only supports Wayland, and it's quite..... bad This is a DRAFT! Just a small proof-of-concept. I'll submit a draft PR to the SDL project to see if I should continue development. If this is greenlit, I might making consider a WGPU SDL_GPU backend if wgpu-native is in a good enough state (maybe Dawn if it isn't?) No promises though! Don't get angry at me if I don't! Current known issues: 1: Error handling is sparse. 2: It only supports the shared library version of wgpu-native, and it does that by just loading it whenever it needs to do something 3: wgpu-native is bad and doesn't implement wgpuGetProcAddress so we're just using SDL_LoadFunction instead. I'd much prefer using the native wgpuGetProcAddress but alas....
This commit is contained in:
parent
687a59f277
commit
7e733d0934
15 changed files with 6999 additions and 99 deletions
|
|
@ -85,6 +85,7 @@
|
|||
#include <SDL3/SDL_tray.h>
|
||||
#include <SDL3/SDL_touch.h>
|
||||
#include <SDL3/SDL_version.h>
|
||||
#include <SDL3/SDL_wgpu.h>
|
||||
#include <SDL3/SDL_video.h>
|
||||
#include <SDL3/SDL_oldnames.h>
|
||||
|
||||
|
|
|
|||
42
include/SDL3/SDL_wgpu.h
Normal file
42
include/SDL3/SDL_wgpu.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* # CategoryWGPU
|
||||
*
|
||||
* Experimental support for the wgpu-native C bindings.
|
||||
*/
|
||||
|
||||
#ifndef SDL_wgpu_h_
|
||||
#define SDL_wgpu_h_
|
||||
|
||||
#include <SDL3/SDL_video.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef WEBGPU_H_
|
||||
#define WGPU_OBJECT_ATTRIBUTE(object) typedef struct object##Impl *object;
|
||||
#endif
|
||||
|
||||
WGPU_OBJECT_ATTRIBUTE(WGPUSurface)
|
||||
WGPU_OBJECT_ATTRIBUTE(WGPUInstance)
|
||||
|
||||
#undef WGPU_OBJECT_ATTRIBUTE
|
||||
|
||||
/**
|
||||
* Create a new WGPU surface.
|
||||
*
|
||||
* \param window The window which the surface will attach itself to.
|
||||
* \param instance The WGPU instance.
|
||||
*
|
||||
* \returns A WGPUSurface. Can be NULL if there was a failure.
|
||||
*/
|
||||
extern SDL_DECLSPEC WGPUSurface SDLCALL SDL_WGPU_CreateSurface(SDL_Window *window, WGPUInstance instance);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include <SDL3/SDL_close_code.h>
|
||||
|
||||
#endif // SDL_wgpu_h_
|
||||
|
|
@ -487,6 +487,9 @@
|
|||
/* Enable Metal support */
|
||||
#cmakedefine SDL_VIDEO_METAL 1
|
||||
|
||||
/* Enable experimental WGPU support */
|
||||
#cmakedefine SDL_VIDEO_WGPU 1
|
||||
|
||||
/* Enable GPU support */
|
||||
#cmakedefine SDL_GPU_D3D11 1
|
||||
#cmakedefine SDL_GPU_D3D12 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue