Reimplement shader flags being set - GL core should have only

Slang support and no GLSL, with the GL2 driver it is dependent
on the context driver
This commit is contained in:
twinaphex 2019-03-13 14:06:09 +01:00
parent a8a7fba2ca
commit b347b26d61
20 changed files with 107 additions and 34 deletions

View File

@ -4129,43 +4129,12 @@ static float gl2_get_refresh_rate(void *data)
static uint32_t gl2_get_flags(void *data)
{
unsigned i;
uint32_t shader_driver_count = 0;
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_HARD_SYNC);
BIT32_SET(flags, GFX_CTX_FLAGS_BLACK_FRAME_INSERTION);
BIT32_SET(flags, GFX_CTX_FLAGS_MENU_FRAME_FILTERING);
#ifdef HAVE_GLSL
shader_driver_count++;
#endif
#ifdef HAVE_CG
shader_driver_count++;
#endif
#ifdef HAVE_GLSL
for (i = 0; i < shader_driver_count; i++)
{
if (string_is_equal(gl2_shader_ctx_drivers[i]->ident, "glsl"))
{
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
break;
}
}
#endif
#ifdef HAVE_CG
for (i = 0; i < shader_driver_count; i++)
{
if (string_is_equal(gl2_shader_ctx_drivers[i]->ident, "cg"))
{
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_CG);
break;
}
}
#endif
return flags;
}

View File

@ -590,6 +590,24 @@ static uint32_t android_gfx_ctx_get_flags(void *data)
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
switch (android_api)
{
case GFX_CTX_OPENGL_API:
case GFX_CTX_OPENGL_ES_API:
#ifdef HAVE_GLSL
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
#endif
break;
case GFX_CTX_VULKAN_API:
#ifdef HAVE_SLANG
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
#endif
break;
case GFX_CTX_NONE:
default:
break;
}
return flags;
}

View File

@ -326,7 +326,7 @@ error:
static uint32_t gfx_ctx_cgl_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
return flags;
}

View File

@ -112,6 +112,24 @@ static uint32_t cocoagl_gfx_ctx_get_flags(void *data)
if (cocoa_ctx->core_hw_context_enable)
BIT32_SET(flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT);
switch (cocoagl_api)
{
case GFX_CTX_OPENGL_API:
if (string_is_equal(video_driver_get_ident(), "gl1")) { }
else if (string_is_equal(video_driver_get_ident(), "glcore")) { }
else
{
#ifdef HAVE_GLSL
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
#endif
}
break;
case GFX_CTX_VULKAN_API:
break;
default:
break;
}
return flags;
}

View File

@ -909,6 +909,8 @@ static uint32_t gfx_ctx_drm_get_flags(void *data)
if (drm->core_hw_context_enable)
BIT32_SET(flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT);
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
return flags;
}

View File

@ -359,7 +359,7 @@ static void gfx_ctx_emscripten_bind_hw_render(void *data, bool enable)
static uint32_t gfx_ctx_emscripten_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
return flags;
}

View File

@ -223,6 +223,9 @@ static uint32_t gfx_ctx_khr_display_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
#ifdef HAVE_SLANG
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
#endif
return flags;
}

View File

@ -287,6 +287,7 @@ static uint32_t gfx_ctx_mali_fbdev_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
return flags;
}

View File

@ -255,6 +255,7 @@ static uint32_t gfx_ctx_opendingux_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
return flags;
}

View File

@ -261,6 +261,7 @@ static uint32_t orbis_ctx_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
return flags;
}

View File

@ -380,7 +380,7 @@ static uint32_t osmesa_ctx_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
(void)data;
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
return flags;
}

View File

@ -406,6 +406,9 @@ static uint32_t gfx_ctx_ps3_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
#ifdef HAVE_CG
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_CG);
#endif
return flags;
}

View File

@ -453,6 +453,7 @@ static uint32_t gfx_ctx_qnx_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
return flags;
}

View File

@ -268,6 +268,9 @@ static uint32_t switch_ctx_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
#ifdef HAVE_GLSL
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
#endif
return flags;
}

View File

@ -697,6 +697,7 @@ static uint32_t gfx_ctx_vc_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_CUSTOMIZABLE_SWAPCHAIN_IMAGES);
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
return flags;
}

View File

@ -262,6 +262,7 @@ static uint32_t gfx_ctx_vivante_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
return flags;
}

View File

@ -1894,6 +1894,20 @@ static uint32_t gfx_ctx_wl_get_flags(void *data)
else
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
switch (wl_api)
{
case GFX_CTX_OPENGL_API:
case GFX_CTX_OPENGL_ES_API:
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
break;
case GFX_CTX_VULKAN_API:
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_VULKAN);
break;
case GFX_CTX_NONE:
default:
break;
}
return flags;
}

View File

@ -810,6 +810,25 @@ static uint32_t gfx_ctx_wgl_get_flags(void *data)
{
BIT32_SET(flags, GFX_CTX_FLAGS_GL_CORE_CONTEXT);
}
if (string_is_equal(video_driver_get_ident(), "gl1")) { }
else if (string_is_equal(video_driver_get_ident(), "glcore")) { }
else
{
#ifdef HAVE_CG
if (!win32_core_hw_context_enable)
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_CG);
#endif
#ifdef HAVE_GLSL
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
#endif
}
break;
case GFX_CTX_VULKAN_API:
#ifdef HAVE_SLANG
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
#endif
break;
case GFX_CTX_NONE:
default:

View File

@ -1169,6 +1169,23 @@ static uint32_t gfx_ctx_x_get_flags(void *data)
{
BIT32_SET(flags, GFX_CTX_FLAGS_MULTISAMPLING);
}
if (string_is_equal(video_driver_get_ident(), "gl1")) { }
else if (string_is_equal(video_driver_get_ident(), "glcore")) { }
else
{
#ifdef HAVE_CG
if (!(x->core_hw_context_enable || x->g_core_es))
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_CG);
#endif
#ifdef HAVE_GLSL
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
#endif
}
break;
case GFX_CTX_VULKAN_API:
#ifdef HAVE_SLANG
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_SLANG);
#endif
break;
case GFX_CTX_NONE:
default:

View File

@ -604,6 +604,7 @@ static uint32_t gfx_ctx_xegl_get_flags(void *data)
{
uint32_t flags = 0;
BIT32_SET(flags, GFX_CTX_FLAGS_NONE);
BIT32_SET(flags, GFX_CTX_FLAGS_SHADERS_GLSL);
return flags;
}