Merge pull request #19230 from sonninnos/libretro-renderer

Libretro: Add video renderer core option
This commit is contained in:
Henrik Rydgård 2024-06-04 13:58:41 +02:00 committed by GitHub
commit 0388613ce2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 430 additions and 146 deletions

View File

@ -90,6 +90,9 @@ LibretroGraphicsContext *LibretroGraphicsContext::CreateGraphicsContext() {
if (!Libretro::environ_cb(RETRO_ENVIRONMENT_GET_PREFERRED_HW_RENDER, &preferred))
preferred = RETRO_HW_CONTEXT_DUMMY;
if (Libretro::backend != RETRO_HW_CONTEXT_DUMMY)
preferred = Libretro::backend;
#ifndef USING_GLES2
if (preferred == RETRO_HW_CONTEXT_DUMMY || preferred == RETRO_HW_CONTEXT_OPENGL_CORE) {
ctx = new LibretroGLCoreContext();
@ -131,7 +134,6 @@ LibretroGraphicsContext *LibretroGraphicsContext::CreateGraphicsContext() {
delete ctx;
ctx = new LibretroD3D9Context();
if (ctx->Init()) {
return ctx;
}
@ -143,3 +145,61 @@ LibretroGraphicsContext *LibretroGraphicsContext::CreateGraphicsContext() {
ctx->Init();
return ctx;
}
std::vector<u32> TranslateDebugBufferToCompare(const GPUDebugBuffer *buffer, u32 stride, u32 h) {
// If the output was small, act like everything outside was 0.
// This can happen depending on viewport parameters.
u32 safeW = std::min(stride, buffer->GetStride());
u32 safeH = std::min(h, buffer->GetHeight());
std::vector<u32> data;
data.resize(stride * h, 0);
const u32 *pixels32 = (const u32 *)buffer->GetData();
const u16 *pixels16 = (const u16 *)buffer->GetData();
int outStride = buffer->GetStride();
#if 0
if (!buffer->GetFlipped()) {
// Bitmaps are flipped, so we have to compare backwards in this case.
int toLastRow = outStride * (h > buffer->GetHeight() ? buffer->GetHeight() - 1 : h - 1);
pixels32 += toLastRow;
pixels16 += toLastRow;
outStride = -outStride;
}
#endif
// Skip the bottom of the image in the buffer was smaller. Remember, we're flipped.
u32 *dst = &data[0];
if (safeH < h) {
dst += (h - safeH) * stride;
}
for (u32 y = 0; y < safeH; ++y) {
switch (buffer->GetFormat()) {
case GPU_DBG_FORMAT_8888:
ConvertBGRA8888ToRGBA8888(&dst[y * stride], pixels32, safeW);
break;
case GPU_DBG_FORMAT_8888_BGRA:
memcpy(&dst[y * stride], pixels32, safeW * sizeof(u32));
break;
case GPU_DBG_FORMAT_565:
ConvertRGB565ToBGRA8888(&dst[y * stride], pixels16, safeW);
break;
case GPU_DBG_FORMAT_5551:
ConvertRGBA5551ToBGRA8888(&dst[y * stride], pixels16, safeW);
break;
case GPU_DBG_FORMAT_4444:
ConvertRGBA4444ToBGRA8888(&dst[y * stride], pixels16, safeW);
break;
default:
data.resize(0);
return data;
}
pixels32 += outStride;
pixels16 += outStride;
}
return data;
}

View File

@ -5,8 +5,16 @@
#include "Common/GraphicsContext.h"
#include "Common/GPU/thin3d_create.h"
#include "Core/Config.h"
#include "Core/System.h"
#include "GPU/GPUState.h"
#include "GPU/Software/SoftGpu.h"
#include "headless/Compare.h"
#include "Common/Data/Convert/ColorConv.h"
#define NATIVEWIDTH 480
#define NATIVEHEIGHT 272
#define SOFT_BMP_SIZE NATIVEWIDTH * NATIVEHEIGHT * 4
class LibretroGraphicsContext : public GraphicsContext {
public:
@ -51,7 +59,7 @@ public:
bool Init(bool cache_context);
void SetRenderTarget() override {}
void SwapBuffers() override {
video_cb(RETRO_HW_FRAME_BUFFER_VALID, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight, 0);
video_cb(RETRO_HW_FRAME_BUFFER_VALID, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight, 0);
}
virtual void ContextReset();
virtual void ContextDestroy();
@ -80,14 +88,27 @@ class LibretroSoftwareContext : public LibretroGraphicsContext {
public:
LibretroSoftwareContext() {}
bool Init() override { return true; }
void SwapBuffers() override { video_cb(NULL, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight, 0); }
void SwapBuffers() override {
GPUDebugBuffer buf;
u16 w = NATIVEWIDTH;
u16 h = NATIVEHEIGHT;
gpuDebug->GetOutputFramebuffer(buf);
const std::vector<u32> pixels = TranslateDebugBufferToCompare(&buf, w, h);
memcpy(soft_bmp, pixels.data(), SOFT_BMP_SIZE);
u32 offset = g_Config.bDisplayCropTo16x9 ? w << 1 : 0;
h -= g_Config.bDisplayCropTo16x9 ? 2 : 0;
video_cb(soft_bmp + offset, w, h, w << 2);
}
GPUCore GetGPUCore() override { return GPUCORE_SOFTWARE; }
const char *Ident() override { return "Software"; }
u16 soft_bmp[SOFT_BMP_SIZE] = {0};
};
namespace Libretro {
extern LibretroGraphicsContext *ctx;
extern retro_environment_t environ_cb;
extern retro_hw_context_type backend;
enum class EmuThreadState {
DISABLED,

View File

@ -100,6 +100,7 @@ namespace Libretro
{
LibretroGraphicsContext *ctx;
retro_environment_t environ_cb;
retro_hw_context_type backend = RETRO_HW_CONTEXT_DUMMY;
static retro_audio_sample_batch_t audio_batch_cb;
static retro_input_poll_t input_poll_cb;
static retro_input_state_t input_state_cb;
@ -107,6 +108,7 @@ namespace Libretro
static bool detectVsyncSwapInterval = false;
static bool detectVsyncSwapIntervalOptShown = true;
static bool softwareRenderInitHack = false;
static s64 expectedTimeUsPerRun = 0;
static uint32_t vsyncSwapInterval = 1;
@ -502,6 +504,7 @@ static void check_variables(CoreParameter &coreParam)
int iTexScalingType_prev;
int iTexScalingLevel_prev;
int iMultiSampleLevel_prev;
bool bDisplayCropTo16x9_prev;
var.key = "ppsspp_language";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
@ -679,6 +682,26 @@ static void check_variables(CoreParameter &coreParam)
g_Config.iInternalResolution = 9;
else if (!strcmp(var.value, "4800x2720"))
g_Config.iInternalResolution = 10;
// Force resolution to 1x without hardware context
if (backend == RETRO_HW_CONTEXT_NONE)
g_Config.iInternalResolution = 1;
}
var.key = "ppsspp_software_rendering";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (!PSP_IsInited())
{
if (!strcmp(var.value, "disabled") && backend != RETRO_HW_CONTEXT_NONE)
g_Config.bSoftwareRendering = false;
else
g_Config.bSoftwareRendering = true;
}
// Force resolution to 1x with software rendering
if (g_Config.bSoftwareRendering)
g_Config.iInternalResolution = 1;
}
#if 0 // see issue #16786
@ -698,13 +721,15 @@ static void check_variables(CoreParameter &coreParam)
}
#endif
var.key = "ppsspp_skip_gpu_readbacks";
var.key = "ppsspp_cropto16x9";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
bDisplayCropTo16x9_prev = g_Config.bDisplayCropTo16x9;
if (!strcmp(var.value, "disabled"))
g_Config.iSkipGPUReadbackMode = (int)SkipGPUReadbackMode::NO_SKIP;
g_Config.bDisplayCropTo16x9 = false;
else
g_Config.iSkipGPUReadbackMode = (int)SkipGPUReadbackMode::SKIP;
g_Config.bDisplayCropTo16x9 = true;
}
var.key = "ppsspp_frameskip";
@ -758,22 +783,31 @@ static void check_variables(CoreParameter &coreParam)
g_Config.iInflightFrames = 2;
}
var.key = "ppsspp_gpu_hardware_transform";
var.key = "ppsspp_skip_buffer_effects";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (!strcmp(var.value, "disabled"))
g_Config.bHardwareTransform = false;
g_Config.bSkipBufferEffects = false;
else
g_Config.bHardwareTransform = true;
g_Config.bSkipBufferEffects = true;
}
var.key = "ppsspp_software_skinning";
var.key = "ppsspp_disable_range_culling";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (!strcmp(var.value, "disabled"))
g_Config.bSoftwareSkinning = false;
g_Config.bDisableRangeCulling = false;
else
g_Config.bSoftwareSkinning = true;
g_Config.bDisableRangeCulling = true;
}
var.key = "ppsspp_skip_gpu_readbacks";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (!strcmp(var.value, "disabled"))
g_Config.iSkipGPUReadbackMode = (int)SkipGPUReadbackMode::NO_SKIP;
else
g_Config.iSkipGPUReadbackMode = (int)SkipGPUReadbackMode::SKIP;
}
var.key = "ppsspp_lazy_texture_caching";
@ -796,6 +830,24 @@ static void check_variables(CoreParameter &coreParam)
g_Config.iSplineBezierQuality = 2;
}
var.key = "ppsspp_gpu_hardware_transform";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (!strcmp(var.value, "disabled"))
g_Config.bHardwareTransform = false;
else
g_Config.bHardwareTransform = true;
}
var.key = "ppsspp_software_skinning";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (!strcmp(var.value, "disabled"))
g_Config.bSoftwareSkinning = false;
else
g_Config.bSoftwareSkinning = true;
}
var.key = "ppsspp_hardware_tesselation";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
@ -1065,16 +1117,18 @@ static void check_variables(CoreParameter &coreParam)
!g_Config.bRenderDuplicateFrames;
bool updateAvInfo = false;
bool updateGeometry = false;
if (!detectVsyncSwapInterval && (vsyncSwapInterval != 1))
{
vsyncSwapInterval = 1;
updateAvInfo = true;
}
if (g_Config.iInternalResolution != iInternalResolution_prev && !PSP_IsInited())
if (g_Config.iInternalResolution != iInternalResolution_prev && backend != RETRO_HW_CONTEXT_NONE)
{
coreParam.pixelWidth = coreParam.renderWidth = g_Config.iInternalResolution * 480;
coreParam.pixelHeight = coreParam.renderHeight = g_Config.iInternalResolution * 272;
coreParam.pixelWidth = coreParam.renderWidth = g_Config.iInternalResolution * NATIVEWIDTH;
coreParam.pixelHeight = coreParam.renderHeight = g_Config.iInternalResolution * NATIVEHEIGHT;
if (gpu)
{
@ -1086,6 +1140,13 @@ static void check_variables(CoreParameter &coreParam)
}
}
if (g_Config.bDisplayCropTo16x9 != bDisplayCropTo16x9_prev && PSP_IsInited())
{
updateGeometry = true;
if (gpu)
gpu->NotifyDisplayResized();
}
#if 0 // see issue #16786
if (g_Config.iMultiSampleLevel != iMultiSampleLevel_prev && PSP_IsInited())
{
@ -1102,6 +1163,12 @@ static void check_variables(CoreParameter &coreParam)
retro_get_system_av_info(&avInfo);
environ_cb(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &avInfo);
}
else if (updateGeometry)
{
retro_system_av_info avInfo;
retro_get_system_av_info(&avInfo);
environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &avInfo);
}
set_variable_visibility();
}
@ -1111,6 +1178,18 @@ void retro_set_audio_sample(retro_audio_sample_t cb) { (void)cb; }
void retro_set_input_poll(retro_input_poll_t cb) { input_poll_cb = cb; }
void retro_set_input_state(retro_input_state_t cb) { input_state_cb = cb; }
static const struct retro_controller_description psp_controllers[] =
{
{ "PSP", RETRO_DEVICE_JOYPAD },
{ NULL, 0 }
};
static const struct retro_controller_info ports[] =
{
{ psp_controllers, 1 },
{ NULL, 0 }
};
void retro_init(void)
{
VsyncSwapIntervalReset();
@ -1137,6 +1216,7 @@ void retro_init(void)
{ 0 },
};
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc);
environ_cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
if (environ_cb(RETRO_ENVIRONMENT_GET_INPUT_BITMASKS, NULL))
libretro_supports_bitmasks = true;
@ -1223,11 +1303,23 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
info->timing.fps = (60.0 / 1.001) / (double)vsyncSwapInterval;
info->timing.sample_rate = SAMPLERATE;
info->geometry.base_width = g_Config.iInternalResolution * 480;
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 = 480.0 / 272.0; // Not 16:9! But very, very close.
info->geometry.base_width = g_Config.iInternalResolution * NATIVEWIDTH;
info->geometry.base_height = g_Config.iInternalResolution * NATIVEHEIGHT;
info->geometry.max_width = g_Config.iInternalResolution * NATIVEWIDTH;
info->geometry.max_height = g_Config.iInternalResolution * NATIVEHEIGHT;
if (g_Config.bDisplayCropTo16x9)
info->geometry.base_height -= g_Config.iInternalResolution * 2;
info->geometry.aspect_ratio = (float)info->geometry.base_width / (float)info->geometry.base_height;
PSP_CoreParameter().pixelWidth = PSP_CoreParameter().renderWidth = info->geometry.base_width;
PSP_CoreParameter().pixelHeight = PSP_CoreParameter().renderHeight = info->geometry.base_height;
/* Must reset context to resize render area properly while running,
* but not necessary with software, and not working with Vulkan.. (TODO) */
if (PSP_IsInited() && ctx && backend != RETRO_HW_CONTEXT_NONE && ctx->GetGPUCore() != GPUCORE_VULKAN)
((LibretroHWRenderContext *)Libretro::ctx)->ContextReset();
}
unsigned retro_api_version(void) { return RETRO_API_VERSION; }
@ -1329,6 +1421,26 @@ namespace Libretro
} // namespace Libretro
static void retro_check_backend(void)
{
struct retro_variable var = {0};
var.key = "ppsspp_backend";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (!strcmp(var.value, "auto"))
backend = RETRO_HW_CONTEXT_DUMMY;
else if (!strcmp(var.value, "opengl"))
backend = RETRO_HW_CONTEXT_OPENGL;
else if (!strcmp(var.value, "vulkan"))
backend = RETRO_HW_CONTEXT_VULKAN;
else if (!strcmp(var.value, "d3d11"))
backend = RETRO_HW_CONTEXT_DIRECT3D;
else if (!strcmp(var.value, "none"))
backend = RETRO_HW_CONTEXT_NONE;
}
}
bool retro_load_game(const struct retro_game_info *game)
{
retro_pixel_format fmt = retro_pixel_format::RETRO_PIXEL_FORMAT_XRGB8888;
@ -1338,6 +1450,8 @@ bool retro_load_game(const struct retro_game_info *game)
return false;
}
retro_check_backend();
coreState = CORE_POWERUP;
ctx = LibretroGraphicsContext::CreateGraphicsContext();
INFO_LOG(SYSTEM, "Using %s backend", ctx->Ident());
@ -1360,6 +1474,12 @@ bool retro_load_game(const struct retro_game_info *game)
coreParam.gpuCore = ctx->GetGPUCore();
check_variables(coreParam);
// TODO: OpenGL goes black when inited with software rendering,
// therefore start without, set back after init, and reset.
softwareRenderInitHack = ctx->GetGPUCore() == GPUCORE_GLES && g_Config.bSoftwareRendering;
if (softwareRenderInitHack)
g_Config.bSoftwareRendering = false;
// set cpuCore from libretro setting variable
coreParam.cpuCore = (CPUCore)g_Config.iCpuCore;
@ -1516,6 +1636,14 @@ void retro_run(void)
environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, nullptr);
return;
}
if (softwareRenderInitHack)
{
log_cb(RETRO_LOG_DEBUG, "Software rendering init hack for opengl triggered.\n");
softwareRenderInitHack = false;
g_Config.bSoftwareRendering = true;
retro_reset();
}
}
check_variables(PSP_CoreParameter());

View File

@ -103,6 +103,16 @@ struct retro_core_option_v2_category option_cats_us[] = {
"Video",
"Configure video options."
},
{
"input",
"Input",
"Configure input options."
},
{
"hacks",
"Hacks",
"Configure speed and emulation hacks. Can cause rendering errors!"
},
{
"network",
"Network",
@ -112,31 +122,6 @@ struct retro_core_option_v2_category option_cats_us[] = {
};
struct retro_core_option_v2_definition option_defs_us[] = {
{
"ppsspp_language",
"Language",
NULL,
"Choose language, 'Automatic' will use the frontend language.",
NULL,
"system",
{
{ "Automatic", NULL },
{ "English", NULL },
{ "Japanese", NULL },
{ "French", NULL },
{ "Spanish", NULL },
{ "German", NULL },
{ "Italian", NULL },
{ "Dutch", NULL },
{ "Portuguese", NULL },
{ "Russian", NULL },
{ "Korean", NULL },
{ "Chinese Traditional", NULL },
{ "Chinese Simplified", NULL },
{ NULL, NULL },
},
"Automatic"
},
{
"ppsspp_cpu_core",
"CPU Core",
@ -156,7 +141,7 @@ struct retro_core_option_v2_definition option_defs_us[] = {
"ppsspp_fast_memory",
"Fast Memory",
NULL,
NULL,
"Unstable.",
NULL,
"system",
BOOL_OPTIONS,
@ -189,9 +174,9 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
{
"ppsspp_force_lag_sync",
"Force Real Clock Sync (Slower, less lag)",
NULL,
"Force Real Clock Sync",
NULL,
"Slower, less lag.",
NULL,
"system",
BOOL_OPTIONS,
@ -219,6 +204,16 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
"disabled"
},
{
"ppsspp_memstick_inserted",
"Memory Stick Inserted",
NULL,
"Some games require ejecting/inserting the Memory Stick.",
NULL,
"system",
BOOL_OPTIONS,
"enabled"
},
{
"ppsspp_cache_iso",
"Cache Full ISO in RAM",
@ -239,6 +234,31 @@ struct retro_core_option_v2_definition option_defs_us[] = {
BOOL_OPTIONS,
"disabled"
},
{
"ppsspp_language",
"Game Language",
NULL,
"'Automatic' will use the frontend language.",
NULL,
"system",
{
{ "Automatic", NULL },
{ "English", NULL },
{ "Japanese", NULL },
{ "French", NULL },
{ "Spanish", NULL },
{ "German", NULL },
{ "Italian", NULL },
{ "Dutch", NULL },
{ "Portuguese", NULL },
{ "Russian", NULL },
{ "Korean", NULL },
{ "Chinese Traditional", NULL },
{ "Chinese Simplified", NULL },
{ NULL, NULL },
},
"Automatic"
},
{
"ppsspp_psp_model",
"PSP Model",
@ -254,57 +274,54 @@ struct retro_core_option_v2_definition option_defs_us[] = {
"psp_2000_3000"
},
{
"ppsspp_button_preference",
"Confirmation Button",
"ppsspp_backend",
"Backend",
NULL,
"'Automatic' will use the frontend video driver. Core restart required.",
NULL,
NULL,
"system",
"video",
{
{ "Cross", NULL },
{ "Circle", NULL },
{ "auto", "Automatic" },
{ "opengl", "OpenGL" },
#ifndef HAVE_LIBNX
{ "vulkan", "Vulkan" },
#endif
#ifdef _WIN32
{ "d3d11", "D3D11" },
#endif
{ "none", "None" },
{ NULL, NULL },
},
"Cross"
"auto"
},
{
"ppsspp_analog_is_circular",
"Analog Circle vs Square Gate Compensation",
"ppsspp_software_rendering",
"Software Rendering",
NULL,
"Slow, accurate. Core restart required.",
NULL,
NULL,
"system",
"video",
BOOL_OPTIONS,
"disabled"
},
{
"ppsspp_memstick_inserted",
"Memory Stick Inserted",
NULL,
"Some games require ejecting/inserting the Memory Stick.",
NULL,
"system",
BOOL_OPTIONS,
"enabled"
},
{
"ppsspp_internal_resolution",
"Internal Resolution (Restart)",
NULL,
"Rendering Resolution",
NULL,
"Core restart required with Vulkan.",
NULL,
"video",
{
{ "480x272", NULL },
{ "960x544", NULL },
{ "1440x816", NULL },
{ "1920x1088", NULL },
{ "2400x1360", NULL },
{ "2880x1632", NULL },
{ "3360x1904", NULL },
{ "3840x2176", NULL },
{ "4320x2448", NULL },
{ "4800x2720", NULL },
{ "480x272", "1x (480x272)" },
{ "960x544", "2x (960x544)" },
{ "1440x816", "3x (1440x816)" },
{ "1920x1088", "4x (1920x1088)" },
{ "2400x1360", "5x (2400x1360)" },
{ "2880x1632", "6x (2880x1632)" },
{ "3360x1904", "7x (3360x1904)" },
{ "3840x2176", "8x (3840x2176)" },
{ "4320x2448", "9x (4320x2448)" },
{ "4800x2720", "10x (4800x2720)" },
{ NULL, NULL },
},
"480x272"
@ -328,14 +345,14 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
#endif
{
"ppsspp_skip_gpu_readbacks",
"Skip GPU Readbacks",
"ppsspp_cropto16x9",
"Crop to 16x9",
NULL,
"Some games require GPU readbacks, so be careful.",
"Remove one line from top and bottom to get exact 16:9. Core restart required with Vulkan.",
NULL,
"video",
BOOL_OPTIONS,
"disabled"
"enabled"
},
{
"ppsspp_frameskip",
@ -384,7 +401,7 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
{
"ppsspp_frame_duplication",
"Duplicate Frames in 30 Hz Games",
"Render Duplicate Frames to 60 Hz",
NULL,
"Can make framerate smoother in games that run at lower framerates.",
NULL,
@ -394,9 +411,9 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
{
"ppsspp_detect_vsync_swap_interval",
"Detect Frame Rate Changes (Notify frontend)",
NULL,
"Detect Frame Rate Changes",
NULL,
"Notify frontend.",
NULL,
"video",
BOOL_OPTIONS,
@ -404,9 +421,9 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
{
"ppsspp_inflight_frames",
"Buffered Frames (GL/Vulkan only, slower, less lag, restart)",
NULL,
"Buffer Graphics Commands",
NULL,
"GL/Vulkan only, slower, less lag, restart.",
NULL,
"video",
{
@ -417,6 +434,101 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
"Up to 2"
},
{
"ppsspp_button_preference",
"Confirmation Button",
NULL,
NULL,
NULL,
"input",
{
{ "Cross", NULL },
{ "Circle", NULL },
{ NULL, NULL },
},
"Cross"
},
{
"ppsspp_analog_is_circular",
"Analog Circle vs Square Gate Compensation",
NULL,
NULL,
NULL,
"input",
BOOL_OPTIONS,
"disabled"
},
{
"ppsspp_skip_buffer_effects",
"Skip Buffer Effects",
NULL,
"Faster, but nothing may draw in some games.",
NULL,
"hacks",
BOOL_OPTIONS,
"disabled"
},
{
"ppsspp_disable_range_culling",
"Disable Culling",
NULL,
"",
NULL,
"hacks",
BOOL_OPTIONS,
"disabled"
},
{
"ppsspp_skip_gpu_readbacks",
"Skip GPU Readbacks",
NULL,
"Some games require GPU readbacks, so be careful.",
NULL,
"hacks",
BOOL_OPTIONS,
"disabled"
},
{
"ppsspp_lazy_texture_caching",
"Lazy Texture Caching (Speedup)",
NULL,
"Faster, but can cause text problems in a few games.",
NULL,
"hacks",
BOOL_OPTIONS,
"disabled"
},
{
"ppsspp_spline_quality",
"Spline/Bezier Curves Quality",
NULL,
"Only used by some games, controls smoothness of curves.",
NULL,
"hacks",
{
{ "Low", NULL },
{ "Medium", NULL },
{ "High", NULL },
{ NULL, NULL },
},
"High"
},
{
"ppsspp_lower_resolution_for_effects",
"Lower Resolution for Effects",
NULL,
"Reduces artifacts.",
NULL,
"hacks",
{
{ "disabled", NULL },
{ "Safe", NULL },
{ "Balanced", NULL },
{ "Aggressive", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"ppsspp_gpu_hardware_transform",
"Hardware Transform",
@ -437,41 +549,6 @@ struct retro_core_option_v2_definition option_defs_us[] = {
BOOL_OPTIONS,
"enabled"
},
{
"ppsspp_vertex_cache",
"Vertex Cache",
NULL,
"Faster, but may cause temporary flicker.",
NULL,
"video",
BOOL_OPTIONS,
"disabled"
},
{
"ppsspp_lazy_texture_caching",
"Lazy Texture Caching (Speedup)",
NULL,
"Faster, but can cause text problems in a few games.",
NULL,
"video",
BOOL_OPTIONS,
"disabled"
},
{
"ppsspp_spline_quality",
"Spline/Bezier Curves Quality",
NULL,
"Only used by some games, controls smoothness of curves.",
NULL,
"video",
{
{ "Low", NULL },
{ "Medium", NULL },
{ "High", NULL },
{ NULL, NULL },
},
"High"
},
{
"ppsspp_hardware_tesselation",
"Hardware Tesselation",
@ -483,24 +560,18 @@ struct retro_core_option_v2_definition option_defs_us[] = {
"disabled"
},
{
"ppsspp_lower_resolution_for_effects",
"Lower Resolution for Effects",
NULL,
"ppsspp_vertex_cache",
"Vertex Cache",
NULL,
"Faster, but may cause temporary flicker.",
NULL,
"video",
{
{ "disabled", NULL },
{ "Safe", NULL },
{ "Balanced", NULL },
{ "Aggressive", NULL },
{ NULL, NULL },
},
BOOL_OPTIONS,
"disabled"
},
{
"ppsspp_texture_scaling_type",
"Texture Scaling Type",
"Texture Upscale Type",
NULL,
NULL,
NULL,
@ -516,7 +587,7 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
{
"ppsspp_texture_scaling_level",
"Texture Scaling Level",
"Texture Upscaling Level",
NULL,
"CPU heavy, some scaling may be delayed to avoid stutter.",
NULL,
@ -543,9 +614,9 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
{
"ppsspp_texture_shader",
"Texture Shader (Vulkan only, overrides 'Texture Scaling Type')",
NULL,
"Texture Shader",
NULL,
"Vulkan only, overrides 'Texture Scaling Type'.",
NULL,
"video",
{

View File

@ -125,14 +125,17 @@ 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) {
int w = g_Config.iInternalResolution * 480;
int h = g_Config.iInternalResolution * 272;
int w = g_Config.iInternalResolution * NATIVEWIDTH;
int h = g_Config.iInternalResolution * NATIVEHEIGHT;
pSurfaceCapabilities->minImageExtent.width = w;
pSurfaceCapabilities->minImageExtent.height = h;
pSurfaceCapabilities->maxImageExtent.width = w;
pSurfaceCapabilities->maxImageExtent.height = h;
pSurfaceCapabilities->currentExtent.width = w;
if (g_Config.bDisplayCropTo16x9)
h -= g_Config.iInternalResolution * 2;
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;

View File

@ -29,6 +29,7 @@
#include "ext/vulkan/vulkan.h"
#include "libretro.h"
#include "LibretroGraphicsContext.h"
#define RETRO_HW_RENDER_INTERFACE_VULKAN_VERSION 5
#define RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN_VERSION 1