diff --git a/deno_webgpu/command_encoder.rs b/deno_webgpu/command_encoder.rs index d7306a37a..bf2708427 100644 --- a/deno_webgpu/command_encoder.rs +++ b/deno_webgpu/command_encoder.rs @@ -348,15 +348,15 @@ pub fn op_webgpu_command_encoder_copy_buffer_to_texture( .resource_table .get::(destination.texture)?; - let source = wgpu_core::command::ImageCopyBuffer { + let source = wgpu_core::command::TexelCopyBufferInfo { buffer: source_buffer_resource.1, - layout: wgpu_types::ImageDataLayout { + layout: wgpu_types::TexelCopyBufferLayout { offset: source.offset, bytes_per_row: source.bytes_per_row, rows_per_image: source.rows_per_image, }, }; - let destination = wgpu_core::command::ImageCopyTexture { + let destination = wgpu_core::command::TexelCopyTextureInfo { texture: destination_texture_resource.id, mip_level: destination.mip_level, origin: destination.origin, @@ -391,15 +391,15 @@ pub fn op_webgpu_command_encoder_copy_texture_to_buffer( .resource_table .get::(destination.buffer)?; - let source = wgpu_core::command::ImageCopyTexture { + let source = wgpu_core::command::TexelCopyTextureInfo { texture: source_texture_resource.id, mip_level: source.mip_level, origin: source.origin, aspect: source.aspect, }; - let destination = wgpu_core::command::ImageCopyBuffer { + let destination = wgpu_core::command::TexelCopyBufferInfo { buffer: destination_buffer_resource.1, - layout: wgpu_types::ImageDataLayout { + layout: wgpu_types::TexelCopyBufferLayout { offset: destination.offset, bytes_per_row: destination.bytes_per_row, rows_per_image: destination.rows_per_image, @@ -434,13 +434,13 @@ pub fn op_webgpu_command_encoder_copy_texture_to_texture( .resource_table .get::(destination.texture)?; - let source = wgpu_core::command::ImageCopyTexture { + let source = wgpu_core::command::TexelCopyTextureInfo { texture: source_texture_resource.id, mip_level: source.mip_level, origin: source.origin, aspect: source.aspect, }; - let destination = wgpu_core::command::ImageCopyTexture { + let destination = wgpu_core::command::TexelCopyTextureInfo { texture: destination_texture_resource.id, mip_level: destination.mip_level, origin: destination.origin, diff --git a/deno_webgpu/queue.rs b/deno_webgpu/queue.rs index 5915b68f2..fee291729 100644 --- a/deno_webgpu/queue.rs +++ b/deno_webgpu/queue.rs @@ -62,9 +62,9 @@ pub struct GpuImageDataLayout { rows_per_image: Option, } -impl From for wgpu_types::ImageDataLayout { +impl From for wgpu_types::TexelCopyBufferLayout { fn from(layout: GpuImageDataLayout) -> Self { - wgpu_types::ImageDataLayout { + wgpu_types::TexelCopyBufferLayout { offset: layout.offset, bytes_per_row: layout.bytes_per_row, rows_per_image: layout.rows_per_image, @@ -119,7 +119,7 @@ pub fn op_webgpu_write_texture( let queue_resource = state.resource_table.get::(queue_rid)?; let queue = queue_resource.1; - let destination = wgpu_core::command::ImageCopyTexture { + let destination = wgpu_core::command::TexelCopyTextureInfo { texture: texture_resource.id, mip_level: destination.mip_level, origin: destination.origin, diff --git a/examples/src/bunnymark/mod.rs b/examples/src/bunnymark/mod.rs index a4ea8f5c6..56b0eb730 100644 --- a/examples/src/bunnymark/mod.rs +++ b/examples/src/bunnymark/mod.rs @@ -262,7 +262,7 @@ impl crate::framework::Example for Example { queue.write_texture( texture.as_image_copy(), &buf, - wgpu::ImageDataLayout { + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(info.width * 4), rows_per_image: None, diff --git a/examples/src/cube/mod.rs b/examples/src/cube/mod.rs index 13e050cdd..984592d44 100644 --- a/examples/src/cube/mod.rs +++ b/examples/src/cube/mod.rs @@ -183,7 +183,7 @@ impl crate::framework::Example for Example { queue.write_texture( texture.as_image_copy(), &texels, - wgpu::ImageDataLayout { + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(size), rows_per_image: None, diff --git a/examples/src/framework.rs b/examples/src/framework.rs index ff86cc235..56460bffc 100644 --- a/examples/src/framework.rs +++ b/examples/src/framework.rs @@ -595,15 +595,15 @@ impl From> .create_command_encoder(&wgpu::CommandEncoderDescriptor::default()); cmd_buf.copy_texture_to_buffer( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &dst_texture, mip_level: 0, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All, }, - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &dst_buffer, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(params.width * 4), rows_per_image: None, diff --git a/examples/src/mipmap/mod.rs b/examples/src/mipmap/mod.rs index 817a6d625..fa5bedf8c 100644 --- a/examples/src/mipmap/mod.rs +++ b/examples/src/mipmap/mod.rs @@ -246,9 +246,9 @@ impl crate::framework::Example for Example { usage: wgpu::BufferUsages::COPY_SRC, }); init_encoder.copy_buffer_to_texture( - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &temp_buf, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(4 * size), rows_per_image: None, diff --git a/examples/src/render_to_texture/mod.rs b/examples/src/render_to_texture/mod.rs index 529525498..9c4a32395 100644 --- a/examples/src/render_to_texture/mod.rs +++ b/examples/src/render_to_texture/mod.rs @@ -101,15 +101,15 @@ async fn run(_path: Option) { } // The texture now contains our rendered image command_encoder.copy_texture_to_buffer( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &render_target, mip_level: 0, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All, }, - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &output_staging_buffer, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: 0, // This needs to be a multiple of 256. Normally we would need to pad // it but we here know it will work out anyways. diff --git a/examples/src/storage_texture/mod.rs b/examples/src/storage_texture/mod.rs index 56c8b2a64..7fcafecca 100644 --- a/examples/src/storage_texture/mod.rs +++ b/examples/src/storage_texture/mod.rs @@ -119,15 +119,15 @@ async fn run(_path: Option) { compute_pass.dispatch_workgroups(TEXTURE_DIMS.0 as u32, TEXTURE_DIMS.1 as u32, 1); } command_encoder.copy_texture_to_buffer( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &storage_texture, mip_level: 0, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All, }, - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &output_staging_buffer, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: 0, // This needs to be padded to 256. bytes_per_row: Some((TEXTURE_DIMS.0 * 4) as u32), diff --git a/examples/src/texture_arrays/mod.rs b/examples/src/texture_arrays/mod.rs index 00b90603f..26c39a6cc 100644 --- a/examples/src/texture_arrays/mod.rs +++ b/examples/src/texture_arrays/mod.rs @@ -195,7 +195,7 @@ impl crate::framework::Example for Example { queue.write_texture( red_texture.as_image_copy(), &red_texture_data, - wgpu::ImageDataLayout { + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(4), rows_per_image: None, @@ -205,7 +205,7 @@ impl crate::framework::Example for Example { queue.write_texture( green_texture.as_image_copy(), &green_texture_data, - wgpu::ImageDataLayout { + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(4), rows_per_image: None, @@ -215,7 +215,7 @@ impl crate::framework::Example for Example { queue.write_texture( blue_texture.as_image_copy(), &blue_texture_data, - wgpu::ImageDataLayout { + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(4), rows_per_image: None, @@ -225,7 +225,7 @@ impl crate::framework::Example for Example { queue.write_texture( white_texture.as_image_copy(), &white_texture_data, - wgpu::ImageDataLayout { + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(4), rows_per_image: None, diff --git a/tests/src/image.rs b/tests/src/image.rs index d990fdf9d..7a639b1f8 100644 --- a/tests/src/image.rs +++ b/tests/src/image.rs @@ -398,18 +398,18 @@ fn copy_texture_to_buffer_with_aspect( ); let mip_level = 0; encoder.copy_texture_to_buffer( - ImageCopyTexture { + TexelCopyTextureInfo { texture, mip_level, origin: Origin3d::ZERO, aspect, }, - ImageCopyBuffer { + TexelCopyBufferInfo { buffer: match aspect { TextureAspect::StencilOnly => buffer_stencil.as_ref().unwrap(), _ => buffer, }, - layout: ImageDataLayout { + layout: TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(bytes_per_row), rows_per_image: Some(texture.height() / block_height), diff --git a/tests/tests/bgra8unorm_storage.rs b/tests/tests/bgra8unorm_storage.rs index 0859473b2..30babe0d8 100644 --- a/tests/tests/bgra8unorm_storage.rs +++ b/tests/tests/bgra8unorm_storage.rs @@ -116,15 +116,15 @@ static BGRA8_UNORM_STORAGE: GpuTestConfiguration = GpuTestConfiguration::new() } encoder.copy_texture_to_buffer( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &texture, mip_level: 0, origin: wgpu::Origin3d { x: 0, y: 0, z: 0 }, aspect: wgpu::TextureAspect::All, }, - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &readback_buffer, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(256 * 4), rows_per_image: Some(256), diff --git a/tests/tests/device.rs b/tests/tests/device.rs index edcb3132e..896ac4934 100644 --- a/tests/tests/device.rs +++ b/tests/tests/device.rs @@ -385,9 +385,9 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne &ctx.device, || { encoder_for_buffer_texture_copy.copy_buffer_to_texture( - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &buffer_source, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(4), rows_per_image: None, @@ -406,9 +406,9 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne || { encoder_for_texture_buffer_copy.copy_texture_to_buffer( texture_for_read.as_image_copy(), - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &buffer_source, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(4), rows_per_image: None, diff --git a/tests/tests/encoder.rs b/tests/tests/encoder.rs index 0be5efb90..c832edd97 100644 --- a/tests/tests/encoder.rs +++ b/tests/tests/encoder.rs @@ -168,9 +168,9 @@ fn encoder_operations_fail_while_pass_alive(ctx: TestingContext) { "copy_buffer_to_texture", Box::new(|encoder: &mut wgpu::CommandEncoder| { encoder.copy_buffer_to_texture( - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &buffer_source, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(4), rows_per_image: None, @@ -185,15 +185,15 @@ fn encoder_operations_fail_while_pass_alive(ctx: TestingContext) { "copy_texture_to_buffer", Box::new(|encoder: &mut wgpu::CommandEncoder| { encoder.copy_texture_to_buffer( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &texture_src, mip_level: 0, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All, }, - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &buffer_dest, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(4), rows_per_image: None, @@ -207,13 +207,13 @@ fn encoder_operations_fail_while_pass_alive(ctx: TestingContext) { "copy_texture_to_texture", Box::new(|encoder: &mut wgpu::CommandEncoder| { encoder.copy_texture_to_texture( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &texture_src, mip_level: 0, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All, }, - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &texture_dst, mip_level: 0, origin: wgpu::Origin3d::ZERO, diff --git a/tests/tests/external_texture.rs b/tests/tests/external_texture.rs index 6dba884a3..f577afc0d 100644 --- a/tests/tests/external_texture.rs +++ b/tests/tests/external_texture.rs @@ -269,12 +269,12 @@ static IMAGE_BITMAP_IMPORT: GpuTestConfiguration = !valid, || { ctx.queue.copy_external_image_to_texture( - &wgpu::ImageCopyExternalImage { + &wgpu::CopyExternalImageSourceInfo { source: source.clone(), origin: src_origin, flip_y: src_flip_y, }, - wgpu::ImageCopyTextureTagged { + wgpu::CopyExternalImageDestInfo { texture: &texture, mip_level: 0, origin: dest_origin, @@ -299,7 +299,7 @@ static IMAGE_BITMAP_IMPORT: GpuTestConfiguration = .device .create_command_encoder(&wgpu::CommandEncoderDescriptor::default()); encoder.copy_texture_to_buffer( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &texture, mip_level: 0, origin: wgpu::Origin3d { @@ -309,9 +309,9 @@ static IMAGE_BITMAP_IMPORT: GpuTestConfiguration = }, aspect: wgpu::TextureAspect::All, }, - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &readback_buffer, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(256), rows_per_image: None, diff --git a/tests/tests/queue_transfer.rs b/tests/tests/queue_transfer.rs index 6f816374c..14a552dcf 100644 --- a/tests/tests/queue_transfer.rs +++ b/tests/tests/queue_transfer.rs @@ -26,14 +26,14 @@ static QUEUE_WRITE_TEXTURE_OVERFLOW: GpuTestConfiguration = &ctx.device, || { ctx.queue.write_texture( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &texture, mip_level: 0, origin: wgpu::Origin3d { x: 0, y: 0, z: 1 }, aspect: wgpu::TextureAspect::All, }, &data, - wgpu::ImageDataLayout { + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(879161360), //bytes_per_image: 4294967295, diff --git a/tests/tests/shader_view_format/mod.rs b/tests/tests/shader_view_format/mod.rs index b2bc0426e..d96762482 100644 --- a/tests/tests/shader_view_format/mod.rs +++ b/tests/tests/shader_view_format/mod.rs @@ -164,15 +164,15 @@ async fn reinterpret( .device .create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); encoder.copy_texture_to_buffer( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &target_tex, mip_level: 0, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All, }, - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &read_buffer, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(wgpu::COPY_BYTES_PER_ROW_ALIGNMENT), rows_per_image: None, diff --git a/tests/tests/texture_bounds.rs b/tests/tests/texture_bounds.rs index 469d1ab1c..01e34d131 100644 --- a/tests/tests/texture_bounds.rs +++ b/tests/tests/texture_bounds.rs @@ -13,7 +13,7 @@ static BAD_COPY_ORIGIN_TEST: GpuTestConfiguration = GpuTestConfiguration::new(). should_panic, || { ctx.queue.write_texture( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &texture, mip_level: 0, origin, @@ -108,7 +108,7 @@ const BYTES_PER_PIXEL: u32 = 4; const BUFFER_SIZE: u32 = TEXTURE_SIZE.width * TEXTURE_SIZE.height * BYTES_PER_PIXEL; -const BUFFER_COPY_LAYOUT: wgpu::ImageDataLayout = wgpu::ImageDataLayout { +const BUFFER_COPY_LAYOUT: wgpu::TexelCopyBufferLayout = wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(TEXTURE_SIZE.width * BYTES_PER_PIXEL), rows_per_image: None, diff --git a/tests/tests/transfer.rs b/tests/tests/transfer.rs index 3408fe2e8..cce4b0f7d 100644 --- a/tests/tests/transfer.rs +++ b/tests/tests/transfer.rs @@ -40,13 +40,13 @@ static COPY_OVERFLOW_Z: GpuTestConfiguration = GpuTestConfiguration::new().run_s || { // Validation should catch the silly selected z layer range without panicking. encoder.copy_texture_to_texture( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &t1, mip_level: 1, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All, }, - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &t2, mip_level: 1, origin: wgpu::Origin3d { diff --git a/tests/tests/write_texture.rs b/tests/tests/write_texture.rs index fbb048591..75118d1e9 100644 --- a/tests/tests/write_texture.rs +++ b/tests/tests/write_texture.rs @@ -26,14 +26,14 @@ static WRITE_TEXTURE_SUBSET_2D: GpuTestConfiguration = let data = vec![1u8; size as usize * 2]; // Write the first two rows ctx.queue.write_texture( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &tex, mip_level: 0, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All, }, &data, - wgpu::ImageDataLayout { + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(size), rows_per_image: Some(size), @@ -59,15 +59,15 @@ static WRITE_TEXTURE_SUBSET_2D: GpuTestConfiguration = .create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); encoder.copy_texture_to_buffer( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &tex, mip_level: 0, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All, }, - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &read_buffer, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(size), rows_per_image: Some(size), @@ -121,14 +121,14 @@ static WRITE_TEXTURE_SUBSET_3D: GpuTestConfiguration = let data = vec![1u8; (size * size) as usize * 2]; // Write the first two slices ctx.queue.write_texture( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &tex, mip_level: 0, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All, }, &data, - wgpu::ImageDataLayout { + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(size), rows_per_image: Some(size), @@ -154,15 +154,15 @@ static WRITE_TEXTURE_SUBSET_3D: GpuTestConfiguration = .create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); encoder.copy_texture_to_buffer( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &tex, mip_level: 0, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All, }, - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &read_buffer, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(size), rows_per_image: Some(size), @@ -213,14 +213,14 @@ static WRITE_TEXTURE_NO_OOB: GpuTestConfiguration = }); let data = vec![1u8; size as usize * 2 + 100]; // check that we don't attempt to copy OOB internally by adding 100 bytes here ctx.queue.write_texture( - wgpu::ImageCopyTexture { + wgpu::TexelCopyTextureInfo { texture: &tex, mip_level: 0, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All, }, &data, - wgpu::ImageDataLayout { + wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(size), rows_per_image: Some(size), diff --git a/tests/tests/zero_init_texture_after_discard.rs b/tests/tests/zero_init_texture_after_discard.rs index d947006d1..570d99e83 100644 --- a/tests/tests/zero_init_texture_after_discard.rs +++ b/tests/tests/zero_init_texture_after_discard.rs @@ -177,14 +177,14 @@ impl<'ctx> TestCase<'ctx> { let buffer_size = texture.height() * bytes_per_row; let data = vec![255; buffer_size as usize]; ctx.queue.write_texture( - ImageCopyTexture { + TexelCopyTextureInfo { texture: &texture, mip_level: 0, origin: Origin3d { x: 0, y: 0, z: 0 }, aspect: TextureAspect::All, }, &data, - ImageDataLayout { + TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(bytes_per_row), rows_per_image: None, diff --git a/wgpu-core/src/command/clear.rs b/wgpu-core/src/command/clear.rs index 3a12a5411..b22c01f5e 100644 --- a/wgpu-core/src/command/clear.rs +++ b/wgpu-core/src/command/clear.rs @@ -386,7 +386,7 @@ fn clear_texture_via_buffer_copies( let num_rows = num_rows_left.min(max_rows_per_copy); zero_buffer_copy_regions.push(hal::BufferTextureCopy { - buffer_layout: wgt::ImageDataLayout { + buffer_layout: wgt::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(bytes_per_row), rows_per_image: None, diff --git a/wgpu-core/src/command/transfer.rs b/wgpu-core/src/command/transfer.rs index 2fe6c83f7..740763a29 100644 --- a/wgpu-core/src/command/transfer.rs +++ b/wgpu-core/src/command/transfer.rs @@ -27,9 +27,9 @@ use std::sync::Arc; use super::{ClearError, CommandBufferMutable}; -pub type ImageCopyBuffer = wgt::ImageCopyBuffer; -pub type ImageCopyTexture = wgt::ImageCopyTexture; -pub type ImageCopyTextureTagged = wgt::ImageCopyTextureTagged; +pub type TexelCopyBufferInfo = wgt::TexelCopyBufferInfo; +pub type TexelCopyTextureInfo = wgt::TexelCopyTextureInfo; +pub type CopyExternalImageDestInfo = wgt::CopyExternalImageDestInfo; #[derive(Clone, Copy, Debug)] pub enum CopySide { @@ -153,7 +153,7 @@ impl From for CopyError { } pub(crate) fn extract_texture_selector( - copy_texture: &wgt::ImageCopyTexture, + copy_texture: &wgt::TexelCopyTextureInfo, copy_size: &Extent3d, texture: &Texture, ) -> Result<(TextureSelector, hal::TextureCopyBase), TransferError> { @@ -203,7 +203,7 @@ pub(crate) fn extract_texture_selector( /// /// [vltd]: https://gpuweb.github.io/gpuweb/#abstract-opdef-validating-linear-texture-data pub(crate) fn validate_linear_texture_data( - layout: &wgt::ImageDataLayout, + layout: &wgt::TexelCopyBufferLayout, format: wgt::TextureFormat, aspect: wgt::TextureAspect, buffer_size: BufferAddress, @@ -311,7 +311,7 @@ pub(crate) fn validate_linear_texture_data( /// /// [vtcr]: https://gpuweb.github.io/gpuweb/#validating-texture-copy-range pub(crate) fn validate_texture_copy_range( - texture_copy_view: &wgt::ImageCopyTexture, + texture_copy_view: &wgt::TexelCopyTextureInfo, desc: &wgt::TextureDescriptor<(), Vec>, texture_side: CopySide, copy_size: &Extent3d, @@ -404,7 +404,7 @@ fn handle_texture_init( init_kind: MemoryInitKind, cmd_buf_data: &mut CommandBufferMutable, device: &Device, - copy_texture: &ImageCopyTexture, + copy_texture: &TexelCopyTextureInfo, copy_size: &Extent3d, texture: &Arc, snatch_guard: &SnatchGuard<'_>, @@ -453,7 +453,7 @@ fn handle_texture_init( fn handle_src_texture_init( cmd_buf_data: &mut CommandBufferMutable, device: &Device, - source: &ImageCopyTexture, + source: &TexelCopyTextureInfo, copy_size: &Extent3d, texture: &Arc, snatch_guard: &SnatchGuard<'_>, @@ -477,7 +477,7 @@ fn handle_src_texture_init( fn handle_dst_texture_init( cmd_buf_data: &mut CommandBufferMutable, device: &Device, - destination: &ImageCopyTexture, + destination: &TexelCopyTextureInfo, copy_size: &Extent3d, texture: &Arc, snatch_guard: &SnatchGuard<'_>, @@ -673,8 +673,8 @@ impl Global { pub fn command_encoder_copy_buffer_to_texture( &self, command_encoder_id: CommandEncoderId, - source: &ImageCopyBuffer, - destination: &ImageCopyTexture, + source: &TexelCopyBufferInfo, + destination: &TexelCopyTextureInfo, copy_size: &Extent3d, ) -> Result<(), CopyError> { profiling::scope!("CommandEncoder::copy_buffer_to_texture"); @@ -826,8 +826,8 @@ impl Global { pub fn command_encoder_copy_texture_to_buffer( &self, command_encoder_id: CommandEncoderId, - source: &ImageCopyTexture, - destination: &ImageCopyBuffer, + source: &TexelCopyTextureInfo, + destination: &TexelCopyBufferInfo, copy_size: &Extent3d, ) -> Result<(), CopyError> { profiling::scope!("CommandEncoder::copy_texture_to_buffer"); @@ -993,8 +993,8 @@ impl Global { pub fn command_encoder_copy_texture_to_texture( &self, command_encoder_id: CommandEncoderId, - source: &ImageCopyTexture, - destination: &ImageCopyTexture, + source: &TexelCopyTextureInfo, + destination: &TexelCopyTextureInfo, copy_size: &Extent3d, ) -> Result<(), CopyError> { profiling::scope!("CommandEncoder::copy_texture_to_texture"); diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index ce59294e7..1c990608b 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -5,7 +5,7 @@ use crate::{ command::{ extract_texture_selector, validate_linear_texture_data, validate_texture_copy_range, ClearError, CommandAllocator, CommandBuffer, CommandEncoderError, CopySide, - ImageCopyTexture, TransferError, + TexelCopyTextureInfo, TransferError, }, conv, device::{DeviceError, WaitIdleError}, @@ -680,9 +680,9 @@ impl Queue { pub fn write_texture( &self, - destination: wgt::ImageCopyTexture>, + destination: wgt::TexelCopyTextureInfo>, data: &[u8], - data_layout: &wgt::ImageDataLayout, + data_layout: &wgt::TexelCopyBufferLayout, size: &wgt::Extent3d, ) -> Result<(), QueueWriteError> { profiling::scope!("Queue::write_texture"); @@ -694,7 +694,7 @@ impl Queue { } let dst = destination.texture.get()?; - let destination = wgt::ImageCopyTexture { + let destination = wgt::TexelCopyTextureInfo { texture: (), mip_level: destination.mip_level, origin: destination.origin, @@ -857,7 +857,7 @@ impl Queue { let mut texture_base = dst_base.clone(); texture_base.array_layer += array_layer_offset; hal::BufferTextureCopy { - buffer_layout: wgt::ImageDataLayout { + buffer_layout: wgt::TexelCopyBufferLayout { offset: array_layer_offset as u64 * rows_per_image as u64 * stage_bytes_per_row as u64, @@ -901,8 +901,8 @@ impl Queue { #[cfg(webgl)] pub fn copy_external_image_to_texture( &self, - source: &wgt::ImageCopyExternalImage, - destination: wgt::ImageCopyTextureTagged>, + source: &wgt::CopyExternalImageSourceInfo, + destination: wgt::CopyExternalImageDestInfo>, size: wgt::Extent3d, ) -> Result<(), QueueWriteError> { profiling::scope!("Queue::copy_external_image_to_texture"); @@ -933,7 +933,7 @@ impl Queue { let dst = destination.texture.get()?; let premultiplied_alpha = destination.premultiplied_alpha; - let destination = wgt::ImageCopyTexture { + let destination = wgt::TexelCopyTextureInfo { texture: (), mip_level: destination.mip_level, origin: destination.origin, @@ -1475,9 +1475,9 @@ impl Global { pub fn queue_write_texture( &self, queue_id: QueueId, - destination: &ImageCopyTexture, + destination: &TexelCopyTextureInfo, data: &[u8], - data_layout: &wgt::ImageDataLayout, + data_layout: &wgt::TexelCopyBufferLayout, size: &wgt::Extent3d, ) -> Result<(), QueueWriteError> { let queue = self.hub.queues.get(queue_id); @@ -1493,7 +1493,7 @@ impl Global { }); } - let destination = wgt::ImageCopyTexture { + let destination = wgt::TexelCopyTextureInfo { texture: self.hub.textures.get(destination.texture), mip_level: destination.mip_level, origin: destination.origin, @@ -1506,12 +1506,12 @@ impl Global { pub fn queue_copy_external_image_to_texture( &self, queue_id: QueueId, - source: &wgt::ImageCopyExternalImage, - destination: crate::command::ImageCopyTextureTagged, + source: &wgt::CopyExternalImageSourceInfo, + destination: crate::command::CopyExternalImageDestInfo, size: wgt::Extent3d, ) -> Result<(), QueueWriteError> { let queue = self.hub.queues.get(queue_id); - let destination = wgt::ImageCopyTextureTagged { + let destination = wgt::CopyExternalImageDestInfo { texture: self.hub.textures.get(destination.texture), mip_level: destination.mip_level, origin: destination.origin, diff --git a/wgpu-core/src/device/trace.rs b/wgpu-core/src/device/trace.rs index 89b7b48f9..2274d9e94 100644 --- a/wgpu-core/src/device/trace.rs +++ b/wgpu-core/src/device/trace.rs @@ -121,9 +121,9 @@ pub enum Action<'a> { queued: bool, }, WriteTexture { - to: crate::command::ImageCopyTexture, + to: crate::command::TexelCopyTextureInfo, data: FileName, - layout: wgt::ImageDataLayout, + layout: wgt::TexelCopyBufferLayout, size: wgt::Extent3d, }, Submit(crate::SubmissionIndex, Vec), @@ -153,18 +153,18 @@ pub enum Command { size: wgt::BufferAddress, }, CopyBufferToTexture { - src: crate::command::ImageCopyBuffer, - dst: crate::command::ImageCopyTexture, + src: crate::command::TexelCopyBufferInfo, + dst: crate::command::TexelCopyTextureInfo, size: wgt::Extent3d, }, CopyTextureToBuffer { - src: crate::command::ImageCopyTexture, - dst: crate::command::ImageCopyBuffer, + src: crate::command::TexelCopyTextureInfo, + dst: crate::command::TexelCopyBufferInfo, size: wgt::Extent3d, }, CopyTextureToTexture { - src: crate::command::ImageCopyTexture, - dst: crate::command::ImageCopyTexture, + src: crate::command::TexelCopyTextureInfo, + dst: crate::command::TexelCopyTextureInfo, size: wgt::Extent3d, }, ClearBuffer { diff --git a/wgpu-hal/examples/halmark/main.rs b/wgpu-hal/examples/halmark/main.rs index 020d362e8..727b42672 100644 --- a/wgpu-hal/examples/halmark/main.rs +++ b/wgpu-hal/examples/halmark/main.rs @@ -344,7 +344,7 @@ impl Example { usage: hal::TextureUses::COPY_DST..hal::TextureUses::RESOURCE, }; let copy = hal::BufferTextureCopy { - buffer_layout: wgt::ImageDataLayout { + buffer_layout: wgt::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(4), rows_per_image: None, diff --git a/wgpu-hal/src/empty.rs b/wgpu-hal/src/empty.rs index d4fc7c312..7a7bac6ec 100644 --- a/wgpu-hal/src/empty.rs +++ b/wgpu-hal/src/empty.rs @@ -347,7 +347,7 @@ impl crate::CommandEncoder for Encoder { #[cfg(webgl)] unsafe fn copy_external_image_to_texture( &mut self, - src: &wgt::ImageCopyExternalImage, + src: &wgt::CopyExternalImageSourceInfo, dst: &Resource, dst_premultiplication: bool, regions: T, diff --git a/wgpu-hal/src/gles/command.rs b/wgpu-hal/src/gles/command.rs index 2df3c1a99..38382f597 100644 --- a/wgpu-hal/src/gles/command.rs +++ b/wgpu-hal/src/gles/command.rs @@ -367,7 +367,7 @@ impl crate::CommandEncoder for super::CommandEncoder { #[cfg(webgl)] unsafe fn copy_external_image_to_texture( &mut self, - src: &wgt::ImageCopyExternalImage, + src: &wgt::CopyExternalImageSourceInfo, dst: &super::Texture, dst_premultiplication: bool, regions: T, diff --git a/wgpu-hal/src/gles/mod.rs b/wgpu-hal/src/gles/mod.rs index b6e690a5f..028fd25e0 100644 --- a/wgpu-hal/src/gles/mod.rs +++ b/wgpu-hal/src/gles/mod.rs @@ -909,7 +909,7 @@ enum Command { }, #[cfg(webgl)] CopyExternalImageToTexture { - src: wgt::ImageCopyExternalImage, + src: wgt::CopyExternalImageSourceInfo, dst: glow::Texture, dst_target: BindTarget, dst_format: wgt::TextureFormat, diff --git a/wgpu-hal/src/lib.rs b/wgpu-hal/src/lib.rs index 7efe6a88a..4707289bd 100644 --- a/wgpu-hal/src/lib.rs +++ b/wgpu-hal/src/lib.rs @@ -1206,7 +1206,7 @@ pub trait CommandEncoder: WasmNotSendSync + fmt::Debug { #[cfg(webgl)] unsafe fn copy_external_image_to_texture( &mut self, - src: &wgt::ImageCopyExternalImage, + src: &wgt::CopyExternalImageSourceInfo, dst: &::Texture, dst_premultiplication: bool, regions: T, @@ -2296,7 +2296,7 @@ pub struct TextureCopy { #[derive(Clone, Debug)] pub struct BufferTextureCopy { - pub buffer_layout: wgt::ImageDataLayout, + pub buffer_layout: wgt::TexelCopyBufferLayout, pub texture_base: TextureCopyBase, pub size: CopyExtent, } diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index d1f9d4fef..76a273fc9 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -77,7 +77,7 @@ pub type DynamicOffset = u32; /// /// This doesn't apply to [`Queue::write_texture`][Qwt]. /// -/// [`bytes_per_row`]: ImageDataLayout::bytes_per_row +/// [`bytes_per_row`]: TexelCopyBufferLayout::bytes_per_row /// [Qwt]: ../wgpu/struct.Queue.html#method.write_texture pub const COPY_BYTES_PER_ROW_ALIGNMENT: u32 = 256; /// An offset into the query resolve buffer has to be aligned to this. @@ -1692,11 +1692,11 @@ bitflags::bitflags! { /// With this feature not present, there are the following restrictions on `Queue::copy_external_image_to_texture`: /// - The source must not be [`web_sys::OffscreenCanvas`] - /// - [`ImageCopyExternalImage::origin`] must be zero. - /// - [`ImageCopyTextureTagged::color_space`] must be srgb. + /// - [`CopyExternalImageSourceInfo::origin`] must be zero. + /// - [`CopyExternalImageDestInfo::color_space`] must be srgb. /// - If the source is an [`web_sys::ImageBitmap`]: - /// - [`ImageCopyExternalImage::flip_y`] must be false. - /// - [`ImageCopyTextureTagged::premultiplied_alpha`] must be false. + /// - [`CopyExternalImageSourceInfo::flip_y`] must be false. + /// - [`CopyExternalImageDestInfo::premultiplied_alpha`] must be false. /// /// WebGL doesn't support this. WebGPU does. const UNRESTRICTED_EXTERNAL_TEXTURE_COPIES = 1 << 20; @@ -6365,12 +6365,12 @@ impl Default for RenderBundleDescriptor> { /// | 256x256 | BC3 | 16 | 4 * 4 * 1 | 16 * (256 / 4) = 1024 = Some(1024) | None | /// | 64x64x8 | BC3 | 16 | 4 * 4 * 1 | 16 * (64 / 4) = 256 = Some(256) | 64 / 4 = 16 = Some(16) | /// -/// Corresponds to [WebGPU `GPUImageDataLayout`]( +/// Corresponds to [WebGPU `GPUTexelCopyBufferLayout`]( /// https://gpuweb.github.io/gpuweb/#dictdef-gpuimagedatalayout). #[repr(C)] #[derive(Clone, Copy, Debug, Default)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct ImageDataLayout { +pub struct TexelCopyBufferLayout { /// Offset into the buffer that is the start of the texture. Must be a multiple of texture block size. /// For non-compressed textures, this is 1. pub offset: BufferAddress, @@ -6809,26 +6809,26 @@ pub struct BindGroupLayoutEntry { /// View of a buffer which can be used to copy to/from a texture. /// -/// Corresponds to [WebGPU `GPUImageCopyBuffer`]( +/// Corresponds to [WebGPU `GPUTexelCopyBufferInfo`]( /// https://gpuweb.github.io/gpuweb/#dictdef-gpuimagecopybuffer). #[repr(C)] #[derive(Copy, Clone, Debug)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct ImageCopyBuffer { +pub struct TexelCopyBufferInfo { /// The buffer to be copied to/from. pub buffer: B, /// The layout of the texture data in this buffer. - pub layout: ImageDataLayout, + pub layout: TexelCopyBufferLayout, } /// View of a texture which can be used to copy to/from a buffer/texture. /// -/// Corresponds to [WebGPU `GPUImageCopyTexture`]( +/// Corresponds to [WebGPU `GPUTexelCopyTextureInfo`]( /// https://gpuweb.github.io/gpuweb/#dictdef-gpuimagecopytexture). #[repr(C)] #[derive(Copy, Clone, Debug)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct ImageCopyTexture { +pub struct TexelCopyTextureInfo { /// The texture to be copied to/from. pub texture: T, /// The target mip level of the texture. @@ -6843,15 +6843,15 @@ pub struct ImageCopyTexture { pub aspect: TextureAspect, } -impl ImageCopyTexture { +impl TexelCopyTextureInfo { /// Adds color space and premultiplied alpha information to make this /// descriptor tagged. pub fn to_tagged( self, color_space: PredefinedColorSpace, premultiplied_alpha: bool, - ) -> ImageCopyTextureTagged { - ImageCopyTextureTagged { + ) -> CopyExternalImageDestInfo { + CopyExternalImageDestInfo { texture: self.texture, mip_level: self.mip_level, origin: self.origin, @@ -6864,11 +6864,11 @@ impl ImageCopyTexture { /// View of an external texture that can be used to copy to a texture. /// -/// Corresponds to [WebGPU `GPUImageCopyExternalImage`]( +/// Corresponds to [WebGPU `GPUCopyExternalImageSourceInfo`]( /// https://gpuweb.github.io/gpuweb/#dictdef-gpuimagecopyexternalimage). #[cfg(target_arch = "wasm32")] #[derive(Clone, Debug)] -pub struct ImageCopyExternalImage { +pub struct CopyExternalImageSourceInfo { /// The texture to be copied from. The copy source data is captured at the moment /// the copy is issued. pub source: ExternalImageSource, @@ -6887,7 +6887,7 @@ pub struct ImageCopyExternalImage { /// Source of an external texture copy. /// -/// Corresponds to the [implicit union type on WebGPU `GPUImageCopyExternalImage.source`]( +/// Corresponds to the [implicit union type on WebGPU `GPUCopyExternalImageSourceInfo.source`]( /// https://gpuweb.github.io/gpuweb/#dom-gpuimagecopyexternalimage-source). #[cfg(target_arch = "wasm32")] #[derive(Clone, Debug)] @@ -6990,11 +6990,11 @@ pub enum PredefinedColorSpace { /// View of a texture which can be used to copy to a texture, including /// color space and alpha premultiplication information. /// -/// Corresponds to [WebGPU `GPUImageCopyTextureTagged`]( +/// Corresponds to [WebGPU `GPUCopyExternalImageDestInfo`]( /// https://gpuweb.github.io/gpuweb/#dictdef-gpuimagecopytexturetagged). #[derive(Copy, Clone, Debug)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct ImageCopyTextureTagged { +pub struct CopyExternalImageDestInfo { /// The texture to be copied to/from. pub texture: T, /// The target mip level of the texture. @@ -7009,10 +7009,10 @@ pub struct ImageCopyTextureTagged { pub premultiplied_alpha: bool, } -impl ImageCopyTextureTagged { +impl CopyExternalImageDestInfo { /// Removes the colorspace information from the type. - pub fn to_untagged(self) -> ImageCopyTexture { - ImageCopyTexture { + pub fn to_untagged(self) -> TexelCopyTextureInfo { + TexelCopyTextureInfo { texture: self.texture, mip_level: self.mip_level, origin: self.origin, diff --git a/wgpu/src/api/command_encoder.rs b/wgpu/src/api/command_encoder.rs index f7f453aec..f86ccdf03 100644 --- a/wgpu/src/api/command_encoder.rs +++ b/wgpu/src/api/command_encoder.rs @@ -37,23 +37,23 @@ impl Drop for CommandEncoder { pub type CommandEncoderDescriptor<'a> = wgt::CommandEncoderDescriptor>; static_assertions::assert_impl_all!(CommandEncoderDescriptor<'_>: Send, Sync); -pub use wgt::ImageCopyBuffer as ImageCopyBufferBase; +pub use wgt::TexelCopyBufferInfo as TexelCopyBufferInfoBase; /// View of a buffer which can be used to copy to/from a texture. /// -/// Corresponds to [WebGPU `GPUImageCopyBuffer`]( +/// Corresponds to [WebGPU `GPUTexelCopyBufferInfo`]( /// https://gpuweb.github.io/gpuweb/#dictdef-gpuimagecopybuffer). -pub type ImageCopyBuffer<'a> = ImageCopyBufferBase<&'a Buffer>; +pub type TexelCopyBufferInfo<'a> = TexelCopyBufferInfoBase<&'a Buffer>; #[cfg(send_sync)] -static_assertions::assert_impl_all!(ImageCopyBuffer<'_>: Send, Sync); +static_assertions::assert_impl_all!(TexelCopyBufferInfo<'_>: Send, Sync); -pub use wgt::ImageCopyTexture as ImageCopyTextureBase; +pub use wgt::TexelCopyTextureInfo as TexelCopyTextureInfoBase; /// View of a texture which can be used to copy to/from a buffer/texture. /// -/// Corresponds to [WebGPU `GPUImageCopyTexture`]( +/// Corresponds to [WebGPU `GPUTexelCopyTextureInfo`]( /// https://gpuweb.github.io/gpuweb/#dictdef-gpuimagecopytexture). -pub type ImageCopyTexture<'a> = ImageCopyTextureBase<&'a Texture>; +pub type TexelCopyTextureInfo<'a> = TexelCopyTextureInfoBase<&'a Texture>; #[cfg(send_sync)] -static_assertions::assert_impl_all!(ImageCopyTexture<'_>: Send, Sync); +static_assertions::assert_impl_all!(TexelCopyTextureInfo<'_>: Send, Sync); use crate::api::blas::{ BlasBuildEntry, BlasGeometries, BlasTriangleGeometry, DynContextBlasBuildEntry, @@ -62,16 +62,16 @@ use crate::api::blas::{ use crate::api::tlas::{ DynContextTlasBuildEntry, DynContextTlasPackage, TlasBuildEntry, TlasPackage, }; -pub use wgt::ImageCopyTextureTagged as ImageCopyTextureTaggedBase; +pub use wgt::CopyExternalImageDestInfo as CopyExternalImageDestInfoBase; /// View of a texture which can be used to copy to a texture, including /// color space and alpha premultiplication information. /// -/// Corresponds to [WebGPU `GPUImageCopyTextureTagged`]( +/// Corresponds to [WebGPU `GPUCopyExternalImageDestInfo`]( /// https://gpuweb.github.io/gpuweb/#dictdef-gpuimagecopytexturetagged). -pub type ImageCopyTextureTagged<'a> = ImageCopyTextureTaggedBase<&'a Texture>; +pub type CopyExternalImageDestInfo<'a> = CopyExternalImageDestInfoBase<&'a Texture>; #[cfg(send_sync)] -static_assertions::assert_impl_all!(ImageCopyTexture<'_>: Send, Sync); +static_assertions::assert_impl_all!(TexelCopyTextureInfo<'_>: Send, Sync); impl CommandEncoder { /// Finishes recording and returns a [`CommandBuffer`] that can be submitted for execution. @@ -165,8 +165,8 @@ impl CommandEncoder { /// Copy data from a buffer to a texture. pub fn copy_buffer_to_texture( &mut self, - source: ImageCopyBuffer<'_>, - destination: ImageCopyTexture<'_>, + source: TexelCopyBufferInfo<'_>, + destination: TexelCopyTextureInfo<'_>, copy_size: Extent3d, ) { DynContext::command_encoder_copy_buffer_to_texture( @@ -181,8 +181,8 @@ impl CommandEncoder { /// Copy data from a texture to a buffer. pub fn copy_texture_to_buffer( &mut self, - source: ImageCopyTexture<'_>, - destination: ImageCopyBuffer<'_>, + source: TexelCopyTextureInfo<'_>, + destination: TexelCopyBufferInfo<'_>, copy_size: Extent3d, ) { DynContext::command_encoder_copy_texture_to_buffer( @@ -203,8 +203,8 @@ impl CommandEncoder { /// - Copy would overrun either texture pub fn copy_texture_to_texture( &mut self, - source: ImageCopyTexture<'_>, - destination: ImageCopyTexture<'_>, + source: TexelCopyTextureInfo<'_>, + destination: TexelCopyTextureInfo<'_>, copy_size: Extent3d, ) { DynContext::command_encoder_copy_texture_to_texture( diff --git a/wgpu/src/api/queue.rs b/wgpu/src/api/queue.rs index 1fea4a9c6..83ea8a613 100644 --- a/wgpu/src/api/queue.rs +++ b/wgpu/src/api/queue.rs @@ -207,9 +207,9 @@ impl Queue { /// caller may discard it any time after this call completes. pub fn write_texture( &self, - texture: ImageCopyTexture<'_>, + texture: TexelCopyTextureInfo<'_>, data: &[u8], - data_layout: ImageDataLayout, + data_layout: TexelCopyBufferLayout, size: Extent3d, ) { DynContext::queue_write_texture( @@ -226,8 +226,8 @@ impl Queue { #[cfg(any(webgpu, webgl))] pub fn copy_external_image_to_texture( &self, - source: &wgt::ImageCopyExternalImage, - dest: crate::ImageCopyTextureTagged<'_>, + source: &wgt::CopyExternalImageSourceInfo, + dest: crate::CopyExternalImageDestInfo<'_>, size: Extent3d, ) { DynContext::queue_copy_external_image_to_texture( diff --git a/wgpu/src/api/texture.rs b/wgpu/src/api/texture.rs index 6e94e20a3..7826118bf 100644 --- a/wgpu/src/api/texture.rs +++ b/wgpu/src/api/texture.rs @@ -61,9 +61,9 @@ impl Texture { DynContext::texture_destroy(&*self.context, self.data.as_ref()); } - /// Make an `ImageCopyTexture` representing the whole texture. - pub fn as_image_copy(&self) -> ImageCopyTexture<'_> { - ImageCopyTexture { + /// Make an `TexelCopyTextureInfo` representing the whole texture. + pub fn as_image_copy(&self) -> TexelCopyTextureInfo<'_> { + TexelCopyTextureInfo { texture: self, mip_level: 0, origin: Origin3d::ZERO, diff --git a/wgpu/src/backend/webgpu.rs b/wgpu/src/backend/webgpu.rs index 963d7836f..6cbebee8e 100644 --- a/wgpu/src/backend/webgpu.rs +++ b/wgpu/src/backend/webgpu.rs @@ -629,7 +629,7 @@ fn map_texture_view_dimension( } } -fn map_buffer_copy_view(view: crate::ImageCopyBuffer<'_>) -> webgpu_sys::GpuImageCopyBuffer { +fn map_buffer_copy_view(view: crate::TexelCopyBufferInfo<'_>) -> webgpu_sys::GpuImageCopyBuffer { let buffer: &::BufferData = downcast_ref(view.buffer.data.as_ref()); let mut mapped = webgpu_sys::GpuImageCopyBuffer::new(&buffer.0.buffer); @@ -643,7 +643,7 @@ fn map_buffer_copy_view(view: crate::ImageCopyBuffer<'_>) -> webgpu_sys::GpuImag mapped } -fn map_texture_copy_view(view: crate::ImageCopyTexture<'_>) -> webgpu_sys::GpuImageCopyTexture { +fn map_texture_copy_view(view: crate::TexelCopyTextureInfo<'_>) -> webgpu_sys::GpuImageCopyTexture { let texture: &::TextureData = downcast_ref(view.texture.data.as_ref()); let mut mapped = webgpu_sys::GpuImageCopyTexture::new(&texture.0); @@ -653,7 +653,7 @@ fn map_texture_copy_view(view: crate::ImageCopyTexture<'_>) -> webgpu_sys::GpuIm } fn map_tagged_texture_copy_view( - view: crate::ImageCopyTextureTagged<'_>, + view: crate::CopyExternalImageDestInfo<'_>, ) -> webgpu_sys::GpuImageCopyTextureTagged { let texture: &::TextureData = downcast_ref(view.texture.data.as_ref()); @@ -667,7 +667,7 @@ fn map_tagged_texture_copy_view( } fn map_external_texture_copy_view( - view: &crate::ImageCopyExternalImage, + view: &crate::CopyExternalImageSourceInfo, ) -> webgpu_sys::GpuImageCopyExternalImage { let mut mapped = webgpu_sys::GpuImageCopyExternalImage::new(&view.source); mapped.origin(&map_origin_2d(view.origin)); @@ -2338,8 +2338,8 @@ impl crate::context::Context for ContextWebGpu { fn command_encoder_copy_buffer_to_texture( &self, encoder_data: &Self::CommandEncoderData, - source: crate::ImageCopyBuffer<'_>, - destination: crate::ImageCopyTexture<'_>, + source: crate::TexelCopyBufferInfo<'_>, + destination: crate::TexelCopyTextureInfo<'_>, copy_size: wgt::Extent3d, ) { encoder_data @@ -2354,8 +2354,8 @@ impl crate::context::Context for ContextWebGpu { fn command_encoder_copy_texture_to_buffer( &self, encoder_data: &Self::CommandEncoderData, - source: crate::ImageCopyTexture<'_>, - destination: crate::ImageCopyBuffer<'_>, + source: crate::TexelCopyTextureInfo<'_>, + destination: crate::TexelCopyBufferInfo<'_>, copy_size: wgt::Extent3d, ) { encoder_data @@ -2370,8 +2370,8 @@ impl crate::context::Context for ContextWebGpu { fn command_encoder_copy_texture_to_texture( &self, encoder_data: &Self::CommandEncoderData, - source: crate::ImageCopyTexture<'_>, - destination: crate::ImageCopyTexture<'_>, + source: crate::TexelCopyTextureInfo<'_>, + destination: crate::TexelCopyTextureInfo<'_>, copy_size: wgt::Extent3d, ) { encoder_data @@ -2709,9 +2709,9 @@ impl crate::context::Context for ContextWebGpu { fn queue_write_texture( &self, queue_data: &Self::QueueData, - texture: crate::ImageCopyTexture<'_>, + texture: crate::TexelCopyTextureInfo<'_>, data: &[u8], - data_layout: wgt::ImageDataLayout, + data_layout: wgt::TexelCopyBufferLayout, size: wgt::Extent3d, ) { let mut mapped_data_layout = webgpu_sys::GpuImageDataLayout::new(); @@ -2744,8 +2744,8 @@ impl crate::context::Context for ContextWebGpu { fn queue_copy_external_image_to_texture( &self, queue_data: &Self::QueueData, - source: &wgt::ImageCopyExternalImage, - dest: crate::ImageCopyTextureTagged<'_>, + source: &wgt::CopyExternalImageSourceInfo, + dest: crate::CopyExternalImageDestInfo<'_>, size: wgt::Extent3d, ) { queue_data diff --git a/wgpu/src/backend/wgpu_core.rs b/wgpu/src/backend/wgpu_core.rs index 824b84fc0..7de1dc7e2 100644 --- a/wgpu/src/backend/wgpu_core.rs +++ b/wgpu/src/backend/wgpu_core.rs @@ -363,15 +363,17 @@ impl ContextWgpuCore { } } -fn map_buffer_copy_view(view: crate::ImageCopyBuffer<'_>) -> wgc::command::ImageCopyBuffer { - wgc::command::ImageCopyBuffer { +fn map_buffer_copy_view(view: crate::TexelCopyBufferInfo<'_>) -> wgc::command::TexelCopyBufferInfo { + wgc::command::TexelCopyBufferInfo { buffer: downcast_buffer(view.buffer).id, layout: view.layout, } } -fn map_texture_copy_view(view: crate::ImageCopyTexture<'_>) -> wgc::command::ImageCopyTexture { - wgc::command::ImageCopyTexture { +fn map_texture_copy_view( + view: crate::TexelCopyTextureInfo<'_>, +) -> wgc::command::TexelCopyTextureInfo { + wgc::command::TexelCopyTextureInfo { texture: downcast_texture(view.texture).id, mip_level: view.mip_level, origin: view.origin, @@ -384,9 +386,9 @@ fn map_texture_copy_view(view: crate::ImageCopyTexture<'_>) -> wgc::command::Ima allow(unused) )] fn map_texture_tagged_copy_view( - view: crate::ImageCopyTextureTagged<'_>, -) -> wgc::command::ImageCopyTextureTagged { - wgc::command::ImageCopyTextureTagged { + view: crate::CopyExternalImageDestInfo<'_>, +) -> wgc::command::CopyExternalImageDestInfo { + wgc::command::CopyExternalImageDestInfo { texture: downcast_texture(view.texture).id, mip_level: view.mip_level, origin: view.origin, @@ -1630,8 +1632,8 @@ impl crate::Context for ContextWgpuCore { fn command_encoder_copy_buffer_to_texture( &self, encoder_data: &Self::CommandEncoderData, - source: crate::ImageCopyBuffer<'_>, - destination: crate::ImageCopyTexture<'_>, + source: crate::TexelCopyBufferInfo<'_>, + destination: crate::TexelCopyTextureInfo<'_>, copy_size: wgt::Extent3d, ) { if let Err(cause) = self.0.command_encoder_copy_buffer_to_texture( @@ -1651,8 +1653,8 @@ impl crate::Context for ContextWgpuCore { fn command_encoder_copy_texture_to_buffer( &self, encoder_data: &Self::CommandEncoderData, - source: crate::ImageCopyTexture<'_>, - destination: crate::ImageCopyBuffer<'_>, + source: crate::TexelCopyTextureInfo<'_>, + destination: crate::TexelCopyBufferInfo<'_>, copy_size: wgt::Extent3d, ) { if let Err(cause) = self.0.command_encoder_copy_texture_to_buffer( @@ -1672,8 +1674,8 @@ impl crate::Context for ContextWgpuCore { fn command_encoder_copy_texture_to_texture( &self, encoder_data: &Self::CommandEncoderData, - source: crate::ImageCopyTexture<'_>, - destination: crate::ImageCopyTexture<'_>, + source: crate::TexelCopyTextureInfo<'_>, + destination: crate::TexelCopyTextureInfo<'_>, copy_size: wgt::Extent3d, ) { if let Err(cause) = self.0.command_encoder_copy_texture_to_texture( @@ -2029,9 +2031,9 @@ impl crate::Context for ContextWgpuCore { fn queue_write_texture( &self, queue_data: &Self::QueueData, - texture: crate::ImageCopyTexture<'_>, + texture: crate::TexelCopyTextureInfo<'_>, data: &[u8], - data_layout: wgt::ImageDataLayout, + data_layout: wgt::TexelCopyBufferLayout, size: wgt::Extent3d, ) { match self.0.queue_write_texture( @@ -2052,8 +2054,8 @@ impl crate::Context for ContextWgpuCore { fn queue_copy_external_image_to_texture( &self, queue_data: &Self::QueueData, - source: &wgt::ImageCopyExternalImage, - dest: crate::ImageCopyTextureTagged<'_>, + source: &wgt::CopyExternalImageSourceInfo, + dest: crate::CopyExternalImageDestInfo<'_>, size: wgt::Extent3d, ) { match self.0.queue_copy_external_image_to_texture( diff --git a/wgpu/src/context.rs b/wgpu/src/context.rs index 4a17be7e3..cd831e1fe 100644 --- a/wgpu/src/context.rs +++ b/wgpu/src/context.rs @@ -2,21 +2,20 @@ use std::{any::Any, fmt::Debug, future::Future, ops::Range, pin::Pin, sync::Arc} use wgt::{ strict_assert, AdapterInfo, BufferAddress, BufferSize, Color, DeviceLostReason, - DownlevelCapabilities, DynamicOffset, Extent3d, Features, ImageDataLayout, - ImageSubresourceRange, IndexFormat, Limits, ShaderStages, SurfaceStatus, TextureFormat, + DownlevelCapabilities, DynamicOffset, Extent3d, Features, ImageSubresourceRange, IndexFormat, + Limits, ShaderStages, SurfaceStatus, TexelCopyBufferLayout, TextureFormat, TextureFormatFeatures, WasmNotSend, WasmNotSendSync, }; use crate::{ AnyWasmNotSendSync, BindGroupDescriptor, BindGroupLayoutDescriptor, BufferAsyncError, BufferDescriptor, CommandEncoderDescriptor, CompilationInfo, ComputePassDescriptor, - ComputePipelineDescriptor, DeviceDescriptor, Error, ErrorFilter, ImageCopyBuffer, - ImageCopyTexture, Maintain, MaintainResult, MapMode, PipelineCacheDescriptor, - PipelineLayoutDescriptor, QuerySetDescriptor, RenderBundleDescriptor, - RenderBundleEncoderDescriptor, RenderPassDescriptor, RenderPipelineDescriptor, - RequestAdapterOptions, RequestDeviceError, SamplerDescriptor, ShaderModuleDescriptor, - ShaderModuleDescriptorSpirV, SurfaceTargetUnsafe, TextureDescriptor, TextureViewDescriptor, - UncapturedErrorHandler, + ComputePipelineDescriptor, DeviceDescriptor, Error, ErrorFilter, Maintain, MaintainResult, + MapMode, PipelineCacheDescriptor, PipelineLayoutDescriptor, QuerySetDescriptor, + RenderBundleDescriptor, RenderBundleEncoderDescriptor, RenderPassDescriptor, + RenderPipelineDescriptor, RequestAdapterOptions, RequestDeviceError, SamplerDescriptor, + ShaderModuleDescriptor, ShaderModuleDescriptorSpirV, SurfaceTargetUnsafe, TexelCopyBufferInfo, + TexelCopyTextureInfo, TextureDescriptor, TextureViewDescriptor, UncapturedErrorHandler, }; /// Meta trait for an data associated with an id tracked by a context. /// @@ -282,22 +281,22 @@ pub trait Context: Debug + WasmNotSendSync + Sized { fn command_encoder_copy_buffer_to_texture( &self, encoder_data: &Self::CommandEncoderData, - source: ImageCopyBuffer<'_>, - destination: ImageCopyTexture<'_>, + source: TexelCopyBufferInfo<'_>, + destination: TexelCopyTextureInfo<'_>, copy_size: Extent3d, ); fn command_encoder_copy_texture_to_buffer( &self, encoder_data: &Self::CommandEncoderData, - source: ImageCopyTexture<'_>, - destination: ImageCopyBuffer<'_>, + source: TexelCopyTextureInfo<'_>, + destination: TexelCopyBufferInfo<'_>, copy_size: Extent3d, ); fn command_encoder_copy_texture_to_texture( &self, encoder_data: &Self::CommandEncoderData, - source: ImageCopyTexture<'_>, - destination: ImageCopyTexture<'_>, + source: TexelCopyTextureInfo<'_>, + destination: TexelCopyTextureInfo<'_>, copy_size: Extent3d, ); @@ -393,17 +392,17 @@ pub trait Context: Debug + WasmNotSendSync + Sized { fn queue_write_texture( &self, queue_data: &Self::QueueData, - texture: ImageCopyTexture<'_>, + texture: TexelCopyTextureInfo<'_>, data: &[u8], - data_layout: ImageDataLayout, + data_layout: TexelCopyBufferLayout, size: Extent3d, ); #[cfg(any(webgl, webgpu))] fn queue_copy_external_image_to_texture( &self, queue_data: &Self::QueueData, - source: &wgt::ImageCopyExternalImage, - dest: crate::ImageCopyTextureTagged<'_>, + source: &wgt::CopyExternalImageSourceInfo, + dest: crate::CopyExternalImageDestInfo<'_>, size: wgt::Extent3d, ); fn queue_submit>( @@ -1000,22 +999,22 @@ pub(crate) trait DynContext: Debug + WasmNotSendSync { fn command_encoder_copy_buffer_to_texture( &self, encoder_data: &crate::Data, - source: ImageCopyBuffer<'_>, - destination: ImageCopyTexture<'_>, + source: TexelCopyBufferInfo<'_>, + destination: TexelCopyTextureInfo<'_>, copy_size: Extent3d, ); fn command_encoder_copy_texture_to_buffer( &self, encoder_data: &crate::Data, - source: ImageCopyTexture<'_>, - destination: ImageCopyBuffer<'_>, + source: TexelCopyTextureInfo<'_>, + destination: TexelCopyBufferInfo<'_>, copy_size: Extent3d, ); fn command_encoder_copy_texture_to_texture( &self, encoder_data: &crate::Data, - source: ImageCopyTexture<'_>, - destination: ImageCopyTexture<'_>, + source: TexelCopyTextureInfo<'_>, + destination: TexelCopyTextureInfo<'_>, copy_size: Extent3d, ); @@ -1100,17 +1099,17 @@ pub(crate) trait DynContext: Debug + WasmNotSendSync { fn queue_write_texture( &self, queue_data: &crate::Data, - texture: ImageCopyTexture<'_>, + texture: TexelCopyTextureInfo<'_>, data: &[u8], - data_layout: ImageDataLayout, + data_layout: TexelCopyBufferLayout, size: Extent3d, ); #[cfg(any(webgpu, webgl))] fn queue_copy_external_image_to_texture( &self, queue_data: &crate::Data, - source: &wgt::ImageCopyExternalImage, - dest: crate::ImageCopyTextureTagged<'_>, + source: &wgt::CopyExternalImageSourceInfo, + dest: crate::CopyExternalImageDestInfo<'_>, size: wgt::Extent3d, ); fn queue_submit( @@ -1925,8 +1924,8 @@ where fn command_encoder_copy_buffer_to_texture( &self, encoder_data: &crate::Data, - source: ImageCopyBuffer<'_>, - destination: ImageCopyTexture<'_>, + source: TexelCopyBufferInfo<'_>, + destination: TexelCopyTextureInfo<'_>, copy_size: Extent3d, ) { let encoder_data = downcast_ref(encoder_data); @@ -1942,8 +1941,8 @@ where fn command_encoder_copy_texture_to_buffer( &self, encoder_data: &crate::Data, - source: ImageCopyTexture<'_>, - destination: ImageCopyBuffer<'_>, + source: TexelCopyTextureInfo<'_>, + destination: TexelCopyBufferInfo<'_>, copy_size: Extent3d, ) { let encoder_data = downcast_ref(encoder_data); @@ -1959,8 +1958,8 @@ where fn command_encoder_copy_texture_to_texture( &self, encoder_data: &crate::Data, - source: ImageCopyTexture<'_>, - destination: ImageCopyTexture<'_>, + source: TexelCopyTextureInfo<'_>, + destination: TexelCopyTextureInfo<'_>, copy_size: Extent3d, ) { let encoder_data = downcast_ref(encoder_data); @@ -2128,9 +2127,9 @@ where fn queue_write_texture( &self, queue_data: &crate::Data, - texture: ImageCopyTexture<'_>, + texture: TexelCopyTextureInfo<'_>, data: &[u8], - data_layout: ImageDataLayout, + data_layout: TexelCopyBufferLayout, size: Extent3d, ) { let queue_data = downcast_ref(queue_data); @@ -2141,8 +2140,8 @@ where fn queue_copy_external_image_to_texture( &self, queue_data: &crate::Data, - source: &wgt::ImageCopyExternalImage, - dest: crate::ImageCopyTextureTagged<'_>, + source: &wgt::CopyExternalImageSourceInfo, + dest: crate::CopyExternalImageDestInfo<'_>, size: wgt::Extent3d, ) { let queue_data = downcast_ref(queue_data); diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 9e0f4c42b..ef9ffdc65 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -61,23 +61,23 @@ pub use wgt::{ CommandBufferDescriptor, CompareFunction, CompositeAlphaMode, CoreCounters, DepthBiasState, DepthStencilState, DeviceLostReason, DeviceType, DownlevelCapabilities, DownlevelFlags, Dx12Compiler, DynamicOffset, Extent3d, Face, Features, FilterMode, FrontFace, - Gles3MinorVersion, HalCounters, ImageDataLayout, ImageSubresourceRange, IndexFormat, - InstanceDescriptor, InstanceFlags, InternalCounters, Limits, MaintainResult, MemoryHints, - MultisampleState, Origin2d, Origin3d, PipelineStatisticsTypes, PolygonMode, PowerPreference, + Gles3MinorVersion, HalCounters, ImageSubresourceRange, IndexFormat, InstanceDescriptor, + InstanceFlags, InternalCounters, Limits, MaintainResult, MemoryHints, MultisampleState, + Origin2d, Origin3d, PipelineStatisticsTypes, PolygonMode, PowerPreference, PredefinedColorSpace, PresentMode, PresentationTimestamp, PrimitiveState, PrimitiveTopology, PushConstantRange, QueryType, RenderBundleDepthStencil, SamplerBindingType, SamplerBorderColor, ShaderLocation, ShaderModel, ShaderStages, StencilFaceState, StencilOperation, StencilState, - StorageTextureAccess, SurfaceCapabilities, SurfaceStatus, TextureAspect, TextureDimension, - TextureFormat, TextureFormatFeatureFlags, TextureFormatFeatures, TextureSampleType, - TextureUsages, TextureViewDimension, VertexAttribute, VertexFormat, VertexStepMode, - WasmNotSend, WasmNotSendSync, WasmNotSync, COPY_BUFFER_ALIGNMENT, COPY_BYTES_PER_ROW_ALIGNMENT, - MAP_ALIGNMENT, PUSH_CONSTANT_ALIGNMENT, QUERY_RESOLVE_BUFFER_ALIGNMENT, QUERY_SET_MAX_QUERIES, - QUERY_SIZE, VERTEX_STRIDE_ALIGNMENT, + StorageTextureAccess, SurfaceCapabilities, SurfaceStatus, TexelCopyBufferLayout, TextureAspect, + TextureDimension, TextureFormat, TextureFormatFeatureFlags, TextureFormatFeatures, + TextureSampleType, TextureUsages, TextureViewDimension, VertexAttribute, VertexFormat, + VertexStepMode, WasmNotSend, WasmNotSendSync, WasmNotSync, COPY_BUFFER_ALIGNMENT, + COPY_BYTES_PER_ROW_ALIGNMENT, MAP_ALIGNMENT, PUSH_CONSTANT_ALIGNMENT, + QUERY_RESOLVE_BUFFER_ALIGNMENT, QUERY_SET_MAX_QUERIES, QUERY_SIZE, VERTEX_STRIDE_ALIGNMENT, }; // wasm-only types, we try to keep as many types non-platform // specific, but these need to depend on web-sys. #[cfg(any(webgpu, webgl))] -pub use wgt::{ExternalImageSource, ImageCopyExternalImage}; +pub use wgt::{CopyExternalImageSourceInfo, ExternalImageSource}; // // diff --git a/wgpu/src/util/device.rs b/wgpu/src/util/device.rs index 370a9e7ab..3abff00bb 100644 --- a/wgpu/src/util/device.rs +++ b/wgpu/src/util/device.rs @@ -161,7 +161,7 @@ impl DeviceExt for crate::Device { let end_offset = binary_offset + data_size as usize; queue.write_texture( - crate::ImageCopyTexture { + crate::TexelCopyTextureInfo { texture: &texture, mip_level: mip, origin: crate::Origin3d { @@ -172,7 +172,7 @@ impl DeviceExt for crate::Device { aspect: wgt::TextureAspect::All, }, &data[binary_offset..end_offset], - crate::ImageDataLayout { + crate::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(bytes_per_row), rows_per_image: Some(height_blocks),