From b44a711d560bc68494602a179f46e1db3ce6ccf6 Mon Sep 17 00:00:00 2001 From: Lazy Panda Date: Mon, 5 Aug 2024 17:26:05 +0800 Subject: [PATCH] fix: not copy resource; --- src/frame.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/frame.rs b/src/frame.rs index a18a78d..2701a7a 100644 --- a/src/frame.rs +++ b/src/frame.rs @@ -187,6 +187,12 @@ impl<'a> Frame<'a> { }; let texture = texture.unwrap(); + + // Copy the real texture to copy texture + unsafe { + self.context.CopyResource(&texture, &self.frame_texture); + }; + Ok(texture) } @@ -198,11 +204,6 @@ impl<'a> Frame<'a> { pub fn buffer(&mut self) -> Result { let texture = self.texture()?; - // Copy the real texture to copy texture - unsafe { - self.context.CopyResource(&texture, &self.frame_texture); - }; - // Map the texture to enable CPU access let mut mapped_resource = D3D11_MAPPED_SUBRESOURCE::default(); unsafe {