librashader/librashader-runtime-d3d11/src/texture.rs
2024-08-09 00:56:44 -04:00

32 lines
740 B
Rust

use crate::error::Result;
use crate::framebuffer::OwnedImage;
use librashader_common::{FilterMode, WrapMode};
use windows::Win32::Graphics::Direct3D11::ID3D11ShaderResourceView;
#[derive(Debug, Clone)]
pub struct InputTexture {
pub view: ID3D11ShaderResourceView,
pub filter: FilterMode,
pub wrap_mode: WrapMode,
}
impl InputTexture {
pub(crate) fn from_framebuffer(
fbo: &OwnedImage,
wrap_mode: WrapMode,
filter: FilterMode,
) -> Result<Self> {
Ok(InputTexture {
view: fbo.create_shader_resource_view()?,
filter,
wrap_mode,
})
}
}
impl AsRef<InputTexture> for InputTexture {
fn as_ref(&self) -> &InputTexture {
self
}
}