rt: doc FilterPassMeta

This commit is contained in:
chyyran 2023-02-07 02:54:58 -05:00
parent d6e1f2ca16
commit d9a97de131
6 changed files with 14 additions and 8 deletions

View file

@ -82,7 +82,7 @@ impl BindSemantics for FilterPass {
}
impl FilterPassMeta for FilterPass {
fn source_format(&self) -> ImageFormat {
fn framebuffer_format(&self) -> ImageFormat {
self.source.format
}

View file

@ -37,9 +37,9 @@ mod tests {
// "../test/slang-shaders/presets/crt-geom-ntsc-upscale-sharp.slangp",
// const FILTER_PATH: &str = "../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp";
// "../test/null.slangp",
// const FILTER_PATH: &str = "../test/slang-shaders/scalefx/scalefx-9x.slangp";
const FILTER_PATH: &str = "../test/slang-shaders/scalefx/scalefx-9x.slangp";
const FILTER_PATH: &str = "../test/slang-shaders/crt/crt-royale.slangp";
// const FILTER_PATH: &str = "../test/slang-shaders/crt/crt-royale.slangp";
const IMAGE_PATH: &str = "../test/finalfightlong.png";
// #[test]
// fn triangle_d3d11_args() {

View file

@ -76,7 +76,7 @@ impl BindSemantics<NoUniformBinder, Option<()>, RawD3D12Buffer, RawD3D12Buffer>
}
impl FilterPassMeta for FilterPass {
fn source_format(&self) -> ImageFormat {
fn framebuffer_format(&self) -> ImageFormat {
self.source.format
}

View file

@ -149,7 +149,7 @@ impl<T: GLInterface> FilterPass<T> {
}
impl<T: GLInterface> FilterPassMeta for FilterPass<T> {
fn source_format(&self) -> ImageFormat {
fn framebuffer_format(&self) -> ImageFormat {
self.source.format
}

View file

@ -75,7 +75,7 @@ impl BindSemantics<NoUniformBinder, Option<()>, RawVulkanBuffer> for FilterPass
}
impl FilterPassMeta for FilterPass {
fn source_format(&self) -> ImageFormat {
fn framebuffer_format(&self) -> ImageFormat {
self.source.format
}

View file

@ -1,12 +1,18 @@
use librashader_common::ImageFormat;
use librashader_presets::ShaderPassConfig;
/// Trait for metadata about a filter pass.
pub trait FilterPassMeta {
fn source_format(&self) -> ImageFormat;
/// Gets the format of the framebuffer for the pass.
fn framebuffer_format(&self) -> ImageFormat;
/// Gets a reference to the filter pass config.
fn config(&self) -> &ShaderPassConfig;
/// Gets the format of the filter pass framebuffer.
#[inline(always)]
fn get_format(&self) -> ImageFormat {
let fb_format = self.source_format();
let fb_format = self.framebuffer_format();
if let Some(format) = self.config().get_format_override() {
format
} else if fb_format == ImageFormat::Unknown {