From d9a97de13142ed698000979cf64775b442ab2e1d Mon Sep 17 00:00:00 2001 From: chyyran Date: Tue, 7 Feb 2023 02:54:58 -0500 Subject: [PATCH] rt: doc FilterPassMeta --- librashader-runtime-d3d11/src/filter_pass.rs | 2 +- librashader-runtime-d3d11/src/lib.rs | 4 ++-- librashader-runtime-d3d12/src/filter_pass.rs | 2 +- librashader-runtime-gl/src/filter_pass.rs | 2 +- librashader-runtime-vk/src/filter_pass.rs | 2 +- librashader-runtime/src/filter_pass.rs | 10 ++++++++-- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/librashader-runtime-d3d11/src/filter_pass.rs b/librashader-runtime-d3d11/src/filter_pass.rs index 307da38..3f50dc9 100644 --- a/librashader-runtime-d3d11/src/filter_pass.rs +++ b/librashader-runtime-d3d11/src/filter_pass.rs @@ -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 } diff --git a/librashader-runtime-d3d11/src/lib.rs b/librashader-runtime-d3d11/src/lib.rs index eb7ae13..7586400 100644 --- a/librashader-runtime-d3d11/src/lib.rs +++ b/librashader-runtime-d3d11/src/lib.rs @@ -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() { diff --git a/librashader-runtime-d3d12/src/filter_pass.rs b/librashader-runtime-d3d12/src/filter_pass.rs index 1e82d50..2a4c1d1 100644 --- a/librashader-runtime-d3d12/src/filter_pass.rs +++ b/librashader-runtime-d3d12/src/filter_pass.rs @@ -76,7 +76,7 @@ impl BindSemantics, RawD3D12Buffer, RawD3D12Buffer> } impl FilterPassMeta for FilterPass { - fn source_format(&self) -> ImageFormat { + fn framebuffer_format(&self) -> ImageFormat { self.source.format } diff --git a/librashader-runtime-gl/src/filter_pass.rs b/librashader-runtime-gl/src/filter_pass.rs index 7148493..51ac8bc 100644 --- a/librashader-runtime-gl/src/filter_pass.rs +++ b/librashader-runtime-gl/src/filter_pass.rs @@ -149,7 +149,7 @@ impl FilterPass { } impl FilterPassMeta for FilterPass { - fn source_format(&self) -> ImageFormat { + fn framebuffer_format(&self) -> ImageFormat { self.source.format } diff --git a/librashader-runtime-vk/src/filter_pass.rs b/librashader-runtime-vk/src/filter_pass.rs index 99ebf5f..874449c 100644 --- a/librashader-runtime-vk/src/filter_pass.rs +++ b/librashader-runtime-vk/src/filter_pass.rs @@ -75,7 +75,7 @@ impl BindSemantics, RawVulkanBuffer> for FilterPass } impl FilterPassMeta for FilterPass { - fn source_format(&self) -> ImageFormat { + fn framebuffer_format(&self) -> ImageFormat { self.source.format } diff --git a/librashader-runtime/src/filter_pass.rs b/librashader-runtime/src/filter_pass.rs index d140355..d7c813c 100644 --- a/librashader-runtime/src/filter_pass.rs +++ b/librashader-runtime/src/filter_pass.rs @@ -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 {