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 depth bounds

This commit is contained in:
ReinUsesLisp 2020-02-21 00:54:39 -03:00
parent cd0e28c9ec
commit f9df2c6bcd
3 changed files with 14 additions and 0 deletions

View file

@ -1037,6 +1037,9 @@ void RasterizerVulkan::UpdateBlendConstants(Tegra::Engines::Maxwell3D& gpu) {
} }
void RasterizerVulkan::UpdateDepthBounds(Tegra::Engines::Maxwell3D& gpu) { void RasterizerVulkan::UpdateDepthBounds(Tegra::Engines::Maxwell3D& gpu) {
if (!state_tracker.TouchDepthBounds()) {
return;
}
const auto& regs = gpu.regs; const auto& regs = gpu.regs;
scheduler.Record([min = regs.depth_bounds[0], max = regs.depth_bounds[1]]( scheduler.Record([min = regs.depth_bounds[0], max = regs.depth_bounds[1]](
auto cmdbuf, auto& dld) { cmdbuf.setDepthBounds(min, max, dld); }); auto cmdbuf, auto& dld) { cmdbuf.setDepthBounds(min, max, dld); });

View file

@ -32,6 +32,7 @@ Flags MakeInvalidationFlags() {
flags[Scissors] = true; flags[Scissors] = true;
flags[DepthBias] = true; flags[DepthBias] = true;
flags[BlendConstants] = true; flags[BlendConstants] = true;
flags[DepthBounds] = true;
return flags; return flags;
} }
@ -89,6 +90,10 @@ void SetupDirtyBlendConstants(Tables& tables) {
FillBlock(tables[0], OFF(blend_color), NUM(blend_color), BlendConstants); FillBlock(tables[0], OFF(blend_color), NUM(blend_color), BlendConstants);
} }
void SetupDirtyDepthBounds(Tables& tables) {
FillBlock(tables[0], OFF(depth_bounds), NUM(depth_bounds), DepthBounds);
}
} // Anonymous namespace } // Anonymous namespace
StateTracker::StateTracker(Core::System& system) StateTracker::StateTracker(Core::System& system)
@ -102,6 +107,7 @@ void StateTracker::Initialize() {
SetupDirtyScissors(tables); SetupDirtyScissors(tables);
SetupDirtyDepthBias(tables); SetupDirtyDepthBias(tables);
SetupDirtyBlendConstants(tables); SetupDirtyBlendConstants(tables);
SetupDirtyDepthBounds(tables);
auto& store = dirty.on_write_stores; auto& store = dirty.on_write_stores;
store[RenderTargets] = true; store[RenderTargets] = true;

View file

@ -23,6 +23,7 @@ enum : u8 {
Scissors, Scissors,
DepthBias, DepthBias,
BlendConstants, BlendConstants,
DepthBounds,
}; };
} // namespace Dirty } // namespace Dirty
@ -51,6 +52,10 @@ public:
return Exchange(Dirty::BlendConstants, false); return Exchange(Dirty::BlendConstants, false);
} }
bool TouchDepthBounds() {
return Exchange(Dirty::DepthBounds, 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)>;