mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 05:28:56 +02:00
Compare commits
2 commits
76bb5fc18b
...
1ebdef1a02
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ebdef1a02 | ||
|
|
bd80d603e2 |
4 changed files with 26 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
||||
|
|
@ -31,7 +31,7 @@ struct RenderAreaLayout {
|
|||
};
|
||||
constexpr u32 RESCALING_LAYOUT_WORDS_OFFSET = offsetof(RescalingLayout, rescaling_textures);
|
||||
constexpr u32 RESCALING_LAYOUT_DOWN_FACTOR_OFFSET = offsetof(RescalingLayout, down_factor);
|
||||
constexpr u32 RENDERAREA_LAYOUT_OFFSET = offsetof(RenderAreaLayout, render_area);
|
||||
constexpr u32 RENDERAREA_LAYOUT_OFFSET = sizeof(RescalingLayout);
|
||||
|
||||
[[nodiscard]] std::vector<u32> EmitSPIRV(const Profile& profile, const RuntimeInfo& runtime_info,
|
||||
IR::Program& program, Bindings& bindings, bool optimize);
|
||||
|
|
|
|||
|
|
@ -1096,7 +1096,8 @@ void EmitContext::DefineRenderArea(const Info& info) {
|
|||
Decorate(push_constant_struct, spv::Decoration::Block);
|
||||
Name(push_constant_struct, "RenderAreaInfo");
|
||||
|
||||
MemberDecorate(push_constant_struct, render_are_member_index, spv::Decoration::Offset, 0);
|
||||
MemberDecorate(push_constant_struct, render_are_member_index, spv::Decoration::Offset,
|
||||
RENDERAREA_LAYOUT_OFFSET);
|
||||
MemberName(push_constant_struct, render_are_member_index, "render_area");
|
||||
|
||||
const Id pointer_type{TypePointer(spv::StorageClass::PushConstant, push_constant_struct)};
|
||||
|
|
|
|||
|
|
@ -510,8 +510,15 @@ bool GraphicsPipeline::ConfigureImpl(bool is_indexed) {
|
|||
const auto& info{stage_infos[stage]};
|
||||
if (info.uses_render_area) {
|
||||
render_area.uses_render_area = true;
|
||||
render_area.words = {static_cast<float>(regs.surface_clip.width),
|
||||
static_cast<float>(regs.surface_clip.height)};
|
||||
const bool is_rescaling{texture_cache.IsRescaling()};
|
||||
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]) {
|
||||
|
|
|
|||
|
|
@ -1572,10 +1572,16 @@ void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D::Regs& reg
|
|||
return;
|
||||
}
|
||||
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 y = static_cast<float>(regs.surface_clip.y);
|
||||
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));
|
||||
x *= scale;
|
||||
y *= scale;
|
||||
width *= scale;
|
||||
height *= scale;
|
||||
if (regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft) {
|
||||
y += height;
|
||||
height = -height;
|
||||
|
|
@ -1639,6 +1645,13 @@ void RasterizerVulkan::UpdateScissorsState(Tegra::Engines::Maxwell3D::Regs& regs
|
|||
if (regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft) {
|
||||
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{};
|
||||
scissor.offset.x = static_cast<int32_t>(x);
|
||||
scissor.offset.y = static_cast<int32_t>(y);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue