Skip to content

Commit 7efc77a

Browse files
Merge branch 'gfx-rs:trunk' into push-qxmkopzptsyq
2 parents fda4dc0 + 8c4aebc commit 7efc77a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+931
-87
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ jobs:
691691
run: taplo format --check --diff
692692

693693
- name: Check for typos
694-
uses: crate-ci/[email protected].2
694+
uses: crate-ci/[email protected].3
695695

696696
check-cts-runner:
697697
# runtime is normally 2 minutes

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ By @cwfitzgerald in [#8162](https://github.com/gfx-rs/wgpu/pull/8162).
200200
- **BREAKING**: Previously the WGSL storage-texture format `rg11b10float` was incorrectly accepted and generated by naga, but now only accepts the the correct name `rg11b10ufloat` instead. By @ErikWDev in [#8219](https://github.com/gfx-rs/wgpu/pull/8219).
201201
- The [`source()`](https://doc.rust-lang.org/std/error/trait.Error.html#method.source) method of `ShaderError` no longer reports the error as its own source. By @andyleiserson in [#8258](https://github.com/gfx-rs/wgpu/pull/8258).
202202
- naga correctly ingests SPIR-V that use descriptor runtime indexing, which in turn is correctly converted into WGSLs binding array. By @hasenbanck in [8256](https://github.com/gfx-rs/wgpu/pull/8256).
203+
- naga correctly ingests SPIR-V that loads from multi-sampled textures, which in turn is correctly converted into WGSLs texture_multisampled_2d and load operations. By @hasenbanck in [8270](https://github.com/gfx-rs/wgpu/pull/8270).
204+
- naga implement OpImageGather and OpImageDrefGather operations when ingesting SPIR-V. By @hasenbanck in [8280](https://github.com/gfx-rs/wgpu/pull/8280).
203205

204206
#### DX12
205207

@@ -214,12 +216,17 @@ By @cwfitzgerald in [#8162](https://github.com/gfx-rs/wgpu/pull/8162).
214216

215217
#### DX12
216218

219+
- Create an event per wait to prevent 60 second hangs in certain multithreaded scenarios. By @Vecvec in [#8273](https://github.com/gfx-rs/wgpu/pull/8273).
217220
- Fixed a bug where access to matrices with 2 rows would not work in some cases. By @andyleiserson in [#7438](https://github.com/gfx-rs/wgpu/pull/7438).
218221

219222
##### EGL
220223

221224
- Fixed unwrap failed in context creation for some Android devices. By @uael in [#8024](https://github.com/gfx-rs/wgpu/pull/8024).
222225

226+
##### Vulkan
227+
228+
- Fixed wrong color format+space being reported versus what is hardcoded in `create_swapchain()`. By @MarijnS95 in [#8226](https://github.com/gfx-rs/wgpu/pull/8226).
229+
223230
#### naga
224231

225232
- [wgsl-in] Allow a trailing comma in `@blend_src(…)` attributes. By @ErichDonGubler in [#8137](https://github.com/gfx-rs/wgpu/pull/8137).

cts_runner/revision.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
81bfec725ae101551cc29f5f028c968b19c14467
1+
5e7bd6ed86201123ff6b0900974587550afb10e7

cts_runner/test.lst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// cargo xtask cts -- --list <selector>
44
// ```
55
unittests:*
6+
webgpu:api,operation,buffers,createBindGroup:buffer_binding_resource:*
67
webgpu:api,operation,command_buffer,basic:*
78
webgpu:api,operation,command_buffer,copyBufferToBuffer:*
89
fails-if(vulkan) webgpu:api,operation,command_buffer,copyTextureToTexture:copy_depth_stencil:format="depth24plus"
@@ -18,10 +19,13 @@ webgpu:api,operation,compute,basic:memcpy:*
1819
webgpu:api,operation,compute_pipeline,overrides:*
1920
webgpu:api,operation,device,lost:*
2021
webgpu:api,operation,render_pass,storeOp:*
22+
fails-if(vulkan) webgpu:api,operation,vertex_state,correctness:array_stride_zero:*
2123
// Presumably vertex pulling, revisit after https://github.com/gfx-rs/wgpu/issues/7981 is fixed.
2224
fails-if(metal) webgpu:api,operation,vertex_state,correctness:setVertexBuffer_offset_and_attribute_offset:*
2325
fails-if(dx12) webgpu:api,validation,capability_checks,limits,maxBindGroups:setBindGroup,*
2426
webgpu:api,validation,createBindGroup:buffer,effective_buffer_binding_size:*
27+
// Fails because we coerce a size of 0 in `GPUDevice.createBindGroup(…)` to `buffer.size - offset`.
28+
// FAIL webgpu:api,validation,createBindGroup:buffer_offset_and_size_for_bind_groups_match:*
2529
webgpu:api,validation,encoding,beginComputePass:*
2630
webgpu:api,validation,encoding,beginRenderPass:*
2731
webgpu:api,validation,encoding,cmds,clearBuffer:*
@@ -106,14 +110,12 @@ webgpu:api,validation,image_copy,layout_related:copy_end_overflows_u64:*
106110
fails-if(dx12) webgpu:api,validation,image_copy,layout_related:offset_alignment:*
107111
webgpu:api,validation,image_copy,texture_related:format:dimension="1d";*
108112
webgpu:api,validation,queue,submit:command_buffer,*
109-
// `GPUTexture` as `GPUTextureView` not supported by Deno. https://github.com/gfx-rs/wgpu/issues/8200
110-
//FAIL: webgpu:api,validation,render_pass,render_pass_descriptor:attachments,one_color_attachment:
111-
//FAIL: webgpu:api,validation,render_pass,render_pass_descriptor:attachments,one_depth_stencil_attachment:
112-
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,same_size:
113-
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,color_depth_mismatch:
114-
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,layer_count:*
115-
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,mip_level_count:*
113+
webgpu:api,validation,render_pass,render_pass_descriptor:attachments,*
114+
webgpu:api,validation,render_pass,render_pass_descriptor:color_attachments,depthSlice,bound_check:*
115+
// Fails due to missing validation.
116+
// FAIL: webgpu:api,validation,render_pass,render_pass_descriptor:color_attachments,depthSlice,overlaps,diff_miplevel:*
116117
webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,*
118+
webgpu:api,validation,render_pass,resolve:resolve_attachment:*
117119
webgpu:api,validation,texture,rg11b10ufloat_renderable:*
118120
webgpu:api,operation,render_pipeline,overrides:*
119121
webgpu:api,operation,rendering,basic:clear:*

deno_webgpu/bind_group.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use deno_core::WebIDL;
1717
use crate::buffer::GPUBuffer;
1818
use crate::error::GPUGenericError;
1919
use crate::sampler::GPUSampler;
20+
use crate::texture::GPUTexture;
2021
use crate::texture::GPUTextureView;
2122
use crate::Instance;
2223

@@ -93,7 +94,9 @@ pub(crate) struct GPUBufferBinding {
9394

9495
pub(crate) enum GPUBindingResource {
9596
Sampler(Ptr<GPUSampler>),
97+
Texture(Ptr<GPUTexture>),
9698
TextureView(Ptr<GPUTextureView>),
99+
Buffer(Ptr<GPUBuffer>),
97100
BufferBinding(GPUBufferBinding),
98101
}
99102

@@ -115,6 +118,16 @@ impl<'a> WebIdlConverter<'a> for GPUBindingResource {
115118
options,
116119
)
117120
.map(Self::Sampler)
121+
.or_else(|_| {
122+
<Ptr<GPUTexture>>::convert(
123+
scope,
124+
value,
125+
prefix.clone(),
126+
context.borrowed(),
127+
options,
128+
)
129+
.map(Self::Texture)
130+
})
118131
.or_else(|_| {
119132
<Ptr<GPUTextureView>>::convert(
120133
scope,
@@ -125,6 +138,16 @@ impl<'a> WebIdlConverter<'a> for GPUBindingResource {
125138
)
126139
.map(Self::TextureView)
127140
})
141+
.or_else(|_| {
142+
<Ptr<GPUBuffer>>::convert(
143+
scope,
144+
value,
145+
prefix.clone(),
146+
context.borrowed(),
147+
options,
148+
)
149+
.map(Self::Buffer)
150+
})
128151
.or_else(|_| {
129152
GPUBufferBinding::convert(scope, value, prefix, context, options)
130153
.map(Self::BufferBinding)

deno_webgpu/buffer.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ impl GPUBuffer {
114114
*self.map_state.borrow()
115115
}
116116

117+
// In the successful case, the promise should resolve to undefined, but
118+
// `#[undefined]` does not seem to work here.
119+
// https://github.com/denoland/deno/issues/29603
117120
#[async_method]
118121
async fn map_async(
119122
&self,
@@ -250,6 +253,7 @@ impl GPUBuffer {
250253
}
251254

252255
#[nofast]
256+
#[undefined]
253257
fn unmap(&self, scope: &mut v8::HandleScope) -> Result<(), BufferError> {
254258
for ab in self.mapped_js_buffers.replace(vec![]) {
255259
let ab = ab.open(scope);
@@ -267,6 +271,7 @@ impl GPUBuffer {
267271
}
268272

269273
#[fast]
274+
#[undefined]
270275
fn destroy(&self) {
271276
self.instance.buffer_destroy(self.id);
272277
}

deno_webgpu/command_encoder.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ impl GPUCommandEncoder {
7575
.map(|attachment| {
7676
attachment.into_option().map(|attachment| {
7777
wgpu_core::command::RenderPassColorAttachment {
78-
view: attachment.view.id,
78+
view: attachment.view.to_view_id(),
7979
depth_slice: attachment.depth_slice,
80-
resolve_target: attachment.resolve_target.map(|target| target.id),
80+
resolve_target: attachment
81+
.resolve_target
82+
.map(|target| target.to_view_id()),
8183
load_op: attachment
8284
.load_op
8385
.with_default_value(attachment.clear_value.map(Into::into)),
@@ -103,7 +105,7 @@ impl GPUCommandEncoder {
103105
}
104106

105107
Ok(wgpu_core::command::RenderPassDepthStencilAttachment {
106-
view: attachment.view.id,
108+
view: attachment.view.to_view_id(),
107109
depth: PassChannel {
108110
load_op: attachment
109111
.depth_load_op
@@ -191,6 +193,7 @@ impl GPUCommandEncoder {
191193
}
192194

193195
#[required(2)]
196+
#[undefined]
194197
fn copy_buffer_to_buffer<'a>(
195198
&self,
196199
scope: &mut v8::HandleScope<'a>,
@@ -280,6 +283,7 @@ impl GPUCommandEncoder {
280283
}
281284

282285
#[required(3)]
286+
#[undefined]
283287
fn copy_buffer_to_texture(
284288
&self,
285289
#[webidl] source: GPUTexelCopyBufferInfo,
@@ -315,6 +319,7 @@ impl GPUCommandEncoder {
315319
}
316320

317321
#[required(3)]
322+
#[undefined]
318323
fn copy_texture_to_buffer(
319324
&self,
320325
#[webidl] source: GPUTexelCopyTextureInfo,
@@ -350,6 +355,7 @@ impl GPUCommandEncoder {
350355
}
351356

352357
#[required(3)]
358+
#[undefined]
353359
fn copy_texture_to_texture(
354360
&self,
355361
#[webidl] source: GPUTexelCopyTextureInfo,
@@ -383,6 +389,7 @@ impl GPUCommandEncoder {
383389
}
384390

385391
#[required(1)]
392+
#[undefined]
386393
fn clear_buffer(
387394
&self,
388395
#[webidl] buffer: Ptr<GPUBuffer>,
@@ -397,6 +404,7 @@ impl GPUCommandEncoder {
397404
}
398405

399406
#[required(5)]
407+
#[undefined]
400408
fn resolve_query_set(
401409
&self,
402410
#[webidl] query_set: Ptr<super::query_set::GPUQuerySet>,

deno_webgpu/compute_pass.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ impl GPUComputePassEncoder {
4949
// TODO(@crowlKats): no-op, needs wpgu to implement changing the label
5050
}
5151

52+
#[undefined]
5253
fn set_pipeline(
5354
&self,
5455
#[webidl] pipeline: Ptr<crate::compute_pipeline::GPUComputePipeline>,
@@ -63,6 +64,7 @@ impl GPUComputePassEncoder {
6364
self.error_handler.push_error(err);
6465
}
6566

67+
#[undefined]
6668
fn dispatch_workgroups(
6769
&self,
6870
#[webidl(options(enforce_range = true))] work_group_count_x: u32,
@@ -83,6 +85,7 @@ impl GPUComputePassEncoder {
8385
self.error_handler.push_error(err);
8486
}
8587

88+
#[undefined]
8689
fn dispatch_workgroups_indirect(
8790
&self,
8891
#[webidl] indirect_buffer: Ptr<crate::buffer::GPUBuffer>,
@@ -100,6 +103,7 @@ impl GPUComputePassEncoder {
100103
}
101104

102105
#[fast]
106+
#[undefined]
103107
fn end(&self) {
104108
let err = self
105109
.instance
@@ -108,6 +112,7 @@ impl GPUComputePassEncoder {
108112
self.error_handler.push_error(err);
109113
}
110114

115+
#[undefined]
111116
fn push_debug_group(&self, #[webidl] group_label: String) {
112117
let err = self
113118
.instance
@@ -121,6 +126,7 @@ impl GPUComputePassEncoder {
121126
}
122127

123128
#[fast]
129+
#[undefined]
124130
fn pop_debug_group(&self) {
125131
let err = self
126132
.instance
@@ -129,6 +135,7 @@ impl GPUComputePassEncoder {
129135
self.error_handler.push_error(err);
130136
}
131137

138+
#[undefined]
132139
fn insert_debug_marker(&self, #[webidl] marker_label: String) {
133140
let err = self
134141
.instance
@@ -141,6 +148,7 @@ impl GPUComputePassEncoder {
141148
self.error_handler.push_error(err);
142149
}
143150

151+
#[undefined]
144152
fn set_bind_group<'a>(
145153
&self,
146154
scope: &mut v8::HandleScope<'a>,

deno_webgpu/device.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ impl GPUDevice {
142142
}
143143

144144
#[fast]
145+
#[undefined]
145146
fn destroy(&self) {
146147
self.instance.device_destroy(self.id);
147148
self
@@ -230,6 +231,7 @@ impl GPUDevice {
230231
instance: self.instance.clone(),
231232
error_handler: self.error_handler.clone(),
232233
id,
234+
default_view_id: Default::default(),
233235
label: descriptor.label,
234236
size: wgpu_descriptor.size,
235237
mip_level_count: wgpu_descriptor.mip_level_count,
@@ -403,9 +405,19 @@ impl GPUDevice {
403405
GPUBindingResource::Sampler(sampler) => {
404406
BindingResource::Sampler(sampler.id)
405407
}
408+
GPUBindingResource::Texture(texture) => {
409+
BindingResource::TextureView(texture.default_view_id())
410+
}
406411
GPUBindingResource::TextureView(texture_view) => {
407412
BindingResource::TextureView(texture_view.id)
408413
}
414+
GPUBindingResource::Buffer(buffer) => {
415+
BindingResource::Buffer(wgpu_core::binding_model::BufferBinding {
416+
buffer: buffer.id,
417+
offset: 0,
418+
size: NonZeroU64::new(buffer.size),
419+
})
420+
}
409421
GPUBindingResource::BufferBinding(buffer_binding) => {
410422
BindingResource::Buffer(wgpu_core::binding_model::BufferBinding {
411423
buffer: buffer_binding.buffer.id,
@@ -623,6 +635,7 @@ impl GPUDevice {
623635
}
624636

625637
#[required(1)]
638+
#[undefined]
626639
fn push_error_scope(&self, #[webidl] filter: super::error::GPUErrorFilter) {
627640
self
628641
.error_handler

deno_webgpu/query_set.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ impl GPUQuerySet {
5353
}
5454

5555
#[fast]
56+
#[undefined]
5657
fn destroy(&self) -> Result<(), JsErrorBox> {
5758
// TODO(https://github.com/gfx-rs/wgpu/issues/6495): Destroy the query
5859
// set. Until that is supported, it is okay to do nothing here, the

0 commit comments

Comments
 (0)