-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathdescriptor_rust.go
More file actions
270 lines (237 loc) · 6.75 KB
/
Copy pathdescriptor_rust.go
File metadata and controls
270 lines (237 loc) · 6.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
//go:build rust
package wgpu
// Extent3D is a 3D size.
type Extent3D struct {
Width uint32
Height uint32
DepthOrArrayLayers uint32
}
// Origin3D is a 3D origin point.
type Origin3D struct {
X uint32
Y uint32
Z uint32
}
// ImageDataLayout describes the layout of image data in a buffer.
type ImageDataLayout struct {
Offset uint64
BytesPerRow uint32
RowsPerImage uint32
}
// BufferDescriptor describes buffer creation parameters.
type BufferDescriptor struct {
Label string
Size uint64
Usage BufferUsage
MappedAtCreation bool
}
// TextureDescriptor describes texture creation parameters.
type TextureDescriptor struct {
Label string
Size Extent3D
MipLevelCount uint32
SampleCount uint32
Dimension TextureDimension
Format TextureFormat
Usage TextureUsage
ViewFormats []TextureFormat
}
// TextureViewDescriptor describes texture view creation parameters.
type TextureViewDescriptor struct {
Label string
Format TextureFormat
Dimension TextureViewDimension
Aspect TextureAspect
BaseMipLevel uint32
MipLevelCount uint32
BaseArrayLayer uint32
ArrayLayerCount uint32
}
// SamplerDescriptor describes sampler creation parameters.
type SamplerDescriptor struct {
Label string
AddressModeU AddressMode
AddressModeV AddressMode
AddressModeW AddressMode
MagFilter FilterMode
MinFilter FilterMode
MipmapFilter FilterMode
LodMinClamp float32
LodMaxClamp float32
Compare CompareFunction
Anisotropy uint16
}
// ShaderModuleDescriptor describes shader module creation parameters.
type ShaderModuleDescriptor struct {
Label string
WGSL string // WGSL source code
SPIRV []uint32 // SPIR-V bytecode (alternative to WGSL)
}
// CommandEncoderDescriptor describes command encoder creation.
type CommandEncoderDescriptor struct {
Label string
}
// ComputePassDescriptor describes compute pass creation.
type ComputePassDescriptor struct {
Label string
}
// SurfaceConfiguration configures surface presentation.
type SurfaceConfiguration struct {
Width uint32
Height uint32
Format TextureFormat
Usage TextureUsage
PresentMode PresentMode
AlphaMode CompositeAlphaMode
}
// StencilOperation describes a stencil operation.
type StencilOperation uint32
// Stencil operation constants.
const (
StencilOperationKeep StencilOperation = 0
StencilOperationZero StencilOperation = 1
StencilOperationReplace StencilOperation = 2
StencilOperationInvert StencilOperation = 3
StencilOperationIncrementClamp StencilOperation = 4
StencilOperationDecrementClamp StencilOperation = 5
StencilOperationIncrementWrap StencilOperation = 6
StencilOperationDecrementWrap StencilOperation = 7
)
// StencilFaceState describes stencil operations for a face.
type StencilFaceState struct {
Compare CompareFunction
FailOp StencilOperation
DepthFailOp StencilOperation
PassOp StencilOperation
}
// DepthStencilState describes depth and stencil testing configuration.
type DepthStencilState struct {
Format TextureFormat
DepthWriteEnabled bool
DepthCompare CompareFunction
StencilFront StencilFaceState
StencilBack StencilFaceState
StencilReadMask uint32
StencilWriteMask uint32
DepthBias int32
DepthBiasSlopeScale float32
DepthBiasClamp float32
}
// RenderPassDescriptor describes a render pass.
type RenderPassDescriptor struct {
Label string
ColorAttachments []RenderPassColorAttachment
DepthStencilAttachment *RenderPassDepthStencilAttachment
}
// RenderPassColorAttachment describes a color attachment for a render pass.
type RenderPassColorAttachment struct {
View *TextureView
ResolveTarget *TextureView
LoadOp LoadOp
StoreOp StoreOp
ClearValue Color
}
// RenderPassDepthStencilAttachment describes a depth/stencil attachment.
type RenderPassDepthStencilAttachment struct {
View *TextureView
DepthLoadOp LoadOp
DepthStoreOp StoreOp
DepthClearValue float32
DepthReadOnly bool
StencilLoadOp LoadOp
StencilStoreOp StoreOp
StencilClearValue uint32
StencilReadOnly bool
}
// BindGroupLayoutDescriptor describes a bind group layout.
type BindGroupLayoutDescriptor struct {
Label string
Entries []BindGroupLayoutEntry
}
// PipelineLayoutDescriptor describes a pipeline layout.
type PipelineLayoutDescriptor struct {
Label string
BindGroupLayouts []*BindGroupLayout
}
// BindGroupDescriptor describes a bind group.
type BindGroupDescriptor struct {
Label string
Layout *BindGroupLayout
Entries []BindGroupEntry
}
// BindGroupEntry describes a single resource binding in a bind group.
type BindGroupEntry struct {
Binding uint32
Buffer *Buffer
Offset uint64
Size uint64
Sampler *Sampler
TextureView *TextureView
}
// RenderPipelineDescriptor describes a render pipeline.
type RenderPipelineDescriptor struct {
Label string
Layout *PipelineLayout
Vertex VertexState
Primitive PrimitiveState
DepthStencil *DepthStencilState
Multisample MultisampleState
Fragment *FragmentState
}
// VertexState describes the vertex shader stage.
type VertexState struct {
Module *ShaderModule
EntryPoint string
Buffers []VertexBufferLayout
}
// FragmentState describes the fragment shader stage.
type FragmentState struct {
Module *ShaderModule
EntryPoint string
Targets []ColorTargetState
}
// ComputePipelineDescriptor describes a compute pipeline.
type ComputePipelineDescriptor struct {
Label string
Layout *PipelineLayout
Module *ShaderModule
EntryPoint string
}
// ImageCopyTexture specifies a texture subresource for copy operations.
type ImageCopyTexture struct {
Texture *Texture
MipLevel uint32
Origin Origin3D
Aspect TextureAspect
}
// TextureUsageTransition defines a texture usage state transition.
type TextureUsageTransition struct {
OldUsage TextureUsage
NewUsage TextureUsage
}
// TextureRange specifies a range of texture subresources.
type TextureRange struct {
Aspect TextureAspect
BaseMipLevel uint32
MipLevelCount uint32
BaseArrayLayer uint32
ArrayLayerCount uint32
}
// TextureBarrier defines a texture state transition for synchronization.
type TextureBarrier struct {
Texture *Texture
Range TextureRange
Usage TextureUsageTransition
}
// TextureCopy describes a texture-to-texture copy region.
type TextureCopy struct {
Source ImageCopyTexture
Destination ImageCopyTexture
Size Extent3D
}
// BufferTextureCopy defines a buffer-texture copy region.
type BufferTextureCopy struct {
BufferLayout ImageDataLayout
TextureBase ImageCopyTexture
Size Extent3D
}