st/mesa: deduplicate code for ATI fs in st_program_string_notify
authorMarek Olšák <marek.olsak@amd.com>
Mon, 30 Sep 2019 20:39:23 +0000 (16:39 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 17 Oct 2019 00:10:47 +0000 (20:10 -0400)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/state_tracker/st_cb_program.c

index f1c62187a95fb00258f22452aeb672be99910117..2d47af9b363db8e54325960a6b64436f65468336 100644 (file)
@@ -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])