st/mesa: fix size miss match for some check

While we shrink some variable from "GLuint" to "ubyte",
need to update the check from "x != ~0U" to "x != 0xff" too.

This fixes the crash for SPECviewperf 13 benchmark medical
case.

Fixes: d947e3e2c8 "st/mesa: decrease the size of st_vertex_program"
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11757>
This commit is contained in:
Qiang Yu 2021-07-07 15:00:50 +08:00 committed by Marge Bot
parent f2ae76e1a6
commit cf66ccf3f0
3 changed files with 9 additions and 9 deletions

View file

@ -87,7 +87,7 @@ feedback_vertex(struct gl_context *ctx, const struct draw_context *draw,
struct st_vertex_program *stvp = (struct st_vertex_program *)st->vp;
GLfloat win[4];
const GLfloat *color, *texcoord;
GLuint slot;
ubyte slot;
win[0] = v->data[0][0];
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP)
@ -103,13 +103,13 @@ feedback_vertex(struct gl_context *ctx, const struct draw_context *draw,
*/
slot = stvp->result_to_output[VARYING_SLOT_COL0];
if (slot != ~0U)
if (slot != 0xff)
color = v->data[slot];
else
color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
slot = stvp->result_to_output[VARYING_SLOT_TEX0];
if (slot != ~0U)
if (slot != 0xff)
texcoord = v->data[slot];
else
texcoord = ctx->Current.Attrib[VERT_ATTRIB_TEX0];

View file

@ -121,8 +121,8 @@ update_attrib(struct gl_context *ctx, const ubyte *outputMapping,
GLuint result, GLuint defaultAttrib)
{
const GLfloat *src;
const GLuint k = outputMapping[result];
if (k != ~0U)
const ubyte k = outputMapping[result];
if (k != 0xff)
src = vert->data[k];
else
src = ctx->Current.Attrib[defaultAttrib];

View file

@ -5981,9 +5981,9 @@ dst_register(struct st_translate *t, gl_register_file file, unsigned index,
find_inout_array(t->output_decls,
t->num_output_decls, array_id);
unsigned mesa_index = decl->mesa_index;
int slot = t->outputMapping[mesa_index];
ubyte slot = t->outputMapping[mesa_index];
assert(slot != -1 && t->outputs[slot].File == TGSI_FILE_OUTPUT);
assert(slot != 0xff && t->outputs[slot].File == TGSI_FILE_OUTPUT);
struct ureg_dst dst = t->outputs[slot];
dst.ArrayID = array_id;
@ -6116,9 +6116,9 @@ translate_src(struct st_translate *t, const st_src_reg *src_reg)
t->num_input_decls,
src_reg->array_id);
unsigned mesa_index = decl->mesa_index;
int slot = t->inputMapping[mesa_index];
ubyte slot = t->inputMapping[mesa_index];
assert(slot != -1 && t->inputs[slot].File == TGSI_FILE_INPUT);
assert(slot != 0xff && t->inputs[slot].File == TGSI_FILE_INPUT);
src = t->inputs[slot];
src.ArrayID = src_reg->array_id;