mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-15 06:17:00 +02:00
[revert] The next step of the human kind before it's doom
This commit is contained in:
parent
361ff7777d
commit
2005fc5bb0
1 changed files with 25 additions and 71 deletions
|
|
@ -1230,76 +1230,24 @@ void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D::Regs& regs) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerVulkan::UpdateBlendConstants(Tegra::Engines::Maxwell3D::Regs& regs) {
|
void RasterizerVulkan::UpdateLineWidth(Tegra::Engines::Maxwell3D::Regs& regs) {
|
||||||
if (!state_tracker.TouchBlendConstants()) {
|
if (!state_tracker.TouchLineWidth()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const std::array<float, 4> blend_color{
|
const float width =
|
||||||
regs.blend_color.r,
|
regs.line_anti_alias_enable ? regs.line_width_smooth : regs.line_width_aliased;
|
||||||
regs.blend_color.g,
|
scheduler.Record([width](vk::CommandBuffer cmdbuf) { cmdbuf.SetLineWidth(width); });
|
||||||
regs.blend_color.b,
|
|
||||||
regs.blend_color.a,
|
|
||||||
};
|
|
||||||
scheduler.Record([blend_color](vk::CommandBuffer cmdbuf) {
|
|
||||||
cmdbuf.SetBlendConstants(blend_color.data());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerVulkan::UpdateDepthBounds(Tegra::Engines::Maxwell3D::Regs& regs) {
|
if (!state_tracker.CheckStencilWriteMaskFront(regs.stencil_front_mask)) {
|
||||||
if (!state_tracker.TouchDepthBounds()) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!device.IsDepthBoundsSupported()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const float min_depth = regs.depth_bounds[0];
|
|
||||||
const float max_depth = regs.depth_bounds[1];
|
|
||||||
scheduler.Record([min_depth, max_depth](vk::CommandBuffer cmdbuf) {
|
|
||||||
cmdbuf.SetDepthBounds(min_depth, max_depth);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void RasterizerVulkan::UpdateStencilFaces(Tegra::Engines::Maxwell3D::Regs& regs) {
|
|
||||||
const bool properties_dirty = state_tracker.TouchStencilProperties();
|
|
||||||
const bool two_sided = regs.stencil_two_side_enable != 0;
|
|
||||||
const bool update_side = state_tracker.TouchStencilSide(two_sided) || properties_dirty;
|
|
||||||
const bool update_reference = state_tracker.TouchStencilReference() || properties_dirty || update_side;
|
|
||||||
const bool update_write_masks = state_tracker.TouchStencilWriteMask() || properties_dirty || update_side;
|
|
||||||
const bool update_compare_masks = state_tracker.TouchStencilCompare() || properties_dirty || update_side;
|
|
||||||
|
|
||||||
if (!update_reference && !update_write_masks && !update_compare_masks) {
|
|
||||||
state_tracker.ClearStencilReset();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (update_reference) {
|
|
||||||
const bool front_dirty = state_tracker.CheckStencilReferenceFront(regs.stencil_front_ref);
|
|
||||||
const bool back_dirty = two_sided ?
|
|
||||||
state_tracker.CheckStencilReferenceBack(regs.stencil_back_ref) : false;
|
|
||||||
if (update_side || front_dirty || back_dirty) {
|
|
||||||
scheduler.Record([front_ref = regs.stencil_front_ref,
|
|
||||||
back_ref = regs.stencil_back_ref,
|
|
||||||
two_sided](vk::CommandBuffer cmdbuf) {
|
|
||||||
const bool set_back = two_sided && front_ref != back_ref;
|
|
||||||
cmdbuf.SetStencilReference(set_back ? VK_STENCIL_FACE_FRONT_BIT
|
|
||||||
: VK_STENCIL_FACE_FRONT_AND_BACK,
|
|
||||||
front_ref);
|
|
||||||
if (set_back) {
|
|
||||||
cmdbuf.SetStencilReference(VK_STENCIL_FACE_BACK_BIT, back_ref);
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (update_write_masks) {
|
|
||||||
const bool front_dirty = state_tracker.CheckStencilWriteMaskFront(regs.stencil_front_mask);
|
|
||||||
const bool back_dirty = two_sided ?
|
|
||||||
state_tracker.CheckStencilWriteMaskBack(regs.stencil_back_mask) : false;
|
|
||||||
if (update_side || front_dirty || back_dirty) {
|
|
||||||
scheduler.Record([front_write_mask = regs.stencil_front_mask,
|
scheduler.Record([front_write_mask = regs.stencil_front_mask,
|
||||||
back_write_mask = regs.stencil_back_mask,
|
back_write_mask = regs.stencil_back_mask,
|
||||||
two_sided](vk::CommandBuffer cmdbuf) {
|
two_sided = regs.stencil_two_side_enable](vk::CommandBuffer cmdbuf) {
|
||||||
const bool set_back = two_sided && front_write_mask != back_write_mask;
|
const bool set_back = two_sided && front_write_mask != back_write_mask;
|
||||||
|
// Front face
|
||||||
cmdbuf.SetStencilWriteMask(set_back ? VK_STENCIL_FACE_FRONT_BIT
|
cmdbuf.SetStencilWriteMask(set_back ? VK_STENCIL_FACE_FRONT_BIT
|
||||||
: VK_STENCIL_FACE_FRONT_AND_BACK,
|
: VK_STENCIL_FACE_FRONT_AND_BACK,
|
||||||
front_write_mask);
|
front_write_mask);
|
||||||
|
|
@ -1307,18 +1255,25 @@ void RasterizerVulkan::UpdateStencilFaces(Tegra::Engines::Maxwell3D::Regs& regs)
|
||||||
cmdbuf.SetStencilWriteMask(VK_STENCIL_FACE_BACK_BIT, back_write_mask);
|
cmdbuf.SetStencilWriteMask(VK_STENCIL_FACE_BACK_BIT, back_write_mask);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_compare_masks) {
|
if (update_compare_masks) {
|
||||||
const bool front_dirty = state_tracker.CheckStencilCompareMaskFront(regs.stencil_front_func_mask);
|
[&]() {
|
||||||
const bool back_dirty = two_sided ?
|
if (regs.stencil_two_side_enable) {
|
||||||
state_tracker.CheckStencilCompareMaskBack(regs.stencil_back_func_mask) : false;
|
if (!state_tracker.CheckStencilCompareMaskFront(regs.stencil_front_func_mask) &&
|
||||||
if (update_side || front_dirty || back_dirty) {
|
!state_tracker.CheckStencilCompareMaskBack(regs.stencil_back_func_mask)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!state_tracker.CheckStencilCompareMaskFront(regs.stencil_front_func_mask)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
scheduler.Record([front_test_mask = regs.stencil_front_func_mask,
|
scheduler.Record([front_test_mask = regs.stencil_front_func_mask,
|
||||||
back_test_mask = regs.stencil_back_func_mask,
|
back_test_mask = regs.stencil_back_func_mask,
|
||||||
two_sided](vk::CommandBuffer cmdbuf) {
|
two_sided = regs.stencil_two_side_enable](vk::CommandBuffer cmdbuf) {
|
||||||
const bool set_back = two_sided && front_test_mask != back_test_mask;
|
const bool set_back = two_sided && front_test_mask != back_test_mask;
|
||||||
|
// Front face
|
||||||
cmdbuf.SetStencilCompareMask(set_back ? VK_STENCIL_FACE_FRONT_BIT
|
cmdbuf.SetStencilCompareMask(set_back ? VK_STENCIL_FACE_FRONT_BIT
|
||||||
: VK_STENCIL_FACE_FRONT_AND_BACK,
|
: VK_STENCIL_FACE_FRONT_AND_BACK,
|
||||||
front_test_mask);
|
front_test_mask);
|
||||||
|
|
@ -1326,9 +1281,8 @@ void RasterizerVulkan::UpdateStencilFaces(Tegra::Engines::Maxwell3D::Regs& regs)
|
||||||
cmdbuf.SetStencilCompareMask(VK_STENCIL_FACE_BACK_BIT, back_test_mask);
|
cmdbuf.SetStencilCompareMask(VK_STENCIL_FACE_BACK_BIT, back_test_mask);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}();
|
||||||
}
|
}
|
||||||
|
|
||||||
state_tracker.ClearStencilReset();
|
state_tracker.ClearStencilReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue