return false;
}
- stvp->state.tokens = ureg_get_tokens(ureg, &stvp->num_tgsi_tokens);
+ stvp->state.tokens = ureg_get_tokens(ureg, NULL);
ureg_destroy(ureg);
if (stvp->glsl_to_tgsi) {
fs_output_semantic_name,
fs_output_semantic_index);
- stfp->state.tokens = ureg_get_tokens(ureg, &stfp->num_tgsi_tokens);
+ stfp->state.tokens = ureg_get_tokens(ureg, NULL);
ureg_destroy(ureg);
if (stfp->glsl_to_tgsi) {
output_semantic_name,
output_semantic_index);
- stcp->state.tokens = ureg_get_tokens(ureg, &stcp->num_tgsi_tokens);
+ stcp->state.tokens = ureg_get_tokens(ureg, NULL);
ureg_destroy(ureg);
tgsi_free_tokens(prog->state.tokens);
prog->state.tokens = tokens;
- prog->num_tgsi_tokens = tgsi_num_tokens(tokens);
}
tgsi = prog->state;
}
#include "compiler/nir/nir_serialize.h"
#include "pipe/p_shader_tokens.h"
#include "program/ir_to_mesa.h"
+#include "tgsi/tgsi_parse.h"
#include "util/u_memory.h"
void
static void
write_tgsi_to_cache(struct blob *blob, const struct tgsi_token *tokens,
- struct gl_program *prog, unsigned num_tokens)
+ struct gl_program *prog)
{
+ unsigned num_tokens = tgsi_num_tokens(tokens);
+
blob_write_uint32(blob, num_tokens);
blob_write_bytes(blob, tokens, num_tokens * sizeof(struct tgsi_token));
copy_blob_to_driver_cache_blob(blob, prog);
if (nir)
write_nir_to_cache(&blob, prog);
else
- write_tgsi_to_cache(&blob, stvp->state.tokens, prog,
- stvp->num_tgsi_tokens);
+ write_tgsi_to_cache(&blob, stvp->state.tokens, prog);
break;
}
case MESA_SHADER_TESS_CTRL:
if (nir)
write_nir_to_cache(&blob, prog);
else
- write_tgsi_to_cache(&blob, stcp->state.tokens, prog,
- stcp->num_tgsi_tokens);
+ write_tgsi_to_cache(&blob, stcp->state.tokens, prog);
break;
}
case MESA_SHADER_FRAGMENT: {
if (nir)
write_nir_to_cache(&blob, prog);
else
- write_tgsi_to_cache(&blob, stfp->state.tokens, prog,
- stfp->num_tgsi_tokens);
+ write_tgsi_to_cache(&blob, stfp->state.tokens, prog);
break;
}
default:
static void
read_tgsi_from_cache(struct blob_reader *blob_reader,
- const struct tgsi_token **tokens,
- unsigned *num_tokens)
+ const struct tgsi_token **tokens)
{
- *num_tokens = blob_read_uint32(blob_reader);
- unsigned tokens_size = *num_tokens * sizeof(struct tgsi_token);
+ unsigned num_tokens = blob_read_uint32(blob_reader);
+ unsigned tokens_size = num_tokens * sizeof(struct tgsi_token);
*tokens = (const struct tgsi_token*) MALLOC(tokens_size);
blob_copy_bytes(blob_reader, (uint8_t *) *tokens, tokens_size);
}
stvp->state.ir.nir = nir_deserialize(NULL, options, &blob_reader);
prog->nir = stvp->state.ir.nir;
} else {
- read_tgsi_from_cache(&blob_reader, &stvp->state.tokens,
- &stvp->num_tgsi_tokens);
+ read_tgsi_from_cache(&blob_reader, &stvp->state.tokens);
}
if (st->vp == stvp)
stcp->shader_program = shProg;
prog->nir = stcp->state.ir.nir;
} else {
- read_tgsi_from_cache(&blob_reader, &stcp->state.tokens,
- &stcp->num_tgsi_tokens);
+ read_tgsi_from_cache(&blob_reader, &stcp->state.tokens);
}
if ((prog->info.stage == MESA_SHADER_TESS_CTRL && st->tcp == stcp) ||
stfp->state.ir.nir = nir_deserialize(NULL, options, &blob_reader);
prog->nir = stfp->state.ir.nir;
} else {
- read_tgsi_from_cache(&blob_reader, &stfp->state.tokens,
- &stfp->num_tgsi_tokens);
+ read_tgsi_from_cache(&blob_reader, &stfp->state.tokens);
}
if (st->fp == stfp)