wgpu 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE-APACHE +190 -0
  3. data/LICENSE-MIT +21 -0
  4. data/README.md +228 -0
  5. data/ext/wgpu/Makefile +7 -0
  6. data/ext/wgpu/extconf.rb +161 -0
  7. data/lib/wgpu/async_task.rb +55 -0
  8. data/lib/wgpu/commands/command_buffer.rb +17 -0
  9. data/lib/wgpu/commands/command_encoder.rb +201 -0
  10. data/lib/wgpu/commands/compute_pass.rb +89 -0
  11. data/lib/wgpu/commands/render_bundle.rb +18 -0
  12. data/lib/wgpu/commands/render_bundle_encoder.rb +148 -0
  13. data/lib/wgpu/commands/render_pass.rb +207 -0
  14. data/lib/wgpu/core/adapter.rb +186 -0
  15. data/lib/wgpu/core/canvas_context.rb +104 -0
  16. data/lib/wgpu/core/device.rb +397 -0
  17. data/lib/wgpu/core/instance.rb +81 -0
  18. data/lib/wgpu/core/queue.rb +197 -0
  19. data/lib/wgpu/core/surface.rb +221 -0
  20. data/lib/wgpu/error.rb +16 -0
  21. data/lib/wgpu/native/callbacks.rb +26 -0
  22. data/lib/wgpu/native/enums.rb +529 -0
  23. data/lib/wgpu/native/functions.rb +419 -0
  24. data/lib/wgpu/native/loader.rb +61 -0
  25. data/lib/wgpu/native/structs.rb +646 -0
  26. data/lib/wgpu/pipeline/bind_group.rb +80 -0
  27. data/lib/wgpu/pipeline/bind_group_layout.rb +121 -0
  28. data/lib/wgpu/pipeline/compute_pipeline.rb +88 -0
  29. data/lib/wgpu/pipeline/pipeline_layout.rb +43 -0
  30. data/lib/wgpu/pipeline/render_pipeline.rb +278 -0
  31. data/lib/wgpu/pipeline/shader_module.rb +202 -0
  32. data/lib/wgpu/resources/buffer.rb +228 -0
  33. data/lib/wgpu/resources/query_set.rb +45 -0
  34. data/lib/wgpu/resources/sampler.rb +47 -0
  35. data/lib/wgpu/resources/texture.rb +136 -0
  36. data/lib/wgpu/resources/texture_view.rb +49 -0
  37. data/lib/wgpu/version.rb +5 -0
  38. data/lib/wgpu/window.rb +177 -0
  39. data/lib/wgpu.rb +36 -0
  40. metadata +125 -0
@@ -0,0 +1,529 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WGPU
4
+ module Native
5
+ SType = enum(
6
+ :invalid, 0x00000000,
7
+ :shader_source_spirv, 0x00000001,
8
+ :shader_source_wgsl, 0x00000002,
9
+ :render_pass_max_draw_count, 0x00000003,
10
+ :surface_source_metal_layer, 0x00000004,
11
+ :surface_source_windows_hwnd, 0x00000005,
12
+ :surface_source_xlib_window, 0x00000006,
13
+ :surface_source_wayland_surface, 0x00000007,
14
+ :surface_source_android_native_window, 0x00000008,
15
+ :surface_source_xcb_window, 0x00000009,
16
+ :shader_source_glsl, 0x00030004
17
+ )
18
+
19
+ BackendType = enum(
20
+ :undefined, 0x00000000,
21
+ :null, 0x00000001,
22
+ :webgpu, 0x00000002,
23
+ :d3d11, 0x00000003,
24
+ :d3d12, 0x00000004,
25
+ :metal, 0x00000005,
26
+ :vulkan, 0x00000006,
27
+ :opengl, 0x00000007,
28
+ :opengles, 0x00000008
29
+ )
30
+
31
+ AdapterType = enum(
32
+ :discrete_gpu, 0x00000001,
33
+ :integrated_gpu, 0x00000002,
34
+ :cpu, 0x00000003,
35
+ :unknown, 0x00000004
36
+ )
37
+
38
+ PowerPreference = enum(
39
+ :undefined, 0x00000000,
40
+ :low_power, 0x00000001,
41
+ :high_performance, 0x00000002
42
+ )
43
+
44
+ FeatureLevel = enum(
45
+ :compatibility, 0x00000001,
46
+ :core, 0x00000002
47
+ )
48
+
49
+ RequestAdapterStatus = enum(
50
+ :success, 0x00000001,
51
+ :instance_dropped, 0x00000002,
52
+ :unavailable, 0x00000003,
53
+ :error, 0x00000004
54
+ )
55
+
56
+ RequestDeviceStatus = enum(
57
+ :success, 0x00000001,
58
+ :instance_dropped, 0x00000002,
59
+ :error, 0x00000003
60
+ )
61
+
62
+ BufferMapState = enum(
63
+ :unmapped, 0x00000001,
64
+ :pending, 0x00000002,
65
+ :mapped, 0x00000003
66
+ )
67
+
68
+ MapAsyncStatus = enum(
69
+ :success, 0x00000001,
70
+ :instance_dropped, 0x00000002,
71
+ :error, 0x00000003,
72
+ :aborted, 0x00000004
73
+ )
74
+
75
+ BufferUsage = {
76
+ none: 0x0000000000000000,
77
+ map_read: 0x0000000000000001,
78
+ map_write: 0x0000000000000002,
79
+ copy_src: 0x0000000000000004,
80
+ copy_dst: 0x0000000000000008,
81
+ index: 0x0000000000000010,
82
+ vertex: 0x0000000000000020,
83
+ uniform: 0x0000000000000040,
84
+ storage: 0x0000000000000080,
85
+ indirect: 0x0000000000000100,
86
+ query_resolve: 0x0000000000000200
87
+ }.freeze
88
+
89
+ MapMode = {
90
+ none: 0x0000000000000000,
91
+ read: 0x0000000000000001,
92
+ write: 0x0000000000000002
93
+ }.freeze
94
+
95
+ ShaderStage = {
96
+ none: 0x0000000000000000,
97
+ vertex: 0x0000000000000001,
98
+ fragment: 0x0000000000000002,
99
+ compute: 0x0000000000000004
100
+ }.freeze
101
+
102
+ TextureFormat = enum(
103
+ :undefined, 0x00000000,
104
+ :r8_unorm, 0x00000001,
105
+ :r8_snorm, 0x00000002,
106
+ :r8_uint, 0x00000003,
107
+ :r8_sint, 0x00000004,
108
+ :r16_uint, 0x00000005,
109
+ :r16_sint, 0x00000006,
110
+ :r16_float, 0x00000007,
111
+ :rg8_unorm, 0x00000008,
112
+ :rg8_snorm, 0x00000009,
113
+ :rg8_uint, 0x0000000A,
114
+ :rg8_sint, 0x0000000B,
115
+ :r32_float, 0x0000000C,
116
+ :r32_uint, 0x0000000D,
117
+ :r32_sint, 0x0000000E,
118
+ :rg16_uint, 0x0000000F,
119
+ :rg16_sint, 0x00000010,
120
+ :rg16_float, 0x00000011,
121
+ :rgba8_unorm, 0x00000012,
122
+ :rgba8_unorm_srgb, 0x00000013,
123
+ :rgba8_snorm, 0x00000014,
124
+ :rgba8_uint, 0x00000015,
125
+ :rgba8_sint, 0x00000016,
126
+ :bgra8_unorm, 0x00000017,
127
+ :bgra8_unorm_srgb, 0x00000018,
128
+ :rgb10a2_uint, 0x00000019,
129
+ :rgb10a2_unorm, 0x0000001A,
130
+ :rg11b10_ufloat, 0x0000001B,
131
+ :rgb9e5_ufloat, 0x0000001C,
132
+ :rg32_float, 0x0000001D,
133
+ :rg32_uint, 0x0000001E,
134
+ :rg32_sint, 0x0000001F,
135
+ :rgba16_uint, 0x00000020,
136
+ :rgba16_sint, 0x00000021,
137
+ :rgba16_float, 0x00000022,
138
+ :rgba32_float, 0x00000023,
139
+ :rgba32_uint, 0x00000024,
140
+ :rgba32_sint, 0x00000025,
141
+ :stencil8, 0x00000026,
142
+ :depth16_unorm, 0x00000027,
143
+ :depth24_plus, 0x00000028,
144
+ :depth24_plus_stencil8, 0x00000029,
145
+ :depth32_float, 0x0000002A,
146
+ :depth32_float_stencil8, 0x0000002B,
147
+ :bc1_rgba_unorm, 0x0000002C,
148
+ :bc1_rgba_unorm_srgb, 0x0000002D,
149
+ :bc2_rgba_unorm, 0x0000002E,
150
+ :bc2_rgba_unorm_srgb, 0x0000002F,
151
+ :bc3_rgba_unorm, 0x00000030,
152
+ :bc3_rgba_unorm_srgb, 0x00000031,
153
+ :bc4_r_unorm, 0x00000032,
154
+ :bc4_r_snorm, 0x00000033,
155
+ :bc5_rg_unorm, 0x00000034,
156
+ :bc5_rg_snorm, 0x00000035,
157
+ :bc6h_rgb_ufloat, 0x00000036,
158
+ :bc6h_rgb_float, 0x00000037,
159
+ :bc7_rgba_unorm, 0x00000038,
160
+ :bc7_rgba_unorm_srgb, 0x00000039,
161
+ :etc2_rgb8_unorm, 0x0000003A,
162
+ :etc2_rgb8_unorm_srgb, 0x0000003B,
163
+ :etc2_rgb8a1_unorm, 0x0000003C,
164
+ :etc2_rgb8a1_unorm_srgb, 0x0000003D,
165
+ :etc2_rgba8_unorm, 0x0000003E,
166
+ :etc2_rgba8_unorm_srgb, 0x0000003F,
167
+ :eac_r11_unorm, 0x00000040,
168
+ :eac_r11_snorm, 0x00000041,
169
+ :eac_rg11_unorm, 0x00000042,
170
+ :eac_rg11_snorm, 0x00000043,
171
+ :astc_4x4_unorm, 0x00000044,
172
+ :astc_4x4_unorm_srgb, 0x00000045,
173
+ :astc_5x4_unorm, 0x00000046,
174
+ :astc_5x4_unorm_srgb, 0x00000047,
175
+ :astc_5x5_unorm, 0x00000048,
176
+ :astc_5x5_unorm_srgb, 0x00000049,
177
+ :astc_6x5_unorm, 0x0000004A,
178
+ :astc_6x5_unorm_srgb, 0x0000004B,
179
+ :astc_6x6_unorm, 0x0000004C,
180
+ :astc_6x6_unorm_srgb, 0x0000004D,
181
+ :astc_8x5_unorm, 0x0000004E,
182
+ :astc_8x5_unorm_srgb, 0x0000004F,
183
+ :astc_8x6_unorm, 0x00000050,
184
+ :astc_8x6_unorm_srgb, 0x00000051,
185
+ :astc_8x8_unorm, 0x00000052,
186
+ :astc_8x8_unorm_srgb, 0x00000053,
187
+ :astc_10x5_unorm, 0x00000054,
188
+ :astc_10x5_unorm_srgb, 0x00000055,
189
+ :astc_10x6_unorm, 0x00000056,
190
+ :astc_10x6_unorm_srgb, 0x00000057,
191
+ :astc_10x8_unorm, 0x00000058,
192
+ :astc_10x8_unorm_srgb, 0x00000059,
193
+ :astc_10x10_unorm, 0x0000005A,
194
+ :astc_10x10_unorm_srgb, 0x0000005B,
195
+ :astc_12x10_unorm, 0x0000005C,
196
+ :astc_12x10_unorm_srgb, 0x0000005D,
197
+ :astc_12x12_unorm, 0x0000005E,
198
+ :astc_12x12_unorm_srgb, 0x0000005F
199
+ )
200
+
201
+ PrimitiveTopology = enum(
202
+ :undefined, 0x00000000,
203
+ :point_list, 0x00000001,
204
+ :line_list, 0x00000002,
205
+ :line_strip, 0x00000003,
206
+ :triangle_list, 0x00000004,
207
+ :triangle_strip, 0x00000005
208
+ )
209
+
210
+ LoadOp = enum(
211
+ :undefined, 0x00000000,
212
+ :load, 0x00000001,
213
+ :clear, 0x00000002
214
+ )
215
+
216
+ StoreOp = enum(
217
+ :undefined, 0x00000000,
218
+ :store, 0x00000001,
219
+ :discard, 0x00000002
220
+ )
221
+
222
+ TextureDimension = enum(
223
+ :undefined, 0x00000000,
224
+ :d1, 0x00000001,
225
+ :d2, 0x00000002,
226
+ :d3, 0x00000003
227
+ )
228
+
229
+ TextureUsage = {
230
+ none: 0x0000000000000000,
231
+ copy_src: 0x0000000000000001,
232
+ copy_dst: 0x0000000000000002,
233
+ texture_binding: 0x0000000000000004,
234
+ storage_binding: 0x0000000000000008,
235
+ render_attachment: 0x0000000000000010
236
+ }.freeze
237
+
238
+ VertexFormat = enum(
239
+ :uint8, 0x00000001,
240
+ :uint8x2, 0x00000002,
241
+ :uint8x4, 0x00000003,
242
+ :sint8, 0x00000004,
243
+ :sint8x2, 0x00000005,
244
+ :sint8x4, 0x00000006,
245
+ :unorm8, 0x00000007,
246
+ :unorm8x2, 0x00000008,
247
+ :unorm8x4, 0x00000009,
248
+ :snorm8, 0x0000000A,
249
+ :snorm8x2, 0x0000000B,
250
+ :snorm8x4, 0x0000000C,
251
+ :uint16, 0x0000000D,
252
+ :uint16x2, 0x0000000E,
253
+ :uint16x4, 0x0000000F,
254
+ :sint16, 0x00000010,
255
+ :sint16x2, 0x00000011,
256
+ :sint16x4, 0x00000012,
257
+ :unorm16, 0x00000013,
258
+ :unorm16x2, 0x00000014,
259
+ :unorm16x4, 0x00000015,
260
+ :snorm16, 0x00000016,
261
+ :snorm16x2, 0x00000017,
262
+ :snorm16x4, 0x00000018,
263
+ :float16, 0x00000019,
264
+ :float16x2, 0x0000001A,
265
+ :float16x4, 0x0000001B,
266
+ :float32, 0x0000001C,
267
+ :float32x2, 0x0000001D,
268
+ :float32x3, 0x0000001E,
269
+ :float32x4, 0x0000001F,
270
+ :uint32, 0x00000020,
271
+ :uint32x2, 0x00000021,
272
+ :uint32x3, 0x00000022,
273
+ :uint32x4, 0x00000023,
274
+ :sint32, 0x00000024,
275
+ :sint32x2, 0x00000025,
276
+ :sint32x3, 0x00000026,
277
+ :sint32x4, 0x00000027
278
+ )
279
+
280
+ IndexFormat = enum(
281
+ :undefined, 0x00000000,
282
+ :uint16, 0x00000001,
283
+ :uint32, 0x00000002
284
+ )
285
+
286
+ BufferBindingType = enum(
287
+ :binding_not_used, 0x00000000,
288
+ :undefined, 0x00000001,
289
+ :uniform, 0x00000002,
290
+ :storage, 0x00000003,
291
+ :read_only_storage, 0x00000004
292
+ )
293
+
294
+ SamplerBindingType = enum(
295
+ :binding_not_used, 0x00000000,
296
+ :undefined, 0x00000001,
297
+ :filtering, 0x00000002,
298
+ :non_filtering, 0x00000003,
299
+ :comparison, 0x00000004
300
+ )
301
+
302
+ TextureSampleType = enum(
303
+ :binding_not_used, 0x00000000,
304
+ :undefined, 0x00000001,
305
+ :float, 0x00000002,
306
+ :unfilterable_float, 0x00000003,
307
+ :depth, 0x00000004,
308
+ :sint, 0x00000005,
309
+ :uint, 0x00000006
310
+ )
311
+
312
+ StorageTextureAccess = enum(
313
+ :binding_not_used, 0x00000000,
314
+ :undefined, 0x00000001,
315
+ :write_only, 0x00000002,
316
+ :read_only, 0x00000003,
317
+ :read_write, 0x00000004
318
+ )
319
+
320
+ TextureViewDimension = enum(
321
+ :undefined, 0x00000000,
322
+ :d1, 0x00000001,
323
+ :d2, 0x00000002,
324
+ :d2_array, 0x00000003,
325
+ :cube, 0x00000004,
326
+ :cube_array, 0x00000005,
327
+ :d3, 0x00000006
328
+ )
329
+
330
+ TextureAspect = enum(
331
+ :undefined, 0x00000000,
332
+ :all, 0x00000001,
333
+ :stencil_only, 0x00000002,
334
+ :depth_only, 0x00000003
335
+ )
336
+
337
+ AddressMode = enum(
338
+ :undefined, 0x00000000,
339
+ :clamp_to_edge, 0x00000001,
340
+ :repeat, 0x00000002,
341
+ :mirror_repeat, 0x00000003
342
+ )
343
+
344
+ FilterMode = enum(
345
+ :undefined, 0x00000000,
346
+ :nearest, 0x00000001,
347
+ :linear, 0x00000002
348
+ )
349
+
350
+ MipmapFilterMode = enum(
351
+ :undefined, 0x00000000,
352
+ :nearest, 0x00000001,
353
+ :linear, 0x00000002
354
+ )
355
+
356
+ CompareFunction = enum(
357
+ :undefined, 0x00000000,
358
+ :never, 0x00000001,
359
+ :less, 0x00000002,
360
+ :less_equal, 0x00000003,
361
+ :greater, 0x00000004,
362
+ :greater_equal, 0x00000005,
363
+ :equal, 0x00000006,
364
+ :not_equal, 0x00000007,
365
+ :always, 0x00000008
366
+ )
367
+
368
+ FrontFace = enum(
369
+ :undefined, 0x00000000,
370
+ :ccw, 0x00000001,
371
+ :cw, 0x00000002
372
+ )
373
+
374
+ CullMode = enum(
375
+ :undefined, 0x00000000,
376
+ :none, 0x00000001,
377
+ :front, 0x00000002,
378
+ :back, 0x00000003
379
+ )
380
+
381
+ BlendFactor = enum(
382
+ :undefined, 0x00000000,
383
+ :zero, 0x00000001,
384
+ :one, 0x00000002,
385
+ :src, 0x00000003,
386
+ :one_minus_src, 0x00000004,
387
+ :src_alpha, 0x00000005,
388
+ :one_minus_src_alpha, 0x00000006,
389
+ :dst, 0x00000007,
390
+ :one_minus_dst, 0x00000008,
391
+ :dst_alpha, 0x00000009,
392
+ :one_minus_dst_alpha, 0x0000000A,
393
+ :src_alpha_saturated, 0x0000000B,
394
+ :constant, 0x0000000C,
395
+ :one_minus_constant, 0x0000000D,
396
+ :src1, 0x0000000E,
397
+ :one_minus_src1, 0x0000000F,
398
+ :src1_alpha, 0x00000010,
399
+ :one_minus_src1_alpha, 0x00000011
400
+ )
401
+
402
+ BlendOperation = enum(
403
+ :undefined, 0x00000000,
404
+ :add, 0x00000001,
405
+ :subtract, 0x00000002,
406
+ :reverse_subtract, 0x00000003,
407
+ :min, 0x00000004,
408
+ :max, 0x00000005
409
+ )
410
+
411
+ ColorWriteMask = {
412
+ none: 0x00000000,
413
+ red: 0x00000001,
414
+ green: 0x00000002,
415
+ blue: 0x00000004,
416
+ alpha: 0x00000008,
417
+ all: 0x0000000F
418
+ }.freeze
419
+
420
+ VertexStepMode = enum(
421
+ :vertex_buffer_not_used, 0x00000000,
422
+ :undefined, 0x00000001,
423
+ :vertex, 0x00000002,
424
+ :instance, 0x00000003
425
+ )
426
+
427
+ StencilOperation = enum(
428
+ :undefined, 0x00000000,
429
+ :keep, 0x00000001,
430
+ :zero, 0x00000002,
431
+ :replace, 0x00000003,
432
+ :invert, 0x00000004,
433
+ :increment_clamp, 0x00000005,
434
+ :decrement_clamp, 0x00000006,
435
+ :increment_wrap, 0x00000007,
436
+ :decrement_wrap, 0x00000008
437
+ )
438
+
439
+ PresentMode = enum(
440
+ :undefined, 0x00000000,
441
+ :fifo, 0x00000001,
442
+ :fifo_relaxed, 0x00000002,
443
+ :immediate, 0x00000003,
444
+ :mailbox, 0x00000004
445
+ )
446
+
447
+ CompositeAlphaMode = enum(
448
+ :auto, 0x00000000,
449
+ :opaque, 0x00000001,
450
+ :premultiplied, 0x00000002,
451
+ :unpremultiplied, 0x00000003,
452
+ :inherit, 0x00000004
453
+ )
454
+
455
+ SurfaceGetCurrentTextureStatus = enum(
456
+ :success_optimal, 0x00000001,
457
+ :success_suboptimal, 0x00000002,
458
+ :timeout, 0x00000003,
459
+ :outdated, 0x00000004,
460
+ :lost, 0x00000005,
461
+ :error, 0x00000006
462
+ )
463
+
464
+ QueryType = enum(
465
+ :occlusion, 0x00000001,
466
+ :timestamp, 0x00000002
467
+ )
468
+
469
+ ErrorFilter = enum(
470
+ :validation, 0x00000001,
471
+ :out_of_memory, 0x00000002,
472
+ :internal, 0x00000003
473
+ )
474
+
475
+ ErrorType = enum(
476
+ :no_error, 0x00000001,
477
+ :validation, 0x00000002,
478
+ :out_of_memory, 0x00000003,
479
+ :internal, 0x00000004,
480
+ :unknown, 0x00000005
481
+ )
482
+
483
+ PopErrorScopeStatus = enum(
484
+ :success, 0x00000001,
485
+ :callback_cancelled, 0x00000002,
486
+ :error, 0x00000003
487
+ )
488
+
489
+ QueueWorkDoneStatus = enum(
490
+ :success, 0x00000001,
491
+ :instance_dropped, 0x00000002,
492
+ :error, 0x00000003,
493
+ :unknown, 0x00000004
494
+ )
495
+
496
+ CompilationInfoRequestStatus = enum(
497
+ :success, 0x00000001,
498
+ :instance_dropped, 0x00000002,
499
+ :error, 0x00000003,
500
+ :unknown, 0x00000004
501
+ )
502
+
503
+ CompilationMessageType = enum(
504
+ :error, 0x00000001,
505
+ :warning, 0x00000002,
506
+ :info, 0x00000003
507
+ )
508
+
509
+ FeatureName = enum(
510
+ :undefined, 0x00000000,
511
+ :depth_clip_control, 0x00000001,
512
+ :depth32_float_stencil8, 0x00000002,
513
+ :timestamp_query, 0x00000003,
514
+ :texture_compression_bc, 0x00000004,
515
+ :texture_compression_bc_sliced_3d, 0x00000005,
516
+ :texture_compression_etc2, 0x00000006,
517
+ :texture_compression_astc, 0x00000007,
518
+ :texture_compression_astc_sliced_3d, 0x00000008,
519
+ :indirect_first_instance, 0x00000009,
520
+ :shader_f16, 0x0000000A,
521
+ :rg11b10_ufloat_renderable, 0x0000000B,
522
+ :bgra8_unorm_storage, 0x0000000C,
523
+ :float32_filterable, 0x0000000D,
524
+ :float32_blendable, 0x0000000E,
525
+ :clip_distances, 0x0000000F,
526
+ :dual_source_blending, 0x00000010
527
+ )
528
+ end
529
+ end