Skip to content

Commit

Permalink
Update wgpu to v22.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rajveermalviya committed Aug 4, 2024
1 parent 5fb1bd7 commit 7304430
Show file tree
Hide file tree
Showing 9 changed files with 701 additions and 614 deletions.
313 changes: 141 additions & 172 deletions Cargo.lock

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,32 @@ resolver = "2"
[workspace.dependencies.wgc]
package = "wgpu-core"
git = "https://github.com/gfx-rs/wgpu"
rev = "4521502da69bcf4f92c8350042c268573ef216d4"
version = "0.20"
rev = "5c5c8b1d4d2d965fbd10b290ee26f4e7eb158d7c"
version = "22.0.0"

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

[workspace.dependencies.hal]
package = "wgpu-hal"
git = "https://github.com/gfx-rs/wgpu"
rev = "4521502da69bcf4f92c8350042c268573ef216d4"
version = "0.20"
rev = "5c5c8b1d4d2d965fbd10b290ee26f4e7eb158d7c"
version = "22.0.0"

[workspace.dependencies.naga]
package = "naga"
git = "https://github.com/gfx-rs/wgpu"
rev = "4521502da69bcf4f92c8350042c268573ef216d4"
version = "0.20"
rev = "5c5c8b1d4d2d965fbd10b290ee26f4e7eb158d7c"
version = "22.0.0"

[lib]
crate-type = ["cdylib", "staticlib"]

[features]
default = ["wgsl", "spirv", "glsl", "dx12", "metal", "trace"]
default = ["wgsl", "spirv", "glsl", "dx12", "metal"]

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

#! **Note:** In the documentation, if you see that an item depends on a backend,
#! it means that the item is only available when that backend is enabled _and_ the backend
#! is supported on the current platform.

#! ### Shading language support
# --------------------------------------------------------------------

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

# TODO: needs to be exposed in wgpu.h
# ## Enable accepting naga IR shaders as input.
# naga-ir = ["naga"]

#! ### Logging & Tracing
# --------------------------------------------------------------------
#! The following features do not have any effect on the WebGPU backend.
Expand All @@ -98,8 +98,9 @@ api_log_info = ["wgc/api_log_info"]
## Enables serialization via `serde` on common wgpu types.
serde = ["dep:serde", "wgc/serde"]

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

## Allow deserializing of trace capture files that were written with the `trace` feature.
## To replay a trace file use the [wgpu player](https://github.com/gfx-rs/wgpu/tree/trunk/player).
Expand Down
2 changes: 1 addition & 1 deletion examples/capture/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ int main(int argc, char *argv[]) {
assert(render_pass_encoder);

wgpuRenderPassEncoderEnd(render_pass_encoder);
wgpuRenderPassEncoderRelease(render_pass_encoder);

wgpuCommandEncoderCopyTextureToBuffer(
command_encoder,
Expand Down Expand Up @@ -186,7 +187,6 @@ int main(int argc, char *argv[]) {

wgpuBufferUnmap(output_buffer);
wgpuCommandBufferRelease(command_buffer);
wgpuRenderPassEncoderRelease(render_pass_encoder);
wgpuCommandEncoderRelease(command_encoder);
wgpuTextureViewRelease(texture_view);
wgpuTextureRelease(texture);
Expand Down
2 changes: 1 addition & 1 deletion examples/compute/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ int main(int argc, char *argv[]) {
wgpuComputePassEncoderDispatchWorkgroups(compute_pass_encoder, numbers_length,
1, 1);
wgpuComputePassEncoderEnd(compute_pass_encoder);
wgpuComputePassEncoderRelease(compute_pass_encoder);

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

wgpuBufferUnmap(staging_buffer);
wgpuCommandBufferRelease(command_buffer);
wgpuComputePassEncoderRelease(compute_pass_encoder);
wgpuCommandEncoderRelease(command_encoder);
wgpuBindGroupRelease(bind_group);
wgpuBindGroupLayoutRelease(bind_group_layout);
Expand Down
45 changes: 23 additions & 22 deletions examples/texture_arrays/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,27 +689,28 @@ int main(int argc, char *argv[]) {

WGPURenderPassEncoder render_pass_encoder =
wgpuCommandEncoderBeginRenderPass(
command_encoder, &(const WGPURenderPassDescriptor){
.label = "render_pass_encoder",
.colorAttachmentCount = 1,
.colorAttachments =
(const WGPURenderPassColorAttachment[]){
(const WGPURenderPassColorAttachment){
.view = frame,
.loadOp = WGPULoadOp_Clear,
.storeOp = WGPUStoreOp_Store,
.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED,
.clearValue =
(const WGPUColor){
.r = 0.0,
.g = 0.0,
.b = 0.0,
.a = 1.0,
},
},
},

});
command_encoder,
&(const WGPURenderPassDescriptor){
.label = "render_pass_encoder",
.colorAttachmentCount = 1,
.colorAttachments =
(const WGPURenderPassColorAttachment[]){
(const WGPURenderPassColorAttachment){
.view = frame,
.loadOp = WGPULoadOp_Clear,
.storeOp = WGPUStoreOp_Store,
.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED,
.clearValue =
(const WGPUColor){
.r = 0.0,
.g = 0.0,
.b = 0.0,
.a = 1.0,
},
},
},

});
assert(render_pass_encoder);

wgpuRenderPassEncoderSetPipeline(render_pass_encoder, pipeline);
Expand All @@ -730,6 +731,7 @@ int main(int argc, char *argv[]) {
wgpuRenderPassEncoderDrawIndexed(render_pass_encoder, 12, 1, 0, 0, 0);
}
wgpuRenderPassEncoderEnd(render_pass_encoder);
wgpuRenderPassEncoderRelease(render_pass_encoder);

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

wgpuCommandBufferRelease(command_buffer);
wgpuRenderPassEncoderRelease(render_pass_encoder);
wgpuCommandEncoderRelease(command_encoder);
wgpuTextureViewRelease(frame);
wgpuTextureRelease(surface_texture.texture);
Expand Down
43 changes: 22 additions & 21 deletions examples/triangle/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,31 +308,33 @@ int main(int argc, char *argv[]) {

WGPURenderPassEncoder render_pass_encoder =
wgpuCommandEncoderBeginRenderPass(
command_encoder, &(const WGPURenderPassDescriptor){
.label = "render_pass_encoder",
.colorAttachmentCount = 1,
.colorAttachments =
(const WGPURenderPassColorAttachment[]){
(const WGPURenderPassColorAttachment){
.view = frame,
.loadOp = WGPULoadOp_Clear,
.storeOp = WGPUStoreOp_Store,
.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED,
.clearValue =
(const WGPUColor){
.r = 0.0,
.g = 1.0,
.b = 0.0,
.a = 1.0,
},
},
},
});
command_encoder,
&(const WGPURenderPassDescriptor){
.label = "render_pass_encoder",
.colorAttachmentCount = 1,
.colorAttachments =
(const WGPURenderPassColorAttachment[]){
(const WGPURenderPassColorAttachment){
.view = frame,
.loadOp = WGPULoadOp_Clear,
.storeOp = WGPUStoreOp_Store,
.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED,
.clearValue =
(const WGPUColor){
.r = 0.0,
.g = 1.0,
.b = 0.0,
.a = 1.0,
},
},
},
});
assert(render_pass_encoder);

wgpuRenderPassEncoderSetPipeline(render_pass_encoder, render_pipeline);
wgpuRenderPassEncoderDraw(render_pass_encoder, 3, 1, 0, 0);
wgpuRenderPassEncoderEnd(render_pass_encoder);
wgpuRenderPassEncoderRelease(render_pass_encoder);

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

wgpuCommandBufferRelease(command_buffer);
wgpuRenderPassEncoderRelease(render_pass_encoder);
wgpuCommandEncoderRelease(command_encoder);
wgpuTextureViewRelease(frame);
wgpuTextureRelease(surface_texture.texture);
Expand Down
15 changes: 7 additions & 8 deletions ffi/wgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ typedef enum WGPUNativeFeature {
// WGPUNativeFeature_SpirvShaderPassthrough = 0x00030017,
// WGPUNativeFeature_Multiview = 0x00030018,
WGPUNativeFeature_VertexAttribute64bit = 0x00030019,
WGPUNativeFeature_ShaderUnusedVertexOutput = 0x0003001A,
WGPUNativeFeature_TextureFormatNv12 = 0x0003001B,
WGPUNativeFeature_RayTracingAccelerationStructure = 0x0003001C,
WGPUNativeFeature_RayQuery = 0x0003001D,
WGPUNativeFeature_ShaderF64 = 0x0003001E,
WGPUNativeFeature_ShaderI16 = 0x0003001F,
WGPUNativeFeature_ShaderPrimitiveIndex = 0x00030020,
WGPUNativeFeature_ShaderEarlyDepthTest = 0x00030021,
WGPUNativeFeature_TextureFormatNv12 = 0x0003001A,
WGPUNativeFeature_RayTracingAccelerationStructure = 0x0003001B,
WGPUNativeFeature_RayQuery = 0x0003001C,
WGPUNativeFeature_ShaderF64 = 0x0003001D,
WGPUNativeFeature_ShaderI16 = 0x0003001E,
WGPUNativeFeature_ShaderPrimitiveIndex = 0x0003001F,
WGPUNativeFeature_ShaderEarlyDepthTest = 0x00030020,
WGPUNativeFeature_Force32 = 0x7FFFFFFF
} WGPUNativeFeature;

Expand Down
8 changes: 3 additions & 5 deletions src/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ pub(crate) fn map_device_descriptor<'a>(
},
None => base_limits,
},
// TODO(wgpu.h)
memory_hints: Default::default(),
},
match extras {
Some(extras) => extras.tracePath,
Expand Down Expand Up @@ -568,7 +570,7 @@ pub enum ShaderParseError {
Spirv(#[from] naga::front::spv::Error),
#[cfg(feature = "glsl")]
#[error(transparent)]
Glsl(#[from] naga::front::glsl::ParseError),
Glsl(#[from] naga::front::glsl::ParseErrors),
}

#[inline]
Expand Down Expand Up @@ -1183,9 +1185,6 @@ pub fn features_to_native(features: wgt::Features) -> Vec<native::WGPUFeatureNam
if features.contains(wgt::Features::VERTEX_ATTRIBUTE_64BIT) {
temp.push(native::WGPUNativeFeature_VertexAttribute64bit);
}
if features.contains(wgt::Features::SHADER_UNUSED_VERTEX_OUTPUT) {
temp.push(native::WGPUNativeFeature_ShaderUnusedVertexOutput);
}
if features.contains(wgt::Features::TEXTURE_FORMAT_NV12) {
temp.push(native::WGPUNativeFeature_TextureFormatNv12);
}
Expand Down Expand Up @@ -1257,7 +1256,6 @@ pub fn map_feature(feature: native::WGPUFeatureName) -> Option<wgt::Features> {
// native::WGPUNativeFeature_SpirvShaderPassthrough => Some(Features::SPIRV_SHADER_PASSTHROUGH),
// native::WGPUNativeFeature_Multiview => Some(Features::MULTIVIEW),
native::WGPUNativeFeature_VertexAttribute64bit => Some(Features::VERTEX_ATTRIBUTE_64BIT),
native::WGPUNativeFeature_ShaderUnusedVertexOutput => Some(Features::SHADER_UNUSED_VERTEX_OUTPUT),
native::WGPUNativeFeature_TextureFormatNv12 => Some(Features::TEXTURE_FORMAT_NV12),
native::WGPUNativeFeature_RayTracingAccelerationStructure => Some(Features::RAY_TRACING_ACCELERATION_STRUCTURE),
native::WGPUNativeFeature_RayQuery => Some(Features::RAY_QUERY),
Expand Down
Loading

0 comments on commit 7304430

Please sign in to comment.