mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Move some *Copy*Info types out of wgpu_core::command::transfer
In the future `transfer` will want to use the `Arc` versions of these types. I have exported them from `wgpu_core::command::ffi`, to document that these are used for FFI purposes, and from `wgpu_core::command`, for backwards compatibility, although I also change the in-tree uses to use them from `wgpu_types` instead of from `wgpu_core::command`.
This commit is contained in:
parent
d79a49a060
commit
aaf52e93d9
@ -15,18 +15,18 @@ pub enum Command {
|
||||
size: Option<wgt::BufferAddress>,
|
||||
},
|
||||
CopyBufferToTexture {
|
||||
src: crate::command::TexelCopyBufferInfo,
|
||||
dst: crate::command::TexelCopyTextureInfo,
|
||||
src: wgt::TexelCopyBufferInfo<id::BufferId>,
|
||||
dst: wgt::TexelCopyTextureInfo<id::TextureId>,
|
||||
size: wgt::Extent3d,
|
||||
},
|
||||
CopyTextureToBuffer {
|
||||
src: crate::command::TexelCopyTextureInfo,
|
||||
dst: crate::command::TexelCopyBufferInfo,
|
||||
src: wgt::TexelCopyTextureInfo<id::TextureId>,
|
||||
dst: wgt::TexelCopyBufferInfo<id::BufferId>,
|
||||
size: wgt::Extent3d,
|
||||
},
|
||||
CopyTextureToTexture {
|
||||
src: crate::command::TexelCopyTextureInfo,
|
||||
dst: crate::command::TexelCopyTextureInfo,
|
||||
src: wgt::TexelCopyTextureInfo<id::TextureId>,
|
||||
dst: wgt::TexelCopyTextureInfo<id::TextureId>,
|
||||
size: wgt::Extent3d,
|
||||
},
|
||||
ClearBuffer {
|
||||
|
||||
7
wgpu-core/src/command/ffi.rs
Normal file
7
wgpu-core/src/command/ffi.rs
Normal file
@ -0,0 +1,7 @@
|
||||
//! Types that are useful for FFI bindings to `wgpu`.
|
||||
|
||||
use crate::id;
|
||||
|
||||
pub type TexelCopyBufferInfo = wgt::TexelCopyBufferInfo<id::BufferId>;
|
||||
pub type TexelCopyTextureInfo = wgt::TexelCopyTextureInfo<id::TextureId>;
|
||||
pub type CopyExternalImageDestInfo = wgt::CopyExternalImageDestInfo<id::TextureId>;
|
||||
@ -7,6 +7,7 @@ mod compute_command;
|
||||
mod draw;
|
||||
mod encoder;
|
||||
mod encoder_command;
|
||||
pub mod ffi;
|
||||
mod memory_init;
|
||||
mod pass;
|
||||
mod query;
|
||||
@ -58,6 +59,10 @@ use thiserror::Error;
|
||||
#[cfg(feature = "trace")]
|
||||
type TraceCommand = Command;
|
||||
|
||||
pub type TexelCopyBufferInfo = ffi::TexelCopyBufferInfo;
|
||||
pub type TexelCopyTextureInfo = ffi::TexelCopyTextureInfo;
|
||||
pub type CopyExternalImageDestInfo = ffi::CopyExternalImageDestInfo;
|
||||
|
||||
const PUSH_CONSTANT_CLEAR_ARRAY: &[u32] = &[0_u32; 64];
|
||||
|
||||
/// The current state of a command or pass encoder.
|
||||
|
||||
@ -15,7 +15,7 @@ use crate::{
|
||||
command::{clear_texture, CommandEncoderError, EncoderStateError},
|
||||
device::{Device, MissingDownlevelFlags},
|
||||
global::Global,
|
||||
id::{BufferId, CommandEncoderId, TextureId},
|
||||
id::{BufferId, CommandEncoderId},
|
||||
init_tracker::{
|
||||
has_copy_partial_init_tracker_coverage, MemoryInitKind, TextureInitRange,
|
||||
TextureInitTrackerAction,
|
||||
@ -29,9 +29,8 @@ use crate::{
|
||||
|
||||
use super::{ClearError, CommandBufferMutable};
|
||||
|
||||
pub type TexelCopyBufferInfo = wgt::TexelCopyBufferInfo<BufferId>;
|
||||
pub type TexelCopyTextureInfo = wgt::TexelCopyTextureInfo<TextureId>;
|
||||
pub type CopyExternalImageDestInfo = wgt::CopyExternalImageDestInfo<TextureId>;
|
||||
use super::TexelCopyBufferInfo;
|
||||
use super::TexelCopyTextureInfo;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum CopySide {
|
||||
|
||||
@ -22,7 +22,7 @@ use crate::{
|
||||
extract_texture_selector, validate_linear_texture_data, validate_texture_buffer_copy,
|
||||
validate_texture_copy_dst_format, validate_texture_copy_range, ClearError,
|
||||
CommandAllocator, CommandBuffer, CommandEncoder, CommandEncoderError, CopySide,
|
||||
TexelCopyTextureInfo, TransferError,
|
||||
TransferError,
|
||||
},
|
||||
device::{DeviceError, WaitIdleError},
|
||||
get_lowest_common_denom,
|
||||
@ -1617,7 +1617,7 @@ impl Global {
|
||||
pub fn queue_write_texture(
|
||||
&self,
|
||||
queue_id: QueueId,
|
||||
destination: &TexelCopyTextureInfo,
|
||||
destination: &wgt::TexelCopyTextureInfo<id::TextureId>,
|
||||
data: &[u8],
|
||||
data_layout: &wgt::TexelCopyBufferLayout,
|
||||
size: &wgt::Extent3d,
|
||||
|
||||
@ -140,7 +140,7 @@ pub enum Action<'a> {
|
||||
queued: bool,
|
||||
},
|
||||
WriteTexture {
|
||||
to: crate::command::TexelCopyTextureInfo,
|
||||
to: wgt::TexelCopyTextureInfo<id::TextureId>,
|
||||
data: FileName,
|
||||
layout: wgt::TexelCopyBufferLayout,
|
||||
size: wgt::Extent3d,
|
||||
|
||||
@ -386,8 +386,10 @@ impl ContextWgpuCore {
|
||||
}
|
||||
}
|
||||
|
||||
fn map_buffer_copy_view(view: crate::TexelCopyBufferInfo<'_>) -> wgc::command::TexelCopyBufferInfo {
|
||||
wgc::command::TexelCopyBufferInfo {
|
||||
fn map_buffer_copy_view(
|
||||
view: crate::TexelCopyBufferInfo<'_>,
|
||||
) -> wgt::TexelCopyBufferInfo<wgc::id::BufferId> {
|
||||
wgt::TexelCopyBufferInfo {
|
||||
buffer: view.buffer.inner.as_core().id,
|
||||
layout: view.layout,
|
||||
}
|
||||
@ -407,8 +409,8 @@ fn map_texture_copy_view(
|
||||
#[cfg_attr(not(webgl), expect(unused))]
|
||||
fn map_texture_tagged_copy_view(
|
||||
view: crate::CopyExternalImageDestInfo<&api::Texture>,
|
||||
) -> wgc::command::CopyExternalImageDestInfo {
|
||||
wgc::command::CopyExternalImageDestInfo {
|
||||
) -> wgt::CopyExternalImageDestInfo<wgc::id::TextureId> {
|
||||
wgt::CopyExternalImageDestInfo {
|
||||
texture: view.texture.inner.as_core().id,
|
||||
mip_level: view.mip_level,
|
||||
origin: view.origin,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user