From 3888b56c830332580f0bd501c6d81f9435fd6850 Mon Sep 17 00:00:00 2001 From: chyyran Date: Wed, 25 Sep 2024 01:21:11 -0400 Subject: [PATCH] rt(d3d9): accept input image by reference --- librashader-capi/src/runtime/d3d9/filter_chain.rs | 3 ++- librashader-runtime-d3d9/src/draw_quad.rs | 2 +- librashader-runtime-d3d9/src/filter_chain.rs | 4 ++-- librashader-runtime-d3d9/src/luts.rs | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/librashader-capi/src/runtime/d3d9/filter_chain.rs b/librashader-capi/src/runtime/d3d9/filter_chain.rs index 90a3e36..f931c62 100644 --- a/librashader-capi/src/runtime/d3d9/filter_chain.rs +++ b/librashader-capi/src/runtime/d3d9/filter_chain.rs @@ -7,6 +7,7 @@ use librashader::runtime::d3d9::{FilterChain, FilterChainOptions, FrameOptions}; use std::ffi::c_char; use std::ffi::CStr; use std::mem::{ManuallyDrop, MaybeUninit}; +use std::ops::Deref; use std::ptr::NonNull; use std::slice; use windows::Win32::Graphics::Direct3D9::{IDirect3DDevice9, IDirect3DSurface9, IDirect3DTexture9}; @@ -179,7 +180,7 @@ extern_fn! { unsafe { - chain.frame(ManuallyDrop::into_inner(image.clone()), &viewport, frame_count, options.as_ref())?; + chain.frame(image.deref(), &viewport, frame_count, options.as_ref())?; } } } diff --git a/librashader-runtime-d3d9/src/draw_quad.rs b/librashader-runtime-d3d9/src/draw_quad.rs index 3af5a8e..6e37237 100644 --- a/librashader-runtime-d3d9/src/draw_quad.rs +++ b/librashader-runtime-d3d9/src/draw_quad.rs @@ -4,7 +4,7 @@ use array_concat::concat_arrays; use bytemuck::offset_of; use librashader_runtime::quad::{QuadType, VertexInput}; -use windows::Win32::Foundation::{FALSE, TRUE}; +use windows::Win32::Foundation::FALSE; use windows::Win32::Graphics::Direct3D9::{ IDirect3DDevice9, IDirect3DVertexBuffer9, IDirect3DVertexDeclaration9, D3DCMP_ALWAYS, diff --git a/librashader-runtime-d3d9/src/filter_chain.rs b/librashader-runtime-d3d9/src/filter_chain.rs index 9a0916e..eb628fe 100644 --- a/librashader-runtime-d3d9/src/filter_chain.rs +++ b/librashader-runtime-d3d9/src/filter_chain.rs @@ -23,7 +23,7 @@ use librashader_reflect::reflect::semantics::ShaderSemantics; use librashader_reflect::reflect::ReflectShader; use librashader_runtime::binding::{BindingUtil, TextureInput}; use librashader_runtime::framebuffer::FramebufferInit; -use librashader_runtime::image::{Image, ImageError, UVDirection, ARGB8, BGRA8}; +use librashader_runtime::image::{Image, ImageError, UVDirection, BGRA8}; use librashader_runtime::quad::QuadType; use librashader_runtime::render_target::RenderTarget; use librashader_runtime::scaling::ScaleFramebuffer; @@ -288,7 +288,7 @@ impl FilterChainD3D9 { /// * `input` must be in `D3DPOOL_DEFAULT`. pub unsafe fn frame( &mut self, - input: IDirect3DTexture9, + input: &IDirect3DTexture9, viewport: &Viewport, frame_count: usize, options: Option<&FrameOptionsD3D9>, diff --git a/librashader-runtime-d3d9/src/luts.rs b/librashader-runtime-d3d9/src/luts.rs index fa4493c..1fb6b0a 100644 --- a/librashader-runtime-d3d9/src/luts.rs +++ b/librashader-runtime-d3d9/src/luts.rs @@ -3,7 +3,7 @@ use crate::error::assume_d3d_init; use crate::texture::D3D9InputTexture; use librashader_presets::TextureConfig; -use librashader_runtime::image::{Image, ARGB8, BGRA8}; +use librashader_runtime::image::{Image, BGRA8}; use windows::Win32::Graphics::Direct3D9::{ IDirect3DDevice9, D3DFMT_A8R8G8B8, D3DLOCKED_RECT, D3DPOOL_MANAGED,