mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-20 04:56:07 +00:00
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....
42 lines
839 B
C
42 lines
839 B
C
/**
|
|
* # 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_
|