Revert "(core_info.c) Cleanup"

This reverts commit ab8f3115dad8f30a4d53edb81b4c9976fdf9d0ad.
This commit is contained in:
twinaphex 2020-07-26 23:11:53 +02:00
parent b604200730
commit 26d915c1f2

View File

@ -1321,7 +1321,6 @@ bool core_info_hw_api_supported(core_info_t *info)
unsigned j = 0;
bool found_major = false;
bool found_minor = false;
bool found_match = false;
enum compare_op op = COMPARE_OP_GREATER_EQUAL;
enum api_parse_state state = STATE_API_NAME;
@ -1421,114 +1420,89 @@ bool core_info_hw_api_supported(core_info_t *info)
fflush(stdout);
#endif
switch (sys_api)
{
case GFX_CTX_OPENGL_API:
if ( (string_is_equal_noncase(api_str, "opengl") )
|| (string_is_equal_noncase(api_str, "openglcompat"))
|| (string_is_equal_noncase(api_str, "openglcompatibility"))
)
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);
sscanf(sys_api_version_str, "%d.%d", &sys_api_version_major, &sys_api_version_minor);
found_match = true;
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"))
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);
sscanf(sys_api_version_str, "%d.%d", &sys_api_version_major, &sys_api_version_minor);
found_match = true;
if (core_info_compare_api_version(sys_api_version_major, sys_api_version_minor, major, minor, op))
return true;
}
break;
case GFX_CTX_OPENGL_ES_API:
if (string_is_equal_noncase(api_str, "opengles"))
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);
sscanf(sys_api_version_str, "OpenGL ES %d.%d", &sys_api_version_major, &sys_api_version_minor);
found_match = true;
if (core_info_compare_api_version(sys_api_version_major, sys_api_version_minor, major, minor, op))
return true;
}
break;
case GFX_CTX_DIRECT3D8_API:
if (string_is_equal_noncase(api_str, "direct3d8"))
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;
found_match = true;
if (core_info_compare_api_version(sys_api_version_major, sys_api_version_minor, major, minor, op))
return true;
}
break;
case GFX_CTX_DIRECT3D9_API:
if (string_is_equal_noncase(api_str, "direct3d9"))
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;
found_match = true;
if (core_info_compare_api_version(sys_api_version_major, sys_api_version_minor, major, minor, op))
return true;
}
break;
case GFX_CTX_DIRECT3D10_API:
if (string_is_equal_noncase(api_str, "direct3d10"))
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;
found_match = true;
if (core_info_compare_api_version(sys_api_version_major, sys_api_version_minor, major, minor, op))
return true;
}
case GFX_CTX_DIRECT3D11_API:
if (string_is_equal_noncase(api_str, "direct3d11"))
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;
found_match = true;
if (core_info_compare_api_version(sys_api_version_major, sys_api_version_minor, major, minor, op))
return true;
}
break;
case GFX_CTX_DIRECT3D12_API:
if (string_is_equal_noncase(api_str, "direct3d12"))
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;
found_match = true;
}
break;
case GFX_CTX_VULKAN_API:
if (string_is_equal_noncase(api_str, "vulkan"))
{
sscanf(sys_api_version_str, "%d.%d",
&sys_api_version_major, &sys_api_version_minor);
found_match = true;
}
break;
case GFX_CTX_METAL_API:
if (string_is_equal_noncase(api_str, "metal"))
{
sscanf(sys_api_version_str, "%d.%d",
&sys_api_version_major, &sys_api_version_minor);
found_match = true;
}
break;
case GFX_CTX_OPENVG_API:
/* TODO/FIXME - implement */
break;
case GFX_CTX_NONE:
break;
}
if (found_match)
if (core_info_compare_api_version(sys_api_version_major,
sys_api_version_minor, major, minor, op))
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