From f58ec215c5669f36c2649acc9cbeda7383b86879 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 21 Nov 2006 10:16:37 +0000 Subject: [PATCH] Gary Wong's fix for 64 bit cleanness of vertex program inputs bitmask. --- src/mesa/drivers/dri/i965/brw_draw.c | 2 +- src/mesa/drivers/dri/i965/brw_draw_upload.c | 6 +++--- src/mesa/drivers/dri/i965/brw_vs_emit.c | 2 +- src/mesa/drivers/dri/i965/brw_vs_tnl.c | 9 +++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 5c0c5da..471fda9 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -209,7 +209,7 @@ static void brw_merge_inputs( struct brw_context *brw, if (arrays[i] && arrays[i]->Enabled) { brw->vb.inputs[i].glarray = arrays[i]; - brw->vb.info.varying |= 1 << i; + brw->vb.info.varying |= (GLuint64EXT) 1 << i; } else { diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index cde0aa6..57ee294 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -393,7 +393,7 @@ GLboolean brw_upload_vertices( struct brw_context *brw, { GLcontext *ctx = &brw->intel.ctx; struct intel_context *intel = intel_context(ctx); - GLuint tmp = brw->vs.prog_data->inputs_read; + GLuint64EXT tmp = brw->vs.prog_data->inputs_read; struct brw_vertex_element_packet vep; struct brw_array_state vbp; GLuint i; @@ -414,10 +414,10 @@ GLboolean brw_upload_vertices( struct brw_context *brw, */ while (tmp) { - GLuint i = ffs(tmp)-1; + GLuint i = ffsll(tmp)-1; struct brw_vertex_element *input = &brw->vb.inputs[i]; - tmp &= ~(1<index = i; diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index da9d3ba..8403e1b 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -78,7 +78,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) */ c->nr_inputs = 0; for (i = 0; i < BRW_ATTRIB_MAX; i++) { - if (c->prog_data.inputs_read & (1<prog_data.inputs_read & ((GLuint64EXT)1<nr_inputs++; c->regs[PROGRAM_INPUT][i] = brw_vec8_grf(reg, 0); reg++; diff --git a/src/mesa/drivers/dri/i965/brw_vs_tnl.c b/src/mesa/drivers/dri/i965/brw_vs_tnl.c index 52bdb9d..b7893ca 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_tnl.c +++ b/src/mesa/drivers/dri/i965/brw_vs_tnl.c @@ -146,8 +146,8 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) } /* BRW_NEW_INPUT_VARYING */ - for (i = BRW_ATTRIB_MAT_FRONT_AMBIENT ; i < BRW_ATTRIB_INDEX ; i++) - if (brw->vb.info.varying & (1<vb.info.varying & ((GLuint64EXT)1<light_material_mask |= 1<<(i-BRW_ATTRIB_MAT_FRONT_AMBIENT); for (i = 0; i < MAX_LIGHTS; i++) { @@ -374,16 +374,17 @@ static void release_temps( struct tnl_program *p ) static struct ureg register_input( struct tnl_program *p, GLuint input ) { + GLuint orig_input = input; /* Cram the material flags into the generic range. We'll translate * them back later. */ if (input >= BRW_ATTRIB_MAT_FRONT_AMBIENT) - input -= BRW_ATTRIB_MAT_FRONT_AMBIENT; + input -= BRW_ATTRIB_MAT_FRONT_AMBIENT - BRW_ATTRIB_GENERIC0; assert(input < 32); p->program->Base.InputsRead |= (1<