mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 00:13:08 +00:00
handle games with abnormal aspect ratios
This commit is contained in:
parent
a6845e33d4
commit
eb3e731e3a
@ -315,6 +315,11 @@ Frame* Presenter::PrepareFrameInternal(VideoCore::ImageId image_id, bool is_eop)
|
|||||||
if (image_id != VideoCore::NULL_IMAGE_ID) {
|
if (image_id != VideoCore::NULL_IMAGE_ID) {
|
||||||
auto& image = texture_cache.GetImage(image_id);
|
auto& image = texture_cache.GetImage(image_id);
|
||||||
vk::Extent2D image_size = {image.info.size.width, image.info.size.height};
|
vk::Extent2D image_size = {image.info.size.width, image.info.size.height};
|
||||||
|
float ratio = (float)image_size.width / (float)image_size.height;
|
||||||
|
if (ratio != expected_ratio) {
|
||||||
|
expected_ratio = ratio;
|
||||||
|
}
|
||||||
|
|
||||||
image.Transit(vk::ImageLayout::eShaderReadOnlyOptimal, vk::AccessFlagBits2::eShaderRead, {},
|
image.Transit(vk::ImageLayout::eShaderReadOnlyOptimal, vk::AccessFlagBits2::eShaderRead, {},
|
||||||
cmdbuf);
|
cmdbuf);
|
||||||
|
|
||||||
@ -636,15 +641,14 @@ Frame* Presenter::GetRenderFrame() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Presenter::SetExpectedGameSize(s32 width, s32 height) {
|
void Presenter::SetExpectedGameSize(s32 width, s32 height) {
|
||||||
constexpr float expectedRatio = 1920.0 / 1080.0f;
|
|
||||||
const float ratio = (float)width / (float)height;
|
const float ratio = (float)width / (float)height;
|
||||||
|
|
||||||
expected_frame_height = height;
|
expected_frame_height = height;
|
||||||
expected_frame_width = width;
|
expected_frame_width = width;
|
||||||
if (ratio > expectedRatio) {
|
if (ratio > expected_ratio) {
|
||||||
expected_frame_width = static_cast<s32>(height * expectedRatio);
|
expected_frame_width = static_cast<s32>(height * expected_ratio);
|
||||||
} else {
|
} else {
|
||||||
expected_frame_height = static_cast<s32>(width / expectedRatio);
|
expected_frame_height = static_cast<s32>(width / expected_ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,6 +125,7 @@ private:
|
|||||||
void SetExpectedGameSize(s32 width, s32 height);
|
void SetExpectedGameSize(s32 width, s32 height);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
float expected_ratio{1920.0 / 1080.0f};
|
||||||
u32 expected_frame_width{1920};
|
u32 expected_frame_width{1920};
|
||||||
u32 expected_frame_height{1080};
|
u32 expected_frame_height{1080};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user