mirror of https://git.suyu.dev/suyu/suyu
vk_state_tracker: Implement dirty flags for depth bias
This commit is contained in:
parent
42f1874965
commit
a33870996b
|
@ -1015,6 +1015,9 @@ void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D& gpu) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D& gpu) {
|
void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D& gpu) {
|
||||||
|
if (!state_tracker.TouchDepthBias()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const auto& regs = gpu.regs;
|
const auto& regs = gpu.regs;
|
||||||
scheduler.Record([constant = regs.polygon_offset_units, clamp = regs.polygon_offset_clamp,
|
scheduler.Record([constant = regs.polygon_offset_units, clamp = regs.polygon_offset_clamp,
|
||||||
factor = regs.polygon_offset_factor](auto cmdbuf, auto& dld) {
|
factor = regs.polygon_offset_factor](auto cmdbuf, auto& dld) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ Flags MakeInvalidationFlags() {
|
||||||
Flags flags{};
|
Flags flags{};
|
||||||
flags[Viewports] = true;
|
flags[Viewports] = true;
|
||||||
flags[Scissors] = true;
|
flags[Scissors] = true;
|
||||||
|
flags[DepthBias] = true;
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,6 +77,13 @@ void SetupDirtyScissors(Tables& tables) {
|
||||||
FillBlock(tables[0], OFF(scissor_test), NUM(scissor_test), Scissors);
|
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
|
} // Anonymous namespace
|
||||||
|
|
||||||
StateTracker::StateTracker(Core::System& system)
|
StateTracker::StateTracker(Core::System& system)
|
||||||
|
@ -87,6 +95,7 @@ void StateTracker::Initialize() {
|
||||||
SetupDirtyRenderTargets(tables);
|
SetupDirtyRenderTargets(tables);
|
||||||
SetupDirtyViewports(tables);
|
SetupDirtyViewports(tables);
|
||||||
SetupDirtyScissors(tables);
|
SetupDirtyScissors(tables);
|
||||||
|
SetupDirtyDepthBias(tables);
|
||||||
|
|
||||||
auto& store = dirty.on_write_stores;
|
auto& store = dirty.on_write_stores;
|
||||||
store[RenderTargets] = true;
|
store[RenderTargets] = true;
|
||||||
|
|
|
@ -21,6 +21,7 @@ enum : u8 {
|
||||||
|
|
||||||
Viewports,
|
Viewports,
|
||||||
Scissors,
|
Scissors,
|
||||||
|
DepthBias,
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Dirty
|
} // namespace Dirty
|
||||||
|
@ -41,6 +42,10 @@ public:
|
||||||
return Exchange(Dirty::Scissors, false);
|
return Exchange(Dirty::Scissors, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TouchDepthBias() {
|
||||||
|
return Exchange(Dirty::DepthBias, 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)>;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue