2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

vk_state_tracker: Implement dirty flags for scissors

This commit is contained in:
ReinUsesLisp 2020-02-20 22:19:57 -03:00
parent 1bd95a314f
commit 42f1874965
3 changed files with 14 additions and 0 deletions

View file

@ -998,6 +998,9 @@ void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D& gpu) {
} }
void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D& gpu) { void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D& gpu) {
if (!state_tracker.TouchScissors()) {
return;
}
const auto& regs = gpu.regs; const auto& regs = gpu.regs;
const std::array scissors = { const std::array scissors = {
GetScissorState(regs, 0), GetScissorState(regs, 1), GetScissorState(regs, 2), GetScissorState(regs, 0), GetScissorState(regs, 1), GetScissorState(regs, 2),

View file

@ -29,6 +29,7 @@ using Flags = std::remove_reference_t<decltype(Maxwell3D::dirty.flags)>;
Flags MakeInvalidationFlags() { Flags MakeInvalidationFlags() {
Flags flags{}; Flags flags{};
flags[Viewports] = true; flags[Viewports] = true;
flags[Scissors] = true;
return flags; return flags;
} }
@ -71,6 +72,10 @@ void SetupDirtyViewports(Tables& tables) {
tables[0][OFF(viewport_transform_enabled)] = Viewports; tables[0][OFF(viewport_transform_enabled)] = Viewports;
} }
void SetupDirtyScissors(Tables& tables) {
FillBlock(tables[0], OFF(scissor_test), NUM(scissor_test), Scissors);
}
} // Anonymous namespace } // Anonymous namespace
StateTracker::StateTracker(Core::System& system) StateTracker::StateTracker(Core::System& system)
@ -81,6 +86,7 @@ void StateTracker::Initialize() {
auto& tables = dirty.tables; auto& tables = dirty.tables;
SetupDirtyRenderTargets(tables); SetupDirtyRenderTargets(tables);
SetupDirtyViewports(tables); SetupDirtyViewports(tables);
SetupDirtyScissors(tables);
auto& store = dirty.on_write_stores; auto& store = dirty.on_write_stores;
store[RenderTargets] = true; store[RenderTargets] = true;

View file

@ -20,6 +20,7 @@ enum : u8 {
First = VideoCommon::Dirty::LastCommonEntry, First = VideoCommon::Dirty::LastCommonEntry,
Viewports, Viewports,
Scissors,
}; };
} // namespace Dirty } // namespace Dirty
@ -36,6 +37,10 @@ public:
return Exchange(Dirty::Viewports, false); return Exchange(Dirty::Viewports, false);
} }
bool TouchScissors() {
return Exchange(Dirty::Scissors, false);
}
private: private:
using Flags = std::remove_reference_t<decltype(Tegra::Engines::Maxwell3D::dirty.flags)>; using Flags = std::remove_reference_t<decltype(Tegra::Engines::Maxwell3D::dirty.flags)>;