mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-02-16 17:02:32 +00:00
buffer / texture copy operations for DynCommandEncoder
This commit is contained in:
parent
39b408218f
commit
c02ee6270b
@ -1,9 +1,9 @@
|
||||
use std::ops::Range;
|
||||
|
||||
use crate::{
|
||||
Api, Attachment, BufferBarrier, BufferBinding, BufferCopy, ColorAttachment, CommandEncoder,
|
||||
ComputePassDescriptor, DepthStencilAttachment, DeviceError, Label, MemoryRange,
|
||||
PassTimestampWrites, Rect, RenderPassDescriptor, TextureBarrier,
|
||||
Api, Attachment, BufferBarrier, BufferBinding, BufferCopy, BufferTextureCopy, ColorAttachment,
|
||||
CommandEncoder, ComputePassDescriptor, DepthStencilAttachment, DeviceError, Label, MemoryRange,
|
||||
PassTimestampWrites, Rect, RenderPassDescriptor, TextureBarrier, TextureCopy, TextureUses,
|
||||
};
|
||||
|
||||
use super::{
|
||||
@ -28,6 +28,29 @@ pub trait DynCommandEncoder: std::fmt::Debug {
|
||||
regions: &[BufferCopy],
|
||||
);
|
||||
|
||||
unsafe fn copy_texture_to_texture(
|
||||
&mut self,
|
||||
src: &dyn DynTexture,
|
||||
src_usage: TextureUses,
|
||||
dst: &dyn DynTexture,
|
||||
regions: &[TextureCopy],
|
||||
);
|
||||
|
||||
unsafe fn copy_buffer_to_texture(
|
||||
&mut self,
|
||||
src: &dyn DynBuffer,
|
||||
dst: &dyn DynTexture,
|
||||
regions: &[BufferTextureCopy],
|
||||
);
|
||||
|
||||
unsafe fn copy_texture_to_buffer(
|
||||
&mut self,
|
||||
src: &dyn DynTexture,
|
||||
src_usage: TextureUses,
|
||||
dst: &dyn DynBuffer,
|
||||
regions: &[BufferTextureCopy],
|
||||
);
|
||||
|
||||
unsafe fn set_bind_group(
|
||||
&mut self,
|
||||
layout: &dyn DynPipelineLayout,
|
||||
@ -195,6 +218,47 @@ impl<C: CommandEncoder> DynCommandEncoder for C {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn copy_texture_to_texture(
|
||||
&mut self,
|
||||
src: &dyn DynTexture,
|
||||
src_usage: TextureUses,
|
||||
dst: &dyn DynTexture,
|
||||
regions: &[TextureCopy],
|
||||
) {
|
||||
let src = src.expect_downcast_ref();
|
||||
let dst = dst.expect_downcast_ref();
|
||||
unsafe {
|
||||
C::copy_texture_to_texture(self, src, src_usage, dst, regions.iter().cloned());
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn copy_buffer_to_texture(
|
||||
&mut self,
|
||||
src: &dyn DynBuffer,
|
||||
dst: &dyn DynTexture,
|
||||
regions: &[BufferTextureCopy],
|
||||
) {
|
||||
let src = src.expect_downcast_ref();
|
||||
let dst = dst.expect_downcast_ref();
|
||||
unsafe {
|
||||
C::copy_buffer_to_texture(self, src, dst, regions.iter().cloned());
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn copy_texture_to_buffer(
|
||||
&mut self,
|
||||
src: &dyn DynTexture,
|
||||
src_usage: TextureUses,
|
||||
dst: &dyn DynBuffer,
|
||||
regions: &[BufferTextureCopy],
|
||||
) {
|
||||
let src = src.expect_downcast_ref();
|
||||
let dst = dst.expect_downcast_ref();
|
||||
unsafe {
|
||||
C::copy_texture_to_buffer(self, src, src_usage, dst, regions.iter().cloned());
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn set_bind_group(
|
||||
&mut self,
|
||||
layout: &dyn DynPipelineLayout,
|
||||
|
Loading…
Reference in New Issue
Block a user