@@ -99,7 +99,8 @@ impl std::hash::Hash for Temp {
99
99
///
100
100
/// An `Adapter` can be used to open a connection to the corresponding device on the host system,
101
101
/// yielding a [`Device`] object.
102
- #[ derive( Debug , PartialEq , Eq , Hash ) ]
102
+ #[ derive( Debug , PartialEq , Eq ) ]
103
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
103
104
pub struct Adapter {
104
105
id : wgc:: id:: AdapterId ,
105
106
}
@@ -117,7 +118,8 @@ pub struct RequestAdapterOptions<'a> {
117
118
///
118
119
/// The `Device` is the responsible for the creation of most rendering and compute resources, as
119
120
/// well as exposing [`Queue`] objects.
120
- #[ derive( Debug , PartialEq , Eq , Hash ) ]
121
+ #[ derive( Debug , PartialEq , Eq ) ]
122
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
121
123
pub struct Device {
122
124
id : wgc:: id:: DeviceId ,
123
125
temp : Temp ,
@@ -132,14 +134,16 @@ pub enum Maintain {
132
134
}
133
135
134
136
/// A handle to a GPU-accessible buffer.
135
- #[ derive( Debug , PartialEq , Eq , Hash ) ]
137
+ #[ derive( Debug , PartialEq , Eq ) ]
138
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
136
139
pub struct Buffer {
137
140
id : wgc:: id:: BufferId ,
138
141
device_id : wgc:: id:: DeviceId ,
139
142
}
140
143
141
144
/// A handle to a texture on the GPU.
142
- #[ derive( Debug , PartialEq , Eq , Hash ) ]
145
+ #[ derive( Debug , PartialEq , Eq ) ]
146
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
143
147
pub struct Texture {
144
148
id : wgc:: id:: TextureId ,
145
149
owned : bool ,
@@ -149,7 +153,8 @@ pub struct Texture {
149
153
///
150
154
/// A `TextureView` object describes a texture and associated metadata needed by a
151
155
/// [`RenderPipeline`] or [`BindGroup`].
152
- #[ derive( Debug , PartialEq , Eq , Hash ) ]
156
+ #[ derive( Debug , PartialEq , Eq ) ]
157
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
153
158
pub struct TextureView {
154
159
id : wgc:: id:: TextureViewId ,
155
160
owned : bool ,
@@ -160,7 +165,8 @@ pub struct TextureView {
160
165
/// A `Sampler` object defines how a pipeline will sample from a [`TextureView`]. Samplers define
161
166
/// image filters (including anisotropy) and address (wrapping) modes, among other things. See
162
167
/// the documentation for [`SamplerDescriptor`] for more information.
163
- #[ derive( Debug , PartialEq , Eq , Hash ) ]
168
+ #[ derive( Debug , PartialEq , Eq ) ]
169
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
164
170
pub struct Sampler {
165
171
id : wgc:: id:: SamplerId ,
166
172
}
@@ -169,7 +175,8 @@ pub struct Sampler {
169
175
///
170
176
/// A `Surface` represents a platform-specific surface (e.g. a window) to which rendered images may
171
177
/// be presented. A `Surface` may be created with [`Surface::create`].
172
- #[ derive( Debug , PartialEq ) ]
178
+ #[ derive( Debug , PartialEq , Eq ) ]
179
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
173
180
pub struct Surface {
174
181
id : wgc:: id:: SurfaceId ,
175
182
}
@@ -178,7 +185,8 @@ pub struct Surface {
178
185
///
179
186
/// A `SwapChain` represents the image or series of images that will be presented to a [`Surface`].
180
187
/// A `SwapChain` may be created with [`Device::create_swap_chain`].
181
- #[ derive( Debug , PartialEq ) ]
188
+ #[ derive( Debug , PartialEq , Eq ) ]
189
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
182
190
pub struct SwapChain {
183
191
id : wgc:: id:: SwapChainId ,
184
192
}
@@ -189,7 +197,8 @@ pub struct SwapChain {
189
197
/// create a [`BindGroupDescriptor`] object, which in turn can be used to create a [`BindGroup`]
190
198
/// object with [`Device::create_bind_group`]. A series of `BindGroupLayout`s can also be used to
191
199
/// create a [`PipelineLayoutDescriptor`], which can be used to create a [`PipelineLayout`].
192
- #[ derive( Debug , PartialEq , Eq , Hash ) ]
200
+ #[ derive( Debug , PartialEq , Eq ) ]
201
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
193
202
pub struct BindGroupLayout {
194
203
id : wgc:: id:: BindGroupLayoutId ,
195
204
}
@@ -200,7 +209,8 @@ pub struct BindGroupLayout {
200
209
/// [`BindGroupLayout`]. It can be created with [`Device::create_bind_group`]. A `BindGroup` can
201
210
/// be bound to a particular [`RenderPass`] with [`RenderPass::set_bind_group`], or to a
202
211
/// [`ComputePass`] with [`ComputePass::set_bind_group`].
203
- #[ derive( Debug , PartialEq , Eq , Hash ) ]
212
+ #[ derive( Debug , PartialEq , Eq ) ]
213
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
204
214
pub struct BindGroup {
205
215
id : wgc:: id:: BindGroupId ,
206
216
}
@@ -216,15 +226,17 @@ impl Drop for BindGroup {
216
226
/// A `ShaderModule` represents a compiled shader module on the GPU. It can be created by passing
217
227
/// valid SPIR-V source code to [`Device::create_shader_module`]. Shader modules are used to define
218
228
/// programmable stages of a pipeline.
219
- #[ derive( Debug , PartialEq , Eq , Hash ) ]
229
+ #[ derive( Debug , PartialEq , Eq ) ]
230
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
220
231
pub struct ShaderModule {
221
232
id : wgc:: id:: ShaderModuleId ,
222
233
}
223
234
224
235
/// An opaque handle to a pipeline layout.
225
236
///
226
237
/// A `PipelineLayout` object describes the available binding groups of a pipeline.
227
- #[ derive( Debug , PartialEq , Eq , Hash ) ]
238
+ #[ derive( Debug , PartialEq , Eq ) ]
239
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
228
240
pub struct PipelineLayout {
229
241
id : wgc:: id:: PipelineLayoutId ,
230
242
}
@@ -233,13 +245,15 @@ pub struct PipelineLayout {
233
245
///
234
246
/// A `RenderPipeline` object represents a graphics pipeline and its stages, bindings, vertex
235
247
/// buffers and targets. A `RenderPipeline` may be created with [`Device::create_render_pipeline`].
236
- #[ derive( Debug , PartialEq ) ]
248
+ #[ derive( Debug , PartialEq , Eq ) ]
249
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
237
250
pub struct RenderPipeline {
238
251
id : wgc:: id:: RenderPipelineId ,
239
252
}
240
253
241
254
/// A handle to a compute pipeline.
242
- #[ derive( Debug , PartialEq ) ]
255
+ #[ derive( Debug , PartialEq , Eq ) ]
256
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
243
257
pub struct ComputePipeline {
244
258
id : wgc:: id:: ComputePipelineId ,
245
259
}
@@ -249,7 +263,8 @@ pub struct ComputePipeline {
249
263
/// A `CommandBuffer` represents a complete sequence of commands that may be submitted to a command
250
264
/// queue with [`Queue::submit`]. A `CommandBuffer` is obtained by recording a series of commands to
251
265
/// a [`CommandEncoder`] and then calling [`CommandEncoder::finish`].
252
- #[ derive( Debug , PartialEq , Eq , Hash ) ]
266
+ #[ derive( Debug , PartialEq , Eq ) ]
267
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
253
268
pub struct CommandBuffer {
254
269
id : wgc:: id:: CommandBufferId ,
255
270
}
@@ -261,7 +276,8 @@ pub struct CommandBuffer {
261
276
///
262
277
/// When finished recording, call [`CommandEncoder::finish`] to obtain a [`CommandBuffer`] which may
263
278
/// be submitted for execution.
264
- #[ derive( Debug , PartialEq , Eq , Hash ) ]
279
+ #[ derive( Debug , PartialEq , Eq ) ]
280
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
265
281
pub struct CommandEncoder {
266
282
id : wgc:: id:: CommandEncoderId ,
267
283
/// This type should be !Send !Sync, because it represents an allocation on this thread's
@@ -286,7 +302,8 @@ pub struct ComputePass<'a> {
286
302
/// A handle to a command queue on a device.
287
303
///
288
304
/// A `Queue` executes recorded [`CommandBuffer`] objects.
289
- #[ derive( Debug , PartialEq ) ]
305
+ #[ derive( Debug , PartialEq , Eq ) ]
306
+ #[ cfg_attr( not( target_arch = "wasm32" ) , derive( Hash ) ) ]
290
307
pub struct Queue {
291
308
id : wgc:: id:: QueueId ,
292
309
}
0 commit comments