rt(wgpu): rename OutputView to WgpuOutputView

This commit is contained in:
chyyran 2024-02-06 18:47:05 -05:00 committed by Ronny Chan
parent 37397ff216
commit bbfd5153da
8 changed files with 39 additions and 36 deletions

View file

@ -12,24 +12,7 @@
<cargoProject FILE="$PROJECT_DIR$/Cargo.toml" /> <cargoProject FILE="$PROJECT_DIR$/Cargo.toml" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="02471831-07cd-4975-a00c-e042450023a1" name="Changes" comment="rt(wgpu): wip filter chain logic"> <list default="true" id="02471831-07cd-4975-a00c-e042450023a1" name="Changes" comment="rt(wgpu): rename OutputView to WgpuOutputView" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Cargo.lock" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-reflect/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-reflect/Cargo.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-reflect/src/reflect/naga.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-reflect/src/reflect/naga.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-gl/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-gl/Cargo.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-vk/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-vk/Cargo.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/Cargo.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/src/error.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/src/error.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/src/filter_chain.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/src/filter_chain.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/src/filter_pass.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/src/filter_pass.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/src/framebuffer.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/src/framebuffer.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/src/lib.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/src/lib.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/src/options.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/src/options.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader-runtime-wgpu/tests/hello_triangle.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader-runtime-wgpu/tests/hello_triangle.rs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/librashader/Cargo.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/librashader/src/lib.rs" beforeDir="false" afterPath="$PROJECT_DIR$/librashader/src/lib.rs" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -284,7 +267,7 @@
<workItem from="1706229877283" duration="1844000" /> <workItem from="1706229877283" duration="1844000" />
<workItem from="1706680503632" duration="3415000" /> <workItem from="1706680503632" duration="3415000" />
<workItem from="1706766058493" duration="620000" /> <workItem from="1706766058493" duration="620000" />
<workItem from="1707260879653" duration="1928000" /> <workItem from="1707260879653" duration="2601000" />
</task> </task>
<task id="LOCAL-00001" summary="rt(wgpu): basic triangle example"> <task id="LOCAL-00001" summary="rt(wgpu): basic triangle example">
<option name="closed" value="true" /> <option name="closed" value="true" />
@ -382,7 +365,23 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1706680538133</updated> <updated>1706680538133</updated>
</task> </task>
<option name="localTasksCounter" value="13" /> <task id="LOCAL-00013" summary="lib: add wgpu to librashader library">
<option name="closed" value="true" />
<created>1707262952330</created>
<option name="number" value="00013" />
<option name="presentableId" value="LOCAL-00013" />
<option name="project" value="LOCAL" />
<updated>1707262952330</updated>
</task>
<task id="LOCAL-00014" summary="rt(wgpu): rename OutputView to WgpuOutputView">
<option name="closed" value="true" />
<created>1707263225337</created>
<option name="number" value="00014" />
<option name="presentableId" value="LOCAL-00014" />
<option name="project" value="LOCAL" />
<updated>1707263225337</updated>
</task>
<option name="localTasksCounter" value="15" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -412,7 +411,9 @@
<MESSAGE value="rt(wgpu): update to wgpu 0.19" /> <MESSAGE value="rt(wgpu): update to wgpu 0.19" />
<MESSAGE value="rt(wgpu): filter pass logic" /> <MESSAGE value="rt(wgpu): filter pass logic" />
<MESSAGE value="rt(wgpu): wip filter chain logic" /> <MESSAGE value="rt(wgpu): wip filter chain logic" />
<option name="LAST_COMMIT_MESSAGE" value="rt(wgpu): wip filter chain logic" /> <MESSAGE value="lib: add wgpu to librashader library" />
<MESSAGE value="rt(wgpu): rename OutputView to WgpuOutputView" />
<option name="LAST_COMMIT_MESSAGE" value="rt(wgpu): rename OutputView to WgpuOutputView" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>

View file

@ -28,7 +28,7 @@ use wgpu::{Device, TextureFormat};
use crate::error; use crate::error;
use crate::error::FilterChainError; use crate::error::FilterChainError;
use crate::filter_pass::FilterPass; use crate::filter_pass::FilterPass;
use crate::framebuffer::OutputView; use crate::framebuffer::WgpuOutputView;
use crate::graphics_pipeline::WgpuGraphicsPipeline; use crate::graphics_pipeline::WgpuGraphicsPipeline;
use crate::luts::LutTexture; use crate::luts::LutTexture;
use crate::mipmap::MipmapGen; use crate::mipmap::MipmapGen;
@ -319,7 +319,7 @@ impl FilterChainWgpu {
pub fn frame<'a>( pub fn frame<'a>(
&mut self, &mut self,
input: Arc<wgpu::Texture>, input: Arc<wgpu::Texture>,
viewport: &Viewport<OutputView<'a>>, viewport: &Viewport<WgpuOutputView<'a>>,
cmd: &mut wgpu::CommandEncoder, cmd: &mut wgpu::CommandEncoder,
frame_count: usize, frame_count: usize,
options: Option<&FrameOptionsWgpu>, options: Option<&FrameOptionsWgpu>,
@ -402,7 +402,7 @@ impl FilterChainWgpu {
source.wrap_mode = pass.config.wrap_mode; source.wrap_mode = pass.config.wrap_mode;
source.mip_filter = pass.config.filter; source.mip_filter = pass.config.filter;
let output_image = OutputView::from(target); let output_image = WgpuOutputView::from(target);
let out = RenderTarget::identity(&output_image); let out = RenderTarget::identity(&output_image);
pass.draw( pass.draw(

View file

@ -1,7 +1,7 @@
use crate::buffer::WgpuStagedBuffer; use crate::buffer::WgpuStagedBuffer;
use crate::error; use crate::error;
use crate::filter_chain::FilterCommon; use crate::filter_chain::FilterCommon;
use crate::framebuffer::OutputView; use crate::framebuffer::WgpuOutputView;
use crate::graphics_pipeline::WgpuGraphicsPipeline; use crate::graphics_pipeline::WgpuGraphicsPipeline;
use crate::samplers::SamplerSet; use crate::samplers::SamplerSet;
use crate::texture::InputImage; use crate::texture::InputImage;
@ -90,10 +90,10 @@ impl FilterPass {
parent: &FilterCommon, parent: &FilterCommon,
frame_count: u32, frame_count: u32,
frame_direction: i32, frame_direction: i32,
viewport: &Viewport<OutputView>, viewport: &Viewport<WgpuOutputView>,
original: &InputImage, original: &InputImage,
source: &InputImage, source: &InputImage,
output: &RenderTarget<OutputView>, output: &RenderTarget<WgpuOutputView>,
vbo_type: QuadType, vbo_type: QuadType,
) -> error::Result<()> { ) -> error::Result<()> {
let mut main_heap = FxHashMap::default(); let mut main_heap = FxHashMap::default();

View file

@ -4,13 +4,14 @@ use librashader_common::Size;
use wgpu::TextureViewDescriptor; use wgpu::TextureViewDescriptor;
/// A wgpu `TextureView` with size and texture information to output. /// A wgpu `TextureView` with size and texture information to output.
pub struct OutputView<'a> { pub struct WgpuOutputView<'a> {
pub(crate) size: Size<u32>, pub(crate) size: Size<u32>,
pub(crate) view: Handle<'a, wgpu::TextureView>, pub(crate) view: Handle<'a, wgpu::TextureView>,
pub(crate) format: wgpu::TextureFormat, 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( pub fn new_from_raw(
view: &'a wgpu::TextureView, view: &'a wgpu::TextureView,
size: Size<u32>, size: Size<u32>,
@ -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 { fn from(image: &'a OwnedImage) -> Self {
Self { Self {
size: image.size, 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 { fn from(image: &wgpu::Texture) -> Self {
Self { Self {
size: image.size().into(), size: image.size().into(),

View file

@ -1,4 +1,4 @@
use crate::framebuffer::OutputView; use crate::framebuffer::WgpuOutputView;
use crate::util; use crate::util;
use librashader_reflect::back::wgsl::NagaWgslContext; use librashader_reflect::back::wgsl::NagaWgslContext;
use librashader_reflect::back::ShaderCompilerOutput; use librashader_reflect::back::ShaderCompilerOutput;
@ -220,7 +220,7 @@ impl WgpuGraphicsPipeline {
pub(crate) fn begin_rendering<'pass>( pub(crate) fn begin_rendering<'pass>(
&'pass self, &'pass self,
output: &RenderTarget<'pass, OutputView>, output: &RenderTarget<'pass, WgpuOutputView>,
cmd: &'pass mut CommandEncoder, cmd: &'pass mut CommandEncoder,
) -> RenderPass<'pass> { ) -> RenderPass<'pass> {
let mut render_pass = cmd.begin_render_pass(&RenderPassDescriptor { let mut render_pass = cmd.begin_render_pass(&RenderPassDescriptor {

View file

@ -21,7 +21,7 @@ mod texture;
mod util; mod util;
pub use filter_chain::FilterChainWgpu; pub use filter_chain::FilterChainWgpu;
pub use framebuffer::OutputView; pub use framebuffer::WgpuOutputView;
pub mod error; pub mod error;

View file

@ -284,7 +284,7 @@ impl<'a> State<'a> {
x: 0.0, x: 0.0,
y: 0.0, y: 0.0,
mvp: None, mvp: None,
output: librashader_runtime_wgpu::OutputView::new_from_raw( output: librashader_runtime_wgpu::WgpuOutputView::new_from_raw(
&filter_view, &filter_view,
filter_output.size().into(), filter_output.size().into(),
filter_output.format(), filter_output.format(),

View file

@ -314,7 +314,7 @@ pub mod runtime {
options::{ options::{
FilterChainOptionsWgpu as FilterChainOptions, FrameOptionsWgpu as FrameOptions, FilterChainOptionsWgpu as FilterChainOptions, FrameOptionsWgpu as FrameOptions,
}, },
FilterChainWgpu as FilterChain, OutputView, FilterChainWgpu as FilterChain, WgpuOutputView,
}; };
} }
} }