[vk] Apply fallback patch for Viewport
All checks were successful
eden-license / license-header (pull_request) Successful in 28s
All checks were successful
eden-license / license-header (pull_request) Successful in 28s
Will add details if this solves the issue we are testing for.
This commit is contained in:
parent
e75ceb676b
commit
52379c383d
1 changed files with 27 additions and 14 deletions
|
@ -1029,10 +1029,18 @@ void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D::Regs& reg
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!regs.viewport_scale_offset_enabled) {
|
if (!regs.viewport_scale_offset_enabled) {
|
||||||
const auto x = static_cast<float>(regs.surface_clip.x);
|
float x = static_cast<float>(regs.surface_clip.x);
|
||||||
const auto y = static_cast<float>(regs.surface_clip.y);
|
float y = static_cast<float>(regs.surface_clip.y);
|
||||||
const auto width = static_cast<float>(regs.surface_clip.width);
|
float width = static_cast<float>(regs.surface_clip.width);
|
||||||
const auto height = static_cast<float>(regs.surface_clip.height);
|
float height = static_cast<float>(regs.surface_clip.height);
|
||||||
|
|
||||||
|
const bool lower_left =
|
||||||
|
regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft;
|
||||||
|
if (lower_left) {
|
||||||
|
// Vulkan viewport space is top-left; emulate lower-left with negative height.
|
||||||
|
y += height;
|
||||||
|
height = -height;
|
||||||
|
}
|
||||||
VkViewport viewport{
|
VkViewport viewport{
|
||||||
.x = x,
|
.x = x,
|
||||||
.y = y,
|
.y = y,
|
||||||
|
@ -1068,15 +1076,20 @@ void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D::Regs& regs
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!regs.viewport_scale_offset_enabled) {
|
if (!regs.viewport_scale_offset_enabled) {
|
||||||
const auto x = static_cast<float>(regs.surface_clip.x);
|
u32 x = regs.surface_clip.x;
|
||||||
const auto y = static_cast<float>(regs.surface_clip.y);
|
u32 y = regs.surface_clip.y;
|
||||||
const auto width = static_cast<float>(regs.surface_clip.width);
|
u32 width = regs.surface_clip.width ? regs.surface_clip.width : 1u;
|
||||||
const auto height = static_cast<float>(regs.surface_clip.height);
|
u32 height = regs.surface_clip.height ? regs.surface_clip.height : 1u;
|
||||||
VkRect2D scissor;
|
|
||||||
scissor.offset.x = static_cast<u32>(x);
|
if (regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft) {
|
||||||
scissor.offset.y = static_cast<u32>(y);
|
// Vulkan scissor is top-left; convert from lower-left coordinates.
|
||||||
scissor.extent.width = static_cast<u32>(width != 0.0f ? width : 1.0f);
|
y = regs.surface_clip.height - (y + height);
|
||||||
scissor.extent.height = static_cast<u32>(height != 0.0f ? height : 1.0f);
|
}
|
||||||
|
VkRect2D scissor{};
|
||||||
|
scissor.offset.x = static_cast<int32_t>(x);
|
||||||
|
scissor.offset.y = static_cast<int32_t>(y);
|
||||||
|
scissor.extent.width = width;
|
||||||
|
scissor.extent.height = height;
|
||||||
scheduler.Record([scissor](vk::CommandBuffer cmdbuf) { cmdbuf.SetScissor(0, scissor); });
|
scheduler.Record([scissor](vk::CommandBuffer cmdbuf) { cmdbuf.SetScissor(0, scissor); });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1586,7 +1599,7 @@ void RasterizerVulkan::UpdateVertexInput(Tegra::Engines::Maxwell3D::Regs& regs)
|
||||||
highest_dirty_attr = index;
|
highest_dirty_attr = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (size_t index = 0; index < highest_dirty_attr; ++index) {
|
for (size_t index = 0; index <= highest_dirty_attr; ++index) {
|
||||||
const Maxwell::VertexAttribute attribute{regs.vertex_attrib_format[index]};
|
const Maxwell::VertexAttribute attribute{regs.vertex_attrib_format[index]};
|
||||||
const u32 binding{attribute.buffer};
|
const u32 binding{attribute.buffer};
|
||||||
dirty[Dirty::VertexAttribute0 + index] = false;
|
dirty[Dirty::VertexAttribute0 + index] = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue