From bbfd5153da190f1932c83c54868646f963b8ec1c Mon Sep 17 00:00:00 2001 From: chyyran Date: Tue, 6 Feb 2024 18:47:05 -0500 Subject: [PATCH] rt(wgpu): rename OutputView to WgpuOutputView --- .idea/workspace.xml | 43 ++++++++++--------- librashader-runtime-wgpu/src/filter_chain.rs | 6 +-- librashader-runtime-wgpu/src/filter_pass.rs | 6 +-- librashader-runtime-wgpu/src/framebuffer.rs | 10 +++-- .../src/graphics_pipeline.rs | 4 +- librashader-runtime-wgpu/src/lib.rs | 2 +- .../tests/hello_triangle.rs | 2 +- librashader/src/lib.rs | 2 +- 8 files changed, 39 insertions(+), 36 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 72ff6d8..f4139e8 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -12,24 +12,7 @@ - - - - - - - - - - - - - - - - - - + @@ -412,7 +411,9 @@ - diff --git a/librashader-runtime-wgpu/src/filter_chain.rs b/librashader-runtime-wgpu/src/filter_chain.rs index 761ac68..75c51e4 100644 --- a/librashader-runtime-wgpu/src/filter_chain.rs +++ b/librashader-runtime-wgpu/src/filter_chain.rs @@ -28,7 +28,7 @@ use wgpu::{Device, TextureFormat}; use crate::error; use crate::error::FilterChainError; use crate::filter_pass::FilterPass; -use crate::framebuffer::OutputView; +use crate::framebuffer::WgpuOutputView; use crate::graphics_pipeline::WgpuGraphicsPipeline; use crate::luts::LutTexture; use crate::mipmap::MipmapGen; @@ -319,7 +319,7 @@ impl FilterChainWgpu { pub fn frame<'a>( &mut self, input: Arc, - viewport: &Viewport>, + viewport: &Viewport>, cmd: &mut wgpu::CommandEncoder, frame_count: usize, options: Option<&FrameOptionsWgpu>, @@ -402,7 +402,7 @@ impl FilterChainWgpu { source.wrap_mode = pass.config.wrap_mode; source.mip_filter = pass.config.filter; - let output_image = OutputView::from(target); + let output_image = WgpuOutputView::from(target); let out = RenderTarget::identity(&output_image); pass.draw( diff --git a/librashader-runtime-wgpu/src/filter_pass.rs b/librashader-runtime-wgpu/src/filter_pass.rs index f8ad380..467dff8 100644 --- a/librashader-runtime-wgpu/src/filter_pass.rs +++ b/librashader-runtime-wgpu/src/filter_pass.rs @@ -1,7 +1,7 @@ use crate::buffer::WgpuStagedBuffer; use crate::error; use crate::filter_chain::FilterCommon; -use crate::framebuffer::OutputView; +use crate::framebuffer::WgpuOutputView; use crate::graphics_pipeline::WgpuGraphicsPipeline; use crate::samplers::SamplerSet; use crate::texture::InputImage; @@ -90,10 +90,10 @@ impl FilterPass { parent: &FilterCommon, frame_count: u32, frame_direction: i32, - viewport: &Viewport, + viewport: &Viewport, original: &InputImage, source: &InputImage, - output: &RenderTarget, + output: &RenderTarget, vbo_type: QuadType, ) -> error::Result<()> { let mut main_heap = FxHashMap::default(); diff --git a/librashader-runtime-wgpu/src/framebuffer.rs b/librashader-runtime-wgpu/src/framebuffer.rs index ccac8f7..9f4ddee 100644 --- a/librashader-runtime-wgpu/src/framebuffer.rs +++ b/librashader-runtime-wgpu/src/framebuffer.rs @@ -4,13 +4,14 @@ use librashader_common::Size; use wgpu::TextureViewDescriptor; /// A wgpu `TextureView` with size and texture information to output. -pub struct OutputView<'a> { +pub struct WgpuOutputView<'a> { pub(crate) size: Size, pub(crate) view: Handle<'a, wgpu::TextureView>, pub(crate) format: wgpu::TextureFormat, } -impl<'a> OutputView<'a> { +impl<'a> WgpuOutputView<'a> { + /// Create an output view from an existing texture view, size, and format. pub fn new_from_raw( view: &'a wgpu::TextureView, size: Size, @@ -24,7 +25,8 @@ impl<'a> OutputView<'a> { } } -impl<'a> From<&'a OwnedImage> for OutputView<'a> { +#[doc(hidden)] +impl<'a> From<&'a OwnedImage> for WgpuOutputView<'a> { fn from(image: &'a OwnedImage) -> Self { Self { size: image.size, @@ -34,7 +36,7 @@ impl<'a> From<&'a OwnedImage> for OutputView<'a> { } } -impl From<&wgpu::Texture> for OutputView<'static> { +impl From<&wgpu::Texture> for WgpuOutputView<'static> { fn from(image: &wgpu::Texture) -> Self { Self { size: image.size().into(), diff --git a/librashader-runtime-wgpu/src/graphics_pipeline.rs b/librashader-runtime-wgpu/src/graphics_pipeline.rs index 8854a61..b1e2c40 100644 --- a/librashader-runtime-wgpu/src/graphics_pipeline.rs +++ b/librashader-runtime-wgpu/src/graphics_pipeline.rs @@ -1,4 +1,4 @@ -use crate::framebuffer::OutputView; +use crate::framebuffer::WgpuOutputView; use crate::util; use librashader_reflect::back::wgsl::NagaWgslContext; use librashader_reflect::back::ShaderCompilerOutput; @@ -220,7 +220,7 @@ impl WgpuGraphicsPipeline { pub(crate) fn begin_rendering<'pass>( &'pass self, - output: &RenderTarget<'pass, OutputView>, + output: &RenderTarget<'pass, WgpuOutputView>, cmd: &'pass mut CommandEncoder, ) -> RenderPass<'pass> { let mut render_pass = cmd.begin_render_pass(&RenderPassDescriptor { diff --git a/librashader-runtime-wgpu/src/lib.rs b/librashader-runtime-wgpu/src/lib.rs index 6ae42ec..04f326c 100644 --- a/librashader-runtime-wgpu/src/lib.rs +++ b/librashader-runtime-wgpu/src/lib.rs @@ -21,7 +21,7 @@ mod texture; mod util; pub use filter_chain::FilterChainWgpu; -pub use framebuffer::OutputView; +pub use framebuffer::WgpuOutputView; pub mod error; diff --git a/librashader-runtime-wgpu/tests/hello_triangle.rs b/librashader-runtime-wgpu/tests/hello_triangle.rs index 36e19e8..cef3039 100644 --- a/librashader-runtime-wgpu/tests/hello_triangle.rs +++ b/librashader-runtime-wgpu/tests/hello_triangle.rs @@ -284,7 +284,7 @@ impl<'a> State<'a> { x: 0.0, y: 0.0, mvp: None, - output: librashader_runtime_wgpu::OutputView::new_from_raw( + output: librashader_runtime_wgpu::WgpuOutputView::new_from_raw( &filter_view, filter_output.size().into(), filter_output.format(), diff --git a/librashader/src/lib.rs b/librashader/src/lib.rs index af204f4..0d0abaa 100644 --- a/librashader/src/lib.rs +++ b/librashader/src/lib.rs @@ -314,7 +314,7 @@ pub mod runtime { options::{ FilterChainOptionsWgpu as FilterChainOptions, FrameOptionsWgpu as FrameOptions, }, - FilterChainWgpu as FilterChain, OutputView, + FilterChainWgpu as FilterChain, WgpuOutputView, }; } }