diff --git a/gfx/drivers/gl2.c b/gfx/drivers/gl2.c index eaa0d4e9ae9..415d1aae718 100644 --- a/gfx/drivers/gl2.c +++ b/gfx/drivers/gl2.c @@ -92,6 +92,16 @@ #define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 #endif +#if defined(HAVE_OPENGLES2) +#define GL2_DEFAULT_SHADER_TYPE RARCH_SHADER_GLSL +#elif defined(HAVE_GLSL) +#define GL2_DEFAULT_SHADER_TYPE RARCH_SHADER_GLSL +#elif defined(HAVE_CG) +#define GL2_DEFAULT_SHADER_TYPE RARCH_SHADER_CG +#else +#define GL2_DEFAULT_SHADER_TYPE RARCH_SHADER_NONE +#endif + #if defined(HAVE_PSGL) #define RARCH_GL_FRAMEBUFFER GL_FRAMEBUFFER_OES #define RARCH_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES @@ -2974,7 +2984,7 @@ static enum rarch_shader_type gl2_get_fallback_shader_type(enum rarch_shader_typ if (type != RARCH_SHADER_CG && type != RARCH_SHADER_GLSL) { - type = DEFAULT_SHADER_TYPE; + type = GL2_DEFAULT_SHADER_TYPE; if (type != RARCH_SHADER_CG && type != RARCH_SHADER_GLSL) type = RARCH_SHADER_GLSL; diff --git a/gfx/drivers/gl3.c b/gfx/drivers/gl3.c index d4a333655e0..82d42afb973 100644 --- a/gfx/drivers/gl3.c +++ b/gfx/drivers/gl3.c @@ -69,6 +69,14 @@ coords[5] = yamt; \ coords[7] = yamt +#if defined(HAVE_SLANG) +#define GL3_DEFAULT_SHADER_TYPE RARCH_SHADER_SLANG +#elif defined(HAVE_GLSL) +#define GL3_DEFAULT_SHADER_TYPE RARCH_SHADER_GLSL +#else +#define GL3_DEFAULT_SHADER_TYPE RARCH_SHADER_NONE +#endif + struct gl3_streamed_texture { GLuint tex; @@ -2128,38 +2136,38 @@ static bool gl3_init_pipelines(gl3_t *gl) **/ static enum rarch_shader_type gl3_get_fallback_shader_type(enum rarch_shader_type type) { -#if defined(HAVE_SLANG) || defined(HAVE_GLSL) || defined(HAVE_CG) +#if defined(HAVE_SLANG) || defined(HAVE_GLSL) int i; gfx_ctx_flags_t flags; flags.flags = 0; video_context_driver_get_flags(&flags); - if (type != RARCH_SHADER_CG && type != RARCH_SHADER_GLSL && type != RARCH_SHADER_SLANG) + /* No context driver advertises GFX_CTX_FLAGS_SHADERS_CG for the + * "glcore" video driver -- audited x_ctx.c, wgl_ctx.c, drm_ctx.c, + * wayland_ctx.c, etc. Cg requires the legacy fixed-function / ARB + * asm pipeline that Core Profile contexts don't expose, so no + * RARCH_SHADER_CG path is wired up here. GLSL and slang are both + * Core Profile-compatible and remain valid; in practice context + * drivers advertise SLANG for glcore but the GLSL fallback is kept + * for builds without slang/spirv-cross. */ + if (type != RARCH_SHADER_GLSL && type != RARCH_SHADER_SLANG) { - type = DEFAULT_SHADER_TYPE; + type = GL3_DEFAULT_SHADER_TYPE; - if (type != RARCH_SHADER_CG && type != RARCH_SHADER_GLSL && type != RARCH_SHADER_SLANG) + if (type != RARCH_SHADER_GLSL && type != RARCH_SHADER_SLANG) type = RARCH_SHADER_SLANG; } - for (i = 0; i < 3; i++) + for (i = 0; i < 2; i++) { switch (type) { - case RARCH_SHADER_CG: -#ifdef HAVE_CG - if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_CG)) - return type; -#endif - type = RARCH_SHADER_SLANG; - break; - case RARCH_SHADER_GLSL: #ifdef HAVE_GLSL if (BIT32_GET(flags.flags, GFX_CTX_FLAGS_SHADERS_GLSL)) return type; #endif - type = RARCH_SHADER_CG; + type = RARCH_SHADER_SLANG; break; case RARCH_SHADER_SLANG: @@ -2231,11 +2239,6 @@ static const shader_backend_t *gl3_shader_driver_set_backend( switch (fallback) { -#ifdef HAVE_CG - case RARCH_SHADER_CG: - RARCH_LOG("[GLCore] Using Cg shader backend.\n"); - return &gl_cg_backend; -#endif #ifdef HAVE_GLSL case RARCH_SHADER_GLSL: RARCH_LOG("[GLCore] Using GLSL shader backend.\n"); diff --git a/gfx/video_crt_switch.c b/gfx/video_crt_switch.c index 8c70e51f3c4..6f83e44df7b 100644 --- a/gfx/video_crt_switch.c +++ b/gfx/video_crt_switch.c @@ -111,8 +111,7 @@ static void crt_aspect_ratio_switch( video_st->current_video->set_viewport( video_st->data, width, height, true, true); - video_driver_apply_state_changes(); - + command_event(CMD_EVENT_VIDEO_APPLY_STATE_CHANGES, NULL); } static void crt_switch_set_aspect( @@ -419,7 +418,7 @@ static void switch_res_crt( 1.0f, false); video_driver_set_output_size(width , height); - video_driver_apply_state_changes(); + command_event(CMD_EVENT_VIDEO_APPLY_STATE_CHANGES, NULL); } } #endif @@ -517,7 +516,7 @@ void crt_switch_res_core( float fly_aspect = (float)p_switch->fly_aspect; RARCH_LOG("[CRT] Restoring aspect ratio: %f.\n", fly_aspect); video_st->aspect_ratio = fly_aspect; - video_driver_apply_state_changes(); + command_event(CMD_EVENT_VIDEO_APPLY_STATE_CHANGES, NULL); } } } diff --git a/gfx/video_driver.h b/gfx/video_driver.h index f9d0dc9cc35..7489e630521 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -63,20 +63,6 @@ #define VIDEO_SHADER_STOCK_NOBLEND (GFX_MAX_SHADERS - 10) #define VIDEO_SHADER_STOCK_BLEND_HDR (GFX_MAX_SHADERS - 11) -#if defined(_XBOX360) -#define DEFAULT_SHADER_TYPE RARCH_SHADER_HLSL -#elif defined(HAVE_OPENGLES2) -#define DEFAULT_SHADER_TYPE RARCH_SHADER_GLSL -#elif defined(HAVE_SLANG) -#define DEFAULT_SHADER_TYPE RARCH_SHADER_SLANG -#elif defined(HAVE_GLSL) -#define DEFAULT_SHADER_TYPE RARCH_SHADER_GLSL -#elif defined(HAVE_CG) -#define DEFAULT_SHADER_TYPE RARCH_SHADER_CG -#else -#define DEFAULT_SHADER_TYPE RARCH_SHADER_NONE -#endif - #ifndef MAX_EGLIMAGE_TEXTURES #define MAX_EGLIMAGE_TEXTURES 32 #endif