rt(d3d9): accept input image by reference

This commit is contained in:
chyyran 2024-09-25 01:21:11 -04:00 committed by Ronny Chan
parent b0df631651
commit 3888b56c83
4 changed files with 6 additions and 5 deletions

View file

@ -7,6 +7,7 @@ use librashader::runtime::d3d9::{FilterChain, FilterChainOptions, FrameOptions};
use std::ffi::c_char; use std::ffi::c_char;
use std::ffi::CStr; use std::ffi::CStr;
use std::mem::{ManuallyDrop, MaybeUninit}; use std::mem::{ManuallyDrop, MaybeUninit};
use std::ops::Deref;
use std::ptr::NonNull; use std::ptr::NonNull;
use std::slice; use std::slice;
use windows::Win32::Graphics::Direct3D9::{IDirect3DDevice9, IDirect3DSurface9, IDirect3DTexture9}; use windows::Win32::Graphics::Direct3D9::{IDirect3DDevice9, IDirect3DSurface9, IDirect3DTexture9};
@ -179,7 +180,7 @@ extern_fn! {
unsafe { unsafe {
chain.frame(ManuallyDrop::into_inner(image.clone()), &viewport, frame_count, options.as_ref())?; chain.frame(image.deref(), &viewport, frame_count, options.as_ref())?;
} }
} }
} }

View file

@ -4,7 +4,7 @@ use array_concat::concat_arrays;
use bytemuck::offset_of; use bytemuck::offset_of;
use librashader_runtime::quad::{QuadType, VertexInput}; use librashader_runtime::quad::{QuadType, VertexInput};
use windows::Win32::Foundation::{FALSE, TRUE}; use windows::Win32::Foundation::FALSE;
use windows::Win32::Graphics::Direct3D9::{ use windows::Win32::Graphics::Direct3D9::{
IDirect3DDevice9, IDirect3DVertexBuffer9, IDirect3DVertexDeclaration9, D3DCMP_ALWAYS, IDirect3DDevice9, IDirect3DVertexBuffer9, IDirect3DVertexDeclaration9, D3DCMP_ALWAYS,

View file

@ -23,7 +23,7 @@ use librashader_reflect::reflect::semantics::ShaderSemantics;
use librashader_reflect::reflect::ReflectShader; use librashader_reflect::reflect::ReflectShader;
use librashader_runtime::binding::{BindingUtil, TextureInput}; use librashader_runtime::binding::{BindingUtil, TextureInput};
use librashader_runtime::framebuffer::FramebufferInit; 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::quad::QuadType;
use librashader_runtime::render_target::RenderTarget; use librashader_runtime::render_target::RenderTarget;
use librashader_runtime::scaling::ScaleFramebuffer; use librashader_runtime::scaling::ScaleFramebuffer;
@ -288,7 +288,7 @@ impl FilterChainD3D9 {
/// * `input` must be in `D3DPOOL_DEFAULT`. /// * `input` must be in `D3DPOOL_DEFAULT`.
pub unsafe fn frame( pub unsafe fn frame(
&mut self, &mut self,
input: IDirect3DTexture9, input: &IDirect3DTexture9,
viewport: &Viewport<IDirect3DSurface9>, viewport: &Viewport<IDirect3DSurface9>,
frame_count: usize, frame_count: usize,
options: Option<&FrameOptionsD3D9>, options: Option<&FrameOptionsD3D9>,

View file

@ -3,7 +3,7 @@ use crate::error::assume_d3d_init;
use crate::texture::D3D9InputTexture; use crate::texture::D3D9InputTexture;
use librashader_presets::TextureConfig; use librashader_presets::TextureConfig;
use librashader_runtime::image::{Image, ARGB8, BGRA8}; use librashader_runtime::image::{Image, BGRA8};
use windows::Win32::Graphics::Direct3D9::{ use windows::Win32::Graphics::Direct3D9::{
IDirect3DDevice9, D3DFMT_A8R8G8B8, D3DLOCKED_RECT, D3DPOOL_MANAGED, IDirect3DDevice9, D3DFMT_A8R8G8B8, D3DLOCKED_RECT, D3DPOOL_MANAGED,