From ab843a3702742977f51c9dea42d55c8ed805f8b9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 30 Sep 2019 16:39:23 -0400 Subject: [PATCH] st/mesa: deduplicate code for ATI fs in st_program_string_notify Reviewed-by: Timothy Arceri --- src/mesa/state_tracker/st_cb_program.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index f1c62187a95..2d47af9b363 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -163,9 +163,17 @@ st_program_string_notify( struct gl_context *ctx, struct st_context *st = st_context(ctx); gl_shader_stage stage = _mesa_program_enum_to_shader_stage(target); - if (target == GL_FRAGMENT_PROGRAM_ARB) { + if (target == GL_FRAGMENT_PROGRAM_ARB || + target == GL_FRAGMENT_SHADER_ATI) { struct st_fragment_program *stfp = (struct st_fragment_program *) prog; + if (target == GL_FRAGMENT_SHADER_ATI) { + assert(stfp->ati_fs); + assert(stfp->ati_fs->Program == prog); + + st_init_atifs_prog(ctx, prog); + } + st_release_fp_variants(st, stfp); if (!st_translate_fragment_program(st, stfp)) return false; @@ -229,22 +237,6 @@ st_program_string_notify( struct gl_context *ctx, if (st->cp == stcp) st->dirty |= stcp->affected_states; } - else if (target == GL_FRAGMENT_SHADER_ATI) { - assert(prog); - - struct st_fragment_program *stfp = (struct st_fragment_program *) prog; - assert(stfp->ati_fs); - assert(stfp->ati_fs->Program == prog); - - st_init_atifs_prog(ctx, prog); - - st_release_fp_variants(st, stfp); - if (!st_translate_fragment_program(st, stfp)) - return false; - - if (st->fp == stfp) - st->dirty |= stfp->affected_states; - } if (ST_DEBUG & DEBUG_PRECOMPILE || st->shader_has_one_variant[stage]) -- 2.30.2