summaryrefslogtreecommitdiff
path: root/extensions/webgpu/command_encoder.rs
diff options
context:
space:
mode:
authorLuca Casonato <lucacasonato@yahoo.com>2021-05-06 16:48:45 +0200
committerGitHub <noreply@github.com>2021-05-06 16:48:45 +0200
commitf208e6a26f3c21c25dbfcfe29491a6f5660c999d (patch)
tree65dbbd45b2f36faab8ae585eb0d270356bcba33e /extensions/webgpu/command_encoder.rs
parentce76f8c3a97529c86d49c39c6d9a250f978b5430 (diff)
chore: update wgpu and realign to spec (#9760)
Diffstat (limited to 'extensions/webgpu/command_encoder.rs')
-rw-r--r--extensions/webgpu/command_encoder.rs43
1 files changed, 24 insertions, 19 deletions
diff --git a/extensions/webgpu/command_encoder.rs b/extensions/webgpu/command_encoder.rs
index 3bee10248..4eb47ef95 100644
--- a/extensions/webgpu/command_encoder.rs
+++ b/extensions/webgpu/command_encoder.rs
@@ -8,6 +8,7 @@ use deno_core::{OpState, Resource};
use serde::Deserialize;
use std::borrow::Cow;
use std::cell::RefCell;
+use std::num::NonZeroU32;
use super::error::WebGpuResult;
@@ -120,8 +121,8 @@ pub fn op_webgpu_command_encoder_begin_render_pass(
.get::<super::texture::WebGpuTextureView>(color_attachment.view)
.ok_or_else(bad_resource_id)?;
- let attachment = wgpu_core::command::ColorAttachmentDescriptor {
- attachment: texture_view_resource.0,
+ let attachment = wgpu_core::command::RenderPassColorAttachment {
+ view: texture_view_resource.0,
resolve_target: color_attachment
.resolve_target
.map(|rid| {
@@ -173,8 +174,8 @@ pub fn op_webgpu_command_encoder_begin_render_pass(
.ok_or_else(bad_resource_id)?;
depth_stencil_attachment =
- Some(wgpu_core::command::DepthStencilAttachmentDescriptor {
- attachment: texture_view_resource.0,
+ Some(wgpu_core::command::RenderPassDepthStencilAttachment {
+ view: texture_view_resource.0,
depth: match attachment.depth_load_op.as_str() {
"load" => wgpu_core::command::PassChannel {
load_op: wgpu_core::command::LoadOp::Load,
@@ -361,15 +362,15 @@ pub fn op_webgpu_command_encoder_copy_buffer_to_texture(
.get::<super::texture::WebGpuTexture>(args.destination.texture)
.ok_or_else(bad_resource_id)?;
- let source = wgpu_core::command::BufferCopyView {
+ let source = wgpu_core::command::ImageCopyBuffer {
buffer: source_buffer_resource.0,
- layout: wgpu_types::TextureDataLayout {
+ layout: wgpu_types::ImageDataLayout {
offset: args.source.offset.unwrap_or(0),
- bytes_per_row: args.source.bytes_per_row.unwrap_or(0),
- rows_per_image: args.source.rows_per_image.unwrap_or(0),
+ bytes_per_row: NonZeroU32::new(args.source.bytes_per_row.unwrap_or(0)),
+ rows_per_image: NonZeroU32::new(args.source.rows_per_image.unwrap_or(0)),
},
};
- let destination = wgpu_core::command::TextureCopyView {
+ let destination = wgpu_core::command::ImageCopyTexture {
texture: destination_texture_resource.0,
mip_level: args.destination.mip_level.unwrap_or(0),
origin: args
@@ -388,7 +389,7 @@ pub fn op_webgpu_command_encoder_copy_buffer_to_texture(
&wgpu_types::Extent3d {
width: args.copy_size.width.unwrap_or(1),
height: args.copy_size.height.unwrap_or(1),
- depth: args.copy_size.depth.unwrap_or(1),
+ depth_or_array_layers: args.copy_size.depth_or_array_layers.unwrap_or(1),
}
))
}
@@ -422,7 +423,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_buffer(
.get::<super::buffer::WebGpuBuffer>(args.destination.buffer)
.ok_or_else(bad_resource_id)?;
- let source = wgpu_core::command::TextureCopyView {
+ let source = wgpu_core::command::ImageCopyTexture {
texture: source_texture_resource.0,
mip_level: args.source.mip_level.unwrap_or(0),
origin: args.source.origin.map_or(Default::default(), |origin| {
@@ -433,12 +434,16 @@ pub fn op_webgpu_command_encoder_copy_texture_to_buffer(
}
}),
};
- let destination = wgpu_core::command::BufferCopyView {
+ let destination = wgpu_core::command::ImageCopyBuffer {
buffer: destination_buffer_resource.0,
- layout: wgpu_types::TextureDataLayout {
+ layout: wgpu_types::ImageDataLayout {
offset: args.destination.offset.unwrap_or(0),
- bytes_per_row: args.destination.bytes_per_row.unwrap_or(0),
- rows_per_image: args.destination.rows_per_image.unwrap_or(0),
+ bytes_per_row: NonZeroU32::new(
+ args.destination.bytes_per_row.unwrap_or(0),
+ ),
+ rows_per_image: NonZeroU32::new(
+ args.destination.rows_per_image.unwrap_or(0),
+ ),
},
};
gfx_ok!(command_encoder => instance.command_encoder_copy_texture_to_buffer(
@@ -448,7 +453,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_buffer(
&wgpu_types::Extent3d {
width: args.copy_size.width.unwrap_or(1),
height: args.copy_size.height.unwrap_or(1),
- depth: args.copy_size.depth.unwrap_or(1),
+ depth_or_array_layers: args.copy_size.depth_or_array_layers.unwrap_or(1),
}
))
}
@@ -482,7 +487,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_texture(
.get::<super::texture::WebGpuTexture>(args.destination.texture)
.ok_or_else(bad_resource_id)?;
- let source = wgpu_core::command::TextureCopyView {
+ let source = wgpu_core::command::ImageCopyTexture {
texture: source_texture_resource.0,
mip_level: args.source.mip_level.unwrap_or(0),
origin: args.source.origin.map_or(Default::default(), |origin| {
@@ -493,7 +498,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_texture(
}
}),
};
- let destination = wgpu_core::command::TextureCopyView {
+ let destination = wgpu_core::command::ImageCopyTexture {
texture: destination_texture_resource.0,
mip_level: args.destination.mip_level.unwrap_or(0),
origin: args
@@ -512,7 +517,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_texture(
&wgpu_types::Extent3d {
width: args.copy_size.width.unwrap_or(1),
height: args.copy_size.height.unwrap_or(1),
- depth: args.copy_size.depth.unwrap_or(1),
+ depth_or_array_layers: args.copy_size.depth_or_array_layers.unwrap_or(1),
}
))
}