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) {
if (!state_tracker.TouchScissors()) {
return;
}
const auto& regs = gpu.regs;
const std::array scissors = {
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 flags{};
flags[Viewports] = true;
flags[Scissors] = true;
return flags;
}
@ -71,6 +72,10 @@ void SetupDirtyViewports(Tables& tables) {
tables[0][OFF(viewport_transform_enabled)] = Viewports;
}
void SetupDirtyScissors(Tables& tables) {
FillBlock(tables[0], OFF(scissor_test), NUM(scissor_test), Scissors);
}
} // Anonymous namespace
StateTracker::StateTracker(Core::System& system)
@ -81,6 +86,7 @@ void StateTracker::Initialize() {
auto& tables = dirty.tables;
SetupDirtyRenderTargets(tables);
SetupDirtyViewports(tables);
SetupDirtyScissors(tables);
auto& store = dirty.on_write_stores;
store[RenderTargets] = true;

View file

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