From 25b3ce6e3ba4b2da2d278712b95f883807363070 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Fri, 3 Nov 2017 16:57:42 -0700 Subject: [PATCH] i965: Add brw_program_serialize_nir Signed-off-by: Jordan Justen Reviewed-by: Timothy Arceri --- src/mesa/drivers/dri/i965/brw_link.cpp | 7 +------ src/mesa/drivers/dri/i965/brw_program.c | 11 +++++++++++ src/mesa/drivers/dri/i965/brw_program.h | 2 ++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp index 6177c8f5ebd..64267671c05 100644 --- a/src/mesa/drivers/dri/i965/brw_link.cpp +++ b/src/mesa/drivers/dri/i965/brw_link.cpp @@ -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); } } diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 30cc14e88a2..be839ab38a2 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -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) diff --git a/src/mesa/drivers/dri/i965/brw_program.h b/src/mesa/drivers/dri/i965/brw_program.h index bd9b4ad168a..c89614d5c90 100644 --- a/src/mesa/drivers/dri/i965/brw_program.h +++ b/src/mesa/drivers/dri/i965/brw_program.h @@ -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); -- 2.30.2