st/mesa: release the glsl_to_tgsi visitor after translation
authorMarek Olšák <marek.olsak@amd.com>
Mon, 5 Oct 2015 20:46:44 +0000 (22:46 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 9 Oct 2015 20:02:18 +0000 (22:02 +0200)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
src/mesa/state_tracker/st_program.c

index 3317071ed598456c9f0bebb32f52b6979fffe2f0..6a69ba7aa2685f9c76416d3c6f58bfd4c733d792 100644 (file)
@@ -425,6 +425,9 @@ st_translate_vertex_program(struct st_context *st,
       st_translate_stream_output_info(stvp->glsl_to_tgsi,
                                       stvp->result_to_output,
                                       &stvp->tgsi.stream_output);
+
+      free_glsl_to_tgsi_visitor(stvp->glsl_to_tgsi);
+      stvp->glsl_to_tgsi = NULL;
    } else
       error = st_translate_mesa_program(st->ctx,
                                         TGSI_PROCESSOR_VERTEX,
@@ -815,7 +818,7 @@ st_translate_fragment_program(struct st_context *st,
       }
    }
 
-   if (stfp->glsl_to_tgsi)
+   if (stfp->glsl_to_tgsi) {
       st_translate_program(st->ctx,
                            TGSI_PROCESSOR_FRAGMENT,
                            ureg,
@@ -835,7 +838,10 @@ st_translate_fragment_program(struct st_context *st,
                            NULL,
                            fs_output_semantic_name,
                            fs_output_semantic_index);
-   else
+
+      free_glsl_to_tgsi_visitor(stfp->glsl_to_tgsi);
+      stfp->glsl_to_tgsi = NULL;
+   } else
       st_translate_mesa_program(st->ctx,
                                 TGSI_PROCESSOR_FRAGMENT,
                                 ureg,
@@ -1309,6 +1315,9 @@ st_translate_geometry_program(struct st_context *st,
 
    st_translate_program_common(st, &stgp->Base.Base, stgp->glsl_to_tgsi, ureg,
                                TGSI_PROCESSOR_GEOMETRY, &stgp->tgsi);
+
+   free_glsl_to_tgsi_visitor(stgp->glsl_to_tgsi);
+   stgp->glsl_to_tgsi = NULL;
    return true;
 }
 
@@ -1381,6 +1390,9 @@ st_translate_tessctrl_program(struct st_context *st,
 
    st_translate_program_common(st, &sttcp->Base.Base, sttcp->glsl_to_tgsi,
                                ureg, TGSI_PROCESSOR_TESS_CTRL, &sttcp->tgsi);
+
+   free_glsl_to_tgsi_visitor(sttcp->glsl_to_tgsi);
+   sttcp->glsl_to_tgsi = NULL;
    return true;
 }
 
@@ -1475,6 +1487,9 @@ st_translate_tesseval_program(struct st_context *st,
 
    st_translate_program_common(st, &sttep->Base.Base, sttep->glsl_to_tgsi,
                                ureg, TGSI_PROCESSOR_TESS_EVAL, &sttep->tgsi);
+
+   free_glsl_to_tgsi_visitor(sttep->glsl_to_tgsi);
+   sttep->glsl_to_tgsi = NULL;
    return true;
 }