mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
vk_rasterizer: Pass Maxwell registers to dynamic updates
This commit is contained in:
parent
042256c6bb
commit
6669b359a3
|
@ -726,13 +726,13 @@ void RasterizerVulkan::SetupImageTransitions(
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerVulkan::UpdateDynamicStates() {
|
void RasterizerVulkan::UpdateDynamicStates() {
|
||||||
auto& gpu = system.GPU().Maxwell3D();
|
auto& regs = system.GPU().Maxwell3D().regs;
|
||||||
UpdateViewportsState(gpu);
|
UpdateViewportsState(regs);
|
||||||
UpdateScissorsState(gpu);
|
UpdateScissorsState(regs);
|
||||||
UpdateDepthBias(gpu);
|
UpdateDepthBias(regs);
|
||||||
UpdateBlendConstants(gpu);
|
UpdateBlendConstants(regs);
|
||||||
UpdateDepthBounds(gpu);
|
UpdateDepthBounds(regs);
|
||||||
UpdateStencilFaces(gpu);
|
UpdateStencilFaces(regs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerVulkan::SetupVertexArrays(FixedPipelineState::VertexInput& vertex_input,
|
void RasterizerVulkan::SetupVertexArrays(FixedPipelineState::VertexInput& vertex_input,
|
||||||
|
@ -978,11 +978,10 @@ void RasterizerVulkan::SetupImage(const Tegra::Texture::TICEntry& tic, const Ima
|
||||||
image_views.push_back(ImageView{std::move(view), image_layout});
|
image_views.push_back(ImageView{std::move(view), image_layout});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D& gpu) {
|
void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D::Regs& regs) {
|
||||||
if (!state_tracker.TouchViewports()) {
|
if (!state_tracker.TouchViewports()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto& regs = gpu.regs;
|
|
||||||
const std::array viewports{
|
const std::array viewports{
|
||||||
GetViewportState(device, regs, 0), GetViewportState(device, regs, 1),
|
GetViewportState(device, regs, 0), GetViewportState(device, regs, 1),
|
||||||
GetViewportState(device, regs, 2), GetViewportState(device, regs, 3),
|
GetViewportState(device, regs, 2), GetViewportState(device, regs, 3),
|
||||||
|
@ -997,11 +996,10 @@ void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D& gpu) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D& gpu) {
|
void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D::Regs& regs) {
|
||||||
if (!state_tracker.TouchScissors()) {
|
if (!state_tracker.TouchScissors()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto& regs = gpu.regs;
|
|
||||||
const std::array scissors = {
|
const std::array scissors = {
|
||||||
GetScissorState(regs, 0), GetScissorState(regs, 1), GetScissorState(regs, 2),
|
GetScissorState(regs, 0), GetScissorState(regs, 1), GetScissorState(regs, 2),
|
||||||
GetScissorState(regs, 3), GetScissorState(regs, 4), GetScissorState(regs, 5),
|
GetScissorState(regs, 3), GetScissorState(regs, 4), GetScissorState(regs, 5),
|
||||||
|
@ -1014,42 +1012,39 @@ void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D& gpu) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D& gpu) {
|
void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D::Regs& regs) {
|
||||||
if (!state_tracker.TouchDepthBias()) {
|
if (!state_tracker.TouchDepthBias()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
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) {
|
||||||
cmdbuf.setDepthBias(constant, clamp, factor / 2.0f, dld);
|
cmdbuf.setDepthBias(constant, clamp, factor / 2.0f, dld);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerVulkan::UpdateBlendConstants(Tegra::Engines::Maxwell3D& gpu) {
|
void RasterizerVulkan::UpdateBlendConstants(Tegra::Engines::Maxwell3D::Regs& regs) {
|
||||||
if (!state_tracker.TouchBlendConstants()) {
|
if (!state_tracker.TouchBlendConstants()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const std::array blend_color = {gpu.regs.blend_color.r, gpu.regs.blend_color.g,
|
const std::array blend_color = {regs.blend_color.r, regs.blend_color.g, regs.blend_color.b,
|
||||||
gpu.regs.blend_color.b, gpu.regs.blend_color.a};
|
regs.blend_color.a};
|
||||||
scheduler.Record([blend_color](auto cmdbuf, auto& dld) {
|
scheduler.Record([blend_color](auto cmdbuf, auto& dld) {
|
||||||
cmdbuf.setBlendConstants(blend_color.data(), dld);
|
cmdbuf.setBlendConstants(blend_color.data(), dld);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerVulkan::UpdateDepthBounds(Tegra::Engines::Maxwell3D& gpu) {
|
void RasterizerVulkan::UpdateDepthBounds(Tegra::Engines::Maxwell3D::Regs& regs) {
|
||||||
if (!state_tracker.TouchDepthBounds()) {
|
if (!state_tracker.TouchDepthBounds()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
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); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerVulkan::UpdateStencilFaces(Tegra::Engines::Maxwell3D& gpu) {
|
void RasterizerVulkan::UpdateStencilFaces(Tegra::Engines::Maxwell3D::Regs& regs) {
|
||||||
if (!state_tracker.TouchStencilProperties()) {
|
if (!state_tracker.TouchStencilProperties()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto& regs = gpu.regs;
|
|
||||||
if (regs.stencil_two_side_enable) {
|
if (regs.stencil_two_side_enable) {
|
||||||
// Separate values per face
|
// Separate values per face
|
||||||
scheduler.Record(
|
scheduler.Record(
|
||||||
|
|
|
@ -217,12 +217,12 @@ private:
|
||||||
|
|
||||||
void SetupImage(const Tegra::Texture::TICEntry& tic, const ImageEntry& entry);
|
void SetupImage(const Tegra::Texture::TICEntry& tic, const ImageEntry& entry);
|
||||||
|
|
||||||
void UpdateViewportsState(Tegra::Engines::Maxwell3D& gpu);
|
void UpdateViewportsState(Tegra::Engines::Maxwell3D::Regs& regs);
|
||||||
void UpdateScissorsState(Tegra::Engines::Maxwell3D& gpu);
|
void UpdateScissorsState(Tegra::Engines::Maxwell3D::Regs& regs);
|
||||||
void UpdateDepthBias(Tegra::Engines::Maxwell3D& gpu);
|
void UpdateDepthBias(Tegra::Engines::Maxwell3D::Regs& regs);
|
||||||
void UpdateBlendConstants(Tegra::Engines::Maxwell3D& gpu);
|
void UpdateBlendConstants(Tegra::Engines::Maxwell3D::Regs& regs);
|
||||||
void UpdateDepthBounds(Tegra::Engines::Maxwell3D& gpu);
|
void UpdateDepthBounds(Tegra::Engines::Maxwell3D::Regs& regs);
|
||||||
void UpdateStencilFaces(Tegra::Engines::Maxwell3D& gpu);
|
void UpdateStencilFaces(Tegra::Engines::Maxwell3D::Regs& regs);
|
||||||
|
|
||||||
std::size_t CalculateGraphicsStreamBufferSize(bool is_indexed) const;
|
std::size_t CalculateGraphicsStreamBufferSize(bool is_indexed) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue