Update wgpu to better handle optional attachment load/store ops (#34646)

* Update wgpu to better handle attachment load/store ops

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Update expectations

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Samson 2024-12-16 19:58:53 +01:00 committed by GitHub
parent 3d816d6d24
commit d7eb0c5c38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 31 additions and 132 deletions

8
Cargo.lock generated
View file

@ -4493,7 +4493,7 @@ checksum = "956787520e75e9bd233246045d19f42fb73242759cc57fba9611d940ae96d4b0"
[[package]]
name = "naga"
version = "23.0.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=8f82992b9fa0fd71c19a4f5c2d8e2512ef22c010#8f82992b9fa0fd71c19a4f5c2d8e2512ef22c010"
source = "git+https://github.com/gfx-rs/wgpu?rev=4da7c263ed075e5d1ac7ee5640712542830e6330#4da7c263ed075e5d1ac7ee5640712542830e6330"
dependencies = [
"arrayvec",
"bit-set",
@ -8326,7 +8326,7 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
[[package]]
name = "wgpu-core"
version = "23.0.1"
source = "git+https://github.com/gfx-rs/wgpu?rev=8f82992b9fa0fd71c19a4f5c2d8e2512ef22c010#8f82992b9fa0fd71c19a4f5c2d8e2512ef22c010"
source = "git+https://github.com/gfx-rs/wgpu?rev=4da7c263ed075e5d1ac7ee5640712542830e6330#4da7c263ed075e5d1ac7ee5640712542830e6330"
dependencies = [
"arrayvec",
"bit-vec",
@ -8351,7 +8351,7 @@ dependencies = [
[[package]]
name = "wgpu-hal"
version = "23.0.1"
source = "git+https://github.com/gfx-rs/wgpu?rev=8f82992b9fa0fd71c19a4f5c2d8e2512ef22c010#8f82992b9fa0fd71c19a4f5c2d8e2512ef22c010"
source = "git+https://github.com/gfx-rs/wgpu?rev=4da7c263ed075e5d1ac7ee5640712542830e6330#4da7c263ed075e5d1ac7ee5640712542830e6330"
dependencies = [
"android_system_properties",
"arrayvec",
@ -8394,7 +8394,7 @@ dependencies = [
[[package]]
name = "wgpu-types"
version = "23.0.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=8f82992b9fa0fd71c19a4f5c2d8e2512ef22c010#8f82992b9fa0fd71c19a4f5c2d8e2512ef22c010"
source = "git+https://github.com/gfx-rs/wgpu?rev=4da7c263ed075e5d1ac7ee5640712542830e6330#4da7c263ed075e5d1ac7ee5640712542830e6330"
dependencies = [
"bitflags 2.6.0",
"js-sys",

View file

@ -155,8 +155,8 @@ webrender_api = { git = "https://github.com/servo/webrender", branch = "0.65" }
webrender_traits = { path = "components/shared/webrender" }
webxr = { git = "https://github.com/servo/webxr" }
webxr-api = { git = "https://github.com/servo/webxr" }
wgpu-core = { git = "https://github.com/gfx-rs/wgpu", rev = "8f82992b9fa0fd71c19a4f5c2d8e2512ef22c010" }
wgpu-types = { git = "https://github.com/gfx-rs/wgpu", rev = "8f82992b9fa0fd71c19a4f5c2d8e2512ef22c010" }
wgpu-core = { git = "https://github.com/gfx-rs/wgpu", rev = "4da7c263ed075e5d1ac7ee5640712542830e6330" }
wgpu-types = { git = "https://github.com/gfx-rs/wgpu", rev = "4da7c263ed075e5d1ac7ee5640712542830e6330" }
windows-sys = "0.59"
wr_malloc_size_of = { git = "https://github.com/servo/webrender", branch = "0.65" }
xi-unicode = "0.3.0"

View file

@ -24,7 +24,6 @@ use crate::dom::globalscope::GlobalScope;
use crate::dom::webgpu::gpubuffer::GPUBuffer;
use crate::dom::webgpu::gpucommandbuffer::GPUCommandBuffer;
use crate::dom::webgpu::gpucomputepassencoder::GPUComputePassEncoder;
use crate::dom::webgpu::gpuconvert::{convert_load_op, convert_store_op};
use crate::dom::webgpu::gpudevice::GPUDevice;
use crate::dom::webgpu::gpurenderpassencoder::GPURenderPassEncoder;
use crate::script_runtime::CanGc;
@ -154,21 +153,21 @@ impl GPUCommandEncoderMethods<crate::DomTypeHolder> for GPUCommandEncoder {
&self,
descriptor: &GPURenderPassDescriptor,
) -> Fallible<DomRoot<GPURenderPassEncoder>> {
let depth_stencil_attachment = descriptor.depthStencilAttachment.as_ref().map(|depth| {
let depth_stencil_attachment = descriptor.depthStencilAttachment.as_ref().map(|ds| {
wgpu_com::RenderPassDepthStencilAttachment {
depth: wgpu_com::PassChannel {
load_op: convert_load_op(depth.depthLoadOp),
store_op: convert_store_op(depth.depthStoreOp),
clear_value: *depth.depthClearValue.unwrap_or_default(),
read_only: depth.depthReadOnly,
load_op: ds.depthLoadOp.as_ref().map(Convert::convert),
store_op: ds.depthStoreOp.as_ref().map(Convert::convert),
clear_value: *ds.depthClearValue.unwrap_or_default(),
read_only: ds.depthReadOnly,
},
stencil: wgpu_com::PassChannel {
load_op: convert_load_op(depth.stencilLoadOp),
store_op: convert_store_op(depth.stencilStoreOp),
clear_value: depth.stencilClearValue,
read_only: depth.stencilReadOnly,
load_op: ds.stencilLoadOp.as_ref().map(Convert::convert),
store_op: ds.stencilStoreOp.as_ref().map(Convert::convert),
clear_value: ds.stencilClearValue,
read_only: ds.stencilReadOnly,
},
view: depth.view.id().0,
view: ds.view.id().0,
}
});
@ -178,8 +177,8 @@ impl GPUCommandEncoderMethods<crate::DomTypeHolder> for GPUCommandEncoder {
.map(|color| -> Fallible<_> {
Ok(Some(wgpu_com::RenderPassColorAttachment {
resolve_target: color.resolveTarget.as_ref().map(|t| t.id().0),
load_op: convert_load_op(Some(color.loadOp)),
store_op: convert_store_op(Some(color.storeOp)),
load_op: color.loadOp.convert(),
store_op: color.storeOp.convert(),
clear_value: color
.clearValue
.as_ref()

View file

@ -406,19 +406,21 @@ impl Convert<wgt::BlendComponent> for &GPUBlendComponent {
}
}
pub fn convert_load_op(op: Option<GPULoadOp>) -> wgpu_com::LoadOp {
match op {
Some(GPULoadOp::Load) => wgpu_com::LoadOp::Load,
Some(GPULoadOp::Clear) => wgpu_com::LoadOp::Clear,
None => wgpu_com::LoadOp::Clear,
impl Convert<wgpu_com::LoadOp> for &GPULoadOp {
fn convert(self) -> wgpu_com::LoadOp {
match self {
GPULoadOp::Load => wgpu_com::LoadOp::Load,
GPULoadOp::Clear => wgpu_com::LoadOp::Clear,
}
}
}
pub fn convert_store_op(op: Option<GPUStoreOp>) -> wgpu_com::StoreOp {
match op {
Some(GPUStoreOp::Store) => wgpu_com::StoreOp::Store,
Some(GPUStoreOp::Discard) => wgpu_com::StoreOp::Discard,
None => wgpu_com::StoreOp::Discard,
impl Convert<wgpu_com::StoreOp> for &GPUStoreOp {
fn convert(self) -> wgpu_com::StoreOp {
match self {
GPUStoreOp::Store => wgpu_com::StoreOp::Store,
GPUStoreOp::Discard => wgpu_com::StoreOp::Discard,
}
}
}

View file

@ -481,7 +481,7 @@ impl WGPU {
wgpu_core::pipeline::ShaderModuleSource::Wgsl(Cow::Borrowed(&program));
let desc = ShaderModuleDescriptor {
label: label.map(|s| s.into()),
shader_bound_checks: wgt::ShaderBoundChecks::default(),
runtime_checks: wgt::ShaderRuntimeChecks::checked(),
};
let (_, error) = global.device_create_shader_module(
device_id,

View file

@ -34783,16 +34783,12 @@
if os == "linux" and not debug: FAIL
[:depthStencilFormat="depth24plus-stencil8"]
expected:
if os == "linux" and not debug: FAIL
[:depthStencilFormat="depth32float"]
expected:
if os == "linux" and not debug: FAIL
[:depthStencilFormat="depth32float-stencil8"]
expected:
if os == "linux" and not debug: FAIL
[:depthStencilFormat="stencil8"]
expected:
@ -50707,54 +50703,30 @@
[:encoderType="render%20bundle";format="_undef_"]
[:encoderType="render%20bundle";format="depth16unorm"]
expected:
if os == "linux" and not debug: [FAIL, TIMEOUT, NOTRUN]
[:encoderType="render%20bundle";format="depth24plus"]
expected:
if os == "linux" and not debug: [FAIL, TIMEOUT, NOTRUN]
[:encoderType="render%20bundle";format="depth24plus-stencil8"]
expected:
if os == "linux" and not debug: [FAIL, TIMEOUT, NOTRUN]
[:encoderType="render%20bundle";format="depth32float"]
expected:
if os == "linux" and not debug: [FAIL, TIMEOUT, NOTRUN]
[:encoderType="render%20bundle";format="depth32float-stencil8"]
expected:
if os == "linux" and not debug: [FAIL, NOTRUN]
[:encoderType="render%20bundle";format="stencil8"]
expected:
if os == "linux" and not debug: [FAIL, TIMEOUT, NOTRUN]
[:encoderType="render%20pass";format="_undef_"]
[:encoderType="render%20pass";format="depth16unorm"]
expected:
if os == "linux" and not debug: [FAIL, NOTRUN]
[:encoderType="render%20pass";format="depth24plus"]
expected:
if os == "linux" and not debug: [FAIL, NOTRUN]
[:encoderType="render%20pass";format="depth24plus-stencil8"]
expected:
if os == "linux" and not debug: [FAIL, NOTRUN]
[:encoderType="render%20pass";format="depth32float"]
expected:
if os == "linux" and not debug: [FAIL, NOTRUN]
[:encoderType="render%20pass";format="depth32float-stencil8"]
expected:
if os == "linux" and not debug: [FAIL, NOTRUN]
[:encoderType="render%20pass";format="stencil8"]
expected:
if os == "linux" and not debug: [FAIL, TIMEOUT]
[cts.https.html?q=webgpu:api,validation,render_pass,attachment_compatibility:render_pass_or_bundle_and_pipeline,sample_count:*]
@ -51033,16 +51005,12 @@
if os == "linux" and not debug: FAIL
[:format="depth24plus-stencil8"]
expected:
if os == "linux" and not debug: FAIL
[:format="depth32float"]
expected:
if os == "linux" and not debug: FAIL
[:format="depth32float-stencil8"]
expected:
if os == "linux" and not debug: FAIL
[:format="stencil8"]
expected:
@ -71709,48 +71677,26 @@
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=3]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=3]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=3]
expected:
@ -71765,52 +71711,28 @@
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=3]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=3]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=0;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=3]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=0;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1]
expected:
@ -71821,12 +71743,8 @@
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=1;bgLayer=1;bgLayerCount=2]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1]
expected:
@ -71837,32 +71755,18 @@
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=0;bgLevel=1;bgLevelCount=2;bgLayer=1;bgLayerCount=2]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=0;bgLayerCount=3]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=1;bgLevel=0;bgLevelCount=1;bgLayer=1;bgLayerCount=2]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=1;bgLayer=0;bgLayerCount=3]
expected:
@ -71877,8 +71781,6 @@
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=1]
expected:
if os == "linux" and not debug: FAIL
[:dsLevel=1;dsLayer=1;bgLevel=1;bgLevelCount=2;bgLayer=0;bgLayerCount=3]
expected:
@ -74435,14 +74337,10 @@
[:bindAspect="depth-only";depthStencilReadOnly=false]
[:bindAspect="depth-only";depthStencilReadOnly=true]
expected:
if os == "linux" and not debug: FAIL
[:bindAspect="stencil-only";depthStencilReadOnly=false]
[:bindAspect="stencil-only";depthStencilReadOnly=true]
expected:
if os == "linux" and not debug: FAIL
[cts.https.html?q=webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_unused_bind_group:*]