llvmpipe: Use -1 instead of ~0 for "no slot".

As the value of unsigned ~0 depends on the bit-width.

Fixes fdo 42411.
This commit is contained in:
José Fonseca 2011-10-31 19:35:55 +00:00
parent 4a0afa2c3b
commit 0cbb49aff5
3 changed files with 21 additions and 15 deletions

View file

@ -53,10 +53,10 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe)
unsigned vs_index;
uint i;
llvmpipe->color_slot[0] = ~0;
llvmpipe->color_slot[1] = ~0;
llvmpipe->bcolor_slot[0] = ~0;
llvmpipe->bcolor_slot[1] = ~0;
llvmpipe->color_slot[0] = -1;
llvmpipe->color_slot[1] = -1;
llvmpipe->bcolor_slot[0] = -1;
llvmpipe->bcolor_slot[1] = -1;
/*
* Match FS inputs against VS outputs, emitting the necessary
@ -84,7 +84,7 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe)
if (lpfs->info.base.input_semantic_name[i] == TGSI_SEMANTIC_COLOR &&
lpfs->info.base.input_semantic_index[i] < 2) {
int idx = lpfs->info.base.input_semantic_index[i];
llvmpipe->color_slot[idx] = vinfo->num_attribs;
llvmpipe->color_slot[idx] = (int)vinfo->num_attribs;
}
/*
@ -100,7 +100,7 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe)
TGSI_SEMANTIC_BCOLOR, i);
if (vs_index > 0) {
llvmpipe->bcolor_slot[i] = vinfo->num_attribs;
llvmpipe->bcolor_slot[i] = (int)vinfo->num_attribs;
draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, vs_index);
}
}

View file

@ -351,9 +351,9 @@ load_attribute(struct gallivm_state *gallivm,
}
if (key->twoside) {
if (vert_attr == key->color_slot && key->bcolor_slot != ~0)
if (vert_attr == key->color_slot && key->bcolor_slot >= 0)
lp_twoside(gallivm, args, key, key->bcolor_slot);
else if (vert_attr == key->spec_slot && key->bspec_slot != ~0)
else if (vert_attr == key->spec_slot && key->bspec_slot >= 0)
lp_twoside(gallivm, args, key, key->bspec_slot);
}
}
@ -771,10 +771,16 @@ lp_make_setup_variant_key(struct llvmpipe_context *lp,
key->twoside = lp->rasterizer->light_twoside;
key->size = Offset(struct lp_setup_variant_key,
inputs[key->num_inputs]);
key->color_slot = lp->color_slot[0];
key->color_slot = lp->color_slot [0];
key->bcolor_slot = lp->bcolor_slot[0];
key->spec_slot = lp->color_slot[1];
key->bspec_slot = lp->bcolor_slot[1];
key->spec_slot = lp->color_slot [1];
key->bspec_slot = lp->bcolor_slot[1];
assert(key->color_slot == lp->color_slot [0]);
assert(key->bcolor_slot == lp->bcolor_slot[0]);
assert(key->spec_slot == lp->color_slot [1]);
assert(key->bspec_slot == lp->bcolor_slot[1]);
key->units = (float) (lp->rasterizer->offset_units * lp->mrd);
key->scale = lp->rasterizer->offset_scale;
key->pad = 0;

View file

@ -17,11 +17,11 @@ struct lp_setup_variant_list_item
struct lp_setup_variant_key {
unsigned size:16;
unsigned num_inputs:8;
unsigned color_slot:8;
int color_slot:8;
unsigned bcolor_slot:8;
unsigned spec_slot:8;
unsigned bspec_slot:8;
int bcolor_slot:8;
int spec_slot:8;
int bspec_slot:8;
unsigned flatshade_first:1;
unsigned pixel_center_half:1;
unsigned twoside:1;