i965: Add brw_program_serialize_nir
authorJordan Justen <jordan.l.justen@intel.com>
Fri, 3 Nov 2017 23:57:42 +0000 (16:57 -0700)
committerTimothy Arceri <tarceri@itsqueeze.com>
Fri, 8 Dec 2017 05:59:22 +0000 (16:59 +1100)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/drivers/dri/i965/brw_link.cpp
src/mesa/drivers/dri/i965/brw_program.c
src/mesa/drivers/dri/i965/brw_program.h

index 6177c8f5ebdfb5c95fe217e23f8bff17951f687a..64267671c05581db6788a6d82c0e199c32996b10 100644 (file)
@@ -355,12 +355,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
             continue;
 
          struct gl_program *prog = shader->Program;
-         struct blob writer;
-         blob_init(&writer);
-         nir_serialize(&writer, prog->nir);
-         prog->driver_cache_blob = ralloc_size(NULL, writer.size);
-         memcpy(prog->driver_cache_blob, writer.data, writer.size);
-         prog->driver_cache_blob_size = writer.size;
+         brw_program_serialize_nir(ctx, prog);
       }
    }
 
index 30cc14e88a25543d1d02d4b1cd4c8f3b192b6aeb..be839ab38a272f75a426160768c087195e96359e 100644 (file)
@@ -787,6 +787,17 @@ brw_assign_common_binding_table_offsets(const struct gen_device_info *devinfo,
    return next_binding_table_offset;
 }
 
+void
+brw_program_serialize_nir(struct gl_context *ctx, struct gl_program *prog)
+{
+   struct blob writer;
+   blob_init(&writer);
+   nir_serialize(&writer, prog->nir);
+   prog->driver_cache_blob = ralloc_size(NULL, writer.size);
+   memcpy(prog->driver_cache_blob, writer.data, writer.size);
+   prog->driver_cache_blob_size = writer.size;
+}
+
 void
 brw_program_deserialize_nir(struct gl_context *ctx, struct gl_program *prog,
                             gl_shader_stage stage)
index bd9b4ad168a85d09ec431db361fbe1e090808703..c89614d5c90df0fe5a1974c732ae56c1b09b3e87 100644 (file)
@@ -81,6 +81,8 @@ brw_assign_common_binding_table_offsets(const struct gen_device_info *devinfo,
                                         struct brw_stage_prog_data *stage_prog_data,
                                         uint32_t next_binding_table_offset);
 
+void
+brw_program_serialize_nir(struct gl_context *ctx, struct gl_program *prog);
 void
 brw_program_deserialize_nir(struct gl_context *ctx, struct gl_program *prog,
                             gl_shader_stage stage);