yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

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) {
if (!state_tracker.TouchBlendConstants()) {
return;
}
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};
scheduler.Record([blend_color](auto cmdbuf, auto& dld) {

View File

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

View File

@ -22,6 +22,7 @@ enum : u8 {
Viewports,
Scissors,
DepthBias,
BlendConstants,
};
} // namespace Dirty
@ -46,6 +47,10 @@ public:
return Exchange(Dirty::DepthBias, false);
}
bool TouchBlendConstants() {
return Exchange(Dirty::BlendConstants, false);
}
private:
using Flags = std::remove_reference_t<decltype(Tegra::Engines::Maxwell3D::dirty.flags)>;