<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Reviewed-by: Neha Bhende<bhenden@vmware.com><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" style="font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: Calibri, Arial, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p>Regards,</p>
<p>Neha<br>
</p>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Brian Paul <brianp@vmware.com><br>
<b>Sent:</b> Thursday, May 17, 2018 1:06:26 PM<br>
<b>To:</b> mesa-dev@lists.freedesktop.org<br>
<b>Cc:</b> Charmaine Lee; Neha Bhende; Roland Scheidegger<br>
<b>Subject:</b> [PATCH] tgsi: fix incorrect tgsi_shader_info::num_tokens computation</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">We were incrementing num_tokens in each loop iteration while parsing<br>
the shader. But each call to tgsi_parse_token() can consume more than<br>
one token (and often does). Instead, just call the tgsi_num_tokens()<br>
function.<br>
<br>
Luckily, this issue doesn't seem to effect any current users of this<br>
field (llvmpipe just checks for <= 1, for example).<br>
---<br>
src/gallium/auxiliary/tgsi/tgsi_scan.c | 3 +--<br>
1 file changed, 1 insertion(+), 2 deletions(-)<br>
<br>
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c<br>
index 18488d7..685a413 100644<br>
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c<br>
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c<br>
@@ -836,13 +836,12 @@ tgsi_scan_shader(const struct tgsi_token *tokens,<br>
procType == PIPE_SHADER_TESS_EVAL ||<br>
procType == PIPE_SHADER_COMPUTE);<br>
info->processor = procType;<br>
+ info->num_tokens = tgsi_num_tokens(parse.Tokens);<br>
<br>
/**<br>
** Loop over incoming program tokens/instructions<br>
*/<br>
while (!tgsi_parse_end_of_tokens(&parse)) {<br>
- info->num_tokens++;<br>
-<br>
tgsi_parse_token( &parse );<br>
<br>
switch( parse.FullToken.Token.Type ) {<br>
-- <br>
2.7.4<br>
<br>
</div>
</span></font></div>
</body>
</html>