Skip to content

Commit 7304430

Browse files
Update wgpu to v22.1.0
1 parent 5fb1bd7 commit 7304430

File tree

9 files changed

+701
-614
lines changed

9 files changed

+701
-614
lines changed

Cargo.lock

Lines changed: 141 additions & 172 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,32 @@ resolver = "2"
2323
[workspace.dependencies.wgc]
2424
package = "wgpu-core"
2525
git = "https://github.com/gfx-rs/wgpu"
26-
rev = "4521502da69bcf4f92c8350042c268573ef216d4"
27-
version = "0.20"
26+
rev = "5c5c8b1d4d2d965fbd10b290ee26f4e7eb158d7c"
27+
version = "22.0.0"
2828

2929
[workspace.dependencies.wgt]
3030
package = "wgpu-types"
3131
git = "https://github.com/gfx-rs/wgpu"
32-
rev = "4521502da69bcf4f92c8350042c268573ef216d4"
33-
version = "0.20"
32+
rev = "5c5c8b1d4d2d965fbd10b290ee26f4e7eb158d7c"
33+
version = "22.0.0"
3434

3535
[workspace.dependencies.hal]
3636
package = "wgpu-hal"
3737
git = "https://github.com/gfx-rs/wgpu"
38-
rev = "4521502da69bcf4f92c8350042c268573ef216d4"
39-
version = "0.20"
38+
rev = "5c5c8b1d4d2d965fbd10b290ee26f4e7eb158d7c"
39+
version = "22.0.0"
4040

4141
[workspace.dependencies.naga]
4242
package = "naga"
4343
git = "https://github.com/gfx-rs/wgpu"
44-
rev = "4521502da69bcf4f92c8350042c268573ef216d4"
45-
version = "0.20"
44+
rev = "5c5c8b1d4d2d965fbd10b290ee26f4e7eb158d7c"
45+
version = "22.0.0"
4646

4747
[lib]
4848
crate-type = ["cdylib", "staticlib"]
4949

5050
[features]
51-
default = ["wgsl", "spirv", "glsl", "dx12", "metal", "trace"]
51+
default = ["wgsl", "spirv", "glsl", "dx12", "metal"]
5252

5353
#! ### Backends
5454
# --------------------------------------------------------------------
@@ -68,6 +68,10 @@ angle = ["wgc/gles"]
6868
## Enables the Vulkan backend on macOS & iOS.
6969
vulkan-portability = ["wgc/vulkan"]
7070

71+
#! **Note:** In the documentation, if you see that an item depends on a backend,
72+
#! it means that the item is only available when that backend is enabled _and_ the backend
73+
#! is supported on the current platform.
74+
7175
#! ### Shading language support
7276
# --------------------------------------------------------------------
7377

@@ -80,10 +84,6 @@ glsl = ["naga/glsl-in", "wgc/glsl"]
8084
## Enable accepting WGSL shaders as input.
8185
wgsl = ["wgc/wgsl"]
8286

83-
# TODO: needs to be exposed in wgpu.h
84-
# ## Enable accepting naga IR shaders as input.
85-
# naga-ir = ["naga"]
86-
8787
#! ### Logging & Tracing
8888
# --------------------------------------------------------------------
8989
#! The following features do not have any effect on the WebGPU backend.
@@ -98,8 +98,9 @@ api_log_info = ["wgc/api_log_info"]
9898
## Enables serialization via `serde` on common wgpu types.
9999
serde = ["dep:serde", "wgc/serde"]
100100

101-
## Allow writing of trace capture files. See [`Adapter::request_device`].
102-
trace = ["serde", "wgc/trace"]
101+
# Uncomment once upstream adds it again — https://github.com/gfx-rs/wgpu/issues/5974
102+
# ## Allow writing of trace capture files. See [`Adapter::request_device`].
103+
# trace = ["serde", "wgc/trace"]
103104

104105
## Allow deserializing of trace capture files that were written with the `trace` feature.
105106
## To replay a trace file use the [wgpu player](https://github.com/gfx-rs/wgpu/tree/trunk/player).

examples/capture/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ int main(int argc, char *argv[]) {
144144
assert(render_pass_encoder);
145145

146146
wgpuRenderPassEncoderEnd(render_pass_encoder);
147+
wgpuRenderPassEncoderRelease(render_pass_encoder);
147148

148149
wgpuCommandEncoderCopyTextureToBuffer(
149150
command_encoder,
@@ -186,7 +187,6 @@ int main(int argc, char *argv[]) {
186187

187188
wgpuBufferUnmap(output_buffer);
188189
wgpuCommandBufferRelease(command_buffer);
189-
wgpuRenderPassEncoderRelease(render_pass_encoder);
190190
wgpuCommandEncoderRelease(command_encoder);
191191
wgpuTextureViewRelease(texture_view);
192192
wgpuTextureRelease(texture);

examples/compute/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ int main(int argc, char *argv[]) {
124124
wgpuComputePassEncoderDispatchWorkgroups(compute_pass_encoder, numbers_length,
125125
1, 1);
126126
wgpuComputePassEncoderEnd(compute_pass_encoder);
127+
wgpuComputePassEncoderRelease(compute_pass_encoder);
127128

128129
wgpuCommandEncoderCopyBufferToBuffer(command_encoder, storage_buffer, 0,
129130
staging_buffer, 0, numbers_size);
@@ -149,7 +150,6 @@ int main(int argc, char *argv[]) {
149150

150151
wgpuBufferUnmap(staging_buffer);
151152
wgpuCommandBufferRelease(command_buffer);
152-
wgpuComputePassEncoderRelease(compute_pass_encoder);
153153
wgpuCommandEncoderRelease(command_encoder);
154154
wgpuBindGroupRelease(bind_group);
155155
wgpuBindGroupLayoutRelease(bind_group_layout);

examples/texture_arrays/main.c

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -689,27 +689,28 @@ int main(int argc, char *argv[]) {
689689

690690
WGPURenderPassEncoder render_pass_encoder =
691691
wgpuCommandEncoderBeginRenderPass(
692-
command_encoder, &(const WGPURenderPassDescriptor){
693-
.label = "render_pass_encoder",
694-
.colorAttachmentCount = 1,
695-
.colorAttachments =
696-
(const WGPURenderPassColorAttachment[]){
697-
(const WGPURenderPassColorAttachment){
698-
.view = frame,
699-
.loadOp = WGPULoadOp_Clear,
700-
.storeOp = WGPUStoreOp_Store,
701-
.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED,
702-
.clearValue =
703-
(const WGPUColor){
704-
.r = 0.0,
705-
.g = 0.0,
706-
.b = 0.0,
707-
.a = 1.0,
708-
},
709-
},
710-
},
711-
712-
});
692+
command_encoder,
693+
&(const WGPURenderPassDescriptor){
694+
.label = "render_pass_encoder",
695+
.colorAttachmentCount = 1,
696+
.colorAttachments =
697+
(const WGPURenderPassColorAttachment[]){
698+
(const WGPURenderPassColorAttachment){
699+
.view = frame,
700+
.loadOp = WGPULoadOp_Clear,
701+
.storeOp = WGPUStoreOp_Store,
702+
.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED,
703+
.clearValue =
704+
(const WGPUColor){
705+
.r = 0.0,
706+
.g = 0.0,
707+
.b = 0.0,
708+
.a = 1.0,
709+
},
710+
},
711+
},
712+
713+
});
713714
assert(render_pass_encoder);
714715

715716
wgpuRenderPassEncoderSetPipeline(render_pass_encoder, pipeline);
@@ -730,6 +731,7 @@ int main(int argc, char *argv[]) {
730731
wgpuRenderPassEncoderDrawIndexed(render_pass_encoder, 12, 1, 0, 0, 0);
731732
}
732733
wgpuRenderPassEncoderEnd(render_pass_encoder);
734+
wgpuRenderPassEncoderRelease(render_pass_encoder);
733735

734736
WGPUCommandBuffer command_buffer = wgpuCommandEncoderFinish(
735737
command_encoder, &(const WGPUCommandBufferDescriptor){
@@ -741,7 +743,6 @@ int main(int argc, char *argv[]) {
741743
wgpuSurfacePresent(demo.surface);
742744

743745
wgpuCommandBufferRelease(command_buffer);
744-
wgpuRenderPassEncoderRelease(render_pass_encoder);
745746
wgpuCommandEncoderRelease(command_encoder);
746747
wgpuTextureViewRelease(frame);
747748
wgpuTextureRelease(surface_texture.texture);

examples/triangle/main.c

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -308,31 +308,33 @@ int main(int argc, char *argv[]) {
308308

309309
WGPURenderPassEncoder render_pass_encoder =
310310
wgpuCommandEncoderBeginRenderPass(
311-
command_encoder, &(const WGPURenderPassDescriptor){
312-
.label = "render_pass_encoder",
313-
.colorAttachmentCount = 1,
314-
.colorAttachments =
315-
(const WGPURenderPassColorAttachment[]){
316-
(const WGPURenderPassColorAttachment){
317-
.view = frame,
318-
.loadOp = WGPULoadOp_Clear,
319-
.storeOp = WGPUStoreOp_Store,
320-
.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED,
321-
.clearValue =
322-
(const WGPUColor){
323-
.r = 0.0,
324-
.g = 1.0,
325-
.b = 0.0,
326-
.a = 1.0,
327-
},
328-
},
329-
},
330-
});
311+
command_encoder,
312+
&(const WGPURenderPassDescriptor){
313+
.label = "render_pass_encoder",
314+
.colorAttachmentCount = 1,
315+
.colorAttachments =
316+
(const WGPURenderPassColorAttachment[]){
317+
(const WGPURenderPassColorAttachment){
318+
.view = frame,
319+
.loadOp = WGPULoadOp_Clear,
320+
.storeOp = WGPUStoreOp_Store,
321+
.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED,
322+
.clearValue =
323+
(const WGPUColor){
324+
.r = 0.0,
325+
.g = 1.0,
326+
.b = 0.0,
327+
.a = 1.0,
328+
},
329+
},
330+
},
331+
});
331332
assert(render_pass_encoder);
332333

333334
wgpuRenderPassEncoderSetPipeline(render_pass_encoder, render_pipeline);
334335
wgpuRenderPassEncoderDraw(render_pass_encoder, 3, 1, 0, 0);
335336
wgpuRenderPassEncoderEnd(render_pass_encoder);
337+
wgpuRenderPassEncoderRelease(render_pass_encoder);
336338

337339
WGPUCommandBuffer command_buffer = wgpuCommandEncoderFinish(
338340
command_encoder, &(const WGPUCommandBufferDescriptor){
@@ -344,7 +346,6 @@ int main(int argc, char *argv[]) {
344346
wgpuSurfacePresent(demo.surface);
345347

346348
wgpuCommandBufferRelease(command_buffer);
347-
wgpuRenderPassEncoderRelease(render_pass_encoder);
348349
wgpuCommandEncoderRelease(command_encoder);
349350
wgpuTextureViewRelease(frame);
350351
wgpuTextureRelease(surface_texture.texture);

ffi/wgpu.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,13 @@ typedef enum WGPUNativeFeature {
4646
// WGPUNativeFeature_SpirvShaderPassthrough = 0x00030017,
4747
// WGPUNativeFeature_Multiview = 0x00030018,
4848
WGPUNativeFeature_VertexAttribute64bit = 0x00030019,
49-
WGPUNativeFeature_ShaderUnusedVertexOutput = 0x0003001A,
50-
WGPUNativeFeature_TextureFormatNv12 = 0x0003001B,
51-
WGPUNativeFeature_RayTracingAccelerationStructure = 0x0003001C,
52-
WGPUNativeFeature_RayQuery = 0x0003001D,
53-
WGPUNativeFeature_ShaderF64 = 0x0003001E,
54-
WGPUNativeFeature_ShaderI16 = 0x0003001F,
55-
WGPUNativeFeature_ShaderPrimitiveIndex = 0x00030020,
56-
WGPUNativeFeature_ShaderEarlyDepthTest = 0x00030021,
49+
WGPUNativeFeature_TextureFormatNv12 = 0x0003001A,
50+
WGPUNativeFeature_RayTracingAccelerationStructure = 0x0003001B,
51+
WGPUNativeFeature_RayQuery = 0x0003001C,
52+
WGPUNativeFeature_ShaderF64 = 0x0003001D,
53+
WGPUNativeFeature_ShaderI16 = 0x0003001E,
54+
WGPUNativeFeature_ShaderPrimitiveIndex = 0x0003001F,
55+
WGPUNativeFeature_ShaderEarlyDepthTest = 0x00030020,
5756
WGPUNativeFeature_Force32 = 0x7FFFFFFF
5857
} WGPUNativeFeature;
5958

src/conv.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ pub(crate) fn map_device_descriptor<'a>(
327327
},
328328
None => base_limits,
329329
},
330+
// TODO(wgpu.h)
331+
memory_hints: Default::default(),
330332
},
331333
match extras {
332334
Some(extras) => extras.tracePath,
@@ -568,7 +570,7 @@ pub enum ShaderParseError {
568570
Spirv(#[from] naga::front::spv::Error),
569571
#[cfg(feature = "glsl")]
570572
#[error(transparent)]
571-
Glsl(#[from] naga::front::glsl::ParseError),
573+
Glsl(#[from] naga::front::glsl::ParseErrors),
572574
}
573575

574576
#[inline]
@@ -1183,9 +1185,6 @@ pub fn features_to_native(features: wgt::Features) -> Vec<native::WGPUFeatureNam
11831185
if features.contains(wgt::Features::VERTEX_ATTRIBUTE_64BIT) {
11841186
temp.push(native::WGPUNativeFeature_VertexAttribute64bit);
11851187
}
1186-
if features.contains(wgt::Features::SHADER_UNUSED_VERTEX_OUTPUT) {
1187-
temp.push(native::WGPUNativeFeature_ShaderUnusedVertexOutput);
1188-
}
11891188
if features.contains(wgt::Features::TEXTURE_FORMAT_NV12) {
11901189
temp.push(native::WGPUNativeFeature_TextureFormatNv12);
11911190
}
@@ -1257,7 +1256,6 @@ pub fn map_feature(feature: native::WGPUFeatureName) -> Option<wgt::Features> {
12571256
// native::WGPUNativeFeature_SpirvShaderPassthrough => Some(Features::SPIRV_SHADER_PASSTHROUGH),
12581257
// native::WGPUNativeFeature_Multiview => Some(Features::MULTIVIEW),
12591258
native::WGPUNativeFeature_VertexAttribute64bit => Some(Features::VERTEX_ATTRIBUTE_64BIT),
1260-
native::WGPUNativeFeature_ShaderUnusedVertexOutput => Some(Features::SHADER_UNUSED_VERTEX_OUTPUT),
12611259
native::WGPUNativeFeature_TextureFormatNv12 => Some(Features::TEXTURE_FORMAT_NV12),
12621260
native::WGPUNativeFeature_RayTracingAccelerationStructure => Some(Features::RAY_TRACING_ACCELERATION_STRUCTURE),
12631261
native::WGPUNativeFeature_RayQuery => Some(Features::RAY_QUERY),

0 commit comments

Comments
 (0)