if (stvp->glsl_to_tgsi) {
stvp->glsl_to_tgsi = NULL;
- st_store_tgsi_in_disk_cache(st, &stvp->Base, NULL);
+ st_store_tgsi_in_disk_cache(st, &stvp->Base);
}
return stvp->tgsi.tokens != NULL;
if (stfp->glsl_to_tgsi) {
stfp->glsl_to_tgsi = NULL;
- st_store_tgsi_in_disk_cache(st, &stfp->Base, NULL);
+ st_store_tgsi_in_disk_cache(st, &stfp->Base);
}
return stfp->tgsi.tokens != NULL;
if (tgsi_processor == PIPE_SHADER_COMPUTE) {
struct st_compute_program *stcp = (struct st_compute_program *) prog;
out_state->tokens = ureg_get_tokens(ureg, &stcp->num_tgsi_tokens);
+ stcp->tgsi.prog = out_state->tokens;
} else {
struct st_common_program *stcp = (struct st_common_program *) prog;
out_state->tokens = ureg_get_tokens(ureg, &stcp->num_tgsi_tokens);
outputMapping,
&out_state->stream_output);
- st_store_tgsi_in_disk_cache(st, prog, out_state);
+ st_store_tgsi_in_disk_cache(st, prog);
if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) {
_mesa_print_program(prog);
PIPE_SHADER_COMPUTE, &prog);
stcp->tgsi.ir_type = PIPE_SHADER_IR_TGSI;
- stcp->tgsi.prog = prog.tokens;
stcp->tgsi.req_local_mem = stcp->Base.info.cs.shared_size;
stcp->tgsi.req_private_mem = 0;
stcp->tgsi.req_input_mem = 0;
}
static void
-write_tgsi_to_cache(struct blob *blob, struct pipe_shader_state *tgsi,
+write_tgsi_to_cache(struct blob *blob, const struct tgsi_token *tokens,
struct gl_program *prog, unsigned num_tokens)
{
blob_write_uint32(blob, num_tokens);
- blob_write_bytes(blob, tgsi->tokens,
- num_tokens * sizeof(struct tgsi_token));
+ blob_write_bytes(blob, tokens, num_tokens * sizeof(struct tgsi_token));
prog->driver_cache_blob = ralloc_size(NULL, blob->size);
memcpy(prog->driver_cache_blob, blob->data, blob->size);
* Store tgsi and any other required state in on-disk shader cache.
*/
void
-st_store_tgsi_in_disk_cache(struct st_context *st, struct gl_program *prog,
- struct pipe_shader_state *out_state)
+st_store_tgsi_in_disk_cache(struct st_context *st, struct gl_program *prog)
{
if (!st->ctx->Cache)
return;
sizeof(stvp->result_to_output));
write_stream_out_to_cache(&blob, &stvp->tgsi);
- write_tgsi_to_cache(&blob, &stvp->tgsi, prog, stvp->num_tgsi_tokens);
+ write_tgsi_to_cache(&blob, stvp->tgsi.tokens, prog,
+ stvp->num_tgsi_tokens);
break;
}
case MESA_SHADER_TESS_CTRL:
case MESA_SHADER_GEOMETRY: {
struct st_common_program *stcp = (struct st_common_program *) prog;
- write_stream_out_to_cache(&blob, out_state);
- write_tgsi_to_cache(&blob, out_state, prog, stcp->num_tgsi_tokens);
+ write_stream_out_to_cache(&blob, &stcp->tgsi);
+ write_tgsi_to_cache(&blob, stcp->tgsi.tokens, prog,
+ stcp->num_tgsi_tokens);
break;
}
case MESA_SHADER_FRAGMENT: {
struct st_fragment_program *stfp = (struct st_fragment_program *) prog;
- write_tgsi_to_cache(&blob, &stfp->tgsi, prog, stfp->num_tgsi_tokens);
+ write_tgsi_to_cache(&blob, stfp->tgsi.tokens, prog,
+ stfp->num_tgsi_tokens);
break;
}
case MESA_SHADER_COMPUTE: {
struct st_compute_program *stcp = (struct st_compute_program *) prog;
- write_tgsi_to_cache(&blob, out_state, prog, stcp->num_tgsi_tokens);
+ write_tgsi_to_cache(&blob, stcp->tgsi.prog, prog,
+ stcp->num_tgsi_tokens);
break;
}
default: