mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 05:28:56 +02:00
[vulkan] Adjusting how surface clip is working when viewport offset gets a scaling value
This commit is contained in:
parent
bd80d603e2
commit
1ebdef1a02
2 changed files with 22 additions and 2 deletions
|
|
@ -510,8 +510,15 @@ bool GraphicsPipeline::ConfigureImpl(bool is_indexed) {
|
||||||
const auto& info{stage_infos[stage]};
|
const auto& info{stage_infos[stage]};
|
||||||
if (info.uses_render_area) {
|
if (info.uses_render_area) {
|
||||||
render_area.uses_render_area = true;
|
render_area.uses_render_area = true;
|
||||||
render_area.words = {static_cast<float>(regs.surface_clip.width),
|
const bool is_rescaling{texture_cache.IsRescaling()};
|
||||||
static_cast<float>(regs.surface_clip.height)};
|
const auto& resolution = Settings::values.resolution_info;
|
||||||
|
const float render_area_width = static_cast<float>(
|
||||||
|
is_rescaling ? resolution.ScaleUp(static_cast<u32>(regs.surface_clip.width))
|
||||||
|
: static_cast<u32>(regs.surface_clip.width));
|
||||||
|
const float render_area_height = static_cast<float>(
|
||||||
|
is_rescaling ? resolution.ScaleUp(static_cast<u32>(regs.surface_clip.height))
|
||||||
|
: static_cast<u32>(regs.surface_clip.height));
|
||||||
|
render_area.words = {render_area_width, render_area_height};
|
||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
if constexpr (Spec::enabled_stages[0]) {
|
if constexpr (Spec::enabled_stages[0]) {
|
||||||
|
|
|
||||||
|
|
@ -1572,10 +1572,16 @@ void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D::Regs& reg
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!regs.viewport_scale_offset_enabled) {
|
if (!regs.viewport_scale_offset_enabled) {
|
||||||
|
const bool is_rescaling{texture_cache.IsRescaling()};
|
||||||
|
const float scale = is_rescaling ? Settings::values.resolution_info.up_factor : 1.0f;
|
||||||
float x = static_cast<float>(regs.surface_clip.x);
|
float x = static_cast<float>(regs.surface_clip.x);
|
||||||
float y = static_cast<float>(regs.surface_clip.y);
|
float y = static_cast<float>(regs.surface_clip.y);
|
||||||
float width = (std::max)(1.0f, static_cast<float>(regs.surface_clip.width));
|
float width = (std::max)(1.0f, static_cast<float>(regs.surface_clip.width));
|
||||||
float height = (std::max)(1.0f, static_cast<float>(regs.surface_clip.height));
|
float height = (std::max)(1.0f, static_cast<float>(regs.surface_clip.height));
|
||||||
|
x *= scale;
|
||||||
|
y *= scale;
|
||||||
|
width *= scale;
|
||||||
|
height *= scale;
|
||||||
if (regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft) {
|
if (regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft) {
|
||||||
y += height;
|
y += height;
|
||||||
height = -height;
|
height = -height;
|
||||||
|
|
@ -1639,6 +1645,13 @@ void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D::Regs& regs
|
||||||
if (regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft) {
|
if (regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft) {
|
||||||
y = regs.surface_clip.height - (y + height);
|
y = regs.surface_clip.height - (y + height);
|
||||||
}
|
}
|
||||||
|
if (texture_cache.IsRescaling()) {
|
||||||
|
const auto& resolution = Settings::values.resolution_info;
|
||||||
|
x = resolution.ScaleUp(x);
|
||||||
|
y = resolution.ScaleUp(y);
|
||||||
|
width = resolution.ScaleUp(width);
|
||||||
|
height = resolution.ScaleUp(height);
|
||||||
|
}
|
||||||
VkRect2D scissor{};
|
VkRect2D scissor{};
|
||||||
scissor.offset.x = static_cast<int32_t>(x);
|
scissor.offset.x = static_cast<int32_t>(x);
|
||||||
scissor.offset.y = static_cast<int32_t>(y);
|
scissor.offset.y = static_cast<int32_t>(y);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue