mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 09:00:10 +01:00
tgsi: fix incorrect tgsi_shader_info::num_tokens computation
We were incrementing num_tokens in each loop iteration while parsing the shader. But each call to tgsi_parse_token() can consume more than one token (and often does). Instead, just call the tgsi_num_tokens() function. Luckily, this issue doesn't seem to effect any current users of this field (llvmpipe just checks for <= 1, for example). Reviewed-by: Neha Bhende<bhenden@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
parent
fcba3934fc
commit
8fde9429c3
1 changed files with 1 additions and 2 deletions
|
|
@ -836,13 +836,12 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
|
||||||
procType == PIPE_SHADER_TESS_EVAL ||
|
procType == PIPE_SHADER_TESS_EVAL ||
|
||||||
procType == PIPE_SHADER_COMPUTE);
|
procType == PIPE_SHADER_COMPUTE);
|
||||||
info->processor = procType;
|
info->processor = procType;
|
||||||
|
info->num_tokens = tgsi_num_tokens(parse.Tokens);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Loop over incoming program tokens/instructions
|
** Loop over incoming program tokens/instructions
|
||||||
*/
|
*/
|
||||||
while (!tgsi_parse_end_of_tokens(&parse)) {
|
while (!tgsi_parse_end_of_tokens(&parse)) {
|
||||||
info->num_tokens++;
|
|
||||||
|
|
||||||
tgsi_parse_token( &parse );
|
tgsi_parse_token( &parse );
|
||||||
|
|
||||||
switch( parse.FullToken.Token.Type ) {
|
switch( parse.FullToken.Token.Type ) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue