summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-02-21 04:54:39 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-02-28 21:56:43 +0100
commitf9df2c6bcdc1a6129289fb2878d4471c04e55fc7 (patch)
tree17f1f65badeabc5a8d7a84d7fb8dca9b85daf6f8
parentvk_state_tracker: Implement dirty flags for blend constants (diff)
downloadyuzu-f9df2c6bcdc1a6129289fb2878d4471c04e55fc7.tar
yuzu-f9df2c6bcdc1a6129289fb2878d4471c04e55fc7.tar.gz
yuzu-f9df2c6bcdc1a6129289fb2878d4471c04e55fc7.tar.bz2
yuzu-f9df2c6bcdc1a6129289fb2878d4471c04e55fc7.tar.lz
yuzu-f9df2c6bcdc1a6129289fb2878d4471c04e55fc7.tar.xz
yuzu-f9df2c6bcdc1a6129289fb2878d4471c04e55fc7.tar.zst
yuzu-f9df2c6bcdc1a6129289fb2878d4471c04e55fc7.zip
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp3
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.cpp6
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.h5
3 files changed, 14 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 958f90f99..7029b3d5e 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -1037,6 +1037,9 @@ void RasterizerVulkan::UpdateBlendConstants(Tegra::Engines::Maxwell3D& gpu) {
}
void RasterizerVulkan::UpdateDepthBounds(Tegra::Engines::Maxwell3D& gpu) {
+ if (!state_tracker.TouchDepthBounds()) {
+ return;
+ }
const auto& regs = gpu.regs;
scheduler.Record([min = regs.depth_bounds[0], max = regs.depth_bounds[1]](
auto cmdbuf, auto& dld) { cmdbuf.setDepthBounds(min, max, dld); });
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.cpp b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
index c7e54c68b..b55180dd8 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.cpp
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
@@ -32,6 +32,7 @@ Flags MakeInvalidationFlags() {
flags[Scissors] = true;
flags[DepthBias] = true;
flags[BlendConstants] = true;
+ flags[DepthBounds] = true;
return flags;
}
@@ -89,6 +90,10 @@ void SetupDirtyBlendConstants(Tables& tables) {
FillBlock(tables[0], OFF(blend_color), NUM(blend_color), BlendConstants);
}
+void SetupDirtyDepthBounds(Tables& tables) {
+ FillBlock(tables[0], OFF(depth_bounds), NUM(depth_bounds), DepthBounds);
+}
+
} // Anonymous namespace
StateTracker::StateTracker(Core::System& system)
@@ -102,6 +107,7 @@ void StateTracker::Initialize() {
SetupDirtyScissors(tables);
SetupDirtyDepthBias(tables);
SetupDirtyBlendConstants(tables);
+ SetupDirtyDepthBounds(tables);
auto& store = dirty.on_write_stores;
store[RenderTargets] = true;
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.h b/src/video_core/renderer_vulkan/vk_state_tracker.h
index a0493813a..25b5c647b 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.h
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.h
@@ -23,6 +23,7 @@ enum : u8 {
Scissors,
DepthBias,
BlendConstants,
+ DepthBounds,
};
} // namespace Dirty
@@ -51,6 +52,10 @@ public:
return Exchange(Dirty::BlendConstants, false);
}
+ bool TouchDepthBounds() {
+ return Exchange(Dirty::DepthBounds, false);
+ }
+
private:
using Flags = std::remove_reference_t<decltype(Tegra::Engines::Maxwell3D::dirty.flags)>;