d3d11: rebind vertices each pass
This commit is contained in:
parent
07944f9c29
commit
1e99c169db
|
@ -45,7 +45,6 @@ pub struct FilterChainD3D11 {
|
||||||
pub(crate) output_framebuffers: Box<[OwnedFramebuffer]>,
|
pub(crate) output_framebuffers: Box<[OwnedFramebuffer]>,
|
||||||
pub(crate) feedback_framebuffers: Box<[OwnedFramebuffer]>,
|
pub(crate) feedback_framebuffers: Box<[OwnedFramebuffer]>,
|
||||||
pub(crate) history_framebuffers: VecDeque<OwnedFramebuffer>,
|
pub(crate) history_framebuffers: VecDeque<OwnedFramebuffer>,
|
||||||
pub(crate) draw_quad: DrawQuad,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct Direct3D11 {
|
pub(crate) struct Direct3D11 {
|
||||||
|
@ -64,6 +63,7 @@ pub(crate) struct FilterCommon {
|
||||||
pub history_textures: Box<[Option<InputTexture>]>,
|
pub history_textures: Box<[Option<InputTexture>]>,
|
||||||
pub config: FilterMutable,
|
pub config: FilterMutable,
|
||||||
pub disable_mipmaps: bool,
|
pub disable_mipmaps: bool,
|
||||||
|
pub(crate) draw_quad: DrawQuad,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FilterChainD3D11 {
|
impl FilterChainD3D11 {
|
||||||
|
@ -163,7 +163,6 @@ impl FilterChainD3D11 {
|
||||||
output_framebuffers: output_framebuffers.into_boxed_slice(),
|
output_framebuffers: output_framebuffers.into_boxed_slice(),
|
||||||
feedback_framebuffers: feedback_framebuffers.into_boxed_slice(),
|
feedback_framebuffers: feedback_framebuffers.into_boxed_slice(),
|
||||||
history_framebuffers,
|
history_framebuffers,
|
||||||
draw_quad,
|
|
||||||
common: FilterCommon {
|
common: FilterCommon {
|
||||||
d3d11: Direct3D11 {
|
d3d11: Direct3D11 {
|
||||||
device: device.clone(),
|
device: device.clone(),
|
||||||
|
@ -185,6 +184,7 @@ impl FilterChainD3D11 {
|
||||||
output_textures: output_textures.into_boxed_slice(),
|
output_textures: output_textures.into_boxed_slice(),
|
||||||
feedback_textures: feedback_textures.into_boxed_slice(),
|
feedback_textures: feedback_textures.into_boxed_slice(),
|
||||||
history_textures,
|
history_textures,
|
||||||
|
draw_quad,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -433,8 +433,6 @@ impl FilterChainD3D11 {
|
||||||
let filter = passes[0].config.filter;
|
let filter = passes[0].config.filter;
|
||||||
let wrap_mode = passes[0].config.wrap_mode;
|
let wrap_mode = passes[0].config.wrap_mode;
|
||||||
|
|
||||||
self.draw_quad.bind_vertices();
|
|
||||||
|
|
||||||
for ((texture, fbo), pass) in self
|
for ((texture, fbo), pass) in self
|
||||||
.common
|
.common
|
||||||
.feedback_textures
|
.feedback_textures
|
||||||
|
@ -491,7 +489,6 @@ impl FilterChainD3D11 {
|
||||||
for (index, pass) in pass.iter_mut().enumerate() {
|
for (index, pass) in pass.iter_mut().enumerate() {
|
||||||
let target = &self.output_framebuffers[index];
|
let target = &self.output_framebuffers[index];
|
||||||
let size = target.size;
|
let size = target.size;
|
||||||
|
|
||||||
pass.draw(
|
pass.draw(
|
||||||
index,
|
index,
|
||||||
&self.common,
|
&self.common,
|
||||||
|
|
|
@ -157,6 +157,7 @@ impl FilterPass {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
|
parent.draw_quad.bind_vertices();
|
||||||
context.IASetInputLayout(&self.vertex_layout);
|
context.IASetInputLayout(&self.vertex_layout);
|
||||||
context.VSSetShader(&self.vertex_shader, None);
|
context.VSSetShader(&self.vertex_shader, None);
|
||||||
context.PSSetShader(&self.pixel_shader, None);
|
context.PSSetShader(&self.pixel_shader, None);
|
||||||
|
|
|
@ -35,7 +35,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/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
|
"../test/slang-shaders/crt/crt-lottes.slangp",
|
||||||
Some(&FilterChainOptionsGL {
|
Some(&FilterChainOptionsGL {
|
||||||
gl_version: 0,
|
gl_version: 0,
|
||||||
use_dsa: false,
|
use_dsa: false,
|
||||||
|
@ -52,7 +52,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/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
|
"../test/slang-shaders/crt/crt-lottes.slangp",
|
||||||
Some(&FilterChainOptionsGL {
|
Some(&FilterChainOptionsGL {
|
||||||
gl_version: 0,
|
gl_version: 0,
|
||||||
use_dsa: true,
|
use_dsa: true,
|
||||||
|
|
|
@ -39,7 +39,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
ID3D11DeviceContext* baseDeviceContext;
|
ID3D11DeviceContext* baseDeviceContext;
|
||||||
|
|
||||||
D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr,
|
D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr,
|
||||||
D3D11_CREATE_DEVICE_BGRA_SUPPORT, featureLevels,
|
D3D11_CREATE_DEVICE_BGRA_SUPPORT | D3D11_CREATE_DEVICE_DEBUG, featureLevels,
|
||||||
ARRAYSIZE(featureLevels), D3D11_SDK_VERSION, &baseDevice,
|
ARRAYSIZE(featureLevels), D3D11_SDK_VERSION, &baseDevice,
|
||||||
nullptr, &baseDeviceContext);
|
nullptr, &baseDeviceContext);
|
||||||
|
|
||||||
|
@ -64,8 +64,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
&preset);
|
&preset);
|
||||||
|
|
||||||
libra_d3d11_filter_chain_t filter_chain;
|
libra_d3d11_filter_chain_t filter_chain;
|
||||||
|
filter_chain_d3d11_opt_t opt = {
|
||||||
|
.use_deferred_context = true,
|
||||||
|
.force_no_mipmaps = false,
|
||||||
|
};
|
||||||
|
|
||||||
libra.d3d11_filter_chain_create(&preset, NULL, device, &filter_chain);
|
libra.d3d11_filter_chain_create(&preset, &opt, device, &filter_chain);
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
IDXGIDevice1* dxgiDevice;
|
IDXGIDevice1* dxgiDevice;
|
||||||
|
|
||||||
|
@ -392,7 +396,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
|
||||||
while (PeekMessageA(&msg, nullptr, 0, 0, PM_REMOVE)) {
|
while (PeekMessageA(&msg, nullptr, 0, 0, PM_REMOVE)) {
|
||||||
//if (msg.message == WM_KEYDOWN) return 0;
|
if (msg.message == WM_KEYDOWN) return 0;
|
||||||
DispatchMessageA(&msg);
|
DispatchMessageA(&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,9 +480,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
framebufferVP.Width};
|
framebufferVP.Width};
|
||||||
|
|
||||||
libra_viewport_t vp = {0, 0, framebufferVP.Height, framebufferVP.Width};
|
libra_viewport_t vp = {0, 0, framebufferVP.Height, framebufferVP.Width};
|
||||||
|
frame_d3d11_opt_t frame_opt = {.clear_history = false,
|
||||||
|
.frame_direction = -1};
|
||||||
|
|
||||||
libra.d3d11_filter_chain_frame(&filter_chain, frameCount, input, vp,
|
libra.d3d11_filter_chain_frame(&filter_chain, frameCount, input, vp,
|
||||||
framebufferRTV, NULL, NULL);
|
framebufferRTV, NULL, &frame_opt);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
swapChain->Present(1, 0);
|
swapChain->Present(1, 0);
|
||||||
|
|
Loading…
Reference in a new issue