diff --git a/wgpu-core/src/command/transfer.rs b/wgpu-core/src/command/transfer.rs index 690fc7e930..7b0797fcd7 100644 --- a/wgpu-core/src/command/transfer.rs +++ b/wgpu-core/src/command/transfer.rs @@ -13,22 +13,12 @@ use crate::{ }; use hal::command::CommandBuffer as _; -use wgt::{BufferAddress, BufferUsage, Extent3d, Origin3d, TextureUsage}; +use wgt::{BufferAddress, BufferUsage, Extent3d, Origin3d, TextureDataLayout, TextureUsage}; use std::iter; pub(crate) const BITS_PER_BYTE: u32 = 8; -#[repr(C)] -#[derive(Clone, Debug)] -#[cfg_attr(feature = "trace", derive(serde::Serialize))] -#[cfg_attr(feature = "replay", derive(serde::Deserialize))] -pub struct TextureDataLayout { - pub offset: BufferAddress, - pub bytes_per_row: u32, - pub rows_per_image: u32, -} - #[derive(Clone, Debug)] #[cfg_attr(feature = "trace", derive(serde::Serialize))] #[cfg_attr(feature = "replay", derive(serde::Deserialize))] diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index 968c4abeba..97b419b30c 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -238,7 +238,7 @@ impl Device { }; #[cfg(not(feature = "trace"))] match trace_path { - Some(_) => log::warn!("Tracing feature is not enabled"), + Some(_) => log::error!("Feature 'trace' is not enabled"), None => (), } @@ -265,7 +265,7 @@ impl Device { Some(Mutex::new(trace)) } Err(e) => { - log::warn!("Unable to start a trace in '{:?}': {:?}", path, e); + log::error!("Unable to start a trace in '{:?}': {:?}", path, e); None } }), diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index a4331eef1f..a9af87aa6b 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -5,7 +5,7 @@ #[cfg(feature = "trace")] use crate::device::trace::Action; use crate::{ - command::{CommandAllocator, CommandBuffer, TextureCopyView, TextureDataLayout, BITS_PER_BYTE}, + command::{CommandAllocator, CommandBuffer, TextureCopyView, BITS_PER_BYTE}, conv, hub::{GfxBackend, Global, GlobalIdentityHandlerFactory, Token}, id, @@ -192,7 +192,7 @@ impl Global { queue_id: id::QueueId, destination: &TextureCopyView, data: &[u8], - data_layout: &TextureDataLayout, + data_layout: &wgt::TextureDataLayout, size: wgt::Extent3d, ) { let hub = B::hub(self); diff --git a/wgpu-core/src/device/trace.rs b/wgpu-core/src/device/trace.rs index b2a90c872e..2b621ab626 100644 --- a/wgpu-core/src/device/trace.rs +++ b/wgpu-core/src/device/trace.rs @@ -2,10 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use crate::{ - command::{TextureCopyView, TextureDataLayout}, - id, -}; +use crate::{command::TextureCopyView, id}; #[cfg(feature = "trace")] use std::io::Write as _; use std::ops::Range; @@ -171,7 +168,7 @@ pub enum Action { WriteTexture { to: TextureCopyView, data: FileName, - layout: TextureDataLayout, + layout: wgt::TextureDataLayout, size: wgt::Extent3d, }, Submit(crate::SubmissionIndex, Vec), @@ -190,14 +187,14 @@ pub enum Command { }, CopyBufferToTexture { src: id::BufferId, - src_layout: TextureDataLayout, + src_layout: wgt::TextureDataLayout, dst: TextureCopyView, size: wgt::Extent3d, }, CopyTextureToBuffer { src: TextureCopyView, dst: id::BufferId, - dst_layout: TextureDataLayout, + dst_layout: wgt::TextureDataLayout, size: wgt::Extent3d, }, CopyTextureToTexture { diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 3c197414f1..ae93fab664 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -10,6 +10,9 @@ use serde::Deserialize; use serde::Serialize; use std::{io, ptr, slice}; +/// Bound uniform/storage buffer offsets must be aligned to this number. +pub const BIND_BUFFER_ALIGNMENT: u64 = 256; + #[repr(u8)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "trace", derive(Serialize))] @@ -981,5 +984,12 @@ impl From for TextureComponentType { } } -/// Bound uniform/storage buffer offsets must be aligned to this number. -pub const BIND_BUFFER_ALIGNMENT: u64 = 256; +#[repr(C)] +#[derive(Clone, Debug)] +#[cfg_attr(feature = "trace", derive(serde::Serialize))] +#[cfg_attr(feature = "replay", derive(serde::Deserialize))] +pub struct TextureDataLayout { + pub offset: BufferAddress, + pub bytes_per_row: u32, + pub rows_per_image: u32, +}