porky11 / wgpu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using import utils.modify-bindings
using import utils
load-library "/usr/local/lib/libwgpu_native.so"
vvv bind scope
vvv include
""""
#include <wgpu.h>
WGPUBindingResource wgpu_buffer_binding_create_resource(WGPUBufferBinding* buffer_binding) {
return (WGPUBindingResource) {
.tag = WGPUBindingResource_Buffer,
.buffer = (WGPUBindingResource_WGPUBuffer_Body) { *buffer_binding }
};
}
WGPUBindingResource wgpu_sampler_create_resource(WGPUSamplerId sampler) {
return (WGPUBindingResource) {
.tag = WGPUBindingResource_Sampler,
.sampler = (WGPUBindingResource_WGPUSampler_Body) { sampler }
};
}
WGPUBindingResource wgpu_texture_view_create_resource(WGPUTextureViewId texture_view) {
return (WGPUBindingResource) {
.tag = WGPUBindingResource_TextureView,
.texture_view = (WGPUBindingResource_WGPUTextureView_Body) { texture_view }
};
}
let new-scope = (Scope)
vvv bind new-scope
copy-bindings scope.typedef
prefix-remover "wgpu"
new-scope
vvv bind new-scope
copy-bindings scope.extern
prefix-remover "wgpu"
new-scope
vvv bind new-scope
copy-bindings scope.define
prefix-remover "wgpu"
new-scope
vvv bind new-scope
copy-bindings scope.struct
prefix-remover "wgpu"
new-scope
vvv bind new-scope
copy-bindings scope.enum
prefix-remover "wgpu"
new-scope
vvv bind new-scope
copy-bindings scope.const
prefix-remover "wgpu"
new-scope
vvv bind new-scope
copy-bindings scope.union
prefix-remover "wgpu"
new-scope
for k v in new-scope
if (('typeof v) == type and (v as type) < CEnum)
copy-bindings (v as type)
prefix-remover ("WGPU" .. k as Symbol as string)
let ShaderStage BufferUsage TextureUsage ColorWrite TextureAspectFlags =
copy-bindings new-scope
prefix-remover "ShaderStage"
Scope;
copy-bindings new-scope
prefix-remover "BufferUsage"
Scope;
copy-bindings new-scope
prefix-remover "TextureUsage"
Scope;
copy-bindings new-scope
prefix-remover "ColorWrite"
Scope;
copy-bindings new-scope
prefix-remover "TextureAspectFlags"
Scope;
define new-scope
'bind-symbols new-scope
keyed ShaderStage BufferUsage TextureUsage ColorWrite TextureAspectFlags
run-stage;
typedef+ new-scope.Color
let TRANSPARENT BLACK WHITE RED GREEN BLUE =
new-scope.Color 0 0 0 0
new-scope.Color 0 0 0 1
new-scope.Color 1 1 1 1
new-scope.Color 1 0 0 1
new-scope.Color 0 1 0 1
new-scope.Color 0 0 1 1
new-scope