st/mesa: exit st_translate_fragment_program() earlier for NIR path
authorTimothy Arceri <tarceri@itsqueeze.com>
Thu, 5 Apr 2018 06:20:23 +0000 (16:20 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Tue, 10 Apr 2018 05:10:16 +0000 (15:10 +1000)
This avoids a bunch of scanning that is only used by the TGSI path.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_program.c

index 5bf76e1b8886f159135afb33a5dbc194a5b99841..a740c874c9ee640517c0404dd46ff5f78366e83e 100644 (file)
@@ -645,6 +645,12 @@ bool
 st_translate_fragment_program(struct st_context *st,
                               struct st_fragment_program *stfp)
 {
+   /* We have already compiled to NIR so just return */
+   if (stfp->shader_program) {
+      st_store_ir_in_disk_cache(st, &stfp->Base, true);
+      return true;
+   }
+
    ubyte outputMapping[2 * FRAG_RESULT_MAX];
    ubyte inputMapping[VARYING_SLOT_MAX];
    ubyte inputSlotToAttr[VARYING_SLOT_MAX];
@@ -900,12 +906,6 @@ st_translate_fragment_program(struct st_context *st,
       }
    }
 
-   /* We have already compiled to NIR so just return */
-   if (stfp->shader_program) {
-      st_store_ir_in_disk_cache(st, &stfp->Base, true);
-      return true;
-   }
-
    ureg = ureg_create_with_screen(PIPE_SHADER_FRAGMENT, st->pipe->screen);
    if (ureg == NULL)
       return false;