diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2022-08-04 01:00:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-04 01:00:51 +0200 |
commit | 864af52a1bf242bdf59790ba28a08042aab8c66b (patch) | |
tree | 65c1cf28aae00a775085c6d83f10622d1c40c328 /ext/webgpu/src | |
parent | bc4ee5924682fee9e22922c1b8c07fad32728a83 (diff) |
fix(ext/webgpu): use correct IDL key name (#15278)
Diffstat (limited to 'ext/webgpu/src')
-rw-r--r-- | ext/webgpu/src/01_webgpu.js | 8 | ||||
-rw-r--r-- | ext/webgpu/src/02_idl_types.js | 7 | ||||
-rw-r--r-- | ext/webgpu/src/command_encoder.rs | 24 | ||||
-rw-r--r-- | ext/webgpu/src/lib.rs | 6 |
4 files changed, 28 insertions, 17 deletions
diff --git a/ext/webgpu/src/01_webgpu.js b/ext/webgpu/src/01_webgpu.js index 21599a117..79d1f497c 100644 --- a/ext/webgpu/src/01_webgpu.js +++ b/ext/webgpu/src/01_webgpu.js @@ -323,7 +323,13 @@ ); } } - const requiredLimits = descriptor.requiredLimits; + let requiredLimits = descriptor.requiredLimits; + if (requiredLimits) { + requiredLimits = { + ...this[_adapter].limits[_limits], + ...requiredLimits, + }; + } // TODO(lucacasonato): validate requiredLimits const { rid, features, limits } = await core.opAsync( diff --git a/ext/webgpu/src/02_idl_types.js b/ext/webgpu/src/02_idl_types.js index c1532c7ec..08867303a 100644 --- a/ext/webgpu/src/02_idl_types.js +++ b/ext/webgpu/src/02_idl_types.js @@ -151,7 +151,7 @@ // DICTIONARY: GPUDeviceDescriptor const dictMembersGPUDeviceDescriptor = [ { - key: "nonGuaranteedFeatures", + key: "requiredFeatures", converter: webidl.createSequenceConverter( webidl.converters["GPUFeatureName"], ), @@ -160,14 +160,11 @@ }, }, { - key: "nonGuaranteedLimits", + key: "requiredLimits", converter: webidl.createRecordConverter( webidl.converters["DOMString"], webidl.converters["GPUSize32"], ), - get defaultValue() { - return {}; - }, }, ]; webidl.converters["GPUDeviceDescriptor"] = webidl.createDictionaryConverter( diff --git a/ext/webgpu/src/command_encoder.rs b/ext/webgpu/src/command_encoder.rs index d09199bbf..a583466d0 100644 --- a/ext/webgpu/src/command_encoder.rs +++ b/ext/webgpu/src/command_encoder.rs @@ -68,12 +68,12 @@ pub struct GpuRenderPassColorAttachment { pub struct GpuRenderPassDepthStencilAttachment { view: ResourceId, depth_clear_value: f32, - depth_load_op: wgpu_core::command::LoadOp, - depth_store_op: wgpu_core::command::StoreOp, + depth_load_op: Option<wgpu_core::command::LoadOp>, + depth_store_op: Option<wgpu_core::command::StoreOp>, depth_read_only: bool, stencil_clear_value: u32, - stencil_load_op: wgpu_core::command::LoadOp, - stencil_store_op: wgpu_core::command::StoreOp, + stencil_load_op: Option<wgpu_core::command::LoadOp>, + stencil_store_op: Option<wgpu_core::command::StoreOp>, stencil_read_only: bool, } @@ -138,14 +138,22 @@ pub fn op_webgpu_command_encoder_begin_render_pass( Some(wgpu_core::command::RenderPassDepthStencilAttachment { view: texture_view_resource.0, depth: wgpu_core::command::PassChannel { - load_op: attachment.depth_load_op, - store_op: attachment.depth_store_op, + load_op: attachment + .depth_load_op + .unwrap_or(wgpu_core::command::LoadOp::Load), + store_op: attachment + .depth_store_op + .unwrap_or(wgpu_core::command::StoreOp::Store), clear_value: attachment.depth_clear_value, read_only: attachment.depth_read_only, }, stencil: wgpu_core::command::PassChannel { - load_op: attachment.stencil_load_op, - store_op: attachment.stencil_store_op, + load_op: attachment + .stencil_load_op + .unwrap_or(wgpu_core::command::LoadOp::Load), + store_op: attachment + .stencil_store_op + .unwrap_or(wgpu_core::command::StoreOp::Store), clear_value: attachment.stencil_clear_value, read_only: attachment.stencil_read_only, }, diff --git a/ext/webgpu/src/lib.rs b/ext/webgpu/src/lib.rs index 1620532a6..ba5cdbac3 100644 --- a/ext/webgpu/src/lib.rs +++ b/ext/webgpu/src/lib.rs @@ -408,7 +408,7 @@ pub async fn op_webgpu_request_device( state: Rc<RefCell<OpState>>, adapter_rid: ResourceId, label: Option<String>, - required_features: Option<GpuRequiredFeatures>, + required_features: GpuRequiredFeatures, required_limits: Option<wgpu_types::Limits>, ) -> Result<GpuAdapterDevice, AnyError> { let mut state = state.borrow_mut(); @@ -419,8 +419,8 @@ pub async fn op_webgpu_request_device( let descriptor = wgpu_types::DeviceDescriptor { label: label.map(Cow::from), - features: required_features.map(Into::into).unwrap_or_default(), - limits: required_limits.map(Into::into).unwrap_or_default(), + features: required_features.into(), + limits: required_limits.unwrap_or_default(), }; let (device, maybe_err) = gfx_select!(adapter => instance.adapter_request_device( |