vk_state_tracker: Implement dirty flags for blend constants

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

View file

@ -1026,6 +1026,9 @@ void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D& gpu) {
} }
void RasterizerVulkan::UpdateBlendConstants(Tegra::Engines::Maxwell3D& gpu) { void RasterizerVulkan::UpdateBlendConstants(Tegra::Engines::Maxwell3D& gpu) {
if (!state_tracker.TouchBlendConstants()) {
return;
}
const std::array blend_color = {gpu.regs.blend_color.r, gpu.regs.blend_color.g, const std::array blend_color = {gpu.regs.blend_color.r, gpu.regs.blend_color.g,
gpu.regs.blend_color.b, gpu.regs.blend_color.a}; gpu.regs.blend_color.b, gpu.regs.blend_color.a};
scheduler.Record([blend_color](auto cmdbuf, auto& dld) { scheduler.Record([blend_color](auto cmdbuf, auto& dld) {

View file

@ -31,6 +31,7 @@ Flags MakeInvalidationFlags() {
flags[Viewports] = true; flags[Viewports] = true;
flags[Scissors] = true; flags[Scissors] = true;
flags[DepthBias] = true; flags[DepthBias] = true;
flags[BlendConstants] = true;
return flags; return flags;
} }
@ -84,6 +85,10 @@ void SetupDirtyDepthBias(Tables& tables) {
table[OFF(polygon_offset_factor)] = DepthBias; table[OFF(polygon_offset_factor)] = DepthBias;
} }
void SetupDirtyBlendConstants(Tables& tables) {
FillBlock(tables[0], OFF(blend_color), NUM(blend_color), BlendConstants);
}
} // Anonymous namespace } // Anonymous namespace
StateTracker::StateTracker(Core::System& system) StateTracker::StateTracker(Core::System& system)
@ -96,6 +101,7 @@ void StateTracker::Initialize() {
SetupDirtyViewports(tables); SetupDirtyViewports(tables);
SetupDirtyScissors(tables); SetupDirtyScissors(tables);
SetupDirtyDepthBias(tables); SetupDirtyDepthBias(tables);
SetupDirtyBlendConstants(tables);
auto& store = dirty.on_write_stores; auto& store = dirty.on_write_stores;
store[RenderTargets] = true; store[RenderTargets] = true;

View file

@ -22,6 +22,7 @@ enum : u8 {
Viewports, Viewports,
Scissors, Scissors,
DepthBias, DepthBias,
BlendConstants,
}; };
} // namespace Dirty } // namespace Dirty
@ -46,6 +47,10 @@ public:
return Exchange(Dirty::DepthBias, false); return Exchange(Dirty::DepthBias, false);
} }
bool TouchBlendConstants() {
return Exchange(Dirty::BlendConstants, 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)>;