vk: try to fix feedback (but its not working..)
This commit is contained in:
parent
d435b43a52
commit
5acf70e362
|
@ -13,8 +13,8 @@ use crate::gl::gl3::CompatibilityGL;
|
||||||
use crate::gl::{FramebufferInterface, GLInterface};
|
use crate::gl::{FramebufferInterface, GLInterface};
|
||||||
use crate::viewport::Viewport;
|
use crate::viewport::Viewport;
|
||||||
|
|
||||||
const WIDTH: u32 = 1920;
|
const WIDTH: u32 = 800;
|
||||||
const HEIGHT: u32 = 1080;
|
const HEIGHT: u32 = 600;
|
||||||
const TITLE: &str = "librashader OpenGL";
|
const TITLE: &str = "librashader OpenGL";
|
||||||
|
|
||||||
pub fn compile_program(vertex: &str, fragment: &str) -> GLuint {
|
pub fn compile_program(vertex: &str, fragment: &str) -> GLuint {
|
||||||
|
|
|
@ -13,8 +13,8 @@ use crate::gl::gl46::DirectStateAccessGL;
|
||||||
use crate::gl::{FramebufferInterface, GLInterface};
|
use crate::gl::{FramebufferInterface, GLInterface};
|
||||||
use crate::viewport::Viewport;
|
use crate::viewport::Viewport;
|
||||||
|
|
||||||
const WIDTH: u32 = 1920;
|
const WIDTH: u32 = 800;
|
||||||
const HEIGHT: u32 = 1080;
|
const HEIGHT: u32 = 600;
|
||||||
const TITLE: &str = "librashader OpenGL 4.6";
|
const TITLE: &str = "librashader OpenGL 4.6";
|
||||||
|
|
||||||
pub fn compile_program(vertex: &str, fragment: &str) -> GLuint {
|
pub fn compile_program(vertex: &str, fragment: &str) -> GLuint {
|
||||||
|
|
|
@ -32,7 +32,7 @@ mod tests {
|
||||||
fn triangle_gl() {
|
fn triangle_gl() {
|
||||||
let (glfw, window, events, shader, vao) = gl::gl3::hello_triangle::setup();
|
let (glfw, window, events, shader, vao) = gl::gl3::hello_triangle::setup();
|
||||||
let mut filter = FilterChainGL::load_from_path(
|
let mut filter = FilterChainGL::load_from_path(
|
||||||
"../test/slang-shaders/border/gameboy-player/gameboy-player-crt-royale.slangp",
|
"../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
|
||||||
Some(&FilterChainOptionsGL {
|
Some(&FilterChainOptionsGL {
|
||||||
gl_version: 0,
|
gl_version: 0,
|
||||||
use_dsa: false,
|
use_dsa: false,
|
||||||
|
@ -49,7 +49,7 @@ mod tests {
|
||||||
let (glfw, window, events, shader, vao) = gl::gl46::hello_triangle::setup();
|
let (glfw, window, events, shader, vao) = gl::gl46::hello_triangle::setup();
|
||||||
let mut filter = FilterChainGL::load_from_path(
|
let mut filter = FilterChainGL::load_from_path(
|
||||||
// "../test/slang-shaders/vhs/VHSPro.slangp",
|
// "../test/slang-shaders/vhs/VHSPro.slangp",
|
||||||
"../test/slang-shaders/border/gameboy-player/gameboy-player-crt-royale.slangp",
|
"../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
|
||||||
Some(&FilterChainOptionsGL {
|
Some(&FilterChainOptionsGL {
|
||||||
gl_version: 0,
|
gl_version: 0,
|
||||||
use_dsa: true,
|
use_dsa: true,
|
||||||
|
|
|
@ -3,7 +3,7 @@ use crate::{error, util};
|
||||||
use crate::filter_pass::FilterPass;
|
use crate::filter_pass::FilterPass;
|
||||||
use crate::luts::LutTexture;
|
use crate::luts::LutTexture;
|
||||||
use crate::samplers::SamplerSet;
|
use crate::samplers::SamplerSet;
|
||||||
use crate::texture::{OwnedImage, InputImage, VulkanImage};
|
use crate::texture::{OwnedImage, InputImage, VulkanImage, OwnedImageLayout};
|
||||||
use crate::ubo_ring::VkUboRing;
|
use crate::ubo_ring::VkUboRing;
|
||||||
use crate::vulkan_state::VulkanGraphicsPipeline;
|
use crate::vulkan_state::VulkanGraphicsPipeline;
|
||||||
use ash::vk::{CommandPoolCreateFlags, PFN_vkGetInstanceProcAddr, Queue, StaticFn};
|
use ash::vk::{CommandPoolCreateFlags, PFN_vkGetInstanceProcAddr, Queue, StaticFn};
|
||||||
|
@ -631,7 +631,8 @@ impl FilterChainVulkan {
|
||||||
&original,
|
&original,
|
||||||
&source,
|
&source,
|
||||||
// todo: need to check **next**
|
// todo: need to check **next**
|
||||||
pass.config.mipmap_input
|
pass.config.mipmap_input,
|
||||||
|
None,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
self.feedback_framebuffers[index].scale(
|
self.feedback_framebuffers[index].scale(
|
||||||
|
@ -641,10 +642,15 @@ impl FilterChainVulkan {
|
||||||
&original,
|
&original,
|
||||||
&source,
|
&source,
|
||||||
// todo: need to check **next**
|
// todo: need to check **next**
|
||||||
pass.config.mipmap_input
|
pass.config.mipmap_input,
|
||||||
|
None
|
||||||
)?;
|
)?;
|
||||||
}
|
|
||||||
|
|
||||||
|
if self.common.feedback_textures[index].is_none() {
|
||||||
|
self.common.feedback_textures[index] =
|
||||||
|
Some(source.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let passes_len = passes.len();
|
let passes_len = passes.len();
|
||||||
let (pass, last) = passes.split_at_mut(passes_len - 1);
|
let (pass, last) = passes.split_at_mut(passes_len - 1);
|
||||||
|
@ -673,7 +679,7 @@ impl FilterChainVulkan {
|
||||||
|
|
||||||
source = target.as_input(pass.config.filter, pass.config.wrap_mode)?;
|
source = target.as_input(pass.config.filter, pass.config.wrap_mode)?;
|
||||||
|
|
||||||
self.common.output_textures[index] = Some(source.clone());
|
let feedback = self.common.output_textures[index].replace(source.clone());
|
||||||
intermediates.dispose_outputs(out.output);
|
intermediates.dispose_outputs(out.output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,10 +702,6 @@ impl FilterChainVulkan {
|
||||||
count as u32,
|
count as u32,
|
||||||
0, viewport, &original, &source, &out)?;
|
0, viewport, &original, &source, &out)?;
|
||||||
|
|
||||||
std::mem::swap(
|
|
||||||
&mut self.output_framebuffers,
|
|
||||||
&mut self.feedback_framebuffers,
|
|
||||||
);
|
|
||||||
intermediates.dispose_outputs(out.output);
|
intermediates.dispose_outputs(out.output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ impl FilterPass {
|
||||||
}
|
}
|
||||||
|
|
||||||
// PassOutput
|
// PassOutput
|
||||||
for (index, output) in parent.output_textures[0..pass_index].iter().enumerate() {
|
for (index, output) in parent.output_textures.iter().enumerate() {
|
||||||
let Some(output) = output else {
|
let Some(output) = output else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,6 +18,14 @@ pub struct OwnedImage {
|
||||||
pub levels: u32,
|
pub levels: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct OwnedImageLayout {
|
||||||
|
pub(crate) dst_layout: vk::ImageLayout,
|
||||||
|
pub(crate) dst_access: vk::AccessFlags,
|
||||||
|
pub(crate) src_stage: vk::PipelineStageFlags,
|
||||||
|
pub(crate) dst_stage: vk::PipelineStageFlags,
|
||||||
|
pub(crate) cmd: vk::CommandBuffer
|
||||||
|
}
|
||||||
|
|
||||||
impl OwnedImage {
|
impl OwnedImage {
|
||||||
fn new_internal(
|
fn new_internal(
|
||||||
device: ash::Device,
|
device: ash::Device,
|
||||||
|
@ -122,6 +130,7 @@ impl OwnedImage {
|
||||||
_original: &InputImage,
|
_original: &InputImage,
|
||||||
source: &InputImage,
|
source: &InputImage,
|
||||||
mipmap: bool,
|
mipmap: bool,
|
||||||
|
layout: Option<OwnedImageLayout>
|
||||||
) -> error::Result<Size<u32>> {
|
) -> error::Result<Size<u32>> {
|
||||||
let size = source.image.size.scale_viewport(scaling, *viewport_size);
|
let size = source.image.size.scale_viewport(scaling, *viewport_size);
|
||||||
if self.image.size != size || (mipmap && self.max_miplevels == 1) || (!mipmap && self.max_miplevels != 1) {
|
if self.image.size != size || (mipmap && self.max_miplevels == 1) || (!mipmap && self.max_miplevels != 1) {
|
||||||
|
@ -138,7 +147,20 @@ impl OwnedImage {
|
||||||
}, max_levels)?;
|
}, max_levels)?;
|
||||||
|
|
||||||
let old = std::mem::replace(self, new);
|
let old = std::mem::replace(self, new);
|
||||||
drop(old)
|
drop(old);
|
||||||
|
|
||||||
|
if let Some(layout) = layout {
|
||||||
|
unsafe {
|
||||||
|
util::vulkan_image_layout_transition_levels(&self.device, layout.cmd,
|
||||||
|
self.image.image,
|
||||||
|
self.levels,
|
||||||
|
vk::ImageLayout::UNDEFINED,
|
||||||
|
layout.dst_layout, vk::AccessFlags::empty(),
|
||||||
|
layout.dst_access, layout.src_stage, layout.dst_stage, vk::QUEUE_FAMILY_IGNORED,
|
||||||
|
vk::QUEUE_FAMILY_IGNORED)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(size)
|
Ok(size)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue