Remove unneeded WebGPU headers

Removed webgpu.h and instead we're defining the types ourselves

Thank you @HamdyElzanqali for pointing out my stupidity lol
This commit is contained in:
The Stickmahn 2026-05-30 14:51:59 +02:00
parent 77d364e30d
commit 8469309f42
6 changed files with 105 additions and 6752 deletions

99
src/video/SDL_wgpu_defs.h Normal file
View file

@ -0,0 +1,99 @@
// BSD 3-Clause License
//
// Copyright (c) 2019, "WebGPU native" developers
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SDL_internal.h"
#ifndef WEBGPU_H_
#define NO_WEBGPU_HEADER
#endif
#ifdef NO_WEBGPU_HEADER
#if !defined(WGPU_FUNCTION_ATTRIBUTE)
#define WGPU_FUNCTION_ATTRIBUTE
#endif
typedef enum WGPUSType
{
WGPUSType_ShaderSourceSPIRV = 0x00000001,
WGPUSType_ShaderSourceWGSL = 0x00000002,
WGPUSType_RenderPassMaxDrawCount = 0x00000003,
WGPUSType_SurfaceSourceMetalLayer = 0x00000004,
WGPUSType_SurfaceSourceWindowsHWND = 0x00000005,
WGPUSType_SurfaceSourceXlibWindow = 0x00000006,
WGPUSType_SurfaceSourceWaylandSurface = 0x00000007,
WGPUSType_SurfaceSourceAndroidNativeWindow = 0x00000008,
WGPUSType_SurfaceSourceXCBWindow = 0x00000009,
WGPUSType_SurfaceColorManagement = 0x0000000A,
WGPUSType_RequestAdapterWebXROptions = 0x0000000B,
WGPUSType_TextureComponentSwizzleDescriptor = 0x0000000C,
WGPUSType_ExternalTextureBindingLayout = 0x0000000D,
WGPUSType_ExternalTextureBindingEntry = 0x0000000E,
WGPUSType_CompatibilityModeLimits = 0x0000000F,
WGPUSType_TextureBindingViewDimension = 0x00000010,
WGPUSType_Force32 = 0x7FFFFFFF
} WGPUSType;
typedef struct WGPUChainedStruct
{
struct WGPUChainedStruct *next;
WGPUSType sType;
} WGPUChainedStruct;
typedef struct WGPUStringView
{
char const *data;
size_t length;
} WGPUStringView;
typedef struct WGPUSurfaceDescriptor
{
WGPUChainedStruct *nextInChain;
WGPUStringView label;
} WGPUSurfaceDescriptor;
typedef struct WGPUSurfaceSourceWaylandSurface
{
WGPUChainedStruct chain;
void *display;
void *surface;
} WGPUSurfaceSourceWaylandSurface;
typedef struct WGPUSurfaceSourceXlibWindow {
WGPUChainedStruct chain;
void * display;
uint64_t window;
} WGPUSurfaceSourceXlibWindow;
#define WGPU_STRLEN (SIZE_MAX)
typedef WGPUSurface (*WGPUProcInstanceCreateSurface)(WGPUInstance instance, WGPUSurfaceDescriptor const *descriptor) WGPU_FUNCTION_ATTRIBUTE;
#endif

View file

@ -3,15 +3,19 @@
#if defined(SDL_VIDEO_WGPU) && defined(SDL_VIDEO_DRIVER_WAYLAND)
#include "SDL_waylandvideo.h"
#include "../SDL_wgpu_defs.h"
#include "SDL_waylandwgpu.h"
#include <SDL3/SDL_wgpu.h>
SDL_ELF_NOTE_DLOPEN(
"wayland-wgpu",
"Support for wgpu-native on wayland backend",
SDL_ELF_NOTE_DLOPEN_PRIORITY_SUGGESTED,
"libwgpu_native.so")
WGPUSurface Wayland_WGPU_CreateSurface(SDL_VideoDevice *_this, SDL_Window *window, WGPUInstance instance)
WGPUSurface
Wayland_WGPU_CreateSurface(SDL_VideoDevice *_this, SDL_Window *window, WGPUInstance instance)
{
SDL_PropertiesID windowProperties = SDL_GetWindowProperties(window);

View file

@ -2,7 +2,6 @@
#define SDL_waylandwgpu_h_
// NOTE: Not sure if I'm allowed to do this.
#include "../webgpu/webgpu.h"
#include <SDL3/SDL_wgpu.h>

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@
#if defined(SDL_VIDEO_WGPU) && defined(SDL_VIDEO_DRIVER_X11)
#include "SDL_x11video.h"
#include "../SDL_wgpu_defs.h"
#include "SDL_x11wgpu.h"
SDL_ELF_NOTE_DLOPEN(

View file

@ -1,9 +1,6 @@
#ifndef SDL_x11wgpu_h_
#define SDL_x11wgpu_h_
// NOTE: Again, Not sure if I'm allowed to do this.
#include "../webgpu/webgpu.h"
#include <SDL3/SDL_wgpu.h>
#if defined(SDL_VIDEO_WGPU) && defined(SDL_VIDEO_DRIVER_X11)