1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-05 13:59:01 -05:00

fix(ext/webgpu): use correct IDL key name (#15278)

This commit is contained in:
Leo Kettmeir 2022-08-04 01:00:51 +02:00 committed by GitHub
parent bc4ee59246
commit 864af52a1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 17 deletions

View file

@ -323,7 +323,13 @@
); );
} }
} }
const requiredLimits = descriptor.requiredLimits; let requiredLimits = descriptor.requiredLimits;
if (requiredLimits) {
requiredLimits = {
...this[_adapter].limits[_limits],
...requiredLimits,
};
}
// TODO(lucacasonato): validate requiredLimits // TODO(lucacasonato): validate requiredLimits
const { rid, features, limits } = await core.opAsync( const { rid, features, limits } = await core.opAsync(

View file

@ -151,7 +151,7 @@
// DICTIONARY: GPUDeviceDescriptor // DICTIONARY: GPUDeviceDescriptor
const dictMembersGPUDeviceDescriptor = [ const dictMembersGPUDeviceDescriptor = [
{ {
key: "nonGuaranteedFeatures", key: "requiredFeatures",
converter: webidl.createSequenceConverter( converter: webidl.createSequenceConverter(
webidl.converters["GPUFeatureName"], webidl.converters["GPUFeatureName"],
), ),
@ -160,14 +160,11 @@
}, },
}, },
{ {
key: "nonGuaranteedLimits", key: "requiredLimits",
converter: webidl.createRecordConverter( converter: webidl.createRecordConverter(
webidl.converters["DOMString"], webidl.converters["DOMString"],
webidl.converters["GPUSize32"], webidl.converters["GPUSize32"],
), ),
get defaultValue() {
return {};
},
}, },
]; ];
webidl.converters["GPUDeviceDescriptor"] = webidl.createDictionaryConverter( webidl.converters["GPUDeviceDescriptor"] = webidl.createDictionaryConverter(

View file

@ -68,12 +68,12 @@ pub struct GpuRenderPassColorAttachment {
pub struct GpuRenderPassDepthStencilAttachment { pub struct GpuRenderPassDepthStencilAttachment {
view: ResourceId, view: ResourceId,
depth_clear_value: f32, depth_clear_value: f32,
depth_load_op: wgpu_core::command::LoadOp, depth_load_op: Option<wgpu_core::command::LoadOp>,
depth_store_op: wgpu_core::command::StoreOp, depth_store_op: Option<wgpu_core::command::StoreOp>,
depth_read_only: bool, depth_read_only: bool,
stencil_clear_value: u32, stencil_clear_value: u32,
stencil_load_op: wgpu_core::command::LoadOp, stencil_load_op: Option<wgpu_core::command::LoadOp>,
stencil_store_op: wgpu_core::command::StoreOp, stencil_store_op: Option<wgpu_core::command::StoreOp>,
stencil_read_only: bool, stencil_read_only: bool,
} }
@ -138,14 +138,22 @@ pub fn op_webgpu_command_encoder_begin_render_pass(
Some(wgpu_core::command::RenderPassDepthStencilAttachment { Some(wgpu_core::command::RenderPassDepthStencilAttachment {
view: texture_view_resource.0, view: texture_view_resource.0,
depth: wgpu_core::command::PassChannel { depth: wgpu_core::command::PassChannel {
load_op: attachment.depth_load_op, load_op: attachment
store_op: attachment.depth_store_op, .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, clear_value: attachment.depth_clear_value,
read_only: attachment.depth_read_only, read_only: attachment.depth_read_only,
}, },
stencil: wgpu_core::command::PassChannel { stencil: wgpu_core::command::PassChannel {
load_op: attachment.stencil_load_op, load_op: attachment
store_op: attachment.stencil_store_op, .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, clear_value: attachment.stencil_clear_value,
read_only: attachment.stencil_read_only, read_only: attachment.stencil_read_only,
}, },

View file

@ -408,7 +408,7 @@ pub async fn op_webgpu_request_device(
state: Rc<RefCell<OpState>>, state: Rc<RefCell<OpState>>,
adapter_rid: ResourceId, adapter_rid: ResourceId,
label: Option<String>, label: Option<String>,
required_features: Option<GpuRequiredFeatures>, required_features: GpuRequiredFeatures,
required_limits: Option<wgpu_types::Limits>, required_limits: Option<wgpu_types::Limits>,
) -> Result<GpuAdapterDevice, AnyError> { ) -> Result<GpuAdapterDevice, AnyError> {
let mut state = state.borrow_mut(); let mut state = state.borrow_mut();
@ -419,8 +419,8 @@ pub async fn op_webgpu_request_device(
let descriptor = wgpu_types::DeviceDescriptor { let descriptor = wgpu_types::DeviceDescriptor {
label: label.map(Cow::from), label: label.map(Cow::from),
features: required_features.map(Into::into).unwrap_or_default(), features: required_features.into(),
limits: required_limits.map(Into::into).unwrap_or_default(), limits: required_limits.unwrap_or_default(),
}; };
let (device, maybe_err) = gfx_select!(adapter => instance.adapter_request_device( let (device, maybe_err) = gfx_select!(adapter => instance.adapter_request_device(