Unverified Commit d1e7be8b authored by barbudreadmon's avatar barbudreadmon Committed by GitHub
Browse files

Revert "improve context requests"

parent 012d5bb6
This diff is collapsed.
......@@ -416,47 +416,6 @@ void retro_reset() {
context_reset(); // Force the renderer to appear
}
static bool try_init_context(retro_hw_context_type context_type)
{
emu_instance->hw_render.context_type = context_type;
emu_instance->hw_render.context_reset = context_reset;
emu_instance->hw_render.context_destroy = context_destroy;
emu_instance->hw_render.cache_context = false;
emu_instance->hw_render.bottom_left_origin = true;
switch (context_type) {
case RETRO_HW_CONTEXT_OPENGL_CORE:
// minimum requirements to run is opengl 3.3 (RA will try to use highest version available anyway)
emu_instance->hw_render.version_major = 3;
emu_instance->hw_render.version_minor = 3;
if (LibRetro::SetHWRenderer(&emu_instance->hw_render))
return true;
break;
case RETRO_HW_CONTEXT_OPENGL:
// when using RETRO_HW_CONTEXT_OPENGL you can't set version above 3.0 (RA will try to use highest version available anyway)
emu_instance->hw_render.version_major = 3;
emu_instance->hw_render.version_minor = 0;
if (LibRetro::SetHWRenderer(&emu_instance->hw_render))
return true;
break;
}
return false;
}
static bool init_hw_context()
{
retro_hw_context_type preferred_context = LibRetro::GetPreferredHWContext();
bool found_context = false;
// try requesting the right context for current driver
if (preferred_context == RETRO_HW_CONTEXT_OPENGL || preferred_context == RETRO_HW_CONTEXT_OPENGL_CORE)
found_context = try_init_context(preferred_context);
// if not found, try requesting every compatible context
if (!found_context)
found_context = try_init_context(RETRO_HW_CONTEXT_OPENGL_CORE);
if (!found_context)
found_context = try_init_context(RETRO_HW_CONTEXT_OPENGL);
return found_context;
}
/**
* libretro callback; Called when a game is to be loaded.
*/
......@@ -465,8 +424,6 @@ bool retro_load_game(const struct retro_game_info* info) {
LibRetro::settings.file_path = info->path;
// why is "hw shared context" force-enabled here ? i can't find any issue when it's disabled
// i'm not gonna change this, but for the reminder, it's adding rendering latency -barbudreadmon
LibRetro::SetHWSharedContext();
if (!LibRetro::SetPixelFormat(RETRO_PIXEL_FORMAT_XRGB8888)) {
......@@ -475,7 +432,14 @@ bool retro_load_game(const struct retro_game_info* info) {
return false;
}
if (!init_hw_context()) {
emu_instance->hw_render.context_type = RETRO_HW_CONTEXT_OPENGL_CORE;
emu_instance->hw_render.version_major = 3;
emu_instance->hw_render.version_minor = 3;
emu_instance->hw_render.context_reset = context_reset;
emu_instance->hw_render.context_destroy = context_destroy;
emu_instance->hw_render.cache_context = false;
emu_instance->hw_render.bottom_left_origin = true;
if (!LibRetro::SetHWRenderer(&emu_instance->hw_render)) {
LOG_CRITICAL(Frontend, "OpenGL 3.3 is not supported.");
LibRetro::DisplayMessage("OpenGL 3.3 is not supported.");
return false;
......
......@@ -24,13 +24,6 @@ void UploadVideoFrame(const void* data, unsigned width, unsigned height, size_t
return video_cb(data, width, height, pitch);
}
retro_hw_context_type GetPreferredHWContext() {
retro_hw_context_type preferred_context;
if (!environ_cb(RETRO_ENVIRONMENT_GET_PREFERRED_HW_RENDER, &preferred_context))
preferred_context = RETRO_HW_CONTEXT_DUMMY;
return preferred_context;
}
bool SetHWSharedContext() {
return environ_cb(RETRO_ENVIRONMENT_SET_HW_SHARED_CONTEXT, NULL);
}
......
......@@ -25,8 +25,6 @@ void PollInput();
/// Sets the environmental variables used for settings.
bool SetVariables(const retro_variable vars[]);
retro_hw_context_type GetPreferredHWContext();
bool SetHWSharedContext(void);
/// Returns the LibRetro save directory, or a empty string if one doesn't exist.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment