diff options
author | Jordan Justen <[email protected]> | 2018-02-28 18:29:54 -0800 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2018-07-09 23:02:33 -0700 |
commit | 48ce7745dcfec33205d6e45906684c112cc24103 (patch) | |
tree | 1ecd540d68515c64abc3bba406a6cba10c0162e5 /src | |
parent | 36dd15f8b337e6a864d736ba502b8aa3d0ae6e4f (diff) |
mesa: Add gl_shader_program param to ProgramBinarySerializeDriverBlob
This might be required because some stages might generate different
programs depending on the other stages in the program. For example,
the i965 driver's tessellation control stage depends on the
tessellation evaluation shader.
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_program_binary.c | 8 | ||||
-rw-r--r-- | src/mesa/main/dd.h | 1 | ||||
-rw-r--r-- | src/mesa/main/program_binary.c | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.c | 6 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_shader_cache.c | 16 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_shader_cache.h | 10 |
8 files changed, 45 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 2db22f1c082..968fc1d43d6 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -340,7 +340,7 @@ brw_init_driver_functions(struct brw_context *brw, /* GL_ARB_get_program_binary */ brw_program_binary_init(brw->screen->deviceID); functions->GetProgramBinaryDriverSHA1 = brw_get_program_binary_driver_sha1; - functions->ProgramBinarySerializeDriverBlob = brw_program_serialize_nir; + functions->ProgramBinarySerializeDriverBlob = brw_serialize_program_binary; functions->ProgramBinaryDeserializeDriverBlob = brw_deserialize_program_binary; diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index c9c01b7d56a..72be8f2a4d0 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1637,6 +1637,9 @@ extern void brw_program_binary_init(unsigned device_id); extern void brw_get_program_binary_driver_sha1(struct gl_context *ctx, uint8_t *sha1); +void brw_serialize_program_binary(struct gl_context *ctx, + struct gl_shader_program *sh_prog, + struct gl_program *prog); extern void brw_deserialize_program_binary(struct gl_context *ctx, struct gl_shader_program *shProg, diff --git a/src/mesa/drivers/dri/i965/brw_program_binary.c b/src/mesa/drivers/dri/i965/brw_program_binary.c index 20d3a3c8ba5..1fe3ffd5bf9 100644 --- a/src/mesa/drivers/dri/i965/brw_program_binary.c +++ b/src/mesa/drivers/dri/i965/brw_program_binary.c @@ -238,6 +238,14 @@ brw_deserialize_program_binary(struct gl_context *ctx, } void +brw_serialize_program_binary(struct gl_context *ctx, + struct gl_shader_program *sh_prog, + struct gl_program *prog) +{ + brw_program_serialize_nir(ctx, prog); +} + +void brw_write_blob_program_data(struct blob *binary, gl_shader_stage stage, const void *program, struct brw_stage_prog_data *prog_data) diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 7081d586700..78e99bfa235 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1218,6 +1218,7 @@ struct dd_function_table { void (*GetProgramBinaryDriverSHA1)(struct gl_context *ctx, uint8_t *sha1); void (*ProgramBinarySerializeDriverBlob)(struct gl_context *ctx, + struct gl_shader_program *shProg, struct gl_program *prog); void (*ProgramBinaryDeserializeDriverBlob)(struct gl_context *ctx, diff --git a/src/mesa/main/program_binary.c b/src/mesa/main/program_binary.c index 427a79dc94d..7390fef5887 100644 --- a/src/mesa/main/program_binary.c +++ b/src/mesa/main/program_binary.c @@ -174,7 +174,8 @@ write_program_payload(struct gl_context *ctx, struct blob *blob, for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) { struct gl_linked_shader *shader = sh_prog->_LinkedShaders[stage]; if (shader) - ctx->Driver.ProgramBinarySerializeDriverBlob(ctx, shader->Program); + ctx->Driver.ProgramBinarySerializeDriverBlob(ctx, sh_prog, + shader->Program); } serialize_glsl_program(blob, ctx, sh_prog); diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 488202bbc59..b7330acfcca 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -760,12 +760,14 @@ st_init_driver_functions(struct pipe_screen *screen, PIPE_SHADER_CAP_PREFERRED_IR); if (preferred_ir == PIPE_SHADER_IR_NIR) { functions->ShaderCacheSerializeDriverBlob = st_serialise_nir_program; - functions->ProgramBinarySerializeDriverBlob = st_serialise_nir_program; + functions->ProgramBinarySerializeDriverBlob = + st_serialise_nir_program_binary; functions->ProgramBinaryDeserializeDriverBlob = st_deserialise_nir_program; } else { functions->ShaderCacheSerializeDriverBlob = st_serialise_tgsi_program; - functions->ProgramBinarySerializeDriverBlob = st_serialise_tgsi_program; + functions->ProgramBinarySerializeDriverBlob = + st_serialise_tgsi_program_binary; functions->ProgramBinaryDeserializeDriverBlob = st_deserialise_tgsi_program; } diff --git a/src/mesa/state_tracker/st_shader_cache.c b/src/mesa/state_tracker/st_shader_cache.c index 3f8d2d110ce..c82ce3eaa2d 100644 --- a/src/mesa/state_tracker/st_shader_cache.c +++ b/src/mesa/state_tracker/st_shader_cache.c @@ -415,6 +415,14 @@ st_serialise_tgsi_program(struct gl_context *ctx, struct gl_program *prog) } void +st_serialise_tgsi_program_binary(struct gl_context *ctx, + struct gl_shader_program *shProg, + struct gl_program *prog) +{ + st_serialise_ir_program(ctx, prog, false); +} + +void st_deserialise_tgsi_program(struct gl_context *ctx, struct gl_shader_program *shProg, struct gl_program *prog) @@ -429,6 +437,14 @@ st_serialise_nir_program(struct gl_context *ctx, struct gl_program *prog) } void +st_serialise_nir_program_binary(struct gl_context *ctx, + struct gl_shader_program *shProg, + struct gl_program *prog) +{ + st_serialise_ir_program(ctx, prog, true); +} + +void st_deserialise_nir_program(struct gl_context *ctx, struct gl_shader_program *shProg, struct gl_program *prog) diff --git a/src/mesa/state_tracker/st_shader_cache.h b/src/mesa/state_tracker/st_shader_cache.h index 132dac00c01..5b0bff7b2f8 100644 --- a/src/mesa/state_tracker/st_shader_cache.h +++ b/src/mesa/state_tracker/st_shader_cache.h @@ -39,6 +39,11 @@ void st_serialise_tgsi_program(struct gl_context *ctx, struct gl_program *prog); void +st_serialise_tgsi_program_binary(struct gl_context *ctx, + struct gl_shader_program *shProg, + struct gl_program *prog); + +void st_deserialise_tgsi_program(struct gl_context *ctx, struct gl_shader_program *shProg, struct gl_program *prog); @@ -47,6 +52,11 @@ void st_serialise_nir_program(struct gl_context *ctx, struct gl_program *prog); void +st_serialise_nir_program_binary(struct gl_context *ctx, + struct gl_shader_program *shProg, + struct gl_program *prog); + +void st_deserialise_nir_program(struct gl_context *ctx, struct gl_shader_program *shProg, struct gl_program *prog); |