aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/engines
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/engines')
-rw-r--r--src/video_core/engines/kepler_compute.cpp18
-rw-r--r--src/video_core/engines/kepler_compute.h7
2 files changed, 18 insertions, 7 deletions
diff --git a/src/video_core/engines/kepler_compute.cpp b/src/video_core/engines/kepler_compute.cpp
index 925b1b2ca1..be6a1d5eac 100644
--- a/src/video_core/engines/kepler_compute.cpp
+++ b/src/video_core/engines/kepler_compute.cpp
@@ -591,8 +591,9 @@ void KeplerCompute::DescribeNativeResources(const NativeQmdScheduler::Descriptor
std::atomic<u32> g_nx2_trace_draws_after_upscale{};
// Fire Emblem: Fortune's Weave's first DLSS pass (rejected, before the network) has the input colour
-// at cbuf0+0x278, its motion vectors (R16G16 float, the input's size) at +0x290 and this frame's
-// camera jitter (x, y; input pixels, Halton bases 2 and 3 less 0.5) at +0x1b0.
+// at cbuf0+0x278, its motion vectors (R16G16 float, the input's size) at +0x290, its depth (Z32, the
+// input's size) at +0x298 and this frame's camera jitter (x, y; input pixels, Halton bases 2 and 3
+// less 0.5) at +0x1b0.
void KeplerCompute::RememberDlssMotionVectors() {
const auto& cbuf = launch_description.const_buffer_config[0];
if (cbuf.size.Value() < 0x294) return;
@@ -610,6 +611,14 @@ void KeplerCompute::RememberDlssMotionVectors() {
return;
dlss_motion_vectors = *motion;
dlss_motion_color = color->Address();
+ const auto depth = cbuf.size.Value() >= 0x29c ? image(0x298) : std::nullopt;
+ if (depth && depth->format == Texture::TextureFormat::Z32 && depth->Address() != 0 &&
+ depth->Width() == color->Width() && depth->Height() == color->Height() &&
+ depth->IsBlockLinear()) {
+ dlss_depth = *depth;
+ } else {
+ dlss_depth.reset();
+ }
dlss_jitter = {std::bit_cast<f32>(memory_manager.Read<u32>(cbuf_address + 0x1b0)),
std::bit_cast<f32>(memory_manager.Read<u32>(cbuf_address + 0x1b4))};
}
@@ -794,8 +803,9 @@ bool KeplerCompute::UpscaleInsteadOfNativeProgram() {
return false;
Fermi2D::Surface motion = surface(*dlss_motion_vectors);
motion.format = RTFormat::R16G16_FLOAT;
- return rasterizer->AccelerateTemporalUpscale(source, surface(*output), motion, dlss_jitter,
- {1.0f, 1.0f});
+ return rasterizer->AccelerateTemporalUpscale(source, surface(*output), motion,
+ dlss_depth ? &*dlss_depth : nullptr,
+ dlss_jitter, {1.0f, 1.0f});
};
const bool done = upscale_temporally() ||
rasterizer->AccelerateSurfaceCopy(source, surface(*output), config);
diff --git a/src/video_core/engines/kepler_compute.h b/src/video_core/engines/kepler_compute.h
index b5aee3706a..6a06390294 100644
--- a/src/video_core/engines/kepler_compute.h
+++ b/src/video_core/engines/kepler_compute.h
@@ -269,10 +269,11 @@ private:
void RememberDlssMotionVectors();
bool UpscaleInsteadOfNativeProgram();
- /// Motion vectors of Fire Emblem: Fortune's Weave's DLSS evaluation, from its first pass (run
- /// earlier in the frame than the network pass the stand-in replaces), with the input colour
- /// image and camera jitter they go with.
+ /// Motion vectors and depth of Fire Emblem: Fortune's Weave's DLSS evaluation, from its first
+ /// pass (run earlier in the frame than the network pass the stand-in replaces), with the input
+ /// colour image and camera jitter they go with.
std::optional<Texture::TICEntry> dlss_motion_vectors;
+ std::optional<Texture::TICEntry> dlss_depth;
GPUVAddr dlss_motion_color{};
std::array<f32, 2> dlss_jitter{};
bool ProcessNativeMethod(Core::System& system, u32 method, u32 argument, bool is_last_call);