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) feedback_framebuffers: Box<[OwnedFramebuffer]>,
|
||||
pub(crate) history_framebuffers: VecDeque<OwnedFramebuffer>,
|
||||
pub(crate) draw_quad: DrawQuad,
|
||||
}
|
||||
|
||||
pub(crate) struct Direct3D11 {
|
||||
|
@ -64,6 +63,7 @@ pub(crate) struct FilterCommon {
|
|||
pub history_textures: Box<[Option<InputTexture>]>,
|
||||
pub config: FilterMutable,
|
||||
pub disable_mipmaps: bool,
|
||||
pub(crate) draw_quad: DrawQuad,
|
||||
}
|
||||
|
||||
impl FilterChainD3D11 {
|
||||
|
@ -163,7 +163,6 @@ impl FilterChainD3D11 {
|
|||
output_framebuffers: output_framebuffers.into_boxed_slice(),
|
||||
feedback_framebuffers: feedback_framebuffers.into_boxed_slice(),
|
||||
history_framebuffers,
|
||||
draw_quad,
|
||||
common: FilterCommon {
|
||||
d3d11: Direct3D11 {
|
||||
device: device.clone(),
|
||||
|
@ -185,6 +184,7 @@ impl FilterChainD3D11 {
|
|||
output_textures: output_textures.into_boxed_slice(),
|
||||
feedback_textures: feedback_textures.into_boxed_slice(),
|
||||
history_textures,
|
||||
draw_quad,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -433,8 +433,6 @@ impl FilterChainD3D11 {
|
|||
let filter = passes[0].config.filter;
|
||||
let wrap_mode = passes[0].config.wrap_mode;
|
||||
|
||||
self.draw_quad.bind_vertices();
|
||||
|
||||
for ((texture, fbo), pass) in self
|
||||
.common
|
||||
.feedback_textures
|
||||
|
@ -491,7 +489,6 @@ impl FilterChainD3D11 {
|
|||
for (index, pass) in pass.iter_mut().enumerate() {
|
||||
let target = &self.output_framebuffers[index];
|
||||
let size = target.size;
|
||||
|
||||
pass.draw(
|
||||
index,
|
||||
&self.common,
|
||||
|
|
|
@ -157,6 +157,7 @@ impl FilterPass {
|
|||
}
|
||||
}
|
||||
unsafe {
|
||||
parent.draw_quad.bind_vertices();
|
||||
context.IASetInputLayout(&self.vertex_layout);
|
||||
context.VSSetShader(&self.vertex_shader, None);
|
||||
context.PSSetShader(&self.pixel_shader, None);
|
||||
|
|
|
@ -35,7 +35,7 @@ mod tests {
|
|||
fn triangle_gl() {
|
||||
let (glfw, window, events, shader, vao) = gl::gl3::hello_triangle::setup();
|
||||
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 {
|
||||
gl_version: 0,
|
||||
use_dsa: false,
|
||||
|
@ -52,7 +52,7 @@ mod tests {
|
|||
let (glfw, window, events, shader, vao) = gl::gl46::hello_triangle::setup();
|
||||
let mut filter = FilterChainGL::load_from_path(
|
||||
// "../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 {
|
||||
gl_version: 0,
|
||||
use_dsa: true,
|
||||
|
|
|
@ -39,7 +39,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
ID3D11DeviceContext* baseDeviceContext;
|
||||
|
||||
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,
|
||||
nullptr, &baseDeviceContext);
|
||||
|
||||
|
@ -64,8 +64,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
&preset);
|
||||
|
||||
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;
|
||||
|
||||
|
@ -392,7 +396,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
MSG msg;
|
||||
|
||||
while (PeekMessageA(&msg, nullptr, 0, 0, PM_REMOVE)) {
|
||||
//if (msg.message == WM_KEYDOWN) return 0;
|
||||
if (msg.message == WM_KEYDOWN) return 0;
|
||||
DispatchMessageA(&msg);
|
||||
}
|
||||
|
||||
|
@ -476,9 +480,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
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,
|
||||
framebufferRTV, NULL, NULL);
|
||||
framebufferRTV, NULL, &frame_opt);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
swapChain->Present(1, 0);
|
||||
|
|
Loading…
Reference in a new issue