rt(d3d12): draw final pass to output targets
This commit is contained in:
parent
1bf5d7efca
commit
894d19eb81
2 changed files with 49 additions and 6 deletions
|
@ -824,6 +824,53 @@ impl FilterChainD3D12 {
|
||||||
// try to hint the optimizer
|
// try to hint the optimizer
|
||||||
assert_eq!(last.len(), 1);
|
assert_eq!(last.len(), 1);
|
||||||
if let Some(pass) = last.iter_mut().next() {
|
if let Some(pass) = last.iter_mut().next() {
|
||||||
|
let index = passes_len - 1;
|
||||||
|
|
||||||
|
source.filter = pass.config.filter;
|
||||||
|
source.wrap_mode = pass.config.wrap_mode;
|
||||||
|
|
||||||
|
let feedback_target = &self.output_framebuffers[index];
|
||||||
|
|
||||||
|
if pass.pipeline.format != feedback_target.format {
|
||||||
|
// eprintln!("recompiling final pipeline");
|
||||||
|
pass.pipeline.recompile(
|
||||||
|
feedback_target.format,
|
||||||
|
&self.common.root_signature,
|
||||||
|
&self.common.d3d12,
|
||||||
|
)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.residuals
|
||||||
|
.dispose_barriers(util::d3d12_resource_transition(
|
||||||
|
cmd,
|
||||||
|
&feedback_target.handle.resource(),
|
||||||
|
D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE,
|
||||||
|
D3D12_RESOURCE_STATE_RENDER_TARGET,
|
||||||
|
));
|
||||||
|
|
||||||
|
let view = feedback_target.create_render_target_view(&mut self.rtv_heap)?;
|
||||||
|
let out = RenderTarget::viewport_with_output(&view, viewport);
|
||||||
|
pass.draw(
|
||||||
|
cmd,
|
||||||
|
index,
|
||||||
|
&self.common,
|
||||||
|
pass.config.get_frame_count(frame_count),
|
||||||
|
options,
|
||||||
|
viewport,
|
||||||
|
&original,
|
||||||
|
&source,
|
||||||
|
&out,
|
||||||
|
QuadType::Final,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
self.residuals
|
||||||
|
.dispose_barriers(util::d3d12_resource_transition(
|
||||||
|
cmd,
|
||||||
|
&feedback_target.handle.resource(),
|
||||||
|
D3D12_RESOURCE_STATE_RENDER_TARGET,
|
||||||
|
D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE,
|
||||||
|
));
|
||||||
|
|
||||||
if pass.pipeline.format != viewport.output.format {
|
if pass.pipeline.format != viewport.output.format {
|
||||||
// eprintln!("recompiling final pipeline");
|
// eprintln!("recompiling final pipeline");
|
||||||
pass.pipeline.recompile(
|
pass.pipeline.recompile(
|
||||||
|
@ -833,11 +880,7 @@ impl FilterChainD3D12 {
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
source.filter = pass.config.filter;
|
|
||||||
source.wrap_mode = pass.config.wrap_mode;
|
|
||||||
|
|
||||||
let out = RenderTarget::viewport(viewport);
|
let out = RenderTarget::viewport(viewport);
|
||||||
|
|
||||||
pass.draw(
|
pass.draw(
|
||||||
cmd,
|
cmd,
|
||||||
passes_len - 1,
|
passes_len - 1,
|
||||||
|
|
|
@ -5,12 +5,12 @@ use crate::hello_triangle::{DXSample, SampleCommandLine};
|
||||||
#[test]
|
#[test]
|
||||||
fn triangle_d3d12() {
|
fn triangle_d3d12() {
|
||||||
let sample = hello_triangle::d3d12_hello_triangle::Sample::new(
|
let sample = hello_triangle::d3d12_hello_triangle::Sample::new(
|
||||||
"../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
|
// "../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
|
||||||
// "../test/shaders_slang/crt/crt-lottes.slangp",
|
// "../test/shaders_slang/crt/crt-lottes.slangp",
|
||||||
// "../test/basic.slangp",
|
// "../test/basic.slangp",
|
||||||
// "../test/shaders_slang/handheld/console-border/gbc-lcd-grid-v2.slangp",
|
// "../test/shaders_slang/handheld/console-border/gbc-lcd-grid-v2.slangp",
|
||||||
// "../test/Mega_Bezel_Packs/Duimon-Mega-Bezel/Presets/Advanced/Nintendo_GBA_SP/GBA_SP-[ADV]-[LCD-GRID]-[Night].slangp",
|
// "../test/Mega_Bezel_Packs/Duimon-Mega-Bezel/Presets/Advanced/Nintendo_GBA_SP/GBA_SP-[ADV]-[LCD-GRID]-[Night].slangp",
|
||||||
// "../test/shaders_slang/test/feedback.slangp",
|
"../test/shaders_slang/test/feedback.slangp",
|
||||||
// "../test/shaders_slang/test/history.slangp",
|
// "../test/shaders_slang/test/history.slangp",
|
||||||
// "../test/shaders_slang/crt/crt-royale.slangp",
|
// "../test/shaders_slang/crt/crt-royale.slangp",
|
||||||
// "../test/slang-shaders/vhs/VHSPro.slangp",
|
// "../test/slang-shaders/vhs/VHSPro.slangp",
|
||||||
|
|
Loading…
Add table
Reference in a new issue