diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2022-12-27 22:40:28 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2023-01-03 22:29:16 +0100 |
commit | b62ffb612dbd672371d163e3b511e81f0c2282e6 (patch) | |
tree | 4bf1cf1172e12db339f63ac750b3a5dbde561ef8 /src/video_core/renderer_vulkan/vk_state_tracker.h | |
parent | vulkan_common: blacklist radv from extended_dynamic_state2 on drivers before 22.3.1 (diff) | |
download | yuzu-b62ffb612dbd672371d163e3b511e81f0c2282e6.tar yuzu-b62ffb612dbd672371d163e3b511e81f0c2282e6.tar.gz yuzu-b62ffb612dbd672371d163e3b511e81f0c2282e6.tar.bz2 yuzu-b62ffb612dbd672371d163e3b511e81f0c2282e6.tar.lz yuzu-b62ffb612dbd672371d163e3b511e81f0c2282e6.tar.xz yuzu-b62ffb612dbd672371d163e3b511e81f0c2282e6.tar.zst yuzu-b62ffb612dbd672371d163e3b511e81f0c2282e6.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_state_tracker.h')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_state_tracker.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.h b/src/video_core/renderer_vulkan/vk_state_tracker.h index 7cdc70c60..8010ad26c 100644 --- a/src/video_core/renderer_vulkan/vk_state_tracker.h +++ b/src/video_core/renderer_vulkan/vk_state_tracker.h @@ -35,6 +35,9 @@ enum : u8 { BlendConstants, DepthBounds, StencilProperties, + StencilReference, + StencilWriteMask, + StencilCompare, LineWidth, CullMode, @@ -74,6 +77,7 @@ public: void InvalidateCommandBufferState() { (*flags) |= invalidation_flags; current_topology = INVALID_TOPOLOGY; + stencil_reset = true; } void InvalidateViewports() { @@ -113,6 +117,57 @@ public: return Exchange(Dirty::StencilProperties, false); } + bool TouchStencilReference() { + return Exchange(Dirty::StencilReference, false); + } + + bool TouchStencilWriteMask() { + return Exchange(Dirty::StencilWriteMask, false); + } + + bool TouchStencilCompare() { + return Exchange(Dirty::StencilCompare, false); + } + + template <typename T> + bool ExchangeCheck(T& old_value, T new_value) { + bool result = old_value != new_value; + old_value = new_value; + return result; + } + + bool TouchStencilSide(bool two_sided_stencil_new) { + return ExchangeCheck(two_sided_stencil, two_sided_stencil_new) || stencil_reset; + } + + bool CheckStencilReferenceFront(u32 new_value) { + return ExchangeCheck(front.ref, new_value) || stencil_reset; + } + + bool CheckStencilReferenceBack(u32 new_value) { + return ExchangeCheck(back.ref, new_value) || stencil_reset; + } + + bool CheckStencilWriteMaskFront(u32 new_value) { + return ExchangeCheck(front.write_mask, new_value) || stencil_reset; + } + + bool CheckStencilWriteMaskBack(u32 new_value) { + return ExchangeCheck(back.write_mask, new_value) || stencil_reset; + } + + bool CheckStencilCompareMaskFront(u32 new_value) { + return ExchangeCheck(front.compare_mask, new_value) || stencil_reset; + } + + bool CheckStencilCompareMaskBack(u32 new_value) { + return ExchangeCheck(back.compare_mask, new_value) || stencil_reset; + } + + void ClearStencilReset() { + stencil_reset = false; + } + bool TouchLineWidth() const { return Exchange(Dirty::LineWidth, false); } @@ -214,10 +269,20 @@ private: return is_dirty; } + struct StencilProperties { + u32 ref = 0; + u32 write_mask = 0; + u32 compare_mask = 0; + }; + Tegra::Engines::Maxwell3D::DirtyState::Flags* flags; Tegra::Engines::Maxwell3D::DirtyState::Flags default_flags; Tegra::Engines::Maxwell3D::DirtyState::Flags invalidation_flags; Maxwell::PrimitiveTopology current_topology = INVALID_TOPOLOGY; + bool two_sided_stencil = false; + StencilProperties front{}; + StencilProperties back{}; + bool stencil_reset = false; }; } // namespace Vulkan |