librashader/librashader-runtime-d3d11/src/texture.rs

32 lines
740 B
Rust
Raw Normal View History

use crate::error::Result;
use crate::framebuffer::OwnedImage;
use librashader_common::{FilterMode, WrapMode};
2024-08-09 14:55:58 +10:00
use windows::Win32::Graphics::Direct3D11::ID3D11ShaderResourceView;
2023-01-13 18:54:16 +11:00
2022-11-29 13:00:54 +11:00
#[derive(Debug, Clone)]
2023-01-15 19:01:23 +11:00
pub struct InputTexture {
pub view: ID3D11ShaderResourceView,
2022-11-27 18:21:36 +11:00
pub filter: FilterMode,
pub wrap_mode: WrapMode,
2022-11-26 18:38:15 +11:00
}
2023-01-13 18:54:16 +11:00
impl InputTexture {
2023-01-15 19:01:23 +11:00
pub(crate) fn from_framebuffer(
fbo: &OwnedImage,
2022-12-22 13:39:31 +11:00
wrap_mode: WrapMode,
filter: FilterMode,
) -> Result<Self> {
2023-01-13 18:54:16 +11:00
Ok(InputTexture {
view: fbo.create_shader_resource_view()?,
filter,
2022-12-22 13:39:31 +11:00
wrap_mode,
})
}
}
2023-01-15 19:01:23 +11:00
impl AsRef<InputTexture> for InputTexture {
fn as_ref(&self) -> &InputTexture {
self
}
}