summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-02-21 05:09:02 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-02-28 21:56:43 +0100
commit6ac3eb4d87af7793d805dc9f7fc43f45e59e212e (patch)
treece8f97c30593e199a9150b464fc82ac0200d2989 /src/video_core/renderer_vulkan
parentvk_state_tracker: Implement dirty flags for depth bounds (diff)
downloadyuzu-6ac3eb4d87af7793d805dc9f7fc43f45e59e212e.tar
yuzu-6ac3eb4d87af7793d805dc9f7fc43f45e59e212e.tar.gz
yuzu-6ac3eb4d87af7793d805dc9f7fc43f45e59e212e.tar.bz2
yuzu-6ac3eb4d87af7793d805dc9f7fc43f45e59e212e.tar.lz
yuzu-6ac3eb4d87af7793d805dc9f7fc43f45e59e212e.tar.xz
yuzu-6ac3eb4d87af7793d805dc9f7fc43f45e59e212e.tar.zst
yuzu-6ac3eb4d87af7793d805dc9f7fc43f45e59e212e.zip
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp3
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.cpp13
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.h5
3 files changed, 21 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index 7029b3d5e..eb9c49d5e 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -1046,6 +1046,9 @@ void RasterizerVulkan::UpdateDepthBounds(Tegra::Engines::Maxwell3D& gpu) {
}
void RasterizerVulkan::UpdateStencilFaces(Tegra::Engines::Maxwell3D& gpu) {
+ if (!state_tracker.TouchStencilProperties()) {
+ return;
+ }
const auto& regs = gpu.regs;
if (regs.stencil_two_side_enable) {
// Separate values per face
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.cpp b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
index b55180dd8..3fd0476b6 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.cpp
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
@@ -33,6 +33,7 @@ Flags MakeInvalidationFlags() {
flags[DepthBias] = true;
flags[BlendConstants] = true;
flags[DepthBounds] = true;
+ flags[StencilProperties] = true;
return flags;
}
@@ -94,6 +95,17 @@ void SetupDirtyDepthBounds(Tables& tables) {
FillBlock(tables[0], OFF(depth_bounds), NUM(depth_bounds), DepthBounds);
}
+void SetupDirtyStencilProperties(Tables& tables) {
+ auto& table = tables[0];
+ table[OFF(stencil_two_side_enable)] = StencilProperties;
+ table[OFF(stencil_front_func_ref)] = StencilProperties;
+ table[OFF(stencil_front_mask)] = StencilProperties;
+ table[OFF(stencil_front_func_mask)] = StencilProperties;
+ table[OFF(stencil_back_func_ref)] = StencilProperties;
+ table[OFF(stencil_back_mask)] = StencilProperties;
+ table[OFF(stencil_back_func_mask)] = StencilProperties;
+}
+
} // Anonymous namespace
StateTracker::StateTracker(Core::System& system)
@@ -108,6 +120,7 @@ void StateTracker::Initialize() {
SetupDirtyDepthBias(tables);
SetupDirtyBlendConstants(tables);
SetupDirtyDepthBounds(tables);
+ SetupDirtyStencilProperties(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 25b5c647b..1d8434dd0 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.h
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.h
@@ -24,6 +24,7 @@ enum : u8 {
DepthBias,
BlendConstants,
DepthBounds,
+ StencilProperties,
};
} // namespace Dirty
@@ -56,6 +57,10 @@ public:
return Exchange(Dirty::DepthBounds, false);
}
+ bool TouchStencilProperties() {
+ return Exchange(Dirty::StencilProperties, false);
+ }
+
private:
using Flags = std::remove_reference_t<decltype(Tegra::Engines::Maxwell3D::dirty.flags)>;