summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-02-21 04:28:45 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-02-28 21:56:43 +0100
commita33870996b00f18179048debf183f1cb5c499593 (patch)
tree3e8a09ed40a4713086b15117b3022965923a51fb /src
parentvk_state_tracker: Implement dirty flags for scissors (diff)
downloadyuzu-a33870996b00f18179048debf183f1cb5c499593.tar
yuzu-a33870996b00f18179048debf183f1cb5c499593.tar.gz
yuzu-a33870996b00f18179048debf183f1cb5c499593.tar.bz2
yuzu-a33870996b00f18179048debf183f1cb5c499593.tar.lz
yuzu-a33870996b00f18179048debf183f1cb5c499593.tar.xz
yuzu-a33870996b00f18179048debf183f1cb5c499593.tar.zst
yuzu-a33870996b00f18179048debf183f1cb5c499593.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp3
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.cpp9
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.h5
3 files changed, 17 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 207ef0f0d..be2c4d149 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -1015,6 +1015,9 @@ void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D& gpu) {
}
void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D& gpu) {
+ if (!state_tracker.TouchDepthBias()) {
+ return;
+ }
const auto& regs = gpu.regs;
scheduler.Record([constant = regs.polygon_offset_units, clamp = regs.polygon_offset_clamp,
factor = regs.polygon_offset_factor](auto cmdbuf, auto& dld) {
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.cpp b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
index 0e00a9079..c75caaa56 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.cpp
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
@@ -30,6 +30,7 @@ Flags MakeInvalidationFlags() {
Flags flags{};
flags[Viewports] = true;
flags[Scissors] = true;
+ flags[DepthBias] = true;
return flags;
}
@@ -76,6 +77,13 @@ void SetupDirtyScissors(Tables& tables) {
FillBlock(tables[0], OFF(scissor_test), NUM(scissor_test), Scissors);
}
+void SetupDirtyDepthBias(Tables& tables) {
+ auto& table = tables[0];
+ table[OFF(polygon_offset_units)] = DepthBias;
+ table[OFF(polygon_offset_clamp)] = DepthBias;
+ table[OFF(polygon_offset_factor)] = DepthBias;
+}
+
} // Anonymous namespace
StateTracker::StateTracker(Core::System& system)
@@ -87,6 +95,7 @@ void StateTracker::Initialize() {
SetupDirtyRenderTargets(tables);
SetupDirtyViewports(tables);
SetupDirtyScissors(tables);
+ SetupDirtyDepthBias(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 ba8f3a854..088b47145 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.h
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.h
@@ -21,6 +21,7 @@ enum : u8 {
Viewports,
Scissors,
+ DepthBias,
};
} // namespace Dirty
@@ -41,6 +42,10 @@ public:
return Exchange(Dirty::Scissors, false);
}
+ bool TouchDepthBias() {
+ return Exchange(Dirty::DepthBias, false);
+ }
+
private:
using Flags = std::remove_reference_t<decltype(Tegra::Engines::Maxwell3D::dirty.flags)>;