1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
// Minimal WebGPU type definitions for size measurement builds.
// All types are opaque pointers, all descriptor structs are empty.
// This file is only used when STRIP_EXTERNAL_LIBS is defined.
#pragma once
#if defined(STRIP_EXTERNAL_LIBS)
#include <cstdint>
#include <cstring>
// Opaque handle types
typedef void* WGPUInstance;
typedef void* WGPUAdapter;
typedef void* WGPUSurface;
typedef void* WGPUDevice;
typedef void* WGPUQueue;
typedef void* WGPUBuffer;
typedef void* WGPUTexture;
typedef void* WGPUTextureView;
typedef void* WGPUSampler;
typedef void* WGPUShaderModule;
typedef void* WGPUBindGroupLayout;
typedef void* WGPUPipelineLayout;
typedef void* WGPUBindGroup;
typedef void* WGPURenderPipeline;
typedef void* WGPUComputePipeline;
typedef void* WGPUCommandEncoder;
typedef void* WGPURenderPassEncoder;
typedef void* WGPUComputePassEncoder;
typedef void* WGPUCommandBuffer;
typedef void* WGPUQuerySet;
typedef void* WGPURenderBundle;
typedef void* WGPURenderBundleEncoder;
// Enums (minimal values)
typedef enum {
WGPUTextureFormat_Undefined = 0,
WGPUTextureFormat_BGRA8Unorm = 1,
WGPUTextureFormat_RGBA8Unorm = 2,
} WGPUTextureFormat;
typedef enum {
WGPUBufferBindingType_Uniform = 0,
WGPUBufferBindingType_Storage = 1,
WGPUBufferBindingType_ReadOnlyStorage = 2,
} WGPUBufferBindingType;
typedef enum {
WGPULoadOp_Undefined = 0,
WGPULoadOp_Load = 1,
WGPULoadOp_Clear = 2,
} WGPULoadOp;
typedef enum {
WGPUStoreOp_Store = 0,
WGPUStoreOp_Discard = 1,
} WGPUStoreOp;
typedef enum {
WGPUSurfaceGetCurrentTextureStatus_Success = 0,
WGPUSurfaceGetCurrentTextureStatus_Timeout = 1,
WGPUSurfaceGetCurrentTextureStatus_Outdated = 2,
WGPUSurfaceGetCurrentTextureStatus_Lost = 3,
} WGPUSurfaceGetCurrentTextureStatus;
// Buffer usage flags
#define WGPUBufferUsage_MapRead 0x00000001
#define WGPUBufferUsage_MapWrite 0x00000002
#define WGPUBufferUsage_CopySrc 0x00000004
#define WGPUBufferUsage_CopyDst 0x00000008
#define WGPUBufferUsage_Index 0x00000010
#define WGPUBufferUsage_Vertex 0x00000020
#define WGPUBufferUsage_Uniform 0x00000040
#define WGPUBufferUsage_Storage 0x00000080
#define WGPUBufferUsage_Indirect 0x00000100
#define WGPUBufferUsage_QueryResolve 0x00000200
// Descriptor structs (all empty)
struct WGPUInstanceDescriptor {};
struct WGPUAdapterInfo {};
struct WGPUSurfaceConfiguration {};
struct WGPUDeviceDescriptor {};
struct WGPUBufferDescriptor {};
struct WGPUTextureDescriptor {};
struct WGPUTextureViewDescriptor {};
struct WGPUSamplerDescriptor {};
struct WGPUShaderModuleDescriptor {};
struct WGPUShaderSourceWGSL {};
struct WGPUShaderModuleWGSLDescriptor {};
struct WGPUBindGroupLayoutDescriptor {};
struct WGPUBindGroupLayoutEntry {};
struct WGPUPipelineLayoutDescriptor {};
struct WGPUBindGroupDescriptor {};
struct WGPUBindGroupEntry {};
struct WGPURenderPipelineDescriptor {};
struct WGPUComputePipelineDescriptor {};
struct WGPUVertexState {};
struct WGPUFragmentState {};
struct WGPUColorTargetState {};
struct WGPUBlendState {};
struct WGPUPrimitiveState {};
struct WGPUMultisampleState {};
struct WGPUDepthStencilState {};
struct WGPURenderPassDescriptor {};
struct WGPURenderPassColorAttachment {
WGPUTextureView view;
WGPULoadOp loadOp;
WGPUStoreOp storeOp;
struct {
float r, g, b, a;
} clearValue;
uint32_t depthSlice;
};
struct WGPUComputePassDescriptor {};
struct WGPUCommandEncoderDescriptor {};
struct WGPUCommandBufferDescriptor {};
struct WGPUSurfaceTexture {
WGPUTexture texture;
WGPUSurfaceGetCurrentTextureStatus status;
};
struct WGPUColor {
float r, g, b, a;
};
struct WGPUExtent3D {
uint32_t width, height, depthOrArrayLayers;
};
struct WGPUOrigin3D {
uint32_t x, y, z;
};
struct WGPUImageCopyTexture {};
struct WGPUImageCopyBuffer {};
struct WGPUTextureDataLayout {};
struct WGPUBufferBindingLayout {};
struct WGPUSamplerBindingLayout {};
struct WGPUTextureBindingLayout {};
struct WGPUStorageTextureBindingLayout {};
// String view helper (for compatibility)
struct WGPUStringView {
const char* data;
size_t length;
};
static inline WGPUStringView str_view(const char* str) {
if (!str)
return {nullptr, 0};
return {str, strlen(str)};
}
static inline WGPUStringView label_view(const char* str) {
(void)str;
return {nullptr, 0};
}
// Platform shims (no-ops)
static inline void platform_wgpu_wait_any(WGPUInstance) {
}
static inline void platform_wgpu_set_error_callback(WGPUDevice, void*) {
}
// Constants
#define WGPU_DEPTH_SLICE_UNDEFINED 0xffffffff
#define WGPUOptionalBool_True true
#define WGPUOptionalBool_False false
// Callback types (empty)
typedef void (*WGPUErrorCallback)(void*, void*, const char*);
typedef void (*WGPUUncapturedErrorCallback)(void*, void*, const char*);
#endif // STRIP_EXTERNAL_LIBS
|