Remove unused core_info_hw_api_supported

This commit is contained in:
libretroadmin 2022-07-17 08:10:01 +02:00
parent 113b9e96d1
commit 27704a18de
2 changed files with 0 additions and 321 deletions

View File

@ -1258,16 +1258,6 @@ bool core_info_cache_force_refresh(const char *path_info)
/* Core Info Cache END */ /* Core Info Cache END */
/***********************/ /***********************/
enum compare_op
{
COMPARE_OP_EQUAL = 0,
COMPARE_OP_NOT_EQUAL,
COMPARE_OP_LESS,
COMPARE_OP_LESS_EQUAL,
COMPARE_OP_GREATER,
COMPARE_OP_GREATER_EQUAL
};
typedef struct typedef struct
{ {
const char *path; const char *path;
@ -2808,315 +2798,6 @@ void core_info_qsort(core_info_list_t *core_info_list,
} }
} }
static bool core_info_compare_api_version(
int sys_major, int sys_minor,
int major, int minor, enum compare_op op)
{
switch (op)
{
case COMPARE_OP_EQUAL:
if (sys_major == major && sys_minor == minor)
return true;
break;
case COMPARE_OP_NOT_EQUAL:
if (!(sys_major == major && sys_minor == minor))
return true;
break;
case COMPARE_OP_LESS:
if ( sys_major < major
|| (sys_major == major && sys_minor < minor))
return true;
break;
case COMPARE_OP_LESS_EQUAL:
if ( sys_major < major
|| (sys_major == major && sys_minor <= minor))
return true;
break;
case COMPARE_OP_GREATER:
if ( sys_major > major
|| (sys_major == major && sys_minor > minor))
return true;
break;
case COMPARE_OP_GREATER_EQUAL:
if ( sys_major > major
|| (sys_major == major && sys_minor >= minor))
return true;
break;
default:
break;
}
return false;
}
bool core_info_hw_api_supported(core_info_t *info)
{
#ifdef RARCH_INTERNAL
unsigned i;
enum gfx_ctx_api sys_api;
int sys_api_version_major = 0;
int sys_api_version_minor = 0;
const char *sys_api_version_str = video_driver_get_gpu_api_version_string();
gfx_ctx_flags_t sys_flags = video_driver_get_flags_wrapper();
enum api_parse_state
{
STATE_API_NAME,
STATE_API_COMPARE_OP,
STATE_API_VERSION
};
if ( !info
|| !info->required_hw_api_list
|| info->required_hw_api_list->size == 0)
return true;
sys_api = video_context_driver_get_api();
for (i = 0; i < info->required_hw_api_list->size; i++)
{
char api_str[32] = {0};
char version[16] = {0};
char major_str[16] = {0};
char minor_str[16] = {0};
const char *cur_api = info->required_hw_api_list->elems[i].data;
int api_pos = 0;
int major_str_pos = 0;
int minor_str_pos = 0;
int major = 0;
int minor = 0;
unsigned cur_api_len = 0;
unsigned j = 0;
bool found_major = false;
bool found_minor = false;
enum compare_op op = COMPARE_OP_GREATER_EQUAL;
enum api_parse_state state = STATE_API_NAME;
if (string_is_empty(cur_api))
continue;
cur_api_len = (int)strlen(cur_api);
for (j = 0; j < cur_api_len; j++)
{
if (cur_api[j] == ' ')
continue;
switch (state)
{
case STATE_API_NAME:
{
if ( ISUPPER((unsigned char)cur_api[j]) ||
ISLOWER((unsigned char)cur_api[j]))
api_str[api_pos++] = cur_api[j];
else
{
j--;
state = STATE_API_COMPARE_OP;
break;
}
break;
}
case STATE_API_COMPARE_OP:
{
if ( j < cur_api_len - 1
&& !( cur_api[j] >= '0'
&& cur_api[j] <= '9'))
{
if ( cur_api[j] == '='
&& cur_api[j + 1] == '=')
{
op = COMPARE_OP_EQUAL;
j++;
}
else if (cur_api[j] == '=')
op = COMPARE_OP_EQUAL;
else if (cur_api[j] == '!'
&& cur_api[j + 1] == '=')
{
op = COMPARE_OP_NOT_EQUAL;
j++;
}
else if (cur_api[j] == '<'
&& cur_api[j + 1] == '=')
{
op = COMPARE_OP_LESS_EQUAL;
j++;
}
else if (cur_api[j] == '>'
&& cur_api[j + 1] == '=')
{
op = COMPARE_OP_GREATER_EQUAL;
j++;
}
else if (cur_api[j] == '<')
op = COMPARE_OP_LESS;
else if (cur_api[j] == '>')
op = COMPARE_OP_GREATER;
}
state = STATE_API_VERSION;
break;
}
case STATE_API_VERSION:
{
if ( !found_minor
&& cur_api[j] >= '0'
&& cur_api[j] <= '9'
&& cur_api[j] != '.')
{
found_major = true;
if (major_str_pos < sizeof(major_str) - 1)
major_str[major_str_pos++] = cur_api[j];
}
else if (
found_major
&& found_minor
&& cur_api[j] >= '0'
&& cur_api[j] <= '9')
{
if (minor_str_pos < sizeof(minor_str) - 1)
minor_str[minor_str_pos++] = cur_api[j];
}
else if (cur_api[j] == '.')
found_minor = true;
break;
}
default:
break;
}
}
sscanf(major_str, "%d", &major);
sscanf(minor_str, "%d", &minor);
snprintf(version, sizeof(version), "%d.%d", major, minor);
#if 0
printf("Major: %d\n", major);
printf("Minor: %d\n", minor);
printf("API: %s\n", api_str);
printf("Version: %s\n", version);
fflush(stdout);
#endif
if ( (string_is_equal_noncase(api_str, "opengl")
&& sys_api == GFX_CTX_OPENGL_API) ||
(string_is_equal_noncase(api_str, "openglcompat")
&& sys_api == GFX_CTX_OPENGL_API) ||
(string_is_equal_noncase(api_str, "openglcompatibility")
&& sys_api == GFX_CTX_OPENGL_API)
)
{
/* system is running a core context while compat is requested */
if (sys_flags.flags & (1 << GFX_CTX_FLAGS_GL_CORE_CONTEXT))
return false;
sscanf(sys_api_version_str, "%d.%d",
&sys_api_version_major, &sys_api_version_minor);
if (core_info_compare_api_version(sys_api_version_major,
sys_api_version_minor, major, minor, op))
return true;
}
else if (string_is_equal_noncase(api_str, "openglcore")
&& sys_api == GFX_CTX_OPENGL_API)
{
sscanf(sys_api_version_str, "%d.%d",
&sys_api_version_major, &sys_api_version_minor);
if (core_info_compare_api_version(sys_api_version_major,
sys_api_version_minor, major, minor, op))
return true;
}
else if (string_is_equal_noncase(api_str, "opengles")
&& sys_api == GFX_CTX_OPENGL_ES_API)
{
sscanf(sys_api_version_str, "OpenGL ES %d.%d",
&sys_api_version_major, &sys_api_version_minor);
if (core_info_compare_api_version(sys_api_version_major,
sys_api_version_minor, major, minor, op))
return true;
}
else if (string_is_equal_noncase(api_str, "direct3d8")
&& sys_api == GFX_CTX_DIRECT3D8_API)
{
sys_api_version_major = 8;
sys_api_version_minor = 0;
if (core_info_compare_api_version(sys_api_version_major,
sys_api_version_minor, major, minor, op))
return true;
}
else if (string_is_equal_noncase(api_str, "direct3d9")
&& sys_api == GFX_CTX_DIRECT3D9_API)
{
sys_api_version_major = 9;
sys_api_version_minor = 0;
if (core_info_compare_api_version(sys_api_version_major,
sys_api_version_minor, major, minor, op))
return true;
}
else if (string_is_equal_noncase(api_str, "direct3d10")
&& sys_api == GFX_CTX_DIRECT3D10_API)
{
sys_api_version_major = 10;
sys_api_version_minor = 0;
if (core_info_compare_api_version(sys_api_version_major,
sys_api_version_minor, major, minor, op))
return true;
}
else if (string_is_equal_noncase(api_str, "direct3d11")
&& sys_api == GFX_CTX_DIRECT3D11_API)
{
sys_api_version_major = 11;
sys_api_version_minor = 0;
if (core_info_compare_api_version(sys_api_version_major, sys_api_version_minor, major, minor, op))
return true;
}
else if (string_is_equal_noncase(api_str, "direct3d12")
&& sys_api == GFX_CTX_DIRECT3D12_API)
{
sys_api_version_major = 12;
sys_api_version_minor = 0;
if (core_info_compare_api_version(sys_api_version_major,
sys_api_version_minor, major, minor, op))
return true;
}
else if (string_is_equal_noncase(api_str, "vulkan")
&& sys_api == GFX_CTX_VULKAN_API)
{
sscanf(sys_api_version_str, "%d.%d",
&sys_api_version_major, &sys_api_version_minor);
if (core_info_compare_api_version(sys_api_version_major,
sys_api_version_minor, major, minor, op))
return true;
}
else if (string_is_equal_noncase(api_str, "metal")
&& sys_api == GFX_CTX_METAL_API)
{
sscanf(sys_api_version_str, "%d.%d",
&sys_api_version_major, &sys_api_version_minor);
if (core_info_compare_api_version(sys_api_version_major,
sys_api_version_minor, major, minor, op))
return true;
}
}
return false;
#else
return true;
#endif
}
bool core_info_current_supports_savestate(void) bool core_info_current_supports_savestate(void)
{ {
core_info_state_t *p_coreinfo = &core_info_st; core_info_state_t *p_coreinfo = &core_info_st;

View File

@ -202,8 +202,6 @@ void core_info_qsort(core_info_list_t *core_info_list, enum core_info_list_qsort
bool core_info_list_get_info(core_info_list_t *core_info_list, bool core_info_list_get_info(core_info_list_t *core_info_list,
core_info_t *out_info, const char *core_path); core_info_t *out_info, const char *core_path);
bool core_info_hw_api_supported(core_info_t *info);
/* Convenience wrapper functions used to interpret /* Convenience wrapper functions used to interpret
* the 'savestate_support_level' parameter of * the 'savestate_support_level' parameter of
* the currently loaded core. If no core is * the currently loaded core. If no core is