Skip to content

Commit

Permalink
libretro: Fix screen size problem in Vulkan.
Browse files Browse the repository at this point in the history
(Still something is slightly off, there are duplicated lines on screen.
Can't figure out what)
  • Loading branch information
hrydgard committed Oct 11, 2020
1 parent dffc36b commit 6156779
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions Windows/PPSSPP.vcxproj
Expand Up @@ -1704,6 +1704,7 @@
</ItemGroup>
<ItemGroup>
<Text Include="..\libretro\CMakeLists.txt" />
<Text Include="..\libretro\README_WINDOWS.txt" />
<Text Include="..\ppge_atlasscript.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
Expand Down
3 changes: 3 additions & 0 deletions Windows/PPSSPP.vcxproj.filters
Expand Up @@ -729,5 +729,8 @@
<Text Include="..\libretro\CMakeLists.txt">
<Filter>Other Platforms\libretro</Filter>
</Text>
<Text Include="..\libretro\README_WINDOWS.txt">
<Filter>Other Platforms\libretro</Filter>
</Text>
</ItemGroup>
</Project>
9 changes: 4 additions & 5 deletions libretro/libretro.cpp
Expand Up @@ -34,6 +34,7 @@
#include "GPU/GPUInterface.h"
#include "GPU/Common/FramebufferManagerCommon.h"
#include "GPU/Common/TextureScalerCommon.h"
#include "GPU/Common/PresentationCommon.h"

#include "libretro/libretro.h"
#include "libretro/LibretroGraphicsContext.h"
Expand Down Expand Up @@ -318,10 +319,8 @@ static void check_variables(CoreParameter &coreParam)

if (!PSP_IsInited() && ppsspp_internal_resolution.Update(&g_Config.iInternalResolution))
{
coreParam.pixelWidth = coreParam.renderWidth =
g_Config.iInternalResolution * 480;
coreParam.pixelHeight = coreParam.renderHeight =
g_Config.iInternalResolution * 272;
coreParam.pixelWidth = coreParam.renderWidth = g_Config.iInternalResolution * 480;
coreParam.pixelHeight = coreParam.renderHeight = g_Config.iInternalResolution * 272;

if (gpu)
{
Expand Down Expand Up @@ -421,7 +420,7 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
info->geometry.base_height = g_Config.iInternalResolution * 272;
info->geometry.max_width = g_Config.iInternalResolution * 480;
info->geometry.max_height = g_Config.iInternalResolution * 272;
info->geometry.aspect_ratio = 16.0 / 9.0;
info->geometry.aspect_ratio = 480.0 / 272.0; // Not 16:9! But very, very close.
}

unsigned retro_api_version(void) { return RETRO_API_VERSION; }
Expand Down
16 changes: 12 additions & 4 deletions libretro/libretro_vulkan.cpp
Expand Up @@ -13,6 +13,7 @@
#include <condition_variable>

#include "Common/Log.h"
#include "Core/Config.h"

#define VK_NO_PROTOTYPES
#include "libretro/libretro_vulkan.h"
Expand Down Expand Up @@ -134,8 +135,15 @@ static VKAPI_ATTR VkResult VKAPI_CALL vkCreateLibretroSurfaceKHR(VkInstance inst
VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR_libretro(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) {
VkResult res = vkGetPhysicalDeviceSurfaceCapabilitiesKHR_org(physicalDevice, surface, pSurfaceCapabilities);
if (res == VK_SUCCESS) {
pSurfaceCapabilities->currentExtent.width = -1;
pSurfaceCapabilities->currentExtent.height = -1;
int w = g_Config.iInternalResolution * 480;
int h = g_Config.iInternalResolution * 272;

pSurfaceCapabilities->minImageExtent.width = w;
pSurfaceCapabilities->minImageExtent.height = h;
pSurfaceCapabilities->maxImageExtent.width = w;
pSurfaceCapabilities->maxImageExtent.height = h;
pSurfaceCapabilities->currentExtent.width = w;
pSurfaceCapabilities->currentExtent.height = h;
}
return res;
}
Expand Down Expand Up @@ -415,7 +423,7 @@ void vk_libretro_set_hwrender_interface(retro_hw_render_interface *hw_render_int
}

void vk_libretro_shutdown() {
memset(&vk_init_info, 0x00, sizeof(vk_init_info));
vulkan = NULL;
memset(&vk_init_info, 0, sizeof(vk_init_info));
vulkan = nullptr;
DEDICATED_ALLOCATION = false;
}

0 comments on commit 6156779

Please sign in to comment.