radeonsi/compute: Free program and program.kernels on shutdown
authorAaron Watry <awatry@gmail.com>
Wed, 6 Nov 2013 22:49:22 +0000 (16:49 -0600)
committerTom Stellard <thomas.stellard@amd.com>
Fri, 15 Nov 2013 17:16:49 +0000 (09:16 -0800)
v2: Fix indentation

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
CC: "10.0" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/radeonsi/radeonsi_compute.c

index 49caa2c6a87aa3a5e8da7ffcad473833c1ac8866..e7bf5a4a597cd37b9347c429254e5c20b3e65024 100644 (file)
@@ -245,7 +245,21 @@ static void radeonsi_launch_grid(
 }
 
 
-static void si_delete_compute_state(struct pipe_context *ctx, void* state){}
+static void si_delete_compute_state(struct pipe_context *ctx, void* state){
+       struct si_pipe_compute *program = (struct si_pipe_compute *)state;
+
+       if (!state) {
+               return;
+       }
+
+       if (program->kernels) {
+               FREE(program->kernels);
+       }
+
+       //And then free the program itself.
+       FREE(program);
+}
+
 static void si_set_compute_resources(struct pipe_context * ctx_,
                unsigned start, unsigned count,
                struct pipe_surface ** surfaces) { }