st/mesa: simplify the signature of st_release_basic_variants
authorMarek Olšák <marek.olsak@amd.com>
Mon, 30 Sep 2019 20:45:48 +0000 (16:45 -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
src/mesa/state_tracker/st_program.c
src/mesa/state_tracker/st_program.h
src/mesa/state_tracker/st_shader_cache.c

index 2d47af9b363db8e54325960a6b64436f65468336..9ca1ada109d5fa776e2de9a04f0ccdd23ed3d5c3 100644 (file)
@@ -112,8 +112,7 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog)
       {
          struct st_common_program *p = st_common_program(prog);
 
-         st_release_basic_variants(st, p->Base.Target, &p->variants,
-                                   &p->tgsi);
+         st_release_basic_variants(st, p);
          
          if (p->glsl_to_tgsi)
             free_glsl_to_tgsi_visitor(p->glsl_to_tgsi);
@@ -184,8 +183,7 @@ st_program_string_notify( struct gl_context *ctx,
    else if (target == GL_GEOMETRY_PROGRAM_NV) {
       struct st_common_program *stgp = st_common_program(prog);
 
-      st_release_basic_variants(st, stgp->Base.Target, &stgp->variants,
-                                &stgp->tgsi);
+      st_release_basic_variants(st, stgp);
       if (!st_translate_geometry_program(st, stgp))
          return false;
 
@@ -206,8 +204,7 @@ st_program_string_notify( struct gl_context *ctx,
       struct st_common_program *sttcp =
          st_common_program(prog);
 
-      st_release_basic_variants(st, sttcp->Base.Target, &sttcp->variants,
-                                &sttcp->tgsi);
+      st_release_basic_variants(st, sttcp);
       if (!st_translate_tessctrl_program(st, sttcp))
          return false;
 
@@ -218,8 +215,7 @@ st_program_string_notify( struct gl_context *ctx,
       struct st_common_program *sttep =
          st_common_program(prog);
 
-      st_release_basic_variants(st, sttep->Base.Target, &sttep->variants,
-                                &sttep->tgsi);
+      st_release_basic_variants(st, sttep);
       if (!st_translate_tesseval_program(st, sttep))
          return false;
 
index 3446388c966f5d7d99473bde5ce52e318db5c88e..73a2bf3d280e875f518e3fb2be8a3b662cecda65 100644 (file)
@@ -370,21 +370,18 @@ delete_basic_variant(struct st_context *st, struct st_basic_variant *v,
  * Free all basic program variants.
  */
 void
-st_release_basic_variants(struct st_context *st, GLenum target,
-                          struct st_basic_variant **variants,
-                          struct pipe_shader_state *tgsi)
+st_release_basic_variants(struct st_context *st, struct st_common_program *p)
 {
    struct st_basic_variant *v;
 
-   for (v = *variants; v; ) {
+   for (v = p->variants; v; ) {
       struct st_basic_variant *next = v->next;
-      delete_basic_variant(st, v, target);
+      delete_basic_variant(st, v, p->Base.Target);
       v = next;
    }
 
-   *variants = NULL;
-
-   delete_ir(tgsi);
+   p->variants = NULL;
+   delete_ir(&p->tgsi);
 }
 
 
index 77b335993a56fa60e6addba6108f1d7c5124051c..4b0fcff96a78de90285140e4d8ae1638f720141d 100644 (file)
@@ -450,9 +450,7 @@ st_release_cp_variants(struct st_context *st,
                         struct st_compute_program *stcp);
 
 extern void
-st_release_basic_variants(struct st_context *st, GLenum target,
-                          struct st_basic_variant **variants,
-                          struct pipe_shader_state *tgsi);
+st_release_basic_variants(struct st_context *st, struct st_common_program *p);
 
 extern void
 st_destroy_program_variants(struct st_context *st);
index a56e9fa354cff83f588c8b426a977fa797f270bc..344bd93d6671c5357a0f60b16e27c13861bcf926 100644 (file)
@@ -237,9 +237,7 @@ st_deserialise_ir_program(struct gl_context *ctx,
    case MESA_SHADER_TESS_CTRL: {
       struct st_common_program *sttcp = st_common_program(prog);
 
-      st_release_basic_variants(st, sttcp->Base.Target,
-                                &sttcp->variants, &sttcp->tgsi);
-
+      st_release_basic_variants(st, sttcp);
       read_stream_out_from_cache(&blob_reader, &sttcp->tgsi);
 
       if (nir) {
@@ -260,9 +258,7 @@ st_deserialise_ir_program(struct gl_context *ctx,
    case MESA_SHADER_TESS_EVAL: {
       struct st_common_program *sttep = st_common_program(prog);
 
-      st_release_basic_variants(st, sttep->Base.Target,
-                                &sttep->variants, &sttep->tgsi);
-
+      st_release_basic_variants(st, sttep);
       read_stream_out_from_cache(&blob_reader, &sttep->tgsi);
 
       if (nir) {
@@ -283,9 +279,7 @@ st_deserialise_ir_program(struct gl_context *ctx,
    case MESA_SHADER_GEOMETRY: {
       struct st_common_program *stgp = st_common_program(prog);
 
-      st_release_basic_variants(st, stgp->Base.Target, &stgp->variants,
-                                &stgp->tgsi);
-
+      st_release_basic_variants(st, stgp);
       read_stream_out_from_cache(&blob_reader, &stgp->tgsi);
 
       if (nir) {