We will need this for ARB_get_program_binary binary support.
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
return false;
}
- unsigned num_tokens;
- stvp->tgsi.tokens = ureg_get_tokens(ureg, &num_tokens);
+ stvp->tgsi.tokens = ureg_get_tokens(ureg, &stvp->num_tgsi_tokens);
ureg_destroy(ureg);
if (stvp->glsl_to_tgsi) {
stvp->glsl_to_tgsi = NULL;
- st_store_tgsi_in_disk_cache(st, &stvp->Base, NULL, num_tokens);
+ st_store_tgsi_in_disk_cache(st, &stvp->Base, NULL);
}
return stvp->tgsi.tokens != NULL;
fs_output_semantic_name,
fs_output_semantic_index);
- unsigned num_tokens;
- stfp->tgsi.tokens = ureg_get_tokens(ureg, &num_tokens);
+ stfp->tgsi.tokens = ureg_get_tokens(ureg, &stfp->num_tgsi_tokens);
ureg_destroy(ureg);
if (stfp->glsl_to_tgsi) {
stfp->glsl_to_tgsi = NULL;
- st_store_tgsi_in_disk_cache(st, &stfp->Base, NULL, num_tokens);
+ st_store_tgsi_in_disk_cache(st, &stfp->Base, NULL);
}
return stfp->tgsi.tokens != NULL;
output_semantic_name,
output_semantic_index);
- unsigned num_tokens;
- out_state->tokens = ureg_get_tokens(ureg, &num_tokens);
+ 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);
+ } else {
+ struct st_common_program *stcp = (struct st_common_program *) prog;
+ out_state->tokens = ureg_get_tokens(ureg, &stcp->num_tgsi_tokens);
+ }
ureg_destroy(ureg);
st_translate_stream_output_info(glsl_to_tgsi,
outputMapping,
&out_state->stream_output);
- st_store_tgsi_in_disk_cache(st, prog, out_state, num_tokens);
+ st_store_tgsi_in_disk_cache(st, prog, out_state);
if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) {
_mesa_print_program(prog);
struct gl_shader_program *shader_program;
struct st_fp_variant *variants;
+
+ /* Used by the shader cache and ARB_get_program_binary */
+ unsigned num_tgsi_tokens;
};
/** SHA1 hash of linked tgsi shader program, used for on-disk cache */
unsigned char sha1[20];
+
+ /* Used by the shader cache and ARB_get_program_binary */
+ unsigned num_tgsi_tokens;
};
/** SHA1 hash of linked tgsi shader program, used for on-disk cache */
unsigned char sha1[20];
+
+ /* Used by the shader cache and ARB_get_program_binary */
+ unsigned num_tgsi_tokens;
};
/** SHA1 hash of linked tgsi shader program, used for on-disk cache */
unsigned char sha1[20];
+
+ /* Used by the shader cache and ARB_get_program_binary */
+ unsigned num_tgsi_tokens;
};
*/
void
st_store_tgsi_in_disk_cache(struct st_context *st, struct gl_program *prog,
- struct pipe_shader_state *out_state,
- unsigned num_tokens)
+ struct pipe_shader_state *out_state)
{
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, num_tokens);
+ write_tgsi_to_cache(&blob, &stvp->tgsi, prog, stvp->num_tgsi_tokens);
break;
}
case MESA_SHADER_TESS_CTRL:
case MESA_SHADER_TESS_EVAL:
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, num_tokens);
+ write_tgsi_to_cache(&blob, out_state, 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, num_tokens);
+ write_tgsi_to_cache(&blob, &stfp->tgsi, prog, stfp->num_tgsi_tokens);
break;
}
case MESA_SHADER_COMPUTE: {
- write_tgsi_to_cache(&blob, out_state, prog, num_tokens);
+ struct st_compute_program *stcp = (struct st_compute_program *) prog;
+
+ write_tgsi_to_cache(&blob, out_state, prog, stcp->num_tgsi_tokens);
break;
}
default:
void
st_store_tgsi_in_disk_cache(struct st_context *st, struct gl_program *prog,
- struct pipe_shader_state *out_state,
- unsigned num_tokens);
+ struct pipe_shader_state *out_state);
#ifdef __cplusplus
}