aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2017-11-03 16:57:42 -0700
committerTimothy Arceri <[email protected]>2017-12-08 16:59:22 +1100
commit25b3ce6e3ba4b2da2d278712b95f883807363070 (patch)
tree1be103e7014ef2c2c444d9087f5b17af176f364b /src/mesa/drivers
parentb3f1b765e964f2d4b6be38e7fbbe78b817aec100 (diff)
i965: Add brw_program_serialize_nir
Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_link.cpp7
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c11
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.h2
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
@@ -788,6 +788,17 @@ brw_assign_common_binding_table_offsets(const struct gen_device_info *devinfo,
}
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
@@ -82,6 +82,8 @@ brw_assign_common_binding_table_offsets(const struct gen_device_info *devinfo,
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);