include catmull-rom shader and make it the default in case no shader files were found

This commit is contained in:
FunkyFr3sh 2023-03-29 00:49:11 +02:00
parent 5209952831
commit 708ff015cd
2 changed files with 170 additions and 14 deletions

View file

@ -165,25 +165,31 @@ static void ogl_build_programs()
_snprintf(shader_path, sizeof(shader_path) - 1, "%s%s", g_config.game_path, g_ddraw->shader);
}
if (GetFileAttributes(shader_path) != INVALID_FILE_ATTRIBUTES)
/* detect common upscaling shaders and disable them if no upscaling is required */
BOOL is_upscaler =
strstr(g_ddraw->shader, "catmull-rom-bilinear.glsl") != NULL ||
strstr(g_ddraw->shader, "lanczos2-sharp.glsl") != NULL ||
strstr(g_ddraw->shader, "xbr-lv2-noblend.glsl") != NULL ||
strstr(g_ddraw->shader, "xbrz-freescale.glsl") != NULL;
if (!is_upscaler ||
g_ddraw->render.viewport.width != g_ddraw->width ||
g_ddraw->render.viewport.height != g_ddraw->height)
{
/* detect common upscaling shaders and disable them if no upscaling is required */
g_ogl.scale_program = oglu_build_program_from_file(shader_path, wglCreateContextAttribsARB != NULL);
BOOL is_upscaler =
strstr(g_ddraw->shader, "catmull-rom-bilinear.glsl") != NULL ||
strstr(g_ddraw->shader, "lanczos2-sharp.glsl") != NULL ||
strstr(g_ddraw->shader, "xbr-lv2-noblend.glsl") != NULL ||
strstr(g_ddraw->shader, "xbrz-freescale.glsl") != NULL;
if (is_upscaler &&
g_ddraw->render.viewport.width == g_ddraw->width &&
g_ddraw->render.viewport.height == g_ddraw->height)
if (!g_ogl.scale_program)
{
shader_path[0] = 0;
g_ogl.scale_program = oglu_build_program(PASSTHROUGH_VERT_SHADER, CATMULL_ROM_FRAG_SHADER);
if (!g_ogl.scale_program)
{
g_ogl.scale_program =
oglu_build_program(PASSTHROUGH_VERT_SHADER_CORE, CATMULL_ROM_FRAG_SHADER_CORE);
}
}
}
g_ogl.scale_program = oglu_build_program_from_file(shader_path, wglCreateContextAttribsARB != NULL);
}
else
{