<div dir="ltr"><div><div>Thanks for cleaning this up<br><br></div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br><br></div>The others in the series look fine too.  I'd like to see pt 2 before I give a full R-B though.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 27, 2016 at 11:27 PM, Timothy Arceri <span dir="ltr"><<a href="mailto:timothy.arceri@collabora.com" target="_blank">timothy.arceri@collabora.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
 src/mesa/drivers/dri/i965/brw_<wbr>tcs.c | 13 +++++--------<br>
 1 file changed, 5 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_tcs.c b/src/mesa/drivers/dri/i965/<wbr>brw_tcs.c<br>
index 58d080d..7beccd7 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_tcs.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_tcs.c<br>
@@ -36,12 +36,13 @@<br>
 #include "nir_builder.h"<br>
<br>
 static nir_shader *<br>
-create_passthrough_tcs(const struct brw_compiler *compiler,<br>
+create_passthrough_tcs(void *mem_ctx, const struct brw_compiler *compiler,<br>
                        const nir_shader_compiler_options *options,<br>
                        const struct brw_tcs_prog_key *key)<br>
 {<br>
    nir_builder b;<br>
-   nir_builder_init_simple_<wbr>shader(&b, NULL, MESA_SHADER_TESS_CTRL, options);<br>
+   nir_builder_init_simple_<wbr>shader(&b, mem_ctx, MESA_SHADER_TESS_CTRL,<br>
+                                  options);<br>
    nir_shader *nir = b.shader;<br>
    nir_variable *var;<br>
    nir_intrinsic_instr *load;<br>
@@ -177,6 +178,7 @@ brw_codegen_tcs_prog(struct brw_context *brw,<br>
    bool start_busy = false;<br>
    double start_time = 0;<br>
<br>
+   void *mem_ctx = ralloc_context(NULL);<br>
    if (tcp) {<br>
       nir = tcp->program.nir;<br>
    } else {<br>
@@ -186,7 +188,7 @@ brw_codegen_tcs_prog(struct brw_context *brw,<br>
        */<br>
       const nir_shader_compiler_options *options =<br>
          ctx->Const.<wbr>ShaderCompilerOptions[MESA_<wbr>SHADER_TESS_CTRL].NirOptions;<br>
-      nir = create_passthrough_tcs(<wbr>compiler, options, key);<br>
+      nir = create_passthrough_tcs(mem_<wbr>ctx, compiler, options, key);<br>
    }<br>
<br>
    memset(&prog_data, 0, sizeof(prog_data));<br>
@@ -260,7 +262,6 @@ brw_codegen_tcs_prog(struct brw_context *brw,<br>
       start_time = get_time();<br>
    }<br>
<br>
-   void *mem_ctx = ralloc_context(NULL);<br>
    unsigned program_size;<br>
    char *error_str;<br>
    const unsigned *program =<br>
@@ -270,8 +271,6 @@ brw_codegen_tcs_prog(struct brw_context *brw,<br>
       if (shader_prog) {<br>
          shader_prog->LinkStatus = false;<br>
          ralloc_strcat(&shader_prog-><wbr>InfoLog, error_str);<br>
-      } else {<br>
-         ralloc_free(nir);<br>
       }<br>
<br>
       _mesa_problem(NULL, "Failed to compile tessellation control shader: "<br>
@@ -306,8 +305,6 @@ brw_codegen_tcs_prog(struct brw_context *brw,<br>
                     &prog_data, sizeof(prog_data),<br>
                     &stage_state->prog_offset, &brw->tcs.base.prog_data);<br>
    ralloc_free(mem_ctx);<br>
-   if (!tcs)<br>
-      ralloc_free(nir);<br>
<br>
    return true;<br>
 }<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>