GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
lib_webgpu.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef __EMSCRIPTEN__
4#include <emscripten/html5.h>
5#endif
6
7#ifdef __clang__
8// The internal struct member offset layout is extremely important when marshalling structs to JS,
9// so never let the compiler add any padding (we manually & explicitly make the fields the right size)
10#pragma clang diagnostic push
11#elif defined(_MSC_VER)
12#pragma warning(push)
13#endif
14
15#ifdef __clang__
16#pragma clang diagnostic error "-Wpadded"
17#endif
18
19#ifdef _MSC_VER
20#pragma warning(disable : 4200) // Disable MSVC complaining about zero-sized arrays for copy/move assignment in WGpuCompilationInfo
21#endif
22
23#include "lib_webgpu_fwd.h"
24
25// Some WebGPU JS API functions have default parameters so that the user can omit passing them.
26// These defaults are carried through to these headers. However C does not support default parameters to
27// functions, so enable the default parameters only when called from C++ code.
28#ifdef __cplusplus
29#define _WGPU_DEFAULT_VALUE(x) = x
30#else
31#define _WGPU_DEFAULT_VALUE(x)
32#endif
33
34#ifdef __GNUC__
35#define WGPU_NAN __builtin_nan("")
36#define WGPU_INFINITY __builtin_inf()
37#else
38#include <math.h>
39#define WGPU_NAN ((double)NAN)
40#define WGPU_INFINITY ((double)INFINITY)
41#endif
42
43#ifndef __EMSCRIPTEN__
44#define EM_BOOL int
45#define EM_TRUE 1
46#define EM_FALSE 0
47#endif
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53
54// Returns the number of WebGPU objects referenced by the WebGPU JS library.
55uint32_t wgpu_get_num_live_objects(void);
56
57// Calls .destroy() on the given WebGPU object (if it has such a member function) and releases the JS side reference to it. Use this function
58// to release memory for all types of WebGPU objects after you are done with them.
59// Note that deleting a GPUTexture will also delete all GPUTextureViews that have been created from it.
60// Similar to free(), calling wgpu_object_destroy() on null, or an object that has already been destroyed before is safe, and no-op. (so no need to
61// do excess "if (wgpuObject) wgpu_object_destroy(wgpuObject);")
62void wgpu_object_destroy(WGpuObjectBase wgpuObject);
63
64// Deinitializes all initialized WebGPU objects.
66
67// Acquires a canvas context from a canvas by calling canvas.getCanvasContext().
68#ifdef __EMSCRIPTEN__
70#elif defined (_WIN32)
72#else
73#error Targeting currently unsupported platform! (no declaration for wgpu_canvas_get_webgpu_context())
74#endif
75
77// The ordering and structure of this remainder of this file follows the official WebGPU WebIDL definitions at https://www.w3.org/TR/webgpu/#idl-index
78// This is so that when the official IDL is modified, the modifications can be easily diffed here for updates.
79
80/*
81interface mixin GPUObjectBase {
82 attribute USVString label;
83};
84*/
85// Returns true if the given handle references a valid WebGPU object
87// Set a human-readable label for the given WebGPU object. Pass an empty string "" to clear a label.
88void wgpu_object_set_label(WGpuObjectBase obj, const char *label NOTNULL);
89// Gets the human-readable label of a WebGPU object. If dstLabelSize is too short to
90// contain the label string, then the label is truncated.
91// dstLabelSize: length of dstLabel array in bytes.
92// Returns the number of bytes written (excluding null byte at end).
93int wgpu_object_get_label(WGpuObjectBase obj, char *dstLabel NOTNULL, uint32_t dstLabelSize);
94
95/*
96dictionary GPUObjectDescriptorBase {
97 USVString label;
98};
99*/
100#define WGPU_OBJECT_LABEL_MAX_LENGTH 256
101typedef struct WGpuObjectDescriptorBase // TODO: Currently unused. Actually use this, or remove
102{
105
106/*
107dictionary GPUExtent3DDict {
108 required GPUIntegerCoordinate width;
109 GPUIntegerCoordinate height = 1;
110 GPUIntegerCoordinate depthOrArrayLayers = 1;
111};
112typedef (sequence<GPUIntegerCoordinate> or GPUExtent3DDict) GPUExtent3D;
113*/
114typedef struct WGpuExtent3D
115{
116 int width;
117 int height; // = 1;
121
122/*
123[Exposed=(Window, DedicatedWorker)]
124interface GPUSupportedLimits {
125 readonly attribute unsigned long maxTextureDimension1D;
126 readonly attribute unsigned long maxTextureDimension2D;
127 readonly attribute unsigned long maxTextureDimension3D;
128 readonly attribute unsigned long maxTextureArrayLayers;
129 readonly attribute unsigned long maxBindGroups;
130 readonly attribute unsigned long maxBindGroupsPlusVertexBuffers;
131 readonly attribute unsigned long maxBindingsPerBindGroup;
132 readonly attribute unsigned long maxDynamicUniformBuffersPerPipelineLayout;
133 readonly attribute unsigned long maxDynamicStorageBuffersPerPipelineLayout;
134 readonly attribute unsigned long maxSampledTexturesPerShaderStage;
135 readonly attribute unsigned long maxSamplersPerShaderStage;
136 readonly attribute unsigned long maxStorageBuffersPerShaderStage;
137 readonly attribute unsigned long maxStorageTexturesPerShaderStage;
138 readonly attribute unsigned long maxUniformBuffersPerShaderStage;
139 readonly attribute unsigned long long maxUniformBufferBindingSize;
140 readonly attribute unsigned long long maxStorageBufferBindingSize;
141 readonly attribute unsigned long minUniformBufferOffsetAlignment;
142 readonly attribute unsigned long minStorageBufferOffsetAlignment;
143 readonly attribute unsigned long maxVertexBuffers;
144 readonly attribute unsigned long long maxBufferSize;
145 readonly attribute unsigned long maxVertexAttributes;
146 readonly attribute unsigned long maxVertexBufferArrayStride;
147 readonly attribute unsigned long maxInterStageShaderComponents;
148 readonly attribute unsigned long maxInterStageShaderVariables;
149 readonly attribute unsigned long maxColorAttachments;
150 readonly attribute unsigned long maxColorAttachmentBytesPerSample;
151 readonly attribute unsigned long maxComputeWorkgroupStorageSize;
152 readonly attribute unsigned long maxComputeInvocationsPerWorkgroup;
153 readonly attribute unsigned long maxComputeWorkgroupSizeX;
154 readonly attribute unsigned long maxComputeWorkgroupSizeY;
155 readonly attribute unsigned long maxComputeWorkgroupSizeZ;
156 readonly attribute unsigned long maxComputeWorkgroupsPerDimension;
157};
158*/
160{
161 // See the table in https://www.w3.org/TR/webgpu/#limits for the minimum/maximum
162 // default values for these limits.
163
164 // 64-bit fields must be present first before the 32-bit fields in this struct.
165 uint64_t maxUniformBufferBindingSize; // required >= 16384
166 uint64_t maxStorageBufferBindingSize; // required >= 128*1024*1024 (128MB)
167 uint64_t maxBufferSize; // required >= 256*1024*1024 (256MB)
168
169 uint32_t maxTextureDimension1D; // required >= 8192
170 uint32_t maxTextureDimension2D; // required >= 8192
171 uint32_t maxTextureDimension3D; // required >= 2048
172 uint32_t maxTextureArrayLayers; // required >= 2048
173 uint32_t maxBindGroups; // required >= 4
174 uint32_t maxBindGroupsPlusVertexBuffers; // required >= 24
175 uint32_t maxBindingsPerBindGroup; // required >= 640
178 uint32_t maxSampledTexturesPerShaderStage; // required >= 16
179 uint32_t maxSamplersPerShaderStage; // required >= 16
180 uint32_t maxStorageBuffersPerShaderStage; // required >= 8
181 uint32_t maxStorageTexturesPerShaderStage; // required >= 8
182 uint32_t maxUniformBuffersPerShaderStage; // required >= 12
183 uint32_t minUniformBufferOffsetAlignment; // required >= 256 bytes
184 uint32_t minStorageBufferOffsetAlignment; // required >= 256 bytes
185 uint32_t maxVertexBuffers; // required >= 8
186 uint32_t maxVertexAttributes; // required >= 16
187 uint32_t maxVertexBufferArrayStride; // required >= 2048
188 uint32_t maxInterStageShaderComponents; // required >= 60
189 uint32_t maxInterStageShaderVariables; // required >= 16
190 uint32_t maxColorAttachments; // required >= 8
191 uint32_t maxColorAttachmentBytesPerSample; // required >= 32
192 uint32_t maxComputeWorkgroupStorageSize; // required >= 16384 bytes
193 uint32_t maxComputeInvocationsPerWorkgroup; // required >= 256
194 uint32_t maxComputeWorkgroupSizeX; // required >= 256
195 uint32_t maxComputeWorkgroupSizeY; // required >= 256
196 uint32_t maxComputeWorkgroupSizeZ; // required >= 64
198
199/*
200[Exposed=(Window, DedicatedWorker)]
201interface GPUSupportedFeatures {
202 readonly setlike<DOMString>;
203};
204*/
205/*
206enum GPUFeatureName {
207 "depth-clip-control",
208 "depth32float-stencil8",
209 "texture-compression-bc",
210 "texture-compression-etc2",
211 "texture-compression-astc",
212 "timestamp-query",
213 "indirect-first-instance",
214 "shader-f16",
215 "rg11b10ufloat-renderable",
216 "bgra8unorm-storage",
217 "float32-filterable",
218};
219*/
221#define WGPU_FEATURE_DEPTH_CLIP_CONTROL 0x01
222#define WGPU_FEATURE_DEPTH32FLOAT_STENCIL8 0x02
223#define WGPU_FEATURE_TEXTURE_COMPRESSION_BC 0x04
224#define WGPU_FEATURE_TEXTURE_COMPRESSION_ETC2 0x08
225#define WGPU_FEATURE_TEXTURE_COMPRESSION_ASTC 0x10
226#define WGPU_FEATURE_TIMESTAMP_QUERY 0x20
227#define WGPU_FEATURE_INDIRECT_FIRST_INSTANCE 0x40
228#define WGPU_FEATURE_SHADER_F16 0x80
229#define WGPU_FEATURE_RG11B10UFLOAT_RENDERABLE 0x100
230#define WGPU_FEATURE_BGRA8UNORM_STORAGE 0x200
231#define WGPU_FEATURE_FLOAT32_FILTERABLE 0x400
232
233/*
234// WebGPU reuses the color space enum from the HTML Canvas specification:
235 https://html.spec.whatwg.org/multipage/canvas.html#predefinedcolorspace
236 Because of that reason, it is prefixed here with HTML_ as opposed to WGPU_.
237enum PredefinedColorSpace {
238 "srgb",
239 "display-p3"
240};
241*/
243#define HTML_PREDEFINED_COLOR_SPACE_INVALID 0
244#define HTML_PREDEFINED_COLOR_SPACE_SRGB 1
245#define HTML_PREDEFINED_COLOR_SPACE_DISPLAY_P3 2
246
247/*
248[Exposed=(Window, DedicatedWorker), SecureContext]
249interface GPUAdapterInfo {
250 readonly attribute DOMString vendor;
251 readonly attribute DOMString architecture;
252 readonly attribute DOMString device;
253 readonly attribute DOMString description;
254};
255*/
256typedef struct WGpuAdapterInfo
257{
258 char vendor[512];
259 char architecture[512];
260 char device[512];
261 char description[512];
263
264/*
265interface mixin NavigatorGPU {
266 [SameObject, SecureContext] readonly attribute GPU gpu;
267};
268Navigator includes NavigatorGPU;
269WorkerNavigator includes NavigatorGPU;
270
271[Exposed=(Window, DedicatedWorker), SecureContext]
272interface WGSLLanguageFeatures {
273 readonly setlike<DOMString>;
274};
275
276[Exposed=(Window, DedicatedWorker), SecureContext]
277interface GPU {
278 Promise<GPUAdapter?> requestAdapter(optional GPURequestAdapterOptions options = {});
279 GPUTextureFormat getPreferredCanvasFormat();
280 [SameObject] readonly attribute WGSLLanguageFeatures wgslLanguageFeatures;
281};
282*/
283// Returns true if the browser is advertising to be WebGPU-aware. This means that the browser in question is shipping with WebGPU available, but does not
284// necessarily mean that there would exist any WebGPU adapters or devices that are supported. The only way to know if WebGPU is actually possible will
285// be to try to request and adapter and then a device.
287
288// This function can be used to remove access to WebGPU API on the current JS page. This can be useful for debugging or sandboxing purposes. Note that
289// if the page has already initialized a WebGPU context, then the context is not affected. Amounts to a 'delete navigator.gpu' operation.
290// After calling this function navigator_gpu_available() will return false.
292
293typedef void (*WGpuRequestAdapterCallback)(WGpuAdapter adapter, void *userData);
294// Requests an adapter from the user agent. The user agent chooses whether to return an adapter, and, if so, chooses according to the provided options.
295// If WebGPU is not supported by the browser, returns EM_FALSE.
296// Otherwise returns EM_TRUE, and the callback will resolve later with an ID handle to the adapter.
297// The callback will also be resolved in the event of an initialization failure, but the ID handle
298// passed to the callback will then be zero.
299// options: may be null to request an adapter without specific options.
300// Note: If the current browser is not aware of the WebGPU API, then this function will by design abort execution
301// (fail on assert, and throw a JS exception in release builds). To gracefully detect whether the current browser is new enough to be WebGPU API aware,
302// call the function navigator_gpu_available() to check.
304// Requests a WebGPU adapter synchronously. Requires building with -sASYNCIFY=1 linker flag to work.
305// options: may be null to request an adapter without specific options.
307
308// Like above, but tiny code size without options.
311
313
314// Returns an array of strings representing supported WGSL language features. The array of strings is terminated by a null string.
315// If you do not need to enumerate though all supported language features, you can use the simpler navigator_gpu_is_wgsl_language_feature_supported()
316// function.
318// Tests if the given WGSL language feature is supported. (the given feature string exists in navigator.gpu.wgslLanguageFeatures set).
319// If this information is needed often (e.g. in an inner loop of a shader cross-compiler), then it is recommended to cache the return value,
320// since the supported WGSL language features will not change during page lifetime.
322/*
323dictionary GPURequestAdapterOptions {
324 GPUPowerPreference powerPreference;
325 boolean forceFallbackAdapter = false;
326};
327*/
329{
330 // Optionally provides a hint indicating what class of adapter should be selected from the system’s available adapters.
331 // The value of this hint may influence which adapter is chosen, but it must not influence whether an adapter is returned or not.
332 // Note: The primary utility of this hint is to influence which GPU is used in a multi-GPU system. For instance, some laptops
333 // have a low-power integrated GPU and a high-performance discrete GPU.
334 // Note: Depending on the exact hardware configuration, such as battery status and attached displays or removable GPUs, the user
335 // agent may select different adapters given the same power preference. Typically, given the same hardware configuration and
336 // state and powerPreference, the user agent is likely to select the same adapter.
341
342/*
343enum GPUPowerPreference {
344 "low-power",
345 "high-performance"
346};
347*/
349#define WGPU_POWER_PREFERENCE_INVALID 0
350#define WGPU_POWER_PREFERENCE_LOW_POWER 1
351#define WGPU_POWER_PREFERENCE_HIGH_PERFORMANCE 2
352
353/*
354[Exposed=(Window, DedicatedWorker), SecureContext]
355interface GPUAdapter {
356 [SameObject] readonly attribute GPUSupportedFeatures features;
357 [SameObject] readonly attribute WGpuSupportedLimits limits;
358 readonly attribute boolean isFallbackAdapter;
359
360 Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
361 Promise<GPUAdapterInfo> requestAdapterInfo(optional sequence<DOMString> unmaskHints = []);
362};
363*/
365// Returns true if the given handle references a valid GPUAdapter.
367
368// Returns a bitfield of all the supported features on this adapter.
370#define wgpu_adapter_get_features wgpu_adapter_or_device_get_features
371
372// Returns true if the given feature is supported by this adapter.
374#define wgpu_adapter_supports_feature wgpu_adapter_or_device_supports_feature
375
376// Populates the adapter.limits field of the given adapter to the provided structure.
378#define wgpu_adapter_get_limits wgpu_adapter_or_device_get_limits
379
381
382typedef void (*WGpuRequestDeviceCallback)(WGpuDevice device, void *userData);
383
384void wgpu_adapter_request_device_async(WGpuAdapter adapter, const WGpuDeviceDescriptor *descriptor NOTNULL, WGpuRequestDeviceCallback deviceCallback, void *userData);
385// Requests a WebGPU device synchronously. Requires building with -sASYNCIFY=1 linker flag to work.
387
388// Like above, but tiny code size without options.
391
392// Callback function type that is called when GPUAdapter information has been obtained. The information will be reported in a struct of
393// type WGpuAdapterInfo. Do not hold on to this struct pointer after the duration of this call (but make a copy of the contents if desirable)
394typedef void (*WGpuRequestAdapterInfoCallback)(WGpuAdapter adapter, const WGpuAdapterInfo *adapterInfo NOTNULL, void *userData);
395
396// Begins a process to asynchronously request GPUAdapter information. 'unmaskHints' should be a null-terminated array of null-terminated strings
397// of which information to retrieve, e.g. { "vendor", "architecture", "device", "description", 0 }.
398void wgpu_adapter_request_adapter_info_async(WGpuAdapter adapter, const char **unmaskHints, WGpuRequestAdapterInfoCallback callback, void *userData);
399// TODO: Create asyncified wgpu_adapter_request_adapter_info_sync() function.
400
401/*
402dictionary GPUQueueDescriptor : GPUObjectDescriptorBase {
403};
404*/
406{
407 const char *label;
409
410/*
411dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase {
412 sequence<GPUFeatureName> requiredFeatures = [];
413 record<DOMString, GPUSize64> requiredLimits = {};
414 GPUQueueDescriptor defaultQueue = {};
415};
416*/
426
427/*
428[Exposed=(Window, DedicatedWorker), SecureContext]
429interface GPUDevice : EventTarget {
430 [SameObject] readonly attribute GPUSupportedFeatures features;
431 [SameObject] readonly attribute GPUSupportedLimits limits;
432
433 [SameObject] readonly attribute GPUQueue queue;
434
435 undefined destroy();
436
437 GPUBuffer createBuffer(GPUBufferDescriptor descriptor);
438 GPUTexture createTexture(GPUTextureDescriptor descriptor);
439 GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {});
440 GPUExternalTexture importExternalTexture(GPUExternalTextureDescriptor descriptor);
441
442 GPUBindGroupLayout createBindGroupLayout(GPUBindGroupLayoutDescriptor descriptor);
443 GPUPipelineLayout createPipelineLayout(GPUPipelineLayoutDescriptor descriptor);
444 GPUBindGroup createBindGroup(GPUBindGroupDescriptor descriptor);
445
446 GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor);
447 GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor);
448 GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor);
449 Promise<GPUComputePipeline> createComputePipelineAsync(GPUComputePipelineDescriptor descriptor);
450 Promise<GPURenderPipeline> createRenderPipelineAsync(GPURenderPipelineDescriptor descriptor);
451
452 GPUCommandEncoder createCommandEncoder(optional GPUCommandEncoderDescriptor descriptor = {});
453 GPURenderBundleEncoder createRenderBundleEncoder(GPURenderBundleEncoderDescriptor descriptor);
454
455 GPUQuerySet createQuerySet(GPUQuerySetDescriptor descriptor);
456};
457GPUDevice includes GPUObjectBase;
458*/
460// Returns true if the given handle references a valid GPUDevice.
462
463#define wgpu_device_get_features wgpu_adapter_or_device_get_features
464#define wgpu_device_supports_feature wgpu_adapter_or_device_supports_feature
465#define wgpu_device_get_limits wgpu_adapter_or_device_get_limits
466
468
469#ifdef __EMSCRIPTEN__
470void wgpu_device_tick(WGpuDevice device) __attribute__((deprecated("The function wgpu_device_tick() is not available when targeting the web. Presentation always occurs when yielding out from browser event loop.")));
471#else
472void wgpu_device_tick(WGpuDevice device);
473#endif
474
479
480// N.b. not currently using signature WGpuBindGroupLayout wgpu_device_create_bind_group_layout(WGpuDevice device, const WGpuBindGroupLayoutDescriptor *bindGroupLayoutDesc);
481// since WGpuBindGroupLayoutDescriptor is a single element struct consisting only of a single array. (if it is expanded in the future, switch to using that signature)
482WGpuBindGroupLayout wgpu_device_create_bind_group_layout(WGpuDevice device, const WGpuBindGroupLayoutEntry *bindGroupLayoutEntries, int numEntries);
483
484// N.b. not currently using signature WGpuPipelineLayout wgpu_device_create_pipeline_layout(WGpuDevice device, const WGpuPipelineLayoutDescriptor *pipelineLayoutDesc);
485// since WGpuPipelineLayoutDescriptor is a single element struct consisting only of a single array. (if it is expanded in the future, switch to using that signature)
486WGpuPipelineLayout wgpu_device_create_pipeline_layout(WGpuDevice device, const WGpuBindGroupLayout *bindGroupLayouts, int numLayouts);
487
488// N.b. not currently using signature WGpuBindGroup wgpu_device_create_bind_group(WGpuDevice device, const WGpuBindGroupDescriptor *bindGroupDesc);
489// since WGpuBindGroupDescriptor is a such a light struct. (if it is expanded in the future, switch to using that signature)
490WGpuBindGroup wgpu_device_create_bind_group(WGpuDevice device, WGpuBindGroupLayout bindGroupLayout, const WGpuBindGroupEntry *entries, int numEntries);
491
493
494/*
495[Exposed=(Window, DedicatedWorker), SecureContext, Serializable]
496interface GPUPipelineError : DOMException {
497 constructor(optional DOMString message = "", GPUPipelineErrorInit options);
498 readonly attribute GPUPipelineErrorReason reason;
499};
500
501dictionary GPUPipelineErrorInit {
502 required GPUPipelineErrorReason reason;
503};
504
505enum GPUPipelineErrorReason {
506 "validation",
507 "internal",
508};
509*/
510typedef struct WGpuPipelineError
511{
512 const char *name; // The name of the DOMException type that represents this error.
513 const char *message; // A possibly human-readable message or description of the error.
514 const char *reason; // One of GPUPipelineErrorReason values.
516
517// When this callback fires, on success the 'pipeline' parameter is nonzero.
518// On failure, pipeline is 0, and in WEBGPU_DEBUG builds 'error' parameter identifies details about the failure. (in release builds the error parameter will be null)
520
521// N.b. not currently using signature WGpuComputePipeline wgpu_device_create_compute_pipeline(WGpuDevice device, const WGpuComputePipelineDescriptor *computePipelineDesc);
522// since WGpuComputePipelineDescriptor is a such a light struct. (if it is expanded in the future, switch to using that signature)
524void wgpu_device_create_compute_pipeline_async(WGpuDevice device, WGpuShaderModule computeModule, const char *entryPoint NOTNULL, WGpuPipelineLayout layout, const WGpuPipelineConstant *constants, int numConstants, WGpuCreatePipelineCallback callback, void *userData);
525
528
530// Same as above, but without any descriptor args.
532
534
536
537/*
538[Exposed=(Window, DedicatedWorker), SecureContext]
539interface GPUBuffer {
540 readonly attribute GPUSize64Out size;
541 readonly attribute GPUFlagsConstant usage;
542
543 readonly attribute GPUBufferMapState mapState;
544
545 Promise<undefined> mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size);
546 ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size);
547 undefined unmap();
548
549 undefined destroy();
550};
551GPUBuffer includes GPUObjectBase;
552*/
554// Returns true if the given handle references a valid GPUBuffer.
556
557// TODO: Add error status to map callback for when mapAsync() promise rejects.
558typedef void (*WGpuBufferMapCallback)(WGpuBuffer buffer, void *userData, WGPU_MAP_MODE_FLAGS mode, double_int53_t offset, double_int53_t size);
559#define WGPU_MAX_SIZE -1
561
562// Maps the given WGpuBuffer synchronously. Requires building with -sASYNCIFY=1 linker flag to work.
564
565#define WGPU_BUFFER_GET_MAPPED_RANGE_FAILED ((double_int53_t)-1)
566
567// Calls buffer.getMappedRange(). Returns `startOffset`, which is used as an ID token to wgpu_buffer_read/write_mapped_range().
568// If .getMappedRange() fails, the value WGPU_BUFFER_GET_MAPPED_RANGE_FAILED (-1) will be returned.
572void wgpu_buffer_unmap(WGpuBuffer buffer);
573
574// Getters for retrieving buffer properties:
578
579/*
580enum GPUBufferMapState {
581 "unmapped",
582 "pending",
583 "mapped"
584};
585*/
587#define WGPU_BUFFER_MAP_STATE_INVALID 0
588#define WGPU_BUFFER_MAP_STATE_UNMAPPED 1
589#define WGPU_BUFFER_MAP_STATE_PENDING 2
590#define WGPU_BUFFER_MAP_STATE_MAPPED 3
591
592/*
593dictionary GPUBufferDescriptor : GPUObjectDescriptorBase {
594 required GPUSize64 size;
595 required GPUBufferUsageFlags usage;
596 boolean mappedAtCreation = false;
597};
598*/
600{
601 uint64_t size;
603 EM_BOOL mappedAtCreation; // Note: it is valid to set mappedAtCreation to true without MAP_READ or MAP_WRITE in usage. This can be used to set the buffer’s initial data.
605
606/*
607typedef [EnforceRange] unsigned long GPUBufferUsageFlags;
608[Exposed=(Window, DedicatedWorker)]
609namespace GPUBufferUsage {
610 const GPUFlagsConstant MAP_READ = 0x0001;
611 const GPUFlagsConstant MAP_WRITE = 0x0002;
612 const GPUFlagsConstant COPY_SRC = 0x0004;
613 const GPUFlagsConstant COPY_DST = 0x0008;
614 const GPUFlagsConstant INDEX = 0x0010;
615 const GPUFlagsConstant VERTEX = 0x0020;
616 const GPUFlagsConstant UNIFORM = 0x0040;
617 const GPUFlagsConstant STORAGE = 0x0080;
618 const GPUFlagsConstant INDIRECT = 0x0100;
619 const GPUFlagsConstant QUERY_RESOLVE = 0x0200;
620};
621*/
623#define WGPU_BUFFER_USAGE_MAP_READ 0x0001
624#define WGPU_BUFFER_USAGE_MAP_WRITE 0x0002
625#define WGPU_BUFFER_USAGE_COPY_SRC 0x0004
626#define WGPU_BUFFER_USAGE_COPY_DST 0x0008
627#define WGPU_BUFFER_USAGE_INDEX 0x0010
628#define WGPU_BUFFER_USAGE_VERTEX 0x0020
629#define WGPU_BUFFER_USAGE_UNIFORM 0x0040
630#define WGPU_BUFFER_USAGE_STORAGE 0x0080
631#define WGPU_BUFFER_USAGE_INDIRECT 0x0100
632#define WGPU_BUFFER_USAGE_QUERY_RESOLVE 0x0200
633
634/*
635typedef [EnforceRange] unsigned long GPUMapModeFlags;
636[Exposed=(Window, DedicatedWorker)]
637namespace GPUMapMode {
638 const GPUFlagsConstant READ = 0x0001;
639 const GPUFlagsConstant WRITE = 0x0002;
640};
641*/
643#define WGPU_MAP_MODE_READ 0x1
644#define WGPU_MAP_MODE_WRITE 0x2
645
646/*
647[Exposed=(Window, DedicatedWorker), SecureContext]
648interface GPUTexture {
649 GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {});
650
651 undefined destroy();
652
653 readonly attribute GPUIntegerCoordinate width;
654 readonly attribute GPUIntegerCoordinate height;
655 readonly attribute GPUIntegerCoordinate depthOrArrayLayers;
656 readonly attribute GPUIntegerCoordinate mipLevelCount;
657 readonly attribute GPUSize32 sampleCount;
658 readonly attribute GPUTextureDimension dimension;
659 readonly attribute GPUTextureFormat format;
660 readonly attribute GPUFlagsConstant usage;
661};
662GPUTexture includes GPUObjectBase;
663*/
665// Returns true if the given handle references a valid GPUTexture.
667// textureViewDesc: Can be null, in which case a default view is created.
669// Same as above, but does not take any descriptor args.
671
672// Getters for retrieving texture properties:
673uint32_t wgpu_texture_width(WGpuTexture texture);
674uint32_t wgpu_texture_height(WGpuTexture texture);
677uint32_t wgpu_texture_sample_count(WGpuTexture texture);
681/*
682dictionary GPUTextureDescriptor : GPUObjectDescriptorBase {
683 required GPUExtent3D size;
684 GPUIntegerCoordinate mipLevelCount = 1;
685 GPUSize32 sampleCount = 1;
686 GPUTextureDimension dimension = "2d";
687 required GPUTextureFormat format;
688 required GPUTextureUsageFlags usage;
689 sequence<GPUTextureFormat> viewFormats = [];
690};
691*/
693{
694 uint32_t width;
695 uint32_t height; // default = 1;
696 uint32_t depthOrArrayLayers; // default = 1;
697 uint32_t mipLevelCount; // default = 1;
698 uint32_t sampleCount; // default = 1;
699 WGPU_TEXTURE_DIMENSION dimension; // default = WGPU_TEXTURE_DIMENSION_2D
706
707/*
708enum GPUTextureDimension {
709 "1d",
710 "2d",
711 "3d",
712};
713*/
715#define WGPU_TEXTURE_DIMENSION_INVALID 0
716#define WGPU_TEXTURE_DIMENSION_1D 1
717#define WGPU_TEXTURE_DIMENSION_2D 2
718#define WGPU_TEXTURE_DIMENSION_3D 3
719
720/*
721typedef [EnforceRange] unsigned long GPUTextureUsageFlags;
722[Exposed=(Window, DedicatedWorker)]
723namespace GPUTextureUsage {
724 const GPUFlagsConstant COPY_SRC = 0x01;
725 const GPUFlagsConstant COPY_DST = 0x02;
726 const GPUFlagsConstant TEXTURE_BINDING = 0x04;
727 const GPUFlagsConstant STORAGE_BINDING = 0x08;
728 const GPUFlagsConstant RENDER_ATTACHMENT = 0x10;
729};
730*/
732#define WGPU_TEXTURE_USAGE_COPY_SRC 0x01
733#define WGPU_TEXTURE_USAGE_COPY_DST 0x02
734#define WGPU_TEXTURE_USAGE_TEXTURE_BINDING 0x04
735#define WGPU_TEXTURE_USAGE_STORAGE_BINDING 0x08
736#define WGPU_TEXTURE_USAGE_RENDER_ATTACHMENT 0x10
737
738/*
739[Exposed=(Window, DedicatedWorker), SecureContext]
740interface GPUTextureView {
741};
742GPUTextureView includes GPUObjectBase;
743*/
745// Returns true if the given handle references a valid GPUTextureView.
747
748
749/*
750dictionary GPUTextureViewDescriptor : GPUObjectDescriptorBase {
751 GPUTextureFormat format;
752 GPUTextureViewDimension dimension;
753 GPUTextureAspect aspect = "all";
754 GPUIntegerCoordinate baseMipLevel = 0;
755 GPUIntegerCoordinate mipLevelCount;
756 GPUIntegerCoordinate baseArrayLayer = 0;
757 GPUIntegerCoordinate arrayLayerCount;
758};
759*/
771
772/*
773enum GPUTextureViewDimension {
774 "1d",
775 "2d",
776 "2d-array",
777 "cube",
778 "cube-array",
779 "3d"
780};
781*/
783#define WGPU_TEXTURE_VIEW_DIMENSION_INVALID 0
784#define WGPU_TEXTURE_VIEW_DIMENSION_1D 1
785#define WGPU_TEXTURE_VIEW_DIMENSION_2D 2
786#define WGPU_TEXTURE_VIEW_DIMENSION_2D_ARRAY 3
787#define WGPU_TEXTURE_VIEW_DIMENSION_CUBE 4
788#define WGPU_TEXTURE_VIEW_DIMENSION_CUBE_ARRAY 5
789#define WGPU_TEXTURE_VIEW_DIMENSION_3D 6
790
791/*
792enum GPUTextureAspect {
793 "all",
794 "stencil-only",
795 "depth-only"
796};
797*/
799#define WGPU_TEXTURE_ASPECT_INVALID 0
800#define WGPU_TEXTURE_ASPECT_ALL 1
801#define WGPU_TEXTURE_ASPECT_STENCIL_ONLY 2
802#define WGPU_TEXTURE_ASPECT_DEPTH_ONLY 3
803
804/*
805enum GPUTextureFormat {
806 // 8-bit formats
807 "r8unorm",
808 "r8snorm",
809 "r8uint",
810 "r8sint",
811
812 // 16-bit formats
813 "r16uint",
814 "r16sint",
815 "r16float",
816 "rg8unorm",
817 "rg8snorm",
818 "rg8uint",
819 "rg8sint",
820
821 // 32-bit formats
822 "r32uint",
823 "r32sint",
824 "r32float",
825 "rg16uint",
826 "rg16sint",
827 "rg16float",
828 "rgba8unorm",
829 "rgba8unorm-srgb",
830 "rgba8snorm",
831 "rgba8uint",
832 "rgba8sint",
833 "bgra8unorm",
834 "bgra8unorm-srgb",
835
836 // Packed 32-bit formats
837 "rgb9e5ufloat",
838 "rgb10a2uint",
839 "rgb10a2unorm",
840 "rg11b10ufloat",
841
842 // 64-bit formats
843 "rg32uint",
844 "rg32sint",
845 "rg32float",
846 "rgba16uint",
847 "rgba16sint",
848 "rgba16float",
849
850 // 128-bit formats
851 "rgba32uint",
852 "rgba32sint",
853 "rgba32float",
854
855 // Depth/stencil formats
856 "stencil8",
857 "depth16unorm",
858 "depth24plus",
859 "depth24plus-stencil8",
860 "depth32float",
861
862 // "depth32float-stencil8" feature
863 "depth32float-stencil8",
864
865 // BC compressed formats usable if "texture-compression-bc" is both
866 // supported by the device/user agent and enabled in requestDevice.
867 "bc1-rgba-unorm",
868 "bc1-rgba-unorm-srgb",
869 "bc2-rgba-unorm",
870 "bc2-rgba-unorm-srgb",
871 "bc3-rgba-unorm",
872 "bc3-rgba-unorm-srgb",
873 "bc4-r-unorm",
874 "bc4-r-snorm",
875 "bc5-rg-unorm",
876 "bc5-rg-snorm",
877 "bc6h-rgb-ufloat",
878 "bc6h-rgb-float",
879 "bc7-rgba-unorm",
880 "bc7-rgba-unorm-srgb",
881
882 // ETC2 compressed formats usable if "texture-compression-etc2" is both
883 // supported by the device/user agent and enabled in requestDevice.
884 "etc2-rgb8unorm",
885 "etc2-rgb8unorm-srgb",
886 "etc2-rgb8a1unorm",
887 "etc2-rgb8a1unorm-srgb",
888 "etc2-rgba8unorm",
889 "etc2-rgba8unorm-srgb",
890 "eac-r11unorm",
891 "eac-r11snorm",
892 "eac-rg11unorm",
893 "eac-rg11snorm",
894
895 // ASTC compressed formats usable if "texture-compression-astc" is both
896 // supported by the device/user agent and enabled in requestDevice.
897 "astc-4x4-unorm",
898 "astc-4x4-unorm-srgb",
899 "astc-5x4-unorm",
900 "astc-5x4-unorm-srgb",
901 "astc-5x5-unorm",
902 "astc-5x5-unorm-srgb",
903 "astc-6x5-unorm",
904 "astc-6x5-unorm-srgb",
905 "astc-6x6-unorm",
906 "astc-6x6-unorm-srgb",
907 "astc-8x5-unorm",
908 "astc-8x5-unorm-srgb",
909 "astc-8x6-unorm",
910 "astc-8x6-unorm-srgb",
911 "astc-8x8-unorm",
912 "astc-8x8-unorm-srgb",
913 "astc-10x5-unorm",
914 "astc-10x5-unorm-srgb",
915 "astc-10x6-unorm",
916 "astc-10x6-unorm-srgb",
917 "astc-10x8-unorm",
918 "astc-10x8-unorm-srgb",
919 "astc-10x10-unorm",
920 "astc-10x10-unorm-srgb",
921 "astc-12x10-unorm",
922 "astc-12x10-unorm-srgb",
923 "astc-12x12-unorm",
924 "astc-12x12-unorm-srgb"
925};
926*/
928#define WGPU_TEXTURE_FORMAT_INVALID 0
929 // 8-bit formats
930#define WGPU_TEXTURE_FORMAT_R8UNORM 1
931#define WGPU_TEXTURE_FORMAT_R8SNORM 2
932#define WGPU_TEXTURE_FORMAT_R8UINT 3
933#define WGPU_TEXTURE_FORMAT_R8SINT 4
934 // 16-bit formats
935#define WGPU_TEXTURE_FORMAT_R16UINT 5
936#define WGPU_TEXTURE_FORMAT_R16SINT 6
937#define WGPU_TEXTURE_FORMAT_R16FLOAT 7
938#define WGPU_TEXTURE_FORMAT_RG8UNORM 8
939#define WGPU_TEXTURE_FORMAT_RG8SNORM 9
940#define WGPU_TEXTURE_FORMAT_RG8UINT 10
941#define WGPU_TEXTURE_FORMAT_RG8SINT 11
942 // 32-bit formats
943#define WGPU_TEXTURE_FORMAT_R32UINT 12
944#define WGPU_TEXTURE_FORMAT_R32SINT 13
945#define WGPU_TEXTURE_FORMAT_R32FLOAT 14
946#define WGPU_TEXTURE_FORMAT_RG16UINT 15
947#define WGPU_TEXTURE_FORMAT_RG16SINT 16
948#define WGPU_TEXTURE_FORMAT_RG16FLOAT 17
949#define WGPU_TEXTURE_FORMAT_RGBA8UNORM 18
950#define WGPU_TEXTURE_FORMAT_RGBA8UNORM_SRGB 19
951#define WGPU_TEXTURE_FORMAT_RGBA8SNORM 20
952#define WGPU_TEXTURE_FORMAT_RGBA8UINT 21
953#define WGPU_TEXTURE_FORMAT_RGBA8SINT 22
954#define WGPU_TEXTURE_FORMAT_BGRA8UNORM 23
955#define WGPU_TEXTURE_FORMAT_BGRA8UNORM_SRGB 24
956 // Packed 32-bit formats
957#define WGPU_TEXTURE_FORMAT_RGB9E5UFLOAT 25
958#define WGPU_TEXTURE_FORMAT_RGB10A2UINT 26
959#define WGPU_TEXTURE_FORMAT_RGB10A2UNORM 27
960#define WGPU_TEXTURE_FORMAT_RG11B10UFLOAT 28
961 // 64-bit formats
962#define WGPU_TEXTURE_FORMAT_RG32UINT 29
963#define WGPU_TEXTURE_FORMAT_RG32SINT 30
964#define WGPU_TEXTURE_FORMAT_RG32FLOAT 31
965#define WGPU_TEXTURE_FORMAT_RGBA16UINT 32
966#define WGPU_TEXTURE_FORMAT_RGBA16SINT 33
967#define WGPU_TEXTURE_FORMAT_RGBA16FLOAT 34
968 // 128-bit formats
969#define WGPU_TEXTURE_FORMAT_RGBA32UINT 35
970#define WGPU_TEXTURE_FORMAT_RGBA32SINT 36
971#define WGPU_TEXTURE_FORMAT_RGBA32FLOAT 37
972 // Depth/stencil formats
973#define WGPU_TEXTURE_FORMAT_STENCIL8 38
974#define WGPU_TEXTURE_FORMAT_DEPTH16UNORM 39
975#define WGPU_TEXTURE_FORMAT_DEPTH24PLUS 40
976#define WGPU_TEXTURE_FORMAT_DEPTH24PLUS_STENCIL8 41
977#define WGPU_TEXTURE_FORMAT_DEPTH32FLOAT 42
978#define WGPU_TEXTURE_FORMAT_DEPTH32FLOAT_STENCIL8 43
979 // BC compressed formats usable if "texture-compression-bc" is both
980 // supported by the device/user agent and enabled in requestDevice.
981#define WGPU_TEXTURE_FORMAT_BC1_RGBA_UNORM 44
982#define WGPU_TEXTURE_FORMAT_BC1_RGBA_UNORM_SRGB 45
983#define WGPU_TEXTURE_FORMAT_BC2_RGBA_UNORM 46
984#define WGPU_TEXTURE_FORMAT_BC2_RGBA_UNORM_SRGB 47
985#define WGPU_TEXTURE_FORMAT_BC3_RGBA_UNORM 48
986#define WGPU_TEXTURE_FORMAT_BC3_RGBA_UNORM_SRGB 49
987#define WGPU_TEXTURE_FORMAT_BC4_R_UNORM 50
988#define WGPU_TEXTURE_FORMAT_BC4_R_SNORM 51
989#define WGPU_TEXTURE_FORMAT_BC5_RG_UNORM 52
990#define WGPU_TEXTURE_FORMAT_BC5_RG_SNORM 53
991#define WGPU_TEXTURE_FORMAT_BC6H_RGB_UFLOAT 54
992#define WGPU_TEXTURE_FORMAT_BC6H_RGB_FLOAT 55
993#define WGPU_TEXTURE_FORMAT_BC7_RGBA_UNORM 56
994#define WGPU_TEXTURE_FORMAT_BC7_RGBA_UNORM_SRGB 57
995 // ETC2 compressed formats usable if "texture-compression-etc2" is both
996 // supported by the device/user agent and enabled in requestDevice.
997#define WGPU_TEXTURE_FORMAT_ETC2_RGB8UNORM 58
998#define WGPU_TEXTURE_FORMAT_ETC2_RGB8UNORM_SRGB 59
999#define WGPU_TEXTURE_FORMAT_ETC2_RGB8A1UNORM 60
1000#define WGPU_TEXTURE_FORMAT_ETC2_RGB8A1UNORM_SRGB 61
1001#define WGPU_TEXTURE_FORMAT_ETC2_RGBA8UNORM 62
1002#define WGPU_TEXTURE_FORMAT_ETC2_RGBA8UNORM_SRGB 63
1003#define WGPU_TEXTURE_FORMAT_EAC_R11UNORM 64
1004#define WGPU_TEXTURE_FORMAT_EAC_R11SNORM 65
1005#define WGPU_TEXTURE_FORMAT_EAC_RG11UNORM 66
1006#define WGPU_TEXTURE_FORMAT_EAC_RG11SNORM 67
1007 // ASTC compressed formats usable if "texture-compression-astc" is both
1008 // supported by the device/user agent and enabled in requestDevice.
1009#define WGPU_TEXTURE_FORMAT_ASTC_4X4_UNORM 68
1010#define WGPU_TEXTURE_FORMAT_ASTC_4X4_UNORM_SRGB 69
1011#define WGPU_TEXTURE_FORMAT_ASTC_5X4_UNORM 70
1012#define WGPU_TEXTURE_FORMAT_ASTC_5X4_UNORM_SRGB 71
1013#define WGPU_TEXTURE_FORMAT_ASTC_5X5_UNORM 72
1014#define WGPU_TEXTURE_FORMAT_ASTC_5X5_UNORM_SRGB 73
1015#define WGPU_TEXTURE_FORMAT_ASTC_6X5_UNORM 74
1016#define WGPU_TEXTURE_FORMAT_ASTC_6X5_UNORM_SRGB 75
1017#define WGPU_TEXTURE_FORMAT_ASTC_6X6_UNORM 76
1018#define WGPU_TEXTURE_FORMAT_ASTC_6X6_UNORM_SRGB 77
1019#define WGPU_TEXTURE_FORMAT_ASTC_8X5_UNORM 78
1020#define WGPU_TEXTURE_FORMAT_ASTC_8X5_UNORM_SRGB 79
1021#define WGPU_TEXTURE_FORMAT_ASTC_8X6_UNORM 80
1022#define WGPU_TEXTURE_FORMAT_ASTC_8X6_UNORM_SRGB 81
1023#define WGPU_TEXTURE_FORMAT_ASTC_8X8_UNORM 82
1024#define WGPU_TEXTURE_FORMAT_ASTC_8X8_UNORM_SRGB 83
1025#define WGPU_TEXTURE_FORMAT_ASTC_10X5_UNORM 84
1026#define WGPU_TEXTURE_FORMAT_ASTC_10X5_UNORM_SRGB 85
1027#define WGPU_TEXTURE_FORMAT_ASTC_10X6_UNORM 86
1028#define WGPU_TEXTURE_FORMAT_ASTC_10X6_UNORM_SRGB 87
1029#define WGPU_TEXTURE_FORMAT_ASTC_10X8_UNORM 88
1030#define WGPU_TEXTURE_FORMAT_ASTC_10X8_UNORM_SRGB 89
1031#define WGPU_TEXTURE_FORMAT_ASTC_10X10_UNORM 90
1032#define WGPU_TEXTURE_FORMAT_ASTC_10X10_UNORM_SRGB 91
1033#define WGPU_TEXTURE_FORMAT_ASTC_12X10_UNORM 92
1034#define WGPU_TEXTURE_FORMAT_ASTC_12X10_UNORM_SRGB 93
1035#define WGPU_TEXTURE_FORMAT_ASTC_12X12_UNORM 94
1036#define WGPU_TEXTURE_FORMAT_ASTC_12X12_UNORM_SRGB 95
1037#define WGPU_TEXTURE_FORMAT_LAST_VALUE 95 // This needs to be equal to the highest texture format number above
1038
1039/*
1040[Exposed=(Window, DedicatedWorker), SecureContext]
1041interface GPUExternalTexture {
1042};
1043GPUExternalTexture includes GPUObjectBase;
1044*/
1046// Returns true if the given handle references a valid GPUExternalTexture.
1048
1049/*
1050dictionary GPUExternalTextureDescriptor : GPUObjectDescriptorBase {
1051 required HTMLVideoElement source;
1052 PredefinedColorSpace colorSpace = "srgb";
1053};
1054*/
1056{
1057 // An object ID pointing to instance of type HTMLVideoElement. To obtain this id, you must call
1058 // either wgpuStore() or wgpuStoreAndSetParent() on JavaScript side on a HTMLVideoElement object
1059 // to pin/register the video element to a Wasm referenceable object ID.
1064
1065/*
1066[Exposed=(Window, DedicatedWorker), SecureContext]
1067interface GPUSampler {
1068};
1069GPUSampler includes GPUObjectBase;
1070*/
1072// Returns true if the given handle references a valid GPUSampler.
1074
1075/*
1076dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase {
1077 GPUAddressMode addressModeU = "clamp-to-edge";
1078 GPUAddressMode addressModeV = "clamp-to-edge";
1079 GPUAddressMode addressModeW = "clamp-to-edge";
1080 GPUFilterMode magFilter = "nearest";
1081 GPUFilterMode minFilter = "nearest";
1082 GPUMipmapFilterMode mipmapFilter = "nearest";
1083 float lodMinClamp = 0;
1084 float lodMaxClamp = 32;
1085 GPUCompareFunction compare;
1086 [Clamp] unsigned short maxAnisotropy = 1;
1087};
1088*/
1090{
1091 WGPU_ADDRESS_MODE addressModeU; // default = WGPU_ADDRESS_MODE_CLAMP_TO_EDGE
1092 WGPU_ADDRESS_MODE addressModeV; // default = WGPU_ADDRESS_MODE_CLAMP_TO_EDGE
1093 WGPU_ADDRESS_MODE addressModeW; // default = WGPU_ADDRESS_MODE_CLAMP_TO_EDGE
1094 WGPU_FILTER_MODE magFilter; // default = WGPU_FILTER_MODE_NEAREST
1095 WGPU_FILTER_MODE minFilter; // default = WGPU_FILTER_MODE_NEAREST
1096 WGPU_MIPMAP_FILTER_MODE mipmapFilter; // default = WGPU_MIPMAP_FILTER_MODE_NEAREST
1097 float lodMinClamp; // default = 0
1098 float lodMaxClamp; // default = 32
1099 WGPU_COMPARE_FUNCTION compare; // default = WGPU_COMPARE_FUNCTION_INVALID (not used)
1100 uint32_t maxAnisotropy; // default = 1. N.b. this is 32-bit wide in the bindings implementation for simplicity, unlike in the IDL which specifies a unsigned short.
1103
1104/*
1105enum GPUAddressMode {
1106 "clamp-to-edge",
1107 "repeat",
1108 "mirror-repeat"
1109};
1110*/
1112#define WGPU_ADDRESS_MODE_INVALID 0
1113#define WGPU_ADDRESS_MODE_CLAMP_TO_EDGE 1
1114#define WGPU_ADDRESS_MODE_REPEAT 2
1115#define WGPU_ADDRESS_MODE_MIRROR_REPEAT 3
1116
1117/*
1118enum GPUFilterMode {
1119 "nearest",
1120 "linear"
1121};
1122*/
1124#define WGPU_FILTER_MODE_INVALID 0
1125#define WGPU_FILTER_MODE_NEAREST 1
1126#define WGPU_FILTER_MODE_LINEAR 2
1127
1128/*
1129enum GPUMipmapFilterMode {
1130 "nearest",
1131 "linear"
1132};
1133*/
1135#define WGPU_MIPMAP_FILTER_MODE_INVALID 0
1136#define WGPU_MIPMAP_FILTER_MODE_NEAREST 1
1137#define WGPU_MIPMAP_FILTER_MODE_LINEAR 2
1138
1139/*
1140enum GPUCompareFunction {
1141 "never",
1142 "less",
1143 "equal",
1144 "less-equal",
1145 "greater",
1146 "not-equal",
1147 "greater-equal",
1148 "always"
1149};
1150*/
1152#define WGPU_COMPARE_FUNCTION_INVALID 0
1153#define WGPU_COMPARE_FUNCTION_NEVER 1
1154#define WGPU_COMPARE_FUNCTION_LESS 2
1155#define WGPU_COMPARE_FUNCTION_EQUAL 3
1156#define WGPU_COMPARE_FUNCTION_LESS_EQUAL 4
1157#define WGPU_COMPARE_FUNCTION_GREATER 5
1158#define WGPU_COMPARE_FUNCTION_NOT_EQUAL 6
1159#define WGPU_COMPARE_FUNCTION_GREATER_EQUAL 7
1160#define WGPU_COMPARE_FUNCTION_ALWAYS 8
1161
1162/*
1163[Exposed=(Window, DedicatedWorker), SecureContext]
1164interface GPUBindGroupLayout {
1165};
1166GPUBindGroupLayout includes GPUObjectBase;
1167*/
1169// Returns true if the given handle references a valid GPUBindGroupLayout.
1171
1172/*
1173dictionary GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase {
1174 required sequence<GPUBindGroupLayoutEntry> entries;
1175};
1176*/
1177// Currently not used
1178
1179/*
1180typedef [EnforceRange] unsigned long GPUShaderStageFlags;
1181[Exposed=(Window, DedicatedWorker)]
1182namespace GPUShaderStage {
1183 const GPUFlagsConstant VERTEX = 0x1;
1184 const GPUFlagsConstant FRAGMENT = 0x2;
1185 const GPUFlagsConstant COMPUTE = 0x4;
1186};
1187*/
1189#define WGPU_SHADER_STAGE_VERTEX 0x1
1190#define WGPU_SHADER_STAGE_FRAGMENT 0x2
1191#define WGPU_SHADER_STAGE_COMPUTE 0x4
1192
1193/*
1194dictionary GPUBindGroupLayoutEntry {
1195 required GPUIndex32 binding;
1196 required GPUShaderStageFlags visibility;
1197
1198 GPUBufferBindingLayout buffer;
1199 GPUSamplerBindingLayout sampler;
1200 GPUTextureBindingLayout texture;
1201 GPUStorageTextureBindingLayout storageTexture;
1202 GPUExternalTextureBindingLayout externalTexture;
1203};
1204*/
1206#define WGPU_BIND_GROUP_LAYOUT_TYPE_INVALID 0
1207#define WGPU_BIND_GROUP_LAYOUT_TYPE_BUFFER 1
1208#define WGPU_BIND_GROUP_LAYOUT_TYPE_SAMPLER 2
1209#define WGPU_BIND_GROUP_LAYOUT_TYPE_TEXTURE 3
1210#define WGPU_BIND_GROUP_LAYOUT_TYPE_STORAGE_TEXTURE 4
1211#define WGPU_BIND_GROUP_LAYOUT_TYPE_EXTERNAL_TEXTURE 5
1212
1213// typedef struct WGpuBindGroupLayoutEntry at the end of this file.
1214
1215/*
1216enum GPUBufferBindingType {
1217 "uniform",
1218 "storage",
1219 "read-only-storage",
1220};
1221*/
1223#define WGPU_BUFFER_BINDING_TYPE_INVALID 0
1224#define WGPU_BUFFER_BINDING_TYPE_UNIFORM 1
1225#define WGPU_BUFFER_BINDING_TYPE_STORAGE 2
1226#define WGPU_BUFFER_BINDING_TYPE_READ_ONLY_STORAGE 3
1227
1228/*
1229dictionary GPUBufferBindingLayout {
1230 GPUBufferBindingType type = "uniform";
1231 boolean hasDynamicOffset = false;
1232 GPUSize64 minBindingSize = 0;
1233};
1234*/
1242
1243/*
1244enum GPUSamplerBindingType {
1245 "filtering",
1246 "non-filtering",
1247 "comparison",
1248};
1249*/
1251#define WGPU_SAMPLER_BINDING_TYPE_INVALID 0
1252#define WGPU_SAMPLER_BINDING_TYPE_FILTERING 1
1253#define WGPU_SAMPLER_BINDING_TYPE_NON_FILTERING 2
1254#define WGPU_SAMPLER_BINDING_TYPE_COMPARISON 3
1255
1256/*
1257dictionary GPUSamplerBindingLayout {
1258 GPUSamplerBindingType type = "filtering";
1259};
1260*/
1266
1267/*
1268enum GPUTextureSampleType {
1269 "float",
1270 "unfilterable-float",
1271 "depth",
1272 "sint",
1273 "uint",
1274};
1275*/
1277#define WGPU_TEXTURE_SAMPLE_TYPE_INVALID 0
1278#define WGPU_TEXTURE_SAMPLE_TYPE_FLOAT 1
1279#define WGPU_TEXTURE_SAMPLE_TYPE_UNFILTERABLE_FLOAT 2
1280#define WGPU_TEXTURE_SAMPLE_TYPE_DEPTH 3
1281#define WGPU_TEXTURE_SAMPLE_TYPE_SINT 4
1282#define WGPU_TEXTURE_SAMPLE_TYPE_UINT 5
1283
1284/*
1285dictionary GPUTextureBindingLayout {
1286 GPUTextureSampleType sampleType = "float";
1287 GPUTextureViewDimension viewDimension = "2d";
1288 boolean multisampled = false;
1289};
1290*/
1298
1299/*
1300enum GPUStorageTextureAccess {
1301 "write-only",
1302};
1303*/
1305#define WGPU_STORAGE_TEXTURE_ACCESS_INVALID 0
1306#define WGPU_STORAGE_TEXTURE_ACCESS_WRITE_ONLY 1
1307
1308/*
1309dictionary GPUStorageTextureBindingLayout {
1310 GPUStorageTextureAccess access = "write-only";
1311 required GPUTextureFormat format;
1312 GPUTextureViewDimension viewDimension = "2d";
1313};
1314*/
1322
1323/*
1324dictionary GPUExternalTextureBindingLayout {
1325};
1326*/
1328{
1329 uint32_t _dummyPadding; // Appease mixed C and C++ compilation to agree on non-zero struct size.
1331
1332/*
1333[Exposed=(Window, DedicatedWorker), SecureContext]
1334interface GPUBindGroup {
1335};
1336GPUBindGroup includes GPUObjectBase;
1337*/
1339// Returns true if the given handle references a valid GPUBindGroup.
1341
1342/*
1343dictionary GPUBindGroupDescriptor : GPUObjectDescriptorBase {
1344 required GPUBindGroupLayout layout;
1345 required sequence<GPUBindGroupEntry> entries;
1346};
1347*/
1348// Currently unused
1349
1350/*
1351typedef (GPUSampler or GPUTextureView or GPUBufferBinding or GPUExternalTexture) GPUBindingResource;
1352
1353dictionary GPUBindGroupEntry {
1354 required GPUIndex32 binding;
1355 required GPUBindingResource resource;
1356};
1357*/
1359{
1360 uint32_t binding;
1362 // If 'resource' points to a WGpuBuffer, bufferBindOffset and bufferBindSize specify
1363 // the offset and length of the buffer to bind. If 'resource' does not point to a WGpuBuffer,
1364 // offset and size are ignored.
1366 uint64_t bufferBindSize; // If set to 0 (default), the whole buffer is bound.
1369
1370/*
1371dictionary GPUBufferBinding {
1372 required GPUBuffer buffer;
1373 GPUSize64 offset = 0;
1374 GPUSize64 size;
1375};
1376*/
1377// Not exposed. Integrated as part of WGpuBindGroupEntry.
1378
1379/*
1380[Exposed=(Window, DedicatedWorker), SecureContext]
1381interface GPUPipelineLayout {
1382};
1383GPUPipelineLayout includes GPUObjectBase;
1384*/
1386// Returns true if the given handle references a valid GPUPipelineLayout.
1388
1389/*
1390dictionary GPUPipelineLayoutDescriptor : GPUObjectDescriptorBase {
1391 required sequence<GPUBindGroupLayout> bindGroupLayouts;
1392};
1393*/
1394// Currently unused.
1395
1396/*
1397[Exposed=(Window, DedicatedWorker), SecureContext]
1398interface GPUShaderModule {
1399 Promise<GPUCompilationInfo> getCompilationInfo();
1400};
1401GPUShaderModule includes GPUObjectBase;
1402*/
1404// Returns true if the given handle references a valid GPUShaderModule.
1406
1407typedef void (*WGpuGetCompilationInfoCallback)(WGpuShaderModule shaderModule, WGpuCompilationInfo *compilationInfo NOTNULL, void *userData);
1408
1409// Asynchronously obtains information about WebGPU shader module compilation to the given callback.
1410// !! Remember to call wgpu_free_compilation_info() in the callback function after being done with the data.
1412
1413/*
1414dictionary GPUShaderModuleCompilationHint {
1415 (GPUPipelineLayout or GPUAutoLayoutMode) layout;
1416};
1417*/
1419{
1420 const char *entryPointName;
1421 // WGPU_AUTO_LAYOUT_MODE
1422 WGpuPipelineLayout layout; // Assign the special value WGPU_AUTO_LAYOUT_MODE_AUTO (default) to hint an automatically created pipeline object.
1425
1426/*
1427dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase {
1428 required USVString code;
1429 object sourceMap;
1430 record<USVString, GPUShaderModuleCompilationHint> hints;
1431};
1432*/
1434{
1435 const char *code;
1436 // TODO: add sourceMap support
1440
1441/*
1442enum GPUCompilationMessageType {
1443 "error",
1444 "warning",
1445 "info"
1446};
1447*/
1449#define WGPU_COMPILATION_MESSAGE_TYPE_ERROR 0
1450#define WGPU_COMPILATION_MESSAGE_TYPE_WARNING 1
1451#define WGPU_COMPILATION_MESSAGE_TYPE_INFO 2
1452
1454
1455/*
1456[Exposed=(Window, DedicatedWorker), Serializable, SecureContext]
1457interface GPUCompilationMessage {
1458 readonly attribute DOMString message;
1459 readonly attribute GPUCompilationMessageType type;
1460 readonly attribute unsigned long long lineNum;
1461 readonly attribute unsigned long long linePos;
1462 readonly attribute unsigned long long offset;
1463 readonly attribute unsigned long long length;
1464};
1465*/
1467{
1468 // A human-readable string containing the message generated during the shader compilation.
1469 char *message;
1470
1471 // The severity level of the message.
1473
1474 // The line number in the shader code the message corresponds to. Value is one-based, such
1475 // that a lineNum of 1 indicates the first line of the shader code.
1476 // If the message corresponds to a substring this points to the line on which the substring
1477 // begins. Must be 0 if the message does not correspond to any specific point in the shader code.
1478 uint32_t lineNum;
1479
1480 // The offset, in UTF-16 code units, from the beginning of line lineNum of the shader code
1481 // to the point or beginning of the substring that the message corresponds to. Value is
1482 // one-based, such that a linePos of 1 indicates the first character of the line.
1483 // If message corresponds to a substring this points to the first UTF-16 code unit of the
1484 // substring. Must be 0 if the message does not correspond to any specific point in the shader code.
1485 uint32_t linePos;
1486
1487 // The offset from the beginning of the shader code in UTF-16 code units to the point or
1488 // beginning of the substring that message corresponds to. Must reference the same position as
1489 // lineNum and linePos. Must be 0 if the message does not correspond to any specific point in
1490 // the shader code.
1491 uint32_t offset;
1492
1493 // The number of UTF-16 code units in the substring that message corresponds to. If the message
1494 // does not correspond with a substring then length must be 0.
1495 uint32_t length;
1497
1498/*
1499[Exposed=(Window, DedicatedWorker), Serializable, SecureContext]
1500interface GPUCompilationInfo {
1501 readonly attribute FrozenArray<GPUCompilationMessage> messages;
1502};
1503*/
1509// Deallocates a WGpuCompilationInfo object produced by a call to wgpu_free_compilation_info()
1510#define wgpu_free_compilation_info(info) free((info))
1511
1512/*
1513enum GPUAutoLayoutMode {
1514 "auto",
1515};
1516*/
1518#define WGPU_AUTO_LAYOUT_MODE_NO_HINT 0 // In shader compilation, specifies that no hint is to be passed. In pipeline creation, means same as WGPU_AUTO_LAYOUT_MODE_AUTO.
1519#define WGPU_AUTO_LAYOUT_MODE_AUTO 1 // In shader compilation, specifies that the hint { layout: 'auto' } is to be passed. In pipeline creation, uses automatic layout creation.
1520
1521/*
1522dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase {
1523 required (GPUPipelineLayout or GPUAutoLayoutMode) layout;
1524};
1525*/
1526// Not used since it contains only one member. Will be implemented if # of members increases.
1527
1528/*
1529interface mixin GPUPipelineBase {
1530 [NewObject] GPUBindGroupLayout getBindGroupLayout(unsigned long index);
1531};
1532*/
1533// Returns the bind group layout at the given index of the pipeline. Important: this function allocates a
1534// new WebGPU object, so in order not to leak WebGPU handles, call wgpu_object_destroy() on the returned value
1535// when done with it.
1537#define wgpu_render_pipeline_get_bind_group_layout wgpu_pipeline_get_bind_group_layout
1538#define wgpu_compute_pipeline_get_bind_group_layout wgpu_pipeline_get_bind_group_layout
1539
1540/*
1541dictionary GPUProgrammableStage {
1542 required GPUShaderModule module;
1543 required USVString entryPoint;
1544 record<USVString, GPUPipelineConstantValue> constants;
1545};
1546typedef double GPUPipelineConstantValue; // May represent WGSL’s bool, f32, i32, u32, and f16 if enabled.
1547*/
1548
1550{
1551 const char *name;
1552 uint32_t _dummyPadding; // (would be automatically inserted by the compiler, but present here for explicity)
1553 double value;
1555
1556/*
1557
1558[Exposed=(Window, DedicatedWorker), SecureContext]
1559interface GPUComputePipeline {
1560};
1561GPUComputePipeline includes GPUObjectBase;
1562GPUComputePipeline includes GPUPipelineBase;
1563*/
1565// Returns true if the given handle references a valid GPUComputePipeline.
1567
1568/*
1569dictionary GPUComputePipelineDescriptor : GPUPipelineDescriptorBase {
1570 required GPUProgrammableStage compute;
1571};
1572*/
1573// Currently unused.
1574
1575/*
1576[Exposed=(Window, DedicatedWorker), SecureContext]
1577interface GPURenderPipeline {
1578};
1579GPURenderPipeline includes GPUObjectBase;
1580GPURenderPipeline includes GPUPipelineBase;
1581*/
1584// Returns true if the given handle references a valid GPURenderPipeline.
1586
1587/*
1588dictionary GPURenderPipelineDescriptor : GPUPipelineDescriptorBase {
1589 required GPUVertexState vertex;
1590 GPUPrimitiveState primitive = {};
1591 GPUDepthStencilState depthStencil;
1592 GPUMultisampleState multisample = {};
1593 GPUFragmentState fragment;
1594};
1595*/
1596// Defined at the end of this file
1597
1598/*
1599enum GPUPrimitiveTopology {
1600 "point-list",
1601 "line-list",
1602 "line-strip",
1603 "triangle-list",
1604 "triangle-strip"
1605};
1606*/
1608#define WGPU_PRIMITIVE_TOPOLOGY_INVALID 0
1609#define WGPU_PRIMITIVE_TOPOLOGY_POINT_LIST 1
1610#define WGPU_PRIMITIVE_TOPOLOGY_LINE_LIST 2
1611#define WGPU_PRIMITIVE_TOPOLOGY_LINE_STRIP 3
1612#define WGPU_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST 4
1613#define WGPU_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP 5
1614
1615/*
1616dictionary GPUPrimitiveState {
1617 GPUPrimitiveTopology topology = "triangle-list";
1618 GPUIndexFormat stripIndexFormat;
1619 GPUFrontFace frontFace = "ccw";
1620 GPUCullMode cullMode = "none";
1621
1622 // Requires "depth-clip-control" feature.
1623 boolean unclippedDepth = false;
1624};
1625*/
1627{
1628 WGPU_PRIMITIVE_TOPOLOGY topology; // Defaults to WGPU_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST ('triangle-list')
1629 WGPU_INDEX_FORMAT stripIndexFormat; // Defaults to undefined, must be explicitly specified if WGPU_PRIMITIVE_TOPOLOGY_LINE_STRIP ('line-strip') or WGPU_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP ('triangle-strip') is used.
1630 WGPU_FRONT_FACE frontFace; // Defaults to WGPU_FRONT_FACE_CCW ('ccw')
1631 WGPU_CULL_MODE cullMode; // Defaults to WGPU_CULL_MODE_NONE ('none')
1632
1633 EM_BOOL unclippedDepth; // defaults to EM_FALSE.
1635
1636/*
1637enum GPUFrontFace {
1638 "ccw",
1639 "cw"
1640};
1641*/
1643#define WGPU_FRONT_FACE_INVALID 0
1644#define WGPU_FRONT_FACE_CCW 1
1645#define WGPU_FRONT_FACE_CW 2
1646
1647/*
1648enum GPUCullMode {
1649 "none",
1650 "front",
1651 "back"
1652};
1653*/
1654typedef int WGPU_CULL_MODE;
1655#define WGPU_CULL_MODE_INVALID 0
1656#define WGPU_CULL_MODE_NONE 1
1657#define WGPU_CULL_MODE_FRONT 2
1658#define WGPU_CULL_MODE_BACK 3
1659
1660/*
1661dictionary GPUMultisampleState {
1662 GPUSize32 count = 1;
1663 GPUSampleMask mask = 0xFFFFFFFF;
1664 boolean alphaToCoverageEnabled = false;
1665};
1666*/
1673
1674/*
1675dictionary GPUFragmentState: GPUProgrammableStage {
1676 required sequence<GPUColorTargetState?> targets;
1677};
1678*/
1688
1689/*
1690dictionary GPUColorTargetState {
1691 required GPUTextureFormat format;
1692
1693 GPUBlendState blend;
1694 GPUColorWriteFlags writeMask = 0xF; // GPUColorWrite.ALL
1695};
1696*/
1697// Defined at the end of this file
1698
1699/*
1700dictionary GPUBlendState {
1701 required GPUBlendComponent color;
1702 required GPUBlendComponent alpha;
1703};
1704*/
1705// Defined at the end of this file
1706
1707/*
1708typedef [EnforceRange] unsigned long GPUColorWriteFlags;
1709[Exposed=(Window, DedicatedWorker)]
1710namespace GPUColorWrite {
1711 const GPUFlagsConstant RED = 0x1;
1712 const GPUFlagsConstant GREEN = 0x2;
1713 const GPUFlagsConstant BLUE = 0x4;
1714 const GPUFlagsConstant ALPHA = 0x8;
1715 const GPUFlagsConstant ALL = 0xF;
1716};
1717*/
1719#define WGPU_COLOR_WRITE_RED 0x01
1720#define WGPU_COLOR_WRITE_GREEN 0x02
1721#define WGPU_COLOR_WRITE_BLUE 0x04
1722#define WGPU_COLOR_WRITE_ALPHA 0x08
1723#define WGPU_COLOR_WRITE_ALL 0x0F
1724
1725/*
1726dictionary GPUBlendComponent {
1727 GPUBlendOperation operation = "add";
1728 GPUBlendFactor srcFactor = "one";
1729 GPUBlendFactor dstFactor = "zero";
1730};
1731*/
1738
1739/*
1740enum GPUBlendFactor {
1741 "zero",
1742 "one",
1743 "src",
1744 "one-minus-src",
1745 "src-alpha",
1746 "one-minus-src-alpha",
1747 "dst",
1748 "one-minus-dst",
1749 "dst-alpha",
1750 "one-minus-dst-alpha",
1751 "src-alpha-saturated",
1752 "constant",
1753 "one-minus-constant"
1754};
1755*/
1757#define WGPU_BLEND_FACTOR_INVALID 0
1758#define WGPU_BLEND_FACTOR_ZERO 1
1759#define WGPU_BLEND_FACTOR_ONE 2
1760#define WGPU_BLEND_FACTOR_SRC 3
1761#define WGPU_BLEND_FACTOR_ONE_MINUS_SRC 4
1762#define WGPU_BLEND_FACTOR_SRC_ALPHA 5
1763#define WGPU_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA 6
1764#define WGPU_BLEND_FACTOR_DST 7
1765#define WGPU_BLEND_FACTOR_ONE_MINUS_DST 8
1766#define WGPU_BLEND_FACTOR_DST_ALPHA 9
1767#define WGPU_BLEND_FACTOR_ONE_MINUS_DST_ALPHA 10
1768#define WGPU_BLEND_FACTOR_SRC_ALPHA_SATURATED 11
1769#define WGPU_BLEND_FACTOR_CONSTANT 12
1770#define WGPU_BLEND_FACTOR_ONE_MINUS_CONSTANT 13
1771
1772/*
1773enum GPUBlendOperation {
1774 "add",
1775 "subtract",
1776 "reverse-subtract",
1777 "min",
1778 "max"
1779};
1780*/
1782#define WGPU_BLEND_OPERATION_INVALID 0
1783#define WGPU_BLEND_OPERATION_DISABLED 0 // Alias to 'WGPU_BLEND_OPERATION_INVALID'. Used to denote alpha blending being disabled in a more readable way.
1784#define WGPU_BLEND_OPERATION_ADD 1
1785#define WGPU_BLEND_OPERATION_SUBTRACT 2
1786#define WGPU_BLEND_OPERATION_REVERSE_SUBTRACT 3
1787#define WGPU_BLEND_OPERATION_MIN 4
1788#define WGPU_BLEND_OPERATION_MAX 5
1789
1790/*
1791dictionary GPUDepthStencilState {
1792 required GPUTextureFormat format;
1793
1794 required boolean depthWriteEnabled;
1795 required GPUCompareFunction depthCompare;
1796
1797 GPUStencilFaceState stencilFront = {};
1798 GPUStencilFaceState stencilBack = {};
1799
1800 GPUStencilValue stencilReadMask = 0xFFFFFFFF;
1801 GPUStencilValue stencilWriteMask = 0xFFFFFFFF;
1802
1803 GPUDepthBias depthBias = 0;
1804 float depthBiasSlopeScale = 0;
1805 float depthBiasClamp = 0;
1806};
1807*/
1808// Defined at the end of this file
1809
1810/*
1811dictionary GPUStencilFaceState {
1812 GPUCompareFunction compare = "always";
1813 GPUStencilOperation failOp = "keep";
1814 GPUStencilOperation depthFailOp = "keep";
1815 GPUStencilOperation passOp = "keep";
1816};
1817*/
1825
1826/*
1827enum GPUStencilOperation {
1828 "keep",
1829 "zero",
1830 "replace",
1831 "invert",
1832 "increment-clamp",
1833 "decrement-clamp",
1834 "increment-wrap",
1835 "decrement-wrap"
1836};
1837*/
1839#define WGPU_STENCIL_OPERATION_INVALID 0
1840#define WGPU_STENCIL_OPERATION_KEEP 1
1841#define WGPU_STENCIL_OPERATION_ZERO 2
1842#define WGPU_STENCIL_OPERATION_REPLACE 3
1843#define WGPU_STENCIL_OPERATION_INVERT 4
1844#define WGPU_STENCIL_OPERATION_INCREMENT_CLAMP 5
1845#define WGPU_STENCIL_OPERATION_DECREMENT_CLAMP 6
1846#define WGPU_STENCIL_OPERATION_INCREMENT_WRAP 7
1847#define WGPU_STENCIL_OPERATION_DECREMENT_WRAP 8
1848
1849/*
1850enum GPUIndexFormat {
1851 "uint16",
1852 "uint32"
1853};
1854*/
1856#define WGPU_INDEX_FORMAT_INVALID 0
1857#define WGPU_INDEX_FORMAT_UINT16 1
1858#define WGPU_INDEX_FORMAT_UINT32 2
1859
1860/*
1861enum GPUVertexFormat {
1862 "uint8x2",
1863 "uint8x4",
1864 "sint8x2",
1865 "sint8x4",
1866 "unorm8x2",
1867 "unorm8x4",
1868 "snorm8x2",
1869 "snorm8x4",
1870 "uint16x2",
1871 "uint16x4",
1872 "sint16x2",
1873 "sint16x4",
1874 "unorm16x2",
1875 "unorm16x4",
1876 "snorm16x2",
1877 "snorm16x4",
1878 "float16x2",
1879 "float16x4",
1880 "float32",
1881 "float32x2",
1882 "float32x3",
1883 "float32x4",
1884 "uint32",
1885 "uint32x2",
1886 "uint32x3",
1887 "uint32x4",
1888 "sint32",
1889 "sint32x2",
1890 "sint32x3",
1891 "sint32x4"
1892};
1893*/
1894// The numbering on these types continues at the end of WGPU_TEXTURE_FORMAT
1895// for optimization reasons.
1897#define WGPU_VERTEX_FORMAT_INVALID 0
1898#define WGPU_VERTEX_FORMAT_FIRST_VALUE 96
1899#define WGPU_VERTEX_FORMAT_UINT8X2 96
1900#define WGPU_VERTEX_FORMAT_UINT8X4 97
1901#define WGPU_VERTEX_FORMAT_SINT8X2 98
1902#define WGPU_VERTEX_FORMAT_SINT8X4 99
1903#define WGPU_VERTEX_FORMAT_UNORM8X2 100
1904#define WGPU_VERTEX_FORMAT_UNORM8X4 101
1905#define WGPU_VERTEX_FORMAT_SNORM8X2 102
1906#define WGPU_VERTEX_FORMAT_SNORM8X4 103
1907#define WGPU_VERTEX_FORMAT_UINT16X2 104
1908#define WGPU_VERTEX_FORMAT_UINT16X4 105
1909#define WGPU_VERTEX_FORMAT_SINT16X2 106
1910#define WGPU_VERTEX_FORMAT_SINT16X4 107
1911#define WGPU_VERTEX_FORMAT_UNORM16X2 108
1912#define WGPU_VERTEX_FORMAT_UNORM16X4 109
1913#define WGPU_VERTEX_FORMAT_SNORM16X2 110
1914#define WGPU_VERTEX_FORMAT_SNORM16X4 111
1915#define WGPU_VERTEX_FORMAT_FLOAT16X2 112
1916#define WGPU_VERTEX_FORMAT_FLOAT16X4 113
1917#define WGPU_VERTEX_FORMAT_FLOAT32 114
1918#define WGPU_VERTEX_FORMAT_FLOAT32X2 115
1919#define WGPU_VERTEX_FORMAT_FLOAT32X3 116
1920#define WGPU_VERTEX_FORMAT_FLOAT32X4 117
1921#define WGPU_VERTEX_FORMAT_UINT32 118
1922#define WGPU_VERTEX_FORMAT_UINT32X2 119
1923#define WGPU_VERTEX_FORMAT_UINT32X3 120
1924#define WGPU_VERTEX_FORMAT_UINT32X4 121
1925#define WGPU_VERTEX_FORMAT_SINT32 122
1926#define WGPU_VERTEX_FORMAT_SINT32X2 123
1927#define WGPU_VERTEX_FORMAT_SINT32X3 124
1928#define WGPU_VERTEX_FORMAT_SINT32X4 125
1929
1930#if _cplusplus >= 201103L
1931static_assert(WGPU_VERTEX_FORMAT_FIRST_VALUE == WGPU_TEXTURE_FORMAT_LAST_VALUE + 1, "WGPU_VERTEX_FORMAT enums must have values after WGPU_TEXTURE_FORMAT values!");
1932#endif
1933
1934/*
1935enum GPUVertexStepMode {
1936 "vertex",
1937 "instance"
1938};
1939*/
1941#define WGPU_VERTEX_STEP_MODE_INVALID 0
1942#define WGPU_VERTEX_STEP_MODE_VERTEX 1
1943#define WGPU_VERTEX_STEP_MODE_INSTANCE 2
1944
1945/*
1946dictionary GPUVertexState: GPUProgrammableStage {
1947 sequence<GPUVertexBufferLayout?> buffers = [];
1948};
1949*/
1959
1960/*
1961dictionary GPUVertexBufferLayout {
1962 required GPUSize64 arrayStride;
1963 GPUVertexStepMode stepMode = "vertex";
1964 required sequence<GPUVertexAttribute> attributes;
1965};
1966*/
1975
1976/*
1977dictionary GPUVertexAttribute {
1978 required GPUVertexFormat format;
1979 required GPUSize64 offset;
1980
1981 required GPUIndex32 shaderLocation;
1982};
1983*/
1990
1991/*
1992[Exposed=(Window, DedicatedWorker), SecureContext]
1993interface GPUCommandBuffer {
1994};
1995GPUCommandBuffer includes GPUObjectBase;
1996*/
1998// Returns true if the given handle references a valid GPUCommandBuffer.
2000
2001/*
2002dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase {
2003};
2004*/
2006{
2007 uint32_t _dummyPadding; // Appease mixed C and C++ compilation to agree on non-zero struct size. Remove this once label is added
2008 // TODO: add label
2010
2011/*
2012interface mixin GPUDebugCommandsMixin {
2013 undefined pushDebugGroup(USVString groupLabel);
2014 undefined popDebugGroup();
2015 undefined insertDebugMarker(USVString markerLabel);
2016};
2017*/
2018typedef WGpuObjectBase WGpuDebugCommandsMixin; // One of GPURenderBundleEncoder, GPURenderPassEncoder, GPUComputePassEncoder or GPUCommandEncoder
2019
2023
2024/*
2025[Exposed=(Window, DedicatedWorker), SecureContext]
2026interface GPUCommandEncoder {
2027 GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor);
2028 GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {});
2029
2030 undefined copyBufferToBuffer(
2031 GPUBuffer source,
2032 GPUSize64 sourceOffset,
2033 GPUBuffer destination,
2034 GPUSize64 destinationOffset,
2035 GPUSize64 size);
2036
2037 undefined copyBufferToTexture(
2038 GPUImageCopyBuffer source,
2039 GPUImageCopyTexture destination,
2040 GPUExtent3D copySize);
2041
2042 undefined copyTextureToBuffer(
2043 GPUImageCopyTexture source,
2044 GPUImageCopyBuffer destination,
2045 GPUExtent3D copySize);
2046
2047 undefined copyTextureToTexture(
2048 GPUImageCopyTexture source,
2049 GPUImageCopyTexture destination,
2050 GPUExtent3D copySize);
2051
2052 undefined clearBuffer(
2053 GPUBuffer buffer,
2054 optional GPUSize64 offset = 0,
2055 optional GPUSize64 size);
2056
2057 undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex);
2058
2059 undefined resolveQuerySet(
2060 GPUQuerySet querySet,
2061 GPUSize32 firstQuery,
2062 GPUSize32 queryCount,
2063 GPUBuffer destination,
2064 GPUSize64 destinationOffset);
2065
2066 GPUCommandBuffer finish(optional GPUCommandBufferDescriptor descriptor = {});
2067};
2068GPUCommandEncoder includes GPUObjectBase;
2069GPUCommandEncoder includes GPUCommandsMixin;
2070GPUCommandEncoder includes GPUDebugCommandsMixin;
2071*/
2073// Returns true if the given handle references a valid GPUCommandEncoder.
2075
2077// Like above, but tiny code size path for the case when there is exactly one color and zero depth-stencil targets and no occlusion query set specified for the render pass.
2080void wgpu_command_encoder_copy_buffer_to_buffer(WGpuCommandEncoder commandEncoder, WGpuBuffer source, double_int53_t sourceOffset, WGpuBuffer destination, double_int53_t destinationOffset, double_int53_t size);
2081void wgpu_command_encoder_copy_buffer_to_texture(WGpuCommandEncoder commandEncoder, const WGpuImageCopyBuffer *source NOTNULL, const WGpuImageCopyTexture *destination NOTNULL, uint32_t copyWidth, uint32_t copyHeight _WGPU_DEFAULT_VALUE(1), uint32_t copyDepthOrArrayLayers _WGPU_DEFAULT_VALUE(1));
2082void wgpu_command_encoder_copy_texture_to_buffer(WGpuCommandEncoder commandEncoder, const WGpuImageCopyTexture *source NOTNULL, const WGpuImageCopyBuffer *destination NOTNULL, uint32_t copyWidth, uint32_t copyHeight _WGPU_DEFAULT_VALUE(1), uint32_t copyDepthOrArrayLayers _WGPU_DEFAULT_VALUE(1));
2083void wgpu_command_encoder_copy_texture_to_texture(WGpuCommandEncoder commandEncoder, const WGpuImageCopyTexture *source NOTNULL, const WGpuImageCopyTexture *destination NOTNULL, uint32_t copyWidth, uint32_t copyHeight _WGPU_DEFAULT_VALUE(1), uint32_t copyDepthOrArrayLayers _WGPU_DEFAULT_VALUE(1));
2085void wgpu_command_encoder_write_timestamp(WGpuCommandEncoder commandEncoder, WGpuQuerySet querySet, uint32_t queryIndex);
2086void wgpu_command_encoder_resolve_query_set(WGpuCommandEncoder commandEncoder, WGpuQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGpuBuffer destination, double_int53_t destinationOffset);
2087
2088// GPUCommandEncoder and GPURenderBundleEncoder share the same finish() command.
2089WGpuObjectBase wgpu_encoder_finish(WGpuObjectBase commandOrRenderBundleEncoder);
2090#define wgpu_command_encoder_finish wgpu_encoder_finish
2091
2092// Inherited from GPUDebugCommandsMixin
2093#define wgpu_command_encoder_push_debug_group wgpu_encoder_push_debug_group
2094#define wgpu_command_encoder_pop_debug_group wgpu_encoder_pop_debug_group
2095#define wgpu_command_encoder_insert_debug_marker wgpu_encoder_insert_debug_marker
2096
2097/*
2098dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase {
2099};
2100*/
2102{
2103 uint32_t _dummyPadding; // Appease mixed C and C++ compilation to agree on non-zero struct size.
2106
2107/*
2108dictionary GPUImageDataLayout {
2109 GPUSize64 offset = 0;
2110 GPUSize32 bytesPerRow;
2111 GPUSize32 rowsPerImage;
2112};
2113// unused: fused to WGpuImageCopyBuffer
2114*/
2115
2116/*
2117dictionary GPUImageCopyBuffer : GPUImageDataLayout {
2118 required GPUBuffer buffer;
2119};
2120*/
2130
2131/*
2132dictionary GPUImageCopyTexture {
2133 required GPUTexture texture;
2134 GPUIntegerCoordinate mipLevel = 0;
2135 GPUOrigin3D origin = {};
2136 GPUTextureAspect aspect = "all";
2137};
2138*/
2139// Defined at the end of this file
2140
2141/*
2142dictionary GPUImageCopyTextureTagged : GPUImageCopyTexture {
2143 PredefinedColorSpace colorSpace = "srgb";
2144 boolean premultipliedAlpha = false;
2145};
2146*/
2147// Defined at the end of this file
2148
2149/*
2150dictionary GPUImageCopyExternalImage {
2151 required (ImageBitmap or HTMLVideoElement or HTMLCanvasElement or OffscreenCanvas) source;
2152 GPUOrigin2D origin = {};
2153 boolean flipY = false;
2154};
2155*/
2156// Defined at the end of this file
2157
2158/*
2159interface mixin GPUBindingCommandsMixin {
2160 undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup,
2161 optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []);
2162
2163 undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup,
2164 Uint32Array dynamicOffsetsData,
2165 GPUSize64 dynamicOffsetsDataStart,
2166 GPUSize32 dynamicOffsetsDataLength);
2167};
2168*/
2170// Returns true if the given handle references a valid GPUBindingCommandsMixin. (one of: GPUComputePassEncoder, GPURenderPassEncoder, or GPURenderBundleEncoder)
2172void wgpu_encoder_set_bind_group(WGpuBindingCommandsMixin encoder, uint32_t index, WGpuBindGroup bindGroup, const uint32_t *dynamicOffsets _WGPU_DEFAULT_VALUE(0), uint32_t numDynamicOffsets _WGPU_DEFAULT_VALUE(0));
2173
2174// Some of the functions in GPURenderBundleEncoder, GPURenderPassEncoder and GPUComputePassEncoder are identical in implementation,
2175// so group them under a common base class.
2178
2179/*
2180[Exposed=(Window, DedicatedWorker), SecureContext]
2181interface GPUComputePassEncoder {
2182 undefined setPipeline(GPUComputePipeline pipeline);
2183 undefined dispatchWorkgroups(GPUSize32 workgroupCountX, optional GPUSize32 workgroupCountY = 1, optional GPUSize32 workgroupCountZ = 1);
2184 undefined dispatchWorkgroupsIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
2185
2186 undefined end();
2187};
2188GPUComputePassEncoder includes GPUObjectBase;
2189GPUComputePassEncoder includes GPUCommandsMixin;
2190GPUComputePassEncoder includes GPUDebugCommandsMixin;
2191GPUComputePassEncoder includes GPUBindingCommandsMixin;
2192*/
2194// Returns true if the given handle references a valid GPUComputePassEncoder.
2196
2197#define wgpu_compute_pass_encoder_set_pipeline wgpu_encoder_set_pipeline
2198void wgpu_compute_pass_encoder_dispatch_workgroups(WGpuComputePassEncoder encoder, uint32_t workgroupCountX, uint32_t workgroupCountY _WGPU_DEFAULT_VALUE(1), uint32_t workgroupCountZ _WGPU_DEFAULT_VALUE(1));
2200#define wgpu_compute_pass_encoder_end wgpu_encoder_end
2201
2202// Inherited from GPUDebugCommandsMixin:
2203#define wgpu_compute_pass_encoder_push_debug_group wgpu_encoder_push_debug_group
2204#define wgpu_compute_pass_encoder_pop_debug_group wgpu_encoder_pop_debug_group
2205#define wgpu_compute_pass_encoder_insert_debug_marker wgpu_encoder_insert_debug_marker
2206
2207// Inherited from GPUBindingCommandsMixin:
2208#define wgpu_compute_pass_encoder_set_bind_group wgpu_encoder_set_bind_group
2209
2210/*
2211dictionary GPUComputePassTimestampWrites {
2212 required GPUQuerySet querySet;
2213 GPUSize32 beginningOfPassWriteIndex;
2214 GPUSize32 endOfPassWriteIndex;
2215};
2216*/
2218{
2220 int32_t beginningOfPassWriteIndex; // Important! Specify -1 to not perform a write at beginning of pass. Setting 0 will write to index 0. Ignored if querySet == 0.
2221 int32_t endOfPassWriteIndex; // Important! Specify -1 to not perform a write at end of pass. Setting 0 will write to index 0. Ignored if querySet == 0.
2224
2225/*
2226dictionary GPUComputePassDescriptor
2227 : GPUObjectDescriptorBase {
2228 GPUComputePassTimestampWrites timestampWrites;
2229};
2230*/
2236
2237/*
2238interface mixin GPURenderCommandsMixin {
2239 undefined setPipeline(GPURenderPipeline pipeline);
2240
2241 undefined setIndexBuffer(GPUBuffer buffer, GPUIndexFormat indexFormat, optional GPUSize64 offset = 0, optional GPUSize64 size);
2242 undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size);
2243
2244 undefined draw(GPUSize32 vertexCount, optional GPUSize32 instanceCount = 1,
2245 optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0);
2246 undefined drawIndexed(GPUSize32 indexCount, optional GPUSize32 instanceCount = 1,
2247 optional GPUSize32 firstIndex = 0,
2248 optional GPUSignedOffset32 baseVertex = 0,
2249 optional GPUSize32 firstInstance = 0);
2250
2251 undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
2252 undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
2253};
2254*/
2255// Deliberate API naming divergence: in upstream WebGPU API, there are base "mixin" classes
2257// Returns true if the given handle references a valid GPURenderCommandsMixin.
2259
2260#define wgpu_render_commands_mixin_set_pipeline wgpu_encoder_set_pipeline
2263
2264void wgpu_render_commands_mixin_draw(WGpuRenderCommandsMixin renderCommandsMixin, uint32_t vertexCount, uint32_t instanceCount _WGPU_DEFAULT_VALUE(1), uint32_t firstVertex _WGPU_DEFAULT_VALUE(0), uint32_t firstInstance _WGPU_DEFAULT_VALUE(0));
2265void wgpu_render_commands_mixin_draw_indexed(WGpuRenderCommandsMixin renderCommandsMixin, uint32_t indexCount, uint32_t instanceCount _WGPU_DEFAULT_VALUE(1), uint32_t firstVertex _WGPU_DEFAULT_VALUE(0), int32_t baseVertex _WGPU_DEFAULT_VALUE(0), uint32_t firstInstance _WGPU_DEFAULT_VALUE(0));
2266
2267void wgpu_render_commands_mixin_draw_indirect(WGpuRenderCommandsMixin renderCommandsMixin, WGpuBuffer indirectBuffer, double_int53_t indirectOffset);
2268void wgpu_render_commands_mixin_draw_indexed_indirect(WGpuRenderCommandsMixin renderCommandsMixin, WGpuBuffer indirectBuffer, double_int53_t indirectOffset);
2269
2270/*
2271[Exposed=(Window, DedicatedWorker), SecureContext]
2272interface GPURenderPassEncoder {
2273 undefined setViewport(float x, float y,
2274 float width, float height,
2275 float minDepth, float maxDepth);
2276
2277 undefined setScissorRect(GPUIntegerCoordinate x, GPUIntegerCoordinate y,
2278 GPUIntegerCoordinate width, GPUIntegerCoordinate height);
2279
2280 undefined setBlendConstant(GPUColor color);
2281 undefined setStencilReference(GPUStencilValue reference);
2282
2283 undefined beginOcclusionQuery(GPUSize32 queryIndex);
2284 undefined endOcclusionQuery();
2285
2286 undefined executeBundles(sequence<GPURenderBundle> bundles);
2287 undefined end();
2288};
2289GPURenderPassEncoder includes GPUObjectBase;
2290GPURenderPassEncoder includes GPUCommandsMixin;
2291GPURenderPassEncoder includes GPUDebugCommandsMixin;
2292GPURenderPassEncoder includes GPUBindingCommandsMixin;
2293GPURenderPassEncoder includes GPURenderCommandsMixin;
2294*/
2296// Returns true if the given handle references a valid GPURenderPassEncoder.
2298
2299void wgpu_render_pass_encoder_set_viewport(WGpuRenderPassEncoder encoder, float x, float y, float width, float height, float minDepth, float maxDepth);
2300void wgpu_render_pass_encoder_set_scissor_rect(WGpuRenderPassEncoder encoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height);
2301void wgpu_render_pass_encoder_set_blend_constant(WGpuRenderPassEncoder encoder, double r, double g, double b, double a);
2305void wgpu_render_pass_encoder_execute_bundles(WGpuRenderPassEncoder encoder, const WGpuRenderBundle *bundles, int numBundles);
2306#define wgpu_render_pass_encoder_end wgpu_encoder_end
2307
2308// Inherited from GPUDebugCommandsMixin:
2309#define wgpu_render_pass_encoder_push_debug_group wgpu_programmable_pass_encoder_push_debug_group
2310#define wgpu_render_pass_encoder_pop_debug_group wgpu_programmable_pass_encoder_pop_debug_group
2311#define wgpu_render_pass_encoder_insert_debug_marker wgpu_programmable_pass_encoder_insert_debug_marker
2312
2313// Inherited from GPUBindingCommandsMixin:
2314#define wgpu_render_pass_encoder_set_bind_group wgpu_encoder_set_bind_group
2315
2316// Inherited from GPURenderCommandsMixin:
2317#define wgpu_render_pass_encoder_set_pipeline wgpu_render_commands_mixin_set_pipeline
2318#define wgpu_render_pass_encoder_set_index_buffer wgpu_render_commands_mixin_set_index_buffer
2319#define wgpu_render_pass_encoder_set_vertex_buffer wgpu_render_commands_mixin_set_vertex_buffer
2320#define wgpu_render_pass_encoder_draw wgpu_render_commands_mixin_draw
2321#define wgpu_render_pass_encoder_draw_indexed wgpu_render_commands_mixin_draw_indexed
2322#define wgpu_render_pass_encoder_draw_indirect wgpu_render_commands_mixin_draw_indirect
2323#define wgpu_render_pass_encoder_draw_indexed_indirect wgpu_render_commands_mixin_draw_indexed_indirect
2324
2325/*
2326dictionary GPURenderPassColorAttachment {
2327 required GPUTextureView view;
2328 GPUTextureView resolveTarget;
2329
2330 GPUColor clearValue;
2331 required GPULoadOp loadOp;
2332 required GPUStoreOp storeOp;
2333};
2334*/
2335// Defined at the end of this file
2336
2337/*
2338dictionary GPURenderPassDepthStencilAttachment {
2339 required GPUTextureView view;
2340
2341 float depthClearValue;
2342 GPULoadOp depthLoadOp;
2343 GPUStoreOp depthStoreOp;
2344 boolean depthReadOnly = false;
2345
2346 GPUStencilValue stencilClearValue = 0;
2347 GPULoadOp stencilLoadOp;
2348 GPUStoreOp stencilStoreOp;
2349 boolean stencilReadOnly = false;
2350};
2351*/
2368
2369/*
2370enum GPULoadOp {
2371 "load",
2372 "clear",
2373};
2374*/
2375typedef int WGPU_LOAD_OP;
2376#define WGPU_LOAD_OP_UNDEFINED 0
2377#define WGPU_LOAD_OP_LOAD 1
2378#define WGPU_LOAD_OP_CLEAR 2
2379
2380/*
2381enum GPUStoreOp {
2382 "store",
2383 "discard"
2384};
2385*/
2386typedef int WGPU_STORE_OP;
2387#define WGPU_STORE_OP_UNDEFINED 0
2388#define WGPU_STORE_OP_STORE 1
2389#define WGPU_STORE_OP_DISCARD 2
2390
2391/*
2392dictionary GPURenderPassLayout : GPUObjectDescriptorBase {
2393 required sequence<GPUTextureFormat?> colorFormats;
2394 GPUTextureFormat depthStencilFormat;
2395 GPUSize32 sampleCount = 1;
2396};
2397*/
2398// Not currently exposed, fused to GPURenderBundleEncoderDescriptor.
2399
2400/*
2401[Exposed=(Window, DedicatedWorker), SecureContext]
2402interface GPURenderBundle {
2403};
2404GPURenderBundle includes GPUObjectBase;
2405*/
2407// Returns true if the given handle references a valid GPURenderBundle.
2409
2410/*
2411dictionary GPURenderBundleDescriptor : GPUObjectDescriptorBase {
2412};
2413*/
2415{
2416 uint32_t _dummyPadding; // Appease mixed C and C++ compilation to agree on non-zero struct size. Remove this once label is added
2417 // TODO add label
2419
2420/*
2421[Exposed=(Window, DedicatedWorker), SecureContext]
2422interface GPURenderBundleEncoder {
2423 GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {});
2424};
2425GPURenderBundleEncoder includes GPUObjectBase;
2426GPURenderBundleEncoder includes GPUCommandsMixin;
2427GPURenderBundleEncoder includes GPUDebugCommandsMixin;
2428GPURenderBundleEncoder includes GPUBindingCommandsMixin;
2429GPURenderBundleEncoder includes GPURenderCommandsMixin;
2430*/
2432// Returns true if the given handle references a valid GPURenderBundleEncoder.
2434#define wgpu_render_bundle_encoder_finish wgpu_encoder_finish
2435
2436#define wgpu_render_bundle_encoder_set_bind_group wgpu_encoder_set_bind_group
2437// Inherited from GPUDebugCommandsMixin:
2438#define wgpu_render_bundle_encoder_push_debug_group wgpu_encoder_push_debug_group
2439#define wgpu_render_bundle_encoder_pop_debug_group wgpu_encoder_pop_debug_group
2440#define wgpu_render_bundle_encoder_insert_debug_marker wgpu_encoder_insert_debug_marker
2441
2442#define wgpu_render_bundle_encoder_set_pipeline wgpu_encoder_set_pipeline
2443#define wgpu_render_bundle_encoder_set_index_buffer wgpu_render_commands_mixin_set_index_buffer
2444#define wgpu_render_bundle_encoder_set_vertex_buffer wgpu_render_commands_mixin_set_vertex_buffer
2445#define wgpu_render_bundle_encoder_draw wgpu_render_commands_mixin_draw
2446#define wgpu_render_bundle_encoder_draw_indexed wgpu_render_commands_mixin_draw_indexed
2447#define wgpu_render_bundle_encoder_draw_indirect wgpu_render_commands_mixin_draw_indirect
2448#define wgpu_render_bundle_encoder_draw_indexed_indirect wgpu_render_commands_mixin_draw_indexed_indirect
2449
2450/*
2451dictionary GPURenderBundleEncoderDescriptor : GPURenderPassLayout {
2452 boolean depthReadOnly = false;
2453 boolean stencilReadOnly = false;
2454};
2455*/
2465
2466/*
2467[Exposed=(Window, DedicatedWorker), SecureContext]
2468interface GPUQueue {
2469 undefined submit(sequence<GPUCommandBuffer> commandBuffers);
2470
2471 Promise<undefined> onSubmittedWorkDone();
2472
2473 undefined writeBuffer(
2474 GPUBuffer buffer,
2475 GPUSize64 bufferOffset,
2476 [AllowShared] BufferSource data,
2477 optional GPUSize64 dataOffset = 0,
2478 optional GPUSize64 size);
2479
2480 undefined writeTexture(
2481 GPUImageCopyTexture destination,
2482 [AllowShared] BufferSource data,
2483 GPUImageDataLayout dataLayout,
2484 GPUExtent3D size);
2485
2486 undefined copyExternalImageToTexture(
2487 GPUImageCopyExternalImage source,
2488 GPUImageCopyTextureTagged destination,
2489 GPUExtent3D copySize);
2490};
2491GPUQueue includes GPUObjectBase;
2492*/
2494// Returns true if the given handle references a valid GPUQueue.
2496
2497// Submits one command buffer to the given queue for rendering. Then, the command buffer is destroyed. (as if calling wgpu_object_destroy() on it)
2498// N.b. if you start recording a command buffer and choose not to submit it, then you must manually call wgpu_object_destroy() on it to avoid
2499// a memory leak. (see function wgpu_get_num_live_objects() to help debug the number of live references)
2501
2502// Submits multiple command buffers to the given queue for rendering. Then, the command buffers are destroyed. (as if calling wgpu_object_destroy() on them)
2503// N.b. if you start recording a command buffer and choose not to submit it, then you must manually call wgpu_object_destroy() on it to avoid
2504// a memory leak. (see function wgpu_get_num_live_objects() to help debug the number of live references)
2505void wgpu_queue_submit_multiple_and_destroy(WGpuQueue queue, const WGpuCommandBuffer *commandBuffers, int numCommandBuffers);
2506
2507typedef void (*WGpuOnSubmittedWorkDoneCallback)(WGpuQueue queue, void *userData);
2509
2510// Uploads data to the given GPUBuffer. Data is copied from memory in byte addresses data[0], data[1], ... data[size-1], and uploaded
2511// to the GPU buffer at byte offset bufferOffset, bufferOffset+1, ..., bufferOffset+size-1.
2513void wgpu_queue_write_texture(WGpuQueue queue, const WGpuImageCopyTexture *destination NOTNULL, const void *data NOTNULL, uint32_t bytesPerBlockRow, uint32_t blockRowsPerImage, uint32_t writeWidth, uint32_t writeHeight _WGPU_DEFAULT_VALUE(1), uint32_t writeDepthOrArrayLayers _WGPU_DEFAULT_VALUE(1));
2514void wgpu_queue_copy_external_image_to_texture(WGpuQueue queue, const WGpuImageCopyExternalImage *source NOTNULL, const WGpuImageCopyTextureTagged *destination NOTNULL, uint32_t copyWidth, uint32_t copyHeight _WGPU_DEFAULT_VALUE(1), uint32_t copyDepthOrArrayLayers _WGPU_DEFAULT_VALUE(1));
2515
2516/*
2517[Exposed=(Window, DedicatedWorker), SecureContext]
2518interface GPUQuerySet {
2519 undefined destroy();
2520
2521 readonly attribute GPUQueryType type;
2522 readonly attribute GPUSize32 count;
2523};
2524GPUQuerySet includes GPUObjectBase;
2525*/
2527// Returns true if the given handle references a valid GPUQuerySet.
2529// Getters for retrieving query set properties:
2531uint32_t wgpu_query_set_count(WGpuQuerySet querySet);
2532
2533/*
2534dictionary GPUQuerySetDescriptor : GPUObjectDescriptorBase {
2535 required GPUQueryType type;
2536 required GPUSize32 count;
2537};
2538*/
2544
2545/*
2546enum GPUQueryType {
2547 "occlusion",
2548 "timestamp"
2549};
2550*/
2552#define WGPU_QUERY_TYPE_INVALID 0
2553#define WGPU_QUERY_TYPE_OCCLUSION 1
2554#define WGPU_QUERY_TYPE_TIMESTAMP 2
2555
2556/*
2557enum GPUPipelineStatisticName {
2558 "timestamp"
2559};
2560*/
2562#define WGPU_PIPELINE_STATISTIC_NAME_INVALID 0
2563#define WGPU_PIPELINE_STATISTIC_NAME_TIMESTAMP 1
2564
2565/*
2566[Exposed=(Window, DedicatedWorker), SecureContext]
2567interface GPUCanvasContext {
2568 readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;
2569
2570 undefined configure(GPUCanvasConfiguration configuration);
2571 undefined unconfigure();
2572
2573 GPUTexture getCurrentTexture();
2574};
2575*/
2577// Returns true if the given handle references a valid GPUCanvasContext.
2579
2580// TODO: Add char *wgpu_canvas_context_get_canvas_selector_id() for 'canvas' member property, as both CSS ID selector and object ID.
2581
2582// Configures the swap chain for this context.
2583#ifdef __EMSCRIPTEN__
2585#else
2587#endif
2589
2591
2592// Native Dawn implementation has a concept of a SwapChain. Web does not have this.
2593// Dawn SwapChain returns a TextureView, whereas GPUCanvasContext.getCurrentTexture() returns a Texture,
2594// so provide a convenient function wgpu_canvas_context_get_current_texture_view() to obtain
2595// a TextureView in a cross-platform manner.
2596#ifdef __EMSCRIPTEN__
2597#define wgpu_canvas_context_get_current_texture_view(canvasContext) wgpu_texture_create_view_simple(wgpu_canvas_context_get_current_texture((canvasContext)))
2598#else
2600#endif
2601
2602#ifdef __EMSCRIPTEN__
2603void wgpu_canvas_context_present(WGpuCanvasContext canvasContext) __attribute__((deprecated("The function wgpu_canvas_context_present() is not available when targeting the web. Presentation always occurs when yielding out from browser event loop. Refactor the code to avoid any blocking render loop and calling wgpu_canvas_context_present() when targeting web browsers.", "Use emscripten_request_animation_frame_loop() instead.")));
2604#else
2606#endif
2607
2608/*
2609enum GPUCanvasAlphaMode {
2610 "opaque",
2611 "premultiplied",
2612};
2613*/
2615#define WGPU_CANVAS_ALPHA_MODE_INVALID 0
2616#define WGPU_CANVAS_ALPHA_MODE_OPAQUE 1
2617#define WGPU_CANVAS_ALPHA_MODE_PREMULTIPLIED 2
2618
2619/*
2620enum GPUDeviceLostReason {
2621 "unknown",
2622 "destroyed",
2623};
2624*/
2626#define WGPU_DEVICE_LOST_REASON_UNKNOWN 0
2627#define WGPU_DEVICE_LOST_REASON_DESTROYED 1
2628
2629/*
2630[Exposed=(Window, DedicatedWorker)]
2631interface GPUDeviceLostInfo {
2632 readonly attribute GPUDeviceLostReason reason;
2633 readonly attribute DOMString message;
2634};
2635
2636partial interface GPUDevice {
2637 readonly attribute Promise<GPUDeviceLostInfo> lost;
2638};
2639*/
2640typedef void (*WGpuDeviceLostCallback)(WGpuDevice device, WGPU_DEVICE_LOST_REASON deviceLostReason, const char *message NOTNULL, void *userData);
2641void wgpu_device_set_lost_callback(WGpuDevice device, WGpuDeviceLostCallback callback, void *userData);
2642
2643// Specifies the type of an error that occurred.
2644// N.b. the values of these should be kept in sync with values of WGPU_ERROR_FILTER_*. (except for the unknown error value)
2646#define WGPU_ERROR_TYPE_NO_ERROR 0
2647#define WGPU_ERROR_TYPE_OUT_OF_MEMORY 1
2648#define WGPU_ERROR_TYPE_VALIDATION 2
2649#define WGPU_ERROR_TYPE_UNKNOWN_ERROR 3
2650
2651/*
2652[Exposed=(Window, DedicatedWorker), SecureContext]
2653interface GPUError {
2654 readonly attribute DOMString message;
2655};
2656
2657[Exposed=(Window, DedicatedWorker), SecureContext]
2658interface GPUValidationError : GPUError {
2659 constructor(DOMString message);
2660};
2661
2662[Exposed=(Window, DedicatedWorker), SecureContext]
2663interface GPUOutOfMemoryError : GPUError {
2664 constructor(DOMString message);
2665};
2666
2667[Exposed=(Window, DedicatedWorker), SecureContext]
2668interface GPUInternalError : GPUError {
2669 constructor(DOMString message);
2670};
2671
2672enum GPUErrorFilter {
2673 "validation",
2674 "out-of-memory",
2675 "internal"
2676};
2677*/
2679#define WGPU_ERROR_FILTER_INVALID 0
2680#define WGPU_ERROR_FILTER_OUT_OF_MEMORY 1
2681#define WGPU_ERROR_FILTER_VALIDATION 2
2682#define WGPU_ERROR_FILTER_INTERNAL 3
2683
2684/*
2685partial interface GPUDevice {
2686 undefined pushErrorScope(GPUErrorFilter filter);
2687 Promise<GPUError?> popErrorScope();
2688};
2689*/
2691
2692typedef void (*WGpuDeviceErrorCallback)(WGpuDevice device, WGPU_ERROR_TYPE errorType, const char *errorMessage NOTNULL, void *userData);
2693void wgpu_device_pop_error_scope_async(WGpuDevice device, WGpuDeviceErrorCallback callback, void *userData);
2694
2695/*
2696[
2697 Exposed=(Window, DedicatedWorker)
2698]
2699interface GPUUncapturedErrorEvent : Event {
2700 constructor(
2701 DOMString type,
2702 GPUUncapturedErrorEventInit gpuUncapturedErrorEventInitDict
2703 );
2704 [SameObject] readonly attribute GPUError error;
2705};
2706
2707dictionary GPUUncapturedErrorEventInit : EventInit {
2708 required GPUError error;
2709};
2710
2711partial interface GPUDevice {
2712 [Exposed=(Window, DedicatedWorker)]
2713 attribute EventHandler onuncapturederror;
2714};
2715*/
2716
2717// registers a device uncapturederror event callback. Call with 0 pointer to unregister. Only one callback handler is supported, new call overwrites previous
2719
2720/*
2721typedef [EnforceRange] unsigned long GPUBufferDynamicOffset;
2722typedef [EnforceRange] unsigned long GPUStencilValue;
2723typedef [EnforceRange] unsigned long GPUSampleMask;
2724typedef [EnforceRange] long GPUDepthBias;
2725*/
2726// These do not get their own typedefs for readability, but use uint32_t in headers.
2727
2728/*
2729typedef [EnforceRange] unsigned long long GPUSize64;
2730*/
2731// No custom typedef for readability, use double_int53_t
2732
2733/*
2734typedef [EnforceRange] unsigned long GPUIntegerCoordinate;
2735typedef [EnforceRange] unsigned long GPUIndex32;
2736typedef [EnforceRange] unsigned long GPUSize32;
2737*/
2738// These do not get their own typedefs for readability, but use uint32_t in headers.
2739
2740/*
2741typedef [EnforceRange] long GPUSignedOffset32;
2742*/
2743// No custom typedef for readability, use int32_t.
2744
2745/*
2746typedef unsigned long GPUFlagsConstant;
2747*/
2748// No custom typedef for readability, use uint32_t.
2749
2750/*
2751dictionary GPUColorDict {
2752 required double r;
2753 required double g;
2754 required double b;
2755 required double a;
2756};
2757typedef (sequence<double> or GPUColorDict) GPUColor;
2758*/
2759typedef struct WGpuColor
2760{
2761 double r, g, b, a;
2763
2764/*
2765dictionary GPUOrigin2DDict {
2766 GPUIntegerCoordinate x = 0;
2767 GPUIntegerCoordinate y = 0;
2768};
2769typedef (sequence<GPUIntegerCoordinate> or GPUOrigin2DDict) GPUOrigin2D;
2770*/
2771typedef struct WGpuOrigin2D
2772{
2773 int x, y;
2775
2776/*
2777dictionary GPUOrigin3DDict {
2778 GPUIntegerCoordinate x = 0;
2779 GPUIntegerCoordinate y = 0;
2780 GPUIntegerCoordinate z = 0;
2781};
2782typedef (sequence<GPUIntegerCoordinate> or GPUOrigin3DDict) GPUOrigin3D;
2783*/
2784typedef struct WGpuOrigin3D
2785{
2786 int x, y, z;
2788
2790// Sorted struct definitions for proper C parsing order:
2791
2792/*
2793dictionary GPUCanvasConfiguration : GPUObjectDescriptorBase {
2794 required GPUDevice device;
2795 required GPUTextureFormat format;
2796 GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.RENDER_ATTACHMENT
2797 sequence<GPUTextureFormat> viewFormats = [];
2798 PredefinedColorSpace colorSpace = "srgb";
2799 GPUCanvasAlphaMode alphaMode = "opaque";
2800 GPUExtent3D size;
2801};
2802*/
2814
2815/*
2816dictionary GPURenderPassTimestampWrites {
2817 required GPUQuerySet querySet;
2818 GPUSize32 beginningOfPassWriteIndex;
2819 GPUSize32 endOfPassWriteIndex;
2820};
2821*/
2823{
2825 int32_t beginningOfPassWriteIndex; // Important! Specify -1 to not perform a write at beginning of pass. Setting 0 will write to index 0. Ignored if querySet == 0.
2826 int32_t endOfPassWriteIndex; // Important! Specify -1 to not perform a write at end of pass. Setting 0 will write to index 0. Ignored if querySet == 0.
2829
2830/*
2831typedef sequence<GPURenderPassTimestampWrite> GPURenderPassTimestampWrites;
2832
2833dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase {
2834 required sequence<GPURenderPassColorAttachment?> colorAttachments;
2835 GPURenderPassDepthStencilAttachment depthStencilAttachment;
2836 GPUQuerySet occlusionQuerySet;
2837 GPURenderPassTimestampWrites timestampWrites = [];
2838 GPUSize64 maxDrawCount = 50000000;
2839};
2840*/
2852
2854{
2857
2858 WGPU_STORE_OP storeOp; // Required, be sure to set to WGPU_STORE_OP_STORE (default) or WGPU_STORE_OP_DISCARD
2859 WGPU_LOAD_OP loadOp; // Either WGPU_LOAD_OP_LOAD (== default, 0) or WGPU_LOAD_OP_CLEAR.
2860 WGpuColor clearValue; // Used if loadOp == WGPU_LOAD_OP_CLEAR. Default value = { r = 0.0, g = 0.0, b = 0.0, a = 1.0 }
2863
2865{
2866 WGpuObjectBase source; // must point to a WGpuImageBitmap (could also point to a HTMLVideoElement, HTMLCanvasElement or OffscreenCanvas, but those are currently unimplemented)
2868 EM_BOOL flipY; // defaults to EM_FALSE.
2871
2880
2893
2895{
2896 // Pass format == WGPU_TEXTURE_FORMAT_INVALID (integer value 0)
2897 // to disable depth+stenciling altogether.
2899
2902
2905
2906 int32_t depthBias;
2909
2912
2913 // Enable depth clamping (requires "depth-clamping" feature)
2916
2922
2924{
2926
2927 // The member field blend.operation is default initialized to WGPU_BLEND_OPERATION_DISABLED (integer value 0)
2928 // to disable alpha blending on this color target. Set blend.operation to e.g. WGPU_BLEND_OPERATION_ADD to enable
2929 // alpha blending.
2931
2935
2946
2963
2965// Extensions to the WebGPU specification:
2966
2968
2969// Called when the ImageBitmap finishes loading. If loading fails, this callback will be called with width==height==0.
2970typedef void (*WGpuLoadImageBitmapCallback)(WGpuImageBitmap bitmap, int width, int height, void *userData);
2971
2973
2974
2975#ifdef __cplusplus
2976} // ~extern "C"
2977#endif
2978
2979#ifdef __clang__
2980#pragma clang diagnostic pop
2981#elif defined(_MSC_VER)
2982#pragma warning(pop)
2983#endif
GLastResizePipelineToGltfAnimation pipeline
Definition GameApi_pl.cc:15022
void error(std::string err, std::string fail_reason)
Definition check.cc:18
const WGpuImageCopyBuffer WGPU_IMAGE_COPY_BUFFER_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:87
void wgpu_command_encoder_resolve_query_set(WGpuCommandEncoder commandEncoder, WGpuQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGpuBuffer destination, double_int53_t destinationOffset)
Definition lib_webgpu_dawn.cc:2170
const WGpuShaderModuleCompilationHint WGPU_SHADER_MODULE_COMPILATION_HINT_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:81
uint32_t wgpu_query_set_count(WGpuQuerySet querySet)
Definition lib_webgpu_dawn.cc:2496
int WGPU_TEXTURE_DIMENSION
Definition lib_webgpu.h:714
int WGPU_TEXTURE_SAMPLE_TYPE
Definition lib_webgpu.h:1276
void navigator_gpu_request_adapter_async_simple(WGpuRequestAdapterCallback adapterCallback)
Definition lib_webgpu_dawn.cc:967
WGPU_BUFFER_USAGE_FLAGS wgpu_buffer_usage(WGpuBuffer buffer)
Definition lib_webgpu_dawn.cc:1788
WGpuObjectBase WGpuDevice
Definition lib_webgpu.h:459
WGpuObjectBase WGpuImageBitmap
Definition lib_webgpu.h:2967
void(* WGpuRequestAdapterCallback)(WGpuAdapter adapter, void *userData)
Definition lib_webgpu.h:293
EM_BOOL wgpu_is_binding_commands_mixin(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:2203
WGpuDevice wgpu_adapter_request_device_sync(WGpuAdapter adapter, const WGpuDeviceDescriptor *descriptor NOTNULL)
void wgpu_canvas_context_configure(WGpuCanvasContext canvasContext, const WGpuCanvasConfiguration *config NOTNULL, int width _WGPU_DEFAULT_VALUE(0), int height _WGPU_DEFAULT_VALUE(0))
#define WGPU_MAX_SIZE
Definition lib_webgpu.h:559
void wgpu_adapter_request_device_async_simple(WGpuAdapter adapter, WGpuRequestDeviceCallback deviceCallback)
Definition lib_webgpu_dawn.cc:1099
EM_BOOL wgpu_adapter_is_fallback_adapter(WGpuAdapter adapter)
Definition lib_webgpu_dawn.cc:1063
int WGPU_BUFFER_BINDING_TYPE
Definition lib_webgpu.h:1222
WGpuBindGroupLayout wgpu_device_create_bind_group_layout(WGpuDevice device, const WGpuBindGroupLayoutEntry *bindGroupLayoutEntries, int numEntries)
Definition lib_webgpu_dawn.cc:1201
WGpuTexture wgpu_canvas_context_get_current_texture(WGpuCanvasContext canvasContext)
Definition lib_webgpu_dawn.cc:2537
void wgpu_queue_copy_external_image_to_texture(WGpuQueue queue, const WGpuImageCopyExternalImage *source NOTNULL, const WGpuImageCopyTextureTagged *destination NOTNULL, uint32_t copyWidth, uint32_t copyHeight _WGPU_DEFAULT_VALUE(1), uint32_t copyDepthOrArrayLayers _WGPU_DEFAULT_VALUE(1))
WGPU_TEXTURE_USAGE_FLAGS wgpu_texture_usage(WGpuTexture texture)
Definition lib_webgpu_dawn.cc:1865
int WGPU_ADDRESS_MODE
Definition lib_webgpu.h:1111
int WGPU_SAMPLER_BINDING_TYPE
Definition lib_webgpu.h:1250
void wgpu_render_pass_encoder_end_occlusion_query(WGpuRenderPassEncoder encoder)
Definition lib_webgpu_dawn.cc:2381
int WGPU_AUTO_LAYOUT_MODE
Definition lib_webgpu.h:1517
WGpuObjectBase wgpu_encoder_finish(WGpuObjectBase commandOrRenderBundleEncoder)
Definition lib_webgpu_dawn.cc:2183
void(* WGpuRequestAdapterInfoCallback)(WGpuAdapter adapter, const WGpuAdapterInfo *adapterInfo NOTNULL, void *userData)
Definition lib_webgpu.h:394
void(* WGpuDeviceErrorCallback)(WGpuDevice device, WGPU_ERROR_TYPE errorType, const char *errorMessage NOTNULL, void *userData)
Definition lib_webgpu.h:2692
int WGPU_STORAGE_TEXTURE_ACCESS
Definition lib_webgpu.h:1304
EM_BOOL wgpu_is_pipeline_layout(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:1896
WGpuObjectBase WGpuRenderPipeline
Definition lib_webgpu.h:1582
EM_BOOL wgpu_is_command_buffer(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:1927
EM_BOOL wgpu_is_sampler(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:1881
const WGpuDeviceDescriptor WGPU_DEVICE_DESCRIPTOR_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:15
int WGPU_TEXTURE_ASPECT
Definition lib_webgpu.h:798
WGpuObjectBase WGpuBindGroupLayout
Definition lib_webgpu.h:1168
WGpuComputePipeline wgpu_device_create_compute_pipeline(WGpuDevice device, WGpuShaderModule computeModule, const char *entryPoint NOTNULL, WGpuPipelineLayout layout, const WGpuPipelineConstant *constants, int numConstants)
int WGPU_VERTEX_FORMAT
Definition lib_webgpu.h:1896
void(* WGpuRequestDeviceCallback)(WGpuDevice device, void *userData)
Definition lib_webgpu.h:382
int WGPU_TEXTURE_FORMAT
Definition lib_webgpu.h:927
WGpuObjectBase WGpuComputePassEncoder
Definition lib_webgpu.h:2193
int WGPU_FILTER_MODE
Definition lib_webgpu.h:1123
void wgpu_buffer_map_async(WGpuBuffer buffer, WGpuBufferMapCallback callback, void *userData, WGPU_MAP_MODE_FLAGS mode, double_int53_t offset _WGPU_DEFAULT_VALUE(0), double_int53_t size _WGPU_DEFAULT_VALUE(WGPU_MAX_SIZE))
void(* WGpuDeviceLostCallback)(WGpuDevice device, WGPU_DEVICE_LOST_REASON deviceLostReason, const char *message NOTNULL, void *userData)
Definition lib_webgpu.h:2640
EM_BOOL navigator_gpu_available(void)
WGpuExternalTexture wgpu_device_import_external_texture(WGpuDevice device, const WGpuExternalTextureDescriptor *externalTextureDesc NOTNULL)
EM_BOOL wgpu_adapter_or_device_supports_feature(WGpuAdapter adapter, WGPU_FEATURES_BITFIELD feature)
Definition lib_webgpu_dawn.cc:1005
const WGpuImageCopyTextureTagged WGPU_IMAGE_COPY_TEXTURE_TAGGED_DEFAULT_INITIALIZER
WGpuAdapter navigator_gpu_request_adapter_sync(const WGpuRequestAdapterOptions *options)
Definition lib_webgpu_dawn.cc:920
#define EM_BOOL
Definition lib_webgpu.h:44
void wgpu_render_commands_mixin_set_index_buffer(WGpuRenderCommandsMixin renderCommandsMixin, WGpuBuffer buffer, WGPU_INDEX_FORMAT indexFormat, double_int53_t offset _WGPU_DEFAULT_VALUE(0), double_int53_t size _WGPU_DEFAULT_VALUE(WGPU_MAX_SIZE))
void wgpu_command_encoder_write_timestamp(WGpuCommandEncoder commandEncoder, WGpuQuerySet querySet, uint32_t queryIndex)
Definition lib_webgpu_dawn.cc:2162
WGPU_FEATURES_BITFIELD wgpu_adapter_or_device_get_features(WGpuAdapter adapter)
Definition lib_webgpu_dawn.cc:987
EM_BOOL wgpu_is_adapter(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:982
int WGPU_FEATURES_BITFIELD
Definition lib_webgpu.h:220
void(* WGpuBufferMapCallback)(WGpuBuffer buffer, void *userData, WGPU_MAP_MODE_FLAGS mode, double_int53_t offset, double_int53_t size)
Definition lib_webgpu.h:558
const WGpuRenderPassDepthStencilAttachment WGPU_RENDER_PASS_DEPTH_STENCIL_ATTACHMENT_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:99
void wgpu_encoder_end(WGpuBindingCommandsMixin encoder)
Definition lib_webgpu_dawn.cc:2230
WGpuQuerySet wgpu_device_create_query_set(WGpuDevice device, const WGpuQuerySetDescriptor *querySetDesc NOTNULL)
const WGpuImageCopyTexture WGPU_IMAGE_COPY_TEXTURE_DEFAULT_INITIALIZER
void wgpu_adapter_or_device_get_limits(WGpuAdapter adapter, WGpuSupportedLimits *limits NOTNULL)
uint32_t wgpu_get_num_live_objects(void)
Definition lib_webgpu_dawn.cc:798
WGpuTextureView wgpu_texture_create_view_simple(WGpuTexture texture)
Definition lib_webgpu_dawn.cc:1821
int WGPU_PIPELINE_STATISTIC_NAME
Definition lib_webgpu.h:2561
int WGPU_COMPARE_FUNCTION
Definition lib_webgpu.h:1151
const WGpuTextureViewDescriptor WGPU_TEXTURE_VIEW_DESCRIPTOR_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:31
const char * wgpu_compilation_message_type_to_string(WGPU_COMPILATION_MESSAGE_TYPE type)
Definition lib_webgpu.cc:9
void wgpu_device_push_error_scope(WGpuDevice device, WGPU_ERROR_FILTER filter)
Definition lib_webgpu_dawn.cc:2582
const WGpuComputePassTimestampWrites WGPU_COMPUTE_PASS_TIMESTAMP_WRITES_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:89
WGpuSampler wgpu_device_create_sampler(WGpuDevice device, const WGpuSamplerDescriptor *samplerDesc NOTNULL)
void wgpu_command_encoder_copy_texture_to_texture(WGpuCommandEncoder commandEncoder, const WGpuImageCopyTexture *source NOTNULL, const WGpuImageCopyTexture *destination NOTNULL, uint32_t copyWidth, uint32_t copyHeight _WGPU_DEFAULT_VALUE(1), uint32_t copyDepthOrArrayLayers _WGPU_DEFAULT_VALUE(1))
WGpuCommandEncoder wgpu_device_create_command_encoder(WGpuDevice device, const WGpuCommandEncoderDescriptor *commandEncoderDesc)
Definition lib_webgpu_dawn.cc:1656
int WGPU_BLEND_FACTOR
Definition lib_webgpu.h:1756
WGPU_TEXTURE_FORMAT wgpu_texture_format(WGpuTexture texture)
Definition lib_webgpu_dawn.cc:1859
EM_BOOL wgpu_is_bind_group(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:1891
void wgpu_render_commands_mixin_set_vertex_buffer(WGpuRenderCommandsMixin renderCommandsMixin, int32_t slot, WGpuBuffer buffer, double_int53_t offset _WGPU_DEFAULT_VALUE(0), double_int53_t size _WGPU_DEFAULT_VALUE(WGPU_MAX_SIZE))
int WGPU_STORE_OP
Definition lib_webgpu.h:2386
void wgpu_encoder_set_pipeline(WGpuBindingCommandsMixin encoder, WGpuObjectBase pipeline)
Definition lib_webgpu_dawn.cc:2221
int WGPU_QUERY_TYPE
Definition lib_webgpu.h:2551
const WGpuBindGroupEntry WGPU_BIND_GROUP_ENTRY_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:78
EM_BOOL wgpu_is_render_commands_mixin(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:2256
WGpuObjectBase WGpuRenderPassEncoder
Definition lib_webgpu.h:2295
WGpuDevice wgpu_adapter_request_device_sync_simple(WGpuAdapter adapter)
Definition lib_webgpu_dawn.cc:1104
WGpuObjectBase WGpuRenderBundleEncoder
Definition lib_webgpu.h:2431
int WGPU_CULL_MODE
Definition lib_webgpu.h:1654
WGpuObjectBase WGpuRenderBundle
Definition lib_webgpu.h:2406
void wgpu_encoder_push_debug_group(WGpuDebugCommandsMixin encoder, const char *groupLabel NOTNULL)
int WGPU_BUFFER_USAGE_FLAGS
Definition lib_webgpu.h:622
EM_BOOL wgpu_is_render_bundle_encoder(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:2266
const WGpuSamplerDescriptor WGPU_SAMPLER_DESCRIPTOR_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:46
void wgpu_destroy_all_objects(void)
Definition lib_webgpu_dawn.cc:817
WGpuObjectBase WGpuPipelineBase
Definition lib_webgpu.h:1583
WGpuRenderPassEncoder wgpu_command_encoder_begin_render_pass(WGpuCommandEncoder commandEncoder, const WGpuRenderPassDescriptor *renderPassDesc NOTNULL)
WGpuTextureView wgpu_texture_create_view(WGpuTexture texture, const WGpuTextureViewDescriptor *textureViewDesc _WGPU_DEFAULT_VALUE(0))
EM_BOOL wgpu_is_render_pass_encoder(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:2261
void(* WGpuOnSubmittedWorkDoneCallback)(WGpuQueue queue, void *userData)
Definition lib_webgpu.h:2507
void wgpu_render_pass_encoder_execute_bundles(WGpuRenderPassEncoder encoder, const WGpuRenderBundle *bundles, int numBundles)
Definition lib_webgpu_dawn.cc:2387
const WGpuSamplerBindingLayout WGPU_SAMPLER_BINDING_LAYOUT_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:68
const WGpuRenderPassTimestampWrites WGPU_RENDER_PASS_TIMESTAMP_WRITES_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:129
void wgpu_canvas_context_present(WGpuCanvasContext canvasContext)
Definition lib_webgpu_dawn.cc:2553
WGpuBuffer wgpu_device_create_buffer(WGpuDevice device, const WGpuBufferDescriptor *bufferDesc NOTNULL)
void wgpu_device_create_render_pipeline_async(WGpuDevice device, const WGpuRenderPipelineDescriptor *renderPipelineDesc NOTNULL, WGpuCreatePipelineCallback callback, void *userData)
WGPU_BUFFER_MAP_STATE wgpu_buffer_map_state(WGpuBuffer buffer)
Definition lib_webgpu_dawn.cc:1793
int WGPU_PRIMITIVE_TOPOLOGY
Definition lib_webgpu.h:1607
void wgpu_buffer_map_sync(WGpuBuffer buffer, WGPU_MAP_MODE_FLAGS mode, double_int53_t offset _WGPU_DEFAULT_VALUE(0), double_int53_t size _WGPU_DEFAULT_VALUE(WGPU_MAX_SIZE))
EM_BOOL wgpu_is_queue(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:2401
void wgpu_buffer_read_mapped_range(WGpuBuffer buffer, double_int53_t startOffset, double_int53_t subOffset, void *dst NOTNULL, double_int53_t size)
int WGPU_TEXTURE_VIEW_DIMENSION
Definition lib_webgpu.h:782
WGPU_QUERY_TYPE wgpu_query_set_type(WGpuQuerySet querySet)
Definition lib_webgpu_dawn.cc:2489
WGpuTexture wgpu_device_create_texture(WGpuDevice device, const WGpuTextureDescriptor *textureDesc NOTNULL)
void wgpu_render_pass_encoder_begin_occlusion_query(WGpuRenderPassEncoder encoder, int32_t queryIndex)
Definition lib_webgpu_dawn.cc:2375
int WGPU_ERROR_FILTER
Definition lib_webgpu.h:2678
const WGpuExternalTextureDescriptor WGPU_EXTERNAL_TEXTURE_DESCRIPTOR_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:41
WGpuObjectBase WGpuCommandBuffer
Definition lib_webgpu.h:1997
int WGPU_LOAD_OP
Definition lib_webgpu.h:2375
void wgpu_encoder_insert_debug_marker(WGpuDebugCommandsMixin encoder, const char *markerLabel NOTNULL)
void wgpu_device_pop_error_scope_async(WGpuDevice device, WGpuDeviceErrorCallback callback, void *userData)
Definition lib_webgpu_dawn.cc:2588
int WGPU_COMPILATION_MESSAGE_TYPE
Definition lib_webgpu.h:1448
void wgpu_device_set_uncapturederror_callback(WGpuDevice device, WGpuDeviceErrorCallback callback, void *userData)
Definition lib_webgpu_dawn.cc:2606
const WGpuComputePassDescriptor WGPU_COMPUTE_PASS_DESCRIPTOR_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:95
int WGPU_MAP_MODE_FLAGS
Definition lib_webgpu.h:642
uint32_t wgpu_texture_depth_or_array_layers(WGpuTexture texture)
Definition lib_webgpu_dawn.cc:1838
EM_BOOL navigator_gpu_request_adapter_async(const WGpuRequestAdapterOptions *options, WGpuRequestAdapterCallback adapterCallback, void *userData)
Definition lib_webgpu_dawn.cc:913
WGpuTextureView wgpu_canvas_context_get_current_texture_view(WGpuCanvasContext canvasContext)
Definition lib_webgpu_dawn.cc:2543
WGpuObjectBase WGpuBuffer
Definition lib_webgpu.h:553
EM_BOOL wgpu_is_query_set(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:2484
uint32_t wgpu_texture_height(WGpuTexture texture)
Definition lib_webgpu_dawn.cc:1833
WGpuObjectBase WGpuTextureView
Definition lib_webgpu.h:744
int WGPU_FRONT_FACE
Definition lib_webgpu.h:1642
const WGpuBindGroupLayoutEntry WGPU_BUFFER_BINDING_LAYOUT_ENTRY_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:59
void wgpu_render_pass_encoder_set_viewport(WGpuRenderPassEncoder encoder, float x, float y, float width, float height, float minDepth, float maxDepth)
Definition lib_webgpu_dawn.cc:2351
void wgpu_render_commands_mixin_draw(WGpuRenderCommandsMixin renderCommandsMixin, uint32_t vertexCount, uint32_t instanceCount _WGPU_DEFAULT_VALUE(1), uint32_t firstVertex _WGPU_DEFAULT_VALUE(0), uint32_t firstInstance _WGPU_DEFAULT_VALUE(0))
WGpuObjectBase WGpuCanvasContext
Definition lib_webgpu.h:2576
uint32_t wgpu_texture_sample_count(WGpuTexture texture)
Definition lib_webgpu_dawn.cc:1848
#define _WGPU_DEFAULT_VALUE(x)
Definition lib_webgpu.h:31
void wgpu_object_set_label(WGpuObjectBase obj, const char *label NOTNULL)
int WGPU_MIPMAP_FILTER_MODE
Definition lib_webgpu.h:1134
const WGpuRenderPipelineDescriptor WGPU_RENDER_PIPELINE_DESCRIPTOR_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:161
const WGpuExtent3D WGPU_EXTENT_3D_DEFAULT_INITIALIZER
EM_BOOL wgpu_is_compute_pass_encoder(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:2239
int wgpu_object_get_label(WGpuObjectBase obj, char *dstLabel NOTNULL, uint32_t dstLabelSize)
void wgpu_queue_submit_multiple_and_destroy(WGpuQueue queue, const WGpuCommandBuffer *commandBuffers, int numCommandBuffers)
Definition lib_webgpu_dawn.cc:2415
WGpuObjectBase WGpuTexture
Definition lib_webgpu.h:664
void wgpu_adapter_request_adapter_info_async(WGpuAdapter adapter, const char **unmaskHints, WGpuRequestAdapterInfoCallback callback, void *userData)
Definition lib_webgpu_dawn.cc:1109
void wgpu_load_image_bitmap_from_url_async(const char *url NOTNULL, EM_BOOL flipY, WGpuLoadImageBitmapCallback callback, void *userData)
WGpuObjectBase WGpuDebugCommandsMixin
Definition lib_webgpu.h:2018
WGpuObjectBase WGpuQuerySet
Definition lib_webgpu.h:2526
#define WGPU_INFINITY
Definition lib_webgpu.h:40
void wgpu_device_set_lost_callback(WGpuDevice device, WGpuDeviceLostCallback callback, void *userData)
Definition lib_webgpu_dawn.cc:2561
int WGPU_CANVAS_ALPHA_MODE
Definition lib_webgpu.h:2614
const WGpuRenderPassColorAttachment WGPU_RENDER_PASS_COLOR_ATTACHMENT_DEFAULT_INITIALIZER
int WGPU_TEXTURE_USAGE_FLAGS
Definition lib_webgpu.h:731
WGpuObjectBase WGpuRenderCommandsMixin
Definition lib_webgpu.h:2256
WGpuComputePassEncoder wgpu_command_encoder_begin_compute_pass(WGpuCommandEncoder commandEncoder, const WGpuComputePassDescriptor *computePassDesc _WGPU_DEFAULT_VALUE(0))
void(* WGpuLoadImageBitmapCallback)(WGpuImageBitmap bitmap, int width, int height, void *userData)
Definition lib_webgpu.h:2970
WGpuRenderBundleEncoder wgpu_device_create_render_bundle_encoder(WGpuDevice device, const WGpuRenderBundleEncoderDescriptor *renderBundleEncoderDesc NOTNULL)
double_int53_t wgpu_buffer_size(WGpuBuffer buffer)
Definition lib_webgpu_dawn.cc:1783
const WGpuCanvasConfiguration WGPU_CANVAS_CONFIGURATION_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:119
#define WGPU_TEXTURE_FORMAT_LAST_VALUE
Definition lib_webgpu.h:1037
EM_BOOL wgpu_is_shader_module(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:1901
int WGPU_VERTEX_STEP_MODE
Definition lib_webgpu.h:1940
int WGPU_BLEND_OPERATION
Definition lib_webgpu.h:1781
WGpuObjectBase WGpuBindingCommandsMixin
Definition lib_webgpu.h:2169
void navigator_delete_webgpu_api_access(void)
#define WGPU_VERTEX_FORMAT_FIRST_VALUE
Definition lib_webgpu.h:1898
EM_BOOL navigator_gpu_is_wgsl_language_feature_supported(const char *feature)
WGpuObjectBase WGpuSampler
Definition lib_webgpu.h:1071
void wgpu_object_destroy(WGpuObjectBase wgpuObject)
Definition lib_webgpu_dawn.cc:802
EM_BOOL wgpu_is_compute_pipeline(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:1917
WGpuRenderPipeline wgpu_device_create_render_pipeline(WGpuDevice device, const WGpuRenderPipelineDescriptor *renderPipelineDesc NOTNULL)
WGpuCommandEncoder wgpu_device_create_command_encoder_simple(WGpuDevice device)
Definition lib_webgpu_dawn.cc:1665
void wgpu_queue_submit_one_and_destroy(WGpuQueue queue, WGpuCommandBuffer commandBuffer)
Definition lib_webgpu_dawn.cc:2406
void wgpu_command_encoder_copy_buffer_to_buffer(WGpuCommandEncoder commandEncoder, WGpuBuffer source, double_int53_t sourceOffset, WGpuBuffer destination, double_int53_t destinationOffset, double_int53_t size)
Definition lib_webgpu_dawn.cc:2071
EM_BOOL wgpu_is_command_encoder(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:1965
WGpuObjectBase WGpuPipelineLayout
Definition lib_webgpu.h:1385
WGpuObjectBase WGpuQueue
Definition lib_webgpu.h:2493
WGpuQueue wgpu_device_get_queue(WGpuDevice device)
Definition lib_webgpu_dawn.cc:1120
EM_BOOL wgpu_is_device(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:1115
const WGpuRenderPassDescriptor WGPU_RENDER_PASS_DESCRIPTOR_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:135
void wgpu_render_commands_mixin_draw_indexed_indirect(WGpuRenderCommandsMixin renderCommandsMixin, WGpuBuffer indirectBuffer, double_int53_t indirectOffset)
Definition lib_webgpu_dawn.cc:2339
int WGPU_SHADER_STAGE_FLAGS
Definition lib_webgpu.h:1188
void wgpu_render_pass_encoder_set_stencil_reference(WGpuRenderPassEncoder encoder, uint32_t stencilValue)
Definition lib_webgpu_dawn.cc:2369
int WGPU_BIND_GROUP_LAYOUT_TYPE
Definition lib_webgpu.h:1205
int WGPU_ERROR_TYPE
Definition lib_webgpu.h:2645
WGPU_TEXTURE_DIMENSION wgpu_texture_dimension(WGpuTexture texture)
Definition lib_webgpu_dawn.cc:1853
void wgpu_command_encoder_clear_buffer(WGpuCommandEncoder commandEncoder, WGpuBuffer buffer, double_int53_t offset _WGPU_DEFAULT_VALUE(0), double_int53_t size _WGPU_DEFAULT_VALUE(WGPU_INFINITY))
EM_BOOL wgpu_is_render_pipeline(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:1922
void wgpu_render_commands_mixin_draw_indirect(WGpuRenderCommandsMixin renderCommandsMixin, WGpuBuffer indirectBuffer, double_int53_t indirectOffset)
Definition lib_webgpu_dawn.cc:2327
const WGpuRequestAdapterOptions WGPU_REQUEST_ADAPTER_OPTIONS_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:12
int WGPU_STENCIL_OPERATION
Definition lib_webgpu.h:1838
int WGPU_INDEX_FORMAT
Definition lib_webgpu.h:1855
int HTML_PREDEFINED_COLOR_SPACE
Definition lib_webgpu.h:242
WGpuObjectBase WGpuCommandEncoder
Definition lib_webgpu.h:2072
void wgpu_command_encoder_copy_buffer_to_texture(WGpuCommandEncoder commandEncoder, const WGpuImageCopyBuffer *source NOTNULL, const WGpuImageCopyTexture *destination NOTNULL, uint32_t copyWidth, uint32_t copyHeight _WGPU_DEFAULT_VALUE(1), uint32_t copyDepthOrArrayLayers _WGPU_DEFAULT_VALUE(1))
void(* WGpuCreatePipelineCallback)(WGpuDevice device, WGpuPipelineError *error, WGpuPipelineBase pipeline, void *userData)
Definition lib_webgpu.h:519
WGpuShaderModule wgpu_device_create_shader_module(WGpuDevice device, const WGpuShaderModuleDescriptor *shaderModuleDesc NOTNULL)
WGpuObjectBase WGpuShaderModule
Definition lib_webgpu.h:1403
double_int53_t wgpu_buffer_get_mapped_range(WGpuBuffer buffer, double_int53_t startOffset, double_int53_t size _WGPU_DEFAULT_VALUE(WGPU_MAX_SIZE))
WGpuBindGroupLayout wgpu_pipeline_get_bind_group_layout(WGpuObjectBase pipelineBase, uint32_t index)
Definition lib_webgpu_dawn.cc:1910
WGPU_TEXTURE_FORMAT navigator_gpu_get_preferred_canvas_format(void)
Definition lib_webgpu_dawn.cc:978
int WGPU_POWER_PREFERENCE
Definition lib_webgpu.h:348
void wgpu_queue_set_on_submitted_work_done_callback(WGpuQueue queue, WGpuOnSubmittedWorkDoneCallback callback, void *userData)
Definition lib_webgpu_dawn.cc:2434
WGpuPipelineLayout wgpu_device_create_pipeline_layout(WGpuDevice device, const WGpuBindGroupLayout *bindGroupLayouts, int numLayouts)
Definition lib_webgpu_dawn.cc:1252
WGpuAdapter navigator_gpu_request_adapter_sync_simple(void)
Definition lib_webgpu_dawn.cc:973
int WGPU_COLOR_WRITE_FLAGS
Definition lib_webgpu.h:1718
void wgpu_buffer_write_mapped_range(WGpuBuffer buffer, double_int53_t startOffset, double_int53_t subOffset, const void *src NOTNULL, double_int53_t size)
uint32_t wgpu_texture_mip_level_count(WGpuTexture texture)
Definition lib_webgpu_dawn.cc:1843
int WGPU_DEVICE_LOST_REASON
Definition lib_webgpu.h:2625
const WGpuStorageTextureBindingLayout WGPU_STORAGE_TEXTURE_BINDING_LAYOUT_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:113
WGpuBindGroup wgpu_device_create_bind_group(WGpuDevice device, WGpuBindGroupLayout bindGroupLayout, const WGpuBindGroupEntry *entries, int numEntries)
Definition lib_webgpu_dawn.cc:1268
EM_BOOL wgpu_is_canvas_context(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:2503
EM_BOOL wgpu_is_render_bundle(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:2396
EM_BOOL wgpu_is_buffer(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:1708
void(* WGpuGetCompilationInfoCallback)(WGpuShaderModule shaderModule, WGpuCompilationInfo *compilationInfo NOTNULL, void *userData)
Definition lib_webgpu.h:1407
WGpuObjectBase WGpuBindGroup
Definition lib_webgpu.h:1338
void wgpu_queue_write_buffer(WGpuQueue queue, WGpuBuffer buffer, double_int53_t bufferOffset, const void *data NOTNULL, double_int53_t size)
const WGpuImageCopyExternalImage WGPU_IMAGE_COPY_EXTERNAL_IMAGE_DEFAULT_INITIALIZER
#define WGPU_OBJECT_LABEL_MAX_LENGTH
Definition lib_webgpu.h:100
EM_BOOL wgpu_is_bind_group_layout(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:1886
int WGPU_BUFFER_MAP_STATE
Definition lib_webgpu.h:586
void wgpu_buffer_unmap(WGpuBuffer buffer)
Definition lib_webgpu_dawn.cc:1775
const WGpuTextureDescriptor WGPU_TEXTURE_DESCRIPTOR_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:18
void wgpu_device_tick(WGpuDevice device)
Definition lib_webgpu_dawn.cc:1127
uint32_t wgpu_texture_width(WGpuTexture texture)
Definition lib_webgpu_dawn.cc:1828
void wgpu_compute_pass_encoder_dispatch_workgroups_indirect(WGpuComputePassEncoder encoder, WGpuBuffer indirectBuffer, double_int53_t indirectOffset)
Definition lib_webgpu_dawn.cc:2250
const WGpuBufferBindingLayout WGPU_BUFFER_BINDING_LAYOUT_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:62
WGpuObjectBase WGpuComputePipeline
Definition lib_webgpu.h:1564
void wgpu_shader_module_get_compilation_info_async(WGpuShaderModule shaderModule, WGpuGetCompilationInfoCallback callback, void *userData)
Definition lib_webgpu_dawn.cc:1906
const char *const * navigator_gpu_get_wgsl_language_features(void)
EM_BOOL wgpu_is_valid_object(WGpuObjectBase obj)
Definition lib_webgpu_dawn.cc:843
const WGpuTextureBindingLayout WGPU_TEXTURE_BINDING_LAYOUT_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:72
WGpuObjectBase WGpuAdapter
Definition lib_webgpu.h:364
WGpuRenderPassEncoder wgpu_command_encoder_begin_render_pass_1color_0depth(WGpuCommandEncoder commandEncoder, const WGpuRenderPassDescriptor *renderPassDesc NOTNULL)
EM_BOOL wgpu_is_texture(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:1799
void wgpu_encoder_pop_debug_group(WGpuDebugCommandsMixin encoder)
Definition lib_webgpu_dawn.cc:1943
void wgpu_device_create_compute_pipeline_async(WGpuDevice device, WGpuShaderModule computeModule, const char *entryPoint NOTNULL, WGpuPipelineLayout layout, const WGpuPipelineConstant *constants, int numConstants, WGpuCreatePipelineCallback callback, void *userData)
void wgpu_command_encoder_copy_texture_to_buffer(WGpuCommandEncoder commandEncoder, const WGpuImageCopyTexture *source NOTNULL, const WGpuImageCopyBuffer *destination NOTNULL, uint32_t copyWidth, uint32_t copyHeight _WGPU_DEFAULT_VALUE(1), uint32_t copyDepthOrArrayLayers _WGPU_DEFAULT_VALUE(1))
void wgpu_canvas_context_unconfigure(WGpuCanvasContext canvasContext)
Definition lib_webgpu_dawn.cc:2527
void wgpu_encoder_set_bind_group(WGpuBindingCommandsMixin encoder, uint32_t index, WGpuBindGroup bindGroup, const uint32_t *dynamicOffsets _WGPU_DEFAULT_VALUE(0), uint32_t numDynamicOffsets _WGPU_DEFAULT_VALUE(0))
void wgpu_queue_write_texture(WGpuQueue queue, const WGpuImageCopyTexture *destination NOTNULL, const void *data NOTNULL, uint32_t bytesPerBlockRow, uint32_t blockRowsPerImage, uint32_t writeWidth, uint32_t writeHeight _WGPU_DEFAULT_VALUE(1), uint32_t writeDepthOrArrayLayers _WGPU_DEFAULT_VALUE(1))
void wgpu_render_commands_mixin_draw_indexed(WGpuRenderCommandsMixin renderCommandsMixin, uint32_t indexCount, uint32_t instanceCount _WGPU_DEFAULT_VALUE(1), uint32_t firstVertex _WGPU_DEFAULT_VALUE(0), int32_t baseVertex _WGPU_DEFAULT_VALUE(0), uint32_t firstInstance _WGPU_DEFAULT_VALUE(0))
void wgpu_render_pass_encoder_set_blend_constant(WGpuRenderPassEncoder encoder, double r, double g, double b, double a)
Definition lib_webgpu_dawn.cc:2362
void wgpu_adapter_request_device_async(WGpuAdapter adapter, const WGpuDeviceDescriptor *descriptor NOTNULL, WGpuRequestDeviceCallback deviceCallback, void *userData)
WGpuObjectBase WGpuExternalTexture
Definition lib_webgpu.h:1045
EM_BOOL wgpu_is_texture_view(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:1871
EM_BOOL wgpu_is_external_texture(WGpuObjectBase object)
Definition lib_webgpu_dawn.cc:1876
void wgpu_compute_pass_encoder_dispatch_workgroups(WGpuComputePassEncoder encoder, uint32_t workgroupCountX, uint32_t workgroupCountY _WGPU_DEFAULT_VALUE(1), uint32_t workgroupCountZ _WGPU_DEFAULT_VALUE(1))
const WGpuCommandEncoderDescriptor WGPU_COMMAND_ENCODER_DESCRIPTOR_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:84
const WGpuColorTargetState WGPU_COLOR_TARGET_STATE_DEFAULT_INITIALIZER
Definition lib_webgpu_cpp11.cc:144
void wgpu_render_pass_encoder_set_scissor_rect(WGpuRenderPassEncoder encoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
Definition lib_webgpu_dawn.cc:2356
WGpuCanvasContext wgpu_canvas_get_webgpu_context(HWND hwnd)
Definition lib_webgpu_dawn.cc:826
struct _WGpuObject * WGpuObjectBase
Definition lib_webgpu_fwd.h:38
uint64_t double_int53_t
Definition lib_webgpu_fwd.h:24
#define NOTNULL
Definition lib_webgpu_fwd.h:30
lazy data
Definition meshpage.php:1583
line height
Definition meshpage.php:3536
tag src
Definition meshpage.php:1786
n< br > font size
Definition meshpage.php:3536
< h2 > I want smooth transition from jpg png webp to the engine</h2 > There s few options
Definition meshpage.php:1181
url
Definition meshpage.php:1781
int constants(std::string id)
Definition Parser.cc:428
Definition lib_webgpu.h:257
char description[512]
Definition lib_webgpu.h:261
char device[512]
Definition lib_webgpu.h:260
char vendor[512]
Definition lib_webgpu.h:258
char architecture[512]
Definition lib_webgpu.h:259
Definition lib_webgpu.h:1359
uint64_t bufferBindSize
Definition lib_webgpu.h:1366
uint32_t binding
Definition lib_webgpu.h:1360
uint64_t bufferBindOffset
Definition lib_webgpu.h:1365
WGpuObjectBase resource
Definition lib_webgpu.h:1361
Definition lib_webgpu.h:2948
WGpuTextureBindingLayout texture
Definition lib_webgpu.h:2957
WGPU_BIND_GROUP_LAYOUT_TYPE type
Definition lib_webgpu.h:2951
WGPU_SHADER_STAGE_FLAGS visibility
Definition lib_webgpu.h:2950
uint32_t _dummyPadding64Bits
Definition lib_webgpu.h:2952
WGpuStorageTextureBindingLayout storageTexture
Definition lib_webgpu.h:2958
uint32_t binding
Definition lib_webgpu.h:2949
WGpuExternalTextureBindingLayout externalTexture
Definition lib_webgpu.h:2959
WGpuSamplerBindingLayout sampler
Definition lib_webgpu.h:2956
WGpuBufferBindingLayout buffer
Definition lib_webgpu.h:2955
union WGpuBindGroupLayoutEntry::@326273131371132143321135334311323344005372065211 layout
Definition lib_webgpu.h:1733
WGPU_BLEND_OPERATION operation
Definition lib_webgpu.h:1734
WGPU_BLEND_FACTOR dstFactor
Definition lib_webgpu.h:1736
WGPU_BLEND_FACTOR srcFactor
Definition lib_webgpu.h:1735
Definition lib_webgpu.h:2918
WGpuBlendComponent color
Definition lib_webgpu.h:2919
WGpuBlendComponent alpha
Definition lib_webgpu.h:2920
Definition lib_webgpu.h:1236
uint64_t minBindingSize
Definition lib_webgpu.h:1239
WGPU_BUFFER_BINDING_TYPE type
Definition lib_webgpu.h:1237
EM_BOOL hasDynamicOffset
Definition lib_webgpu.h:1238
Definition lib_webgpu.h:600
WGPU_BUFFER_USAGE_FLAGS usage
Definition lib_webgpu.h:602
EM_BOOL mappedAtCreation
Definition lib_webgpu.h:603
uint64_t size
Definition lib_webgpu.h:601
Definition lib_webgpu.h:2804
int numViewFormats
Definition lib_webgpu.h:2808
WGPU_TEXTURE_USAGE_FLAGS usage
Definition lib_webgpu.h:2807
WGPU_TEXTURE_FORMAT format
Definition lib_webgpu.h:2806
WGPU_TEXTURE_FORMAT * viewFormats
Definition lib_webgpu.h:2809
WGpuDevice device
Definition lib_webgpu.h:2805
HTML_PREDEFINED_COLOR_SPACE colorSpace
Definition lib_webgpu.h:2810
WGPU_CANVAS_ALPHA_MODE alphaMode
Definition lib_webgpu.h:2811
Definition lib_webgpu.h:2924
WGpuBlendState blend
Definition lib_webgpu.h:2930
WGPU_COLOR_WRITE_FLAGS writeMask
Definition lib_webgpu.h:2932
WGPU_TEXTURE_FORMAT format
Definition lib_webgpu.h:2925
Definition lib_webgpu.h:2760
double r
Definition lib_webgpu.h:2761
double a
Definition lib_webgpu.h:2761
double b
Definition lib_webgpu.h:2761
double g
Definition lib_webgpu.h:2761
Definition lib_webgpu.h:2006
uint32_t _dummyPadding
Definition lib_webgpu.h:2007
Definition lib_webgpu.h:2102
uint32_t _dummyPadding
Definition lib_webgpu.h:2103
Definition lib_webgpu.h:1505
WGpuCompilationMessage messages[]
Definition lib_webgpu.h:1507
int numMessages
Definition lib_webgpu.h:1506
Definition lib_webgpu.h:1467
uint32_t length
Definition lib_webgpu.h:1495
WGPU_COMPILATION_MESSAGE_TYPE type
Definition lib_webgpu.h:1472
uint32_t lineNum
Definition lib_webgpu.h:1478
uint32_t offset
Definition lib_webgpu.h:1491
uint32_t linePos
Definition lib_webgpu.h:1485
char * message
Definition lib_webgpu.h:1469
Definition lib_webgpu.h:2232
WGpuComputePassTimestampWrites timestampWrites
Definition lib_webgpu.h:2233
Definition lib_webgpu.h:2218
int32_t endOfPassWriteIndex
Definition lib_webgpu.h:2221
int32_t beginningOfPassWriteIndex
Definition lib_webgpu.h:2220
WGpuQuerySet querySet
Definition lib_webgpu.h:2219
Definition lib_webgpu.h:2895
int32_t depthBias
Definition lib_webgpu.h:2906
float depthBiasClamp
Definition lib_webgpu.h:2908
WGPU_COMPARE_FUNCTION depthCompare
Definition lib_webgpu.h:2901
EM_BOOL depthWriteEnabled
Definition lib_webgpu.h:2900
float depthBiasSlopeScale
Definition lib_webgpu.h:2907
WGPU_TEXTURE_FORMAT format
Definition lib_webgpu.h:2898
WGpuStencilFaceState stencilFront
Definition lib_webgpu.h:2910
uint32_t stencilReadMask
Definition lib_webgpu.h:2903
uint32_t stencilWriteMask
Definition lib_webgpu.h:2904
WGpuStencilFaceState stencilBack
Definition lib_webgpu.h:2911
EM_BOOL clampDepth
Definition lib_webgpu.h:2914
Definition lib_webgpu.h:418
WGpuQueueDescriptor defaultQueue
Definition lib_webgpu.h:422
uint32_t _explicitPaddingFor8BytesAlignedSize
Definition lib_webgpu.h:420
uint32_t _explicitPaddingFor8BytesAlignedSize2
Definition lib_webgpu.h:423
WGpuSupportedLimits requiredLimits
Definition lib_webgpu.h:421
WGPU_FEATURES_BITFIELD requiredFeatures
Definition lib_webgpu.h:419
Definition lib_webgpu.h:115
int depthOrArrayLayers
Definition lib_webgpu.h:118
int width
Definition lib_webgpu.h:116
int height
Definition lib_webgpu.h:117
Definition lib_webgpu.h:1328
uint32_t _dummyPadding
Definition lib_webgpu.h:1329
Definition lib_webgpu.h:1056
HTML_PREDEFINED_COLOR_SPACE colorSpace
Definition lib_webgpu.h:1061
WGpuObjectBase source
Definition lib_webgpu.h:1060
Definition lib_webgpu.h:1680
int numConstants
Definition lib_webgpu.h:1685
WGpuShaderModule module
Definition lib_webgpu.h:1681
const char * entryPoint
Definition lib_webgpu.h:1682
const WGpuColorTargetState * targets
Definition lib_webgpu.h:1684
int numTargets
Definition lib_webgpu.h:1683
const WGpuPipelineConstant * constants
Definition lib_webgpu.h:1686
Definition lib_webgpu.h:2122
WGpuBuffer buffer
Definition lib_webgpu.h:2126
uint32_t bytesPerRow
Definition lib_webgpu.h:2124
uint32_t rowsPerImage
Definition lib_webgpu.h:2125
uint32_t _explicitPaddingFor8BytesAlignedSize
Definition lib_webgpu.h:2127
uint64_t offset
Definition lib_webgpu.h:2123
Definition lib_webgpu.h:2865
WGpuOrigin2D origin
Definition lib_webgpu.h:2867
WGpuObjectBase source
Definition lib_webgpu.h:2866
EM_BOOL flipY
Definition lib_webgpu.h:2868
Definition lib_webgpu.h:2882
WGpuOrigin3D origin
Definition lib_webgpu.h:2886
uint32_t mipLevel
Definition lib_webgpu.h:2885
WGPU_TEXTURE_ASPECT aspect
Definition lib_webgpu.h:2887
HTML_PREDEFINED_COLOR_SPACE colorSpace
Definition lib_webgpu.h:2889
EM_BOOL premultipliedAlpha
Definition lib_webgpu.h:2890
WGpuTexture texture
Definition lib_webgpu.h:2884
Definition lib_webgpu.h:2873
uint32_t mipLevel
Definition lib_webgpu.h:2875
WGpuTexture texture
Definition lib_webgpu.h:2874
WGpuOrigin3D origin
Definition lib_webgpu.h:2876
WGPU_TEXTURE_ASPECT aspect
Definition lib_webgpu.h:2877
Definition lib_webgpu.h:1668
EM_BOOL alphaToCoverageEnabled
Definition lib_webgpu.h:1671
uint32_t mask
Definition lib_webgpu.h:1670
uint32_t count
Definition lib_webgpu.h:1669
Definition lib_webgpu.h:102
char label[WGPU_OBJECT_LABEL_MAX_LENGTH]
Definition lib_webgpu.h:103
Definition lib_webgpu.h:2772
int y
Definition lib_webgpu.h:2773
int x
Definition lib_webgpu.h:2773
Definition lib_webgpu.h:2785
int x
Definition lib_webgpu.h:2786
int z
Definition lib_webgpu.h:2786
int y
Definition lib_webgpu.h:2786
Definition lib_webgpu.h:1550
double value
Definition lib_webgpu.h:1553
const char * name
Definition lib_webgpu.h:1551
uint32_t _dummyPadding
Definition lib_webgpu.h:1552
Definition lib_webgpu.h:511
const char * reason
Definition lib_webgpu.h:514
const char * message
Definition lib_webgpu.h:513
const char * name
Definition lib_webgpu.h:512
Definition lib_webgpu.h:1627
WGPU_INDEX_FORMAT stripIndexFormat
Definition lib_webgpu.h:1629
WGPU_PRIMITIVE_TOPOLOGY topology
Definition lib_webgpu.h:1628
WGPU_FRONT_FACE frontFace
Definition lib_webgpu.h:1630
WGPU_CULL_MODE cullMode
Definition lib_webgpu.h:1631
EM_BOOL unclippedDepth
Definition lib_webgpu.h:1633
Definition lib_webgpu.h:2540
WGPU_QUERY_TYPE type
Definition lib_webgpu.h:2541
uint32_t count
Definition lib_webgpu.h:2542
Definition lib_webgpu.h:406
const char * label
Definition lib_webgpu.h:407
Definition lib_webgpu.h:2415
uint32_t _dummyPadding
Definition lib_webgpu.h:2416
Definition lib_webgpu.h:2457
WGPU_TEXTURE_FORMAT depthStencilFormat
Definition lib_webgpu.h:2460
const WGPU_TEXTURE_FORMAT * colorFormats
Definition lib_webgpu.h:2459
int numColorFormats
Definition lib_webgpu.h:2458
EM_BOOL stencilReadOnly
Definition lib_webgpu.h:2463
uint32_t sampleCount
Definition lib_webgpu.h:2461
EM_BOOL depthReadOnly
Definition lib_webgpu.h:2462
Definition lib_webgpu.h:2854
WGpuColor clearValue
Definition lib_webgpu.h:2860
WGpuTextureView resolveTarget
Definition lib_webgpu.h:2856
WGPU_STORE_OP storeOp
Definition lib_webgpu.h:2858
WGpuTextureView view
Definition lib_webgpu.h:2855
WGPU_LOAD_OP loadOp
Definition lib_webgpu.h:2859
Definition lib_webgpu.h:2353
float depthClearValue
Definition lib_webgpu.h:2357
WGPU_LOAD_OP stencilLoadOp
Definition lib_webgpu.h:2362
WGPU_LOAD_OP depthLoadOp
Definition lib_webgpu.h:2356
WGPU_STORE_OP stencilStoreOp
Definition lib_webgpu.h:2364
uint32_t stencilClearValue
Definition lib_webgpu.h:2363
WGpuTextureView view
Definition lib_webgpu.h:2354
EM_BOOL stencilReadOnly
Definition lib_webgpu.h:2365
EM_BOOL depthReadOnly
Definition lib_webgpu.h:2360
WGPU_STORE_OP depthStoreOp
Definition lib_webgpu.h:2359
Definition lib_webgpu.h:2842
int numColorAttachments
Definition lib_webgpu.h:2843
WGpuQuerySet occlusionQuerySet
Definition lib_webgpu.h:2846
double_int53_t maxDrawCount
Definition lib_webgpu.h:2847
WGpuRenderPassTimestampWrites timestampWrites
Definition lib_webgpu.h:2848
const WGpuRenderPassColorAttachment * colorAttachments
Definition lib_webgpu.h:2844
WGpuRenderPassDepthStencilAttachment depthStencilAttachment
Definition lib_webgpu.h:2845
uint32_t unused_padding
Definition lib_webgpu.h:2849
Definition lib_webgpu.h:2823
int32_t endOfPassWriteIndex
Definition lib_webgpu.h:2826
int32_t beginningOfPassWriteIndex
Definition lib_webgpu.h:2825
WGpuQuerySet querySet
Definition lib_webgpu.h:2824
Definition lib_webgpu.h:2937
WGpuPipelineLayout layout
Definition lib_webgpu.h:2943
WGpuPrimitiveState primitive
Definition lib_webgpu.h:2939
WGpuDepthStencilState depthStencil
Definition lib_webgpu.h:2940
WGpuVertexState vertex
Definition lib_webgpu.h:2938
WGpuFragmentState fragment
Definition lib_webgpu.h:2942
WGpuMultisampleState multisample
Definition lib_webgpu.h:2941
Definition lib_webgpu.h:329
EM_BOOL forceFallbackAdapter
Definition lib_webgpu.h:338
WGPU_POWER_PREFERENCE powerPreference
Definition lib_webgpu.h:337
Definition lib_webgpu.h:1262
WGPU_SAMPLER_BINDING_TYPE type
Definition lib_webgpu.h:1263
Definition lib_webgpu.h:1090
WGPU_FILTER_MODE magFilter
Definition lib_webgpu.h:1094
float lodMinClamp
Definition lib_webgpu.h:1097
WGPU_FILTER_MODE minFilter
Definition lib_webgpu.h:1095
uint32_t maxAnisotropy
Definition lib_webgpu.h:1100
WGPU_MIPMAP_FILTER_MODE mipmapFilter
Definition lib_webgpu.h:1096
WGPU_ADDRESS_MODE addressModeW
Definition lib_webgpu.h:1093
WGPU_COMPARE_FUNCTION compare
Definition lib_webgpu.h:1099
WGPU_ADDRESS_MODE addressModeU
Definition lib_webgpu.h:1091
float lodMaxClamp
Definition lib_webgpu.h:1098
WGPU_ADDRESS_MODE addressModeV
Definition lib_webgpu.h:1092
Definition lib_webgpu.h:1419
const char * entryPointName
Definition lib_webgpu.h:1420
WGpuPipelineLayout layout
Definition lib_webgpu.h:1422
Definition lib_webgpu.h:1434
const WGpuShaderModuleCompilationHint * hints
Definition lib_webgpu.h:1438
const char * code
Definition lib_webgpu.h:1435
int numHints
Definition lib_webgpu.h:1437
Definition lib_webgpu.h:1819
WGPU_STENCIL_OPERATION passOp
Definition lib_webgpu.h:1823
WGPU_STENCIL_OPERATION depthFailOp
Definition lib_webgpu.h:1822
WGPU_STENCIL_OPERATION failOp
Definition lib_webgpu.h:1821
WGPU_COMPARE_FUNCTION compare
Definition lib_webgpu.h:1820
Definition lib_webgpu.h:1316
WGPU_TEXTURE_FORMAT format
Definition lib_webgpu.h:1318
WGPU_STORAGE_TEXTURE_ACCESS access
Definition lib_webgpu.h:1317
WGPU_TEXTURE_VIEW_DIMENSION viewDimension
Definition lib_webgpu.h:1319
Definition lib_webgpu.h:160
uint64_t maxUniformBufferBindingSize
Definition lib_webgpu.h:165
uint32_t maxComputeWorkgroupSizeX
Definition lib_webgpu.h:194
uint32_t maxComputeWorkgroupStorageSize
Definition lib_webgpu.h:192
uint32_t maxVertexBuffers
Definition lib_webgpu.h:185
uint32_t maxTextureDimension2D
Definition lib_webgpu.h:170
uint32_t minUniformBufferOffsetAlignment
Definition lib_webgpu.h:183
uint32_t maxVertexBufferArrayStride
Definition lib_webgpu.h:187
uint32_t maxVertexAttributes
Definition lib_webgpu.h:186
uint32_t minStorageBufferOffsetAlignment
Definition lib_webgpu.h:184
uint32_t maxStorageTexturesPerShaderStage
Definition lib_webgpu.h:181
uint32_t maxDynamicUniformBuffersPerPipelineLayout
Definition lib_webgpu.h:176
uint32_t maxDynamicStorageBuffersPerPipelineLayout
Definition lib_webgpu.h:177
uint32_t maxInterStageShaderComponents
Definition lib_webgpu.h:188
uint32_t maxInterStageShaderVariables
Definition lib_webgpu.h:189
uint32_t maxSampledTexturesPerShaderStage
Definition lib_webgpu.h:178
uint64_t maxStorageBufferBindingSize
Definition lib_webgpu.h:166
uint32_t maxColorAttachments
Definition lib_webgpu.h:190
uint32_t maxComputeWorkgroupSizeY
Definition lib_webgpu.h:195
uint32_t maxTextureDimension1D
Definition lib_webgpu.h:169
uint32_t maxSamplersPerShaderStage
Definition lib_webgpu.h:179
uint32_t maxUniformBuffersPerShaderStage
Definition lib_webgpu.h:182
uint32_t maxTextureArrayLayers
Definition lib_webgpu.h:172
uint32_t maxBindGroups
Definition lib_webgpu.h:173
uint32_t maxComputeInvocationsPerWorkgroup
Definition lib_webgpu.h:193
uint32_t maxColorAttachmentBytesPerSample
Definition lib_webgpu.h:191
uint32_t maxStorageBuffersPerShaderStage
Definition lib_webgpu.h:180
uint32_t maxBindingsPerBindGroup
Definition lib_webgpu.h:175
uint32_t maxTextureDimension3D
Definition lib_webgpu.h:171
uint64_t maxBufferSize
Definition lib_webgpu.h:167
uint32_t maxBindGroupsPlusVertexBuffers
Definition lib_webgpu.h:174
uint32_t maxComputeWorkgroupSizeZ
Definition lib_webgpu.h:196
Definition lib_webgpu.h:1292
EM_BOOL multisampled
Definition lib_webgpu.h:1295
WGPU_TEXTURE_VIEW_DIMENSION viewDimension
Definition lib_webgpu.h:1294
WGPU_TEXTURE_SAMPLE_TYPE sampleType
Definition lib_webgpu.h:1293
Definition lib_webgpu.h:693
int numViewFormats
Definition lib_webgpu.h:702
WGPU_TEXTURE_DIMENSION dimension
Definition lib_webgpu.h:699
uint32_t width
Definition lib_webgpu.h:694
uint32_t mipLevelCount
Definition lib_webgpu.h:697
uint32_t depthOrArrayLayers
Definition lib_webgpu.h:696
WGPU_TEXTURE_USAGE_FLAGS usage
Definition lib_webgpu.h:701
WGPU_TEXTURE_FORMAT format
Definition lib_webgpu.h:700
WGPU_TEXTURE_FORMAT * viewFormats
Definition lib_webgpu.h:703
uint32_t sampleCount
Definition lib_webgpu.h:698
uint32_t height
Definition lib_webgpu.h:695
Definition lib_webgpu.h:761
WGPU_TEXTURE_ASPECT aspect
Definition lib_webgpu.h:764
uint32_t arrayLayerCount
Definition lib_webgpu.h:768
uint32_t baseMipLevel
Definition lib_webgpu.h:765
WGPU_TEXTURE_FORMAT format
Definition lib_webgpu.h:762
uint32_t mipLevelCount
Definition lib_webgpu.h:766
WGPU_TEXTURE_VIEW_DIMENSION dimension
Definition lib_webgpu.h:763
uint32_t baseArrayLayer
Definition lib_webgpu.h:767
Definition lib_webgpu.h:1985
uint32_t shaderLocation
Definition lib_webgpu.h:1987
WGPU_VERTEX_FORMAT format
Definition lib_webgpu.h:1988
uint64_t offset
Definition lib_webgpu.h:1986
Definition lib_webgpu.h:1968
const WGpuVertexAttribute * attributes
Definition lib_webgpu.h:1970
uint32_t _unused64BitPadding
Definition lib_webgpu.h:1973
int numAttributes
Definition lib_webgpu.h:1969
WGPU_VERTEX_STEP_MODE stepMode
Definition lib_webgpu.h:1972
uint64_t arrayStride
Definition lib_webgpu.h:1971
Definition lib_webgpu.h:1951
int numBuffers
Definition lib_webgpu.h:1954
WGpuShaderModule module
Definition lib_webgpu.h:1952
const char * entryPoint
Definition lib_webgpu.h:1953
const WGpuPipelineConstant * constants
Definition lib_webgpu.h:1957
const WGpuVertexBufferLayout * buffers
Definition lib_webgpu.h:1955
int numConstants
Definition lib_webgpu.h:1956