[Mesa-dev] [PATCH 5/6] mesa: Make gl_program::InputsRead 64 bits.

Mathias Fröhlich Mathias.Froehlich at gmx.net
Sun Nov 27 09:18:57 PST 2011


Make gl_program::InputsRead a 64 bits bitfield.
Adapt the intel and radeon driver to handle a 64 bits
InputsRead value.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de>
---
 src/mesa/drivers/dri/i915/i915_fragprog.c      |    4 +-
 src/mesa/drivers/dri/i965/brw_context.h        |    2 +-
 src/mesa/drivers/dri/i965/brw_draw_upload.c    |    6 ++--
 src/mesa/drivers/dri/i965/brw_vs.c             |    4 +-
 src/mesa/drivers/dri/i965/brw_vs_constval.c    |    2 +-
 src/mesa/drivers/dri/i965/brw_vs_emit.c        |    4 +-
 src/mesa/drivers/dri/i965/gen6_wm_state.c      |    2 +-
 src/mesa/drivers/dri/i965/gen7_wm_state.c      |    2 +-
 src/mesa/drivers/dri/r200/r200_vertprog.c      |   31 +++++++++++++++--------
 src/mesa/main/context.c                        |    2 +-
 src/mesa/main/ff_fragment_shader.cpp           |    2 +-
 src/mesa/main/ffvertex_prog.c                  |   18 +++++++-------
 src/mesa/main/mtypes.h                         |    4 +-
 src/mesa/main/state.c                          |    2 +-
 src/mesa/main/state.h                          |    2 +-
 src/mesa/program/program_parse.y               |    6 ++--
 src/mesa/program/programopt.c                  |    4 +-
 src/mesa/state_tracker/st_atom_pixeltransfer.c |    2 +-
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp     |    8 +++---
 src/mesa/state_tracker/st_program.c            |   10 ++++----
 src/mesa/tnl/t_vb_program.c                    |    2 +-
 src/mesa/vbo/vbo_exec_array.c                  |    4 +-
 src/mesa/vbo/vbo_exec_draw.c                   |    2 +-
 src/mesa/vbo/vbo_save_draw.c                   |    2 +-
 24 files changed, 68 insertions(+), 59 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c 
b/src/mesa/drivers/dri/i915/i915_fragprog.c
index 063e155..4f016a3 100644
--- a/src/mesa/drivers/dri/i915/i915_fragprog.c
+++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
@@ -1148,7 +1148,7 @@ fixup_depth_write(struct i915_fragment_program *p)
 static void
 check_wpos(struct i915_fragment_program *p)
 {
-   GLuint inputs = p->FragProg.Base.InputsRead;
+   GLbitfield64 inputs = p->FragProg.Base.InputsRead;
    GLint i;
 
    p->wpos_tex = -1;
@@ -1337,7 +1337,7 @@ i915ValidateFragmentProgram(struct i915_context *i915)
    struct i915_fragment_program *p =
       (struct i915_fragment_program *) ctx->FragmentProgram._Current;
 
-   const GLuint inputsRead = p->FragProg.Base.InputsRead;
+   const GLbitfield64 inputsRead = p->FragProg.Base.InputsRead;
    GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK;
    GLuint s2 = S2_TEXCOORD_NONE;
    int i, offset = 0;
diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index c1b123f5..87675e9 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -379,7 +379,7 @@ struct brw_vs_prog_data {
    GLuint nr_pull_params; /**< number of dwords referenced by pull_param[] */
    GLuint total_scratch;
 
-   GLuint inputs_read;
+   GLbitfield64 inputs_read;
 
    /* Used for calculating urb partitions:
     */
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c 
b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index bd3d969..b4fd220 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -355,7 +355,7 @@ static void brw_prepare_vertices(struct brw_context *brw)
    struct gl_context *ctx = &brw->intel.ctx;
    struct intel_context *intel = intel_context(ctx);
    /* CACHE_NEW_VS_PROG */
-   GLbitfield vs_inputs = brw->vs.prog_data->inputs_read;
+   GLbitfield64 vs_inputs = brw->vs.prog_data->inputs_read;
    const unsigned char *ptr = NULL;
    GLuint interleaved = 0, total_size = 0;
    unsigned int min_index = brw->vb.min_index;
@@ -373,10 +373,10 @@ static void brw_prepare_vertices(struct brw_context 
*brw)
    /* Accumulate the list of enabled arrays. */
    brw->vb.nr_enabled = 0;
    while (vs_inputs) {
-      GLuint i = ffs(vs_inputs) - 1;
+      GLuint i = _mesa_ffsll(vs_inputs) - 1;
       struct brw_vertex_element *input = &brw->vb.inputs[i];
 
-      vs_inputs &= ~(1 << i);
+      vs_inputs &= ~BITFIELD64_BIT(i);
       if (input->glarray->Size && get_size(input->glarray->Type))
          brw->vb.enabled[brw->vb.nr_enabled++] = input;
    }
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c 
b/src/mesa/drivers/dri/i965/brw_vs.c
index 967f82e..6f9fd6a 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -207,7 +207,7 @@ do_vs_prog(struct brw_context *brw,
 
    if (c.key.copy_edgeflag) {
       c.prog_data.outputs_written |= BITFIELD64_BIT(VERT_RESULT_EDGE);
-      c.prog_data.inputs_read |= 1<<VERT_ATTRIB_EDGEFLAG;
+      c.prog_data.inputs_read |= BITFIELD64_BIT(VERT_ATTRIB_EDGEFLAG);
    }
 
    /* Put dummy slots into the VUE for the SF to put the replaced
@@ -318,7 +318,7 @@ static void brw_upload_vs_prog(struct brw_context *brw)
 
    /* BRW_NEW_VERTICES */
    for (i = 0; i < VERT_ATTRIB_MAX; i++) {
-      if (vp->program.Base.InputsRead & (1 << i) &&
+      if (vp->program.Base.InputsRead & BITFIELD64_BIT(i) &&
 	  brw->vb.inputs[i].glarray->Type == GL_FIXED) {
 	 key.gl_fixed_input_size[i] = brw->vb.inputs[i].glarray->Size;
       }
diff --git a/src/mesa/drivers/dri/i965/brw_vs_constval.c 
b/src/mesa/drivers/dri/i965/brw_vs_constval.c
index 8b7993a..9ce5ab3 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_constval.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_constval.c
@@ -202,7 +202,7 @@ static void calc_wm_input_sizes( struct brw_context *brw )
       t.twoside = 1;
 
    for (i = 0; i < VERT_ATTRIB_MAX; i++) 
-      if (vp->program.Base.InputsRead & (1<<i))
+      if (vp->program.Base.InputsRead & BITFIELD64_BIT(i))
 	 set_active_component(&t, PROGRAM_INPUT, i, 
 			      szflag[get_input_size(brw, i)]);
       
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c 
b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index e39b3dd..bcaef04 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -311,7 +311,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
     */
    c->nr_inputs = 0;
    for (i = 0; i < VERT_ATTRIB_MAX; i++) {
-      if (c->prog_data.inputs_read & (1 << i)) {
+      if (c->prog_data.inputs_read & BITFIELD64_BIT(i)) {
 	 c->nr_inputs++;
 	 c->regs[PROGRAM_INPUT][i] = brw_vec8_grf(reg, 0);
 	 reg++;
@@ -1820,7 +1820,7 @@ brw_vs_rescale_gl_fixed(struct brw_vs_compile *c)
    int i;
 
    for (i = 0; i < VERT_ATTRIB_MAX; i++) {
-      if (!(c->prog_data.inputs_read & (1 << i)))
+      if (!(c->prog_data.inputs_read & BITFIELD64_BIT(i)))
 	 continue;
 
       if (c->key.gl_fixed_input_size[i] != 0) {
diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c 
b/src/mesa/drivers/dri/i965/gen6_wm_state.c
index 070220a..22f7903 100644
--- a/src/mesa/drivers/dri/i965/gen6_wm_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c
@@ -184,7 +184,7 @@ upload_wm_state(struct brw_context *brw)
       dw5 |= GEN6_WM_POLYGON_STIPPLE_ENABLE;
 
    /* BRW_NEW_FRAGMENT_PROGRAM */
-   if (fp->program.Base.InputsRead & (1 << FRAG_ATTRIB_WPOS))
+   if (fp->program.Base.InputsRead & BITFIELD64_BIT(FRAG_ATTRIB_WPOS))
       dw5 |= GEN6_WM_USES_SOURCE_DEPTH | GEN6_WM_USES_SOURCE_W;
    if (fp->program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH))
       dw5 |= GEN6_WM_COMPUTED_DEPTH;
diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c 
b/src/mesa/drivers/dri/i965/gen7_wm_state.c
index f38d2f1..3775301 100644
--- a/src/mesa/drivers/dri/i965/gen7_wm_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c
@@ -58,7 +58,7 @@ upload_wm_state(struct brw_context *brw)
       dw1 |= GEN7_WM_POLYGON_STIPPLE_ENABLE;
 
    /* BRW_NEW_FRAGMENT_PROGRAM */
-   if (fp->program.Base.InputsRead & (1 << FRAG_ATTRIB_WPOS))
+   if (fp->program.Base.InputsRead & BITFIELD64_BIT(FRAG_ATTRIB_WPOS))
       dw1 |= GEN7_WM_USES_SOURCE_DEPTH | GEN7_WM_USES_SOURCE_W;
    if (fp->program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
       writes_depth = true;
diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c 
b/src/mesa/drivers/dri/r200/r200_vertprog.c
index 697073e..bf87d80 100644
--- a/src/mesa/drivers/dri/r200/r200_vertprog.c
+++ b/src/mesa/drivers/dri/r200/r200_vertprog.c
@@ -535,20 +535,29 @@ static GLboolean r200_translate_vertex_program(struct 
gl_context *ctx, struct r2
       vp->inputmap_rev[3] = VERT_ATTRIB_FOG;
       array_count++;
    }
-   for (i = VERT_ATTRIB_TEX0; i <= VERT_ATTRIB_TEX5; i++) {
-      if (mesa_vp->Base.InputsRead & (1 << i)) {
-	 vp->inputs[i] = i - VERT_ATTRIB_TEX0 + 6;
-	 vp->inputmap_rev[8 + i - VERT_ATTRIB_TEX0] = i;
-	 free_inputs &= ~(1 << (i - VERT_ATTRIB_TEX0 + 6));
+   /* VERT_ATTRIB_TEX0-5 */
+   for (i = 0; i <= 5; i++) {
+      if (mesa_vp->Base.InputsRead & VERT_BIT_TEX(i)) {
+	 vp->inputs[VERT_ATTRIB_TEX(i)] = i + 6;
+	 vp->inputmap_rev[8 + i] = VERT_ATTRIB_TEX(i);
+	 free_inputs &= ~(1 << (i + 6));
 	 array_count++;
       }
    }
    /* using VERT_ATTRIB_TEX6/7 would be illegal */
+   for (; i < VERT_ATTRIB_TEX_MAX; i++) {
+      if (mesa_vp->Base.InputsRead & VERT_BIT_TEX(i)) {
+          if (R200_DEBUG & RADEON_FALLBACKS) {
+              fprintf(stderr, "texture attribute %d in vert prog\n", i);
+          }
+          return GL_FALSE;
+      }
+   }
    /* completely ignore aliasing? */
-   for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) {
+   for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
       int j;
    /* completely ignore aliasing? */
-      if (mesa_vp->Base.InputsRead & (1 << i)) {
+      if (mesa_vp->Base.InputsRead & VERT_BIT_GENERIC(i)) {
 	 array_count++;
 	 if (array_count > 12) {
 	    if (R200_DEBUG & RADEON_FALLBACKS) {
@@ -560,10 +569,10 @@ static GLboolean r200_translate_vertex_program(struct 
gl_context *ctx, struct r2
 	    /* will always find one due to limited array_count */
 	    if (free_inputs & (1 << j)) {
 	       free_inputs &= ~(1 << j);
-	       vp->inputs[i] = j;
-	       if (j == 0) vp->inputmap_rev[j] = i; /* mapped to pos */
-	       else if (j < 12) vp->inputmap_rev[j + 2] = i; /* mapped to col/tex 
*/
-	       else vp->inputmap_rev[j + 1] = i; /* mapped to pos1 */
+	       vp->inputs[VERT_ATTRIB_GENERIC(i)] = j;
+	       if (j == 0) vp->inputmap_rev[j] = VERT_ATTRIB_GENERIC(i); /* 
mapped to pos */
+	       else if (j < 12) vp->inputmap_rev[j + 2] = VERT_ATTRIB_GENERIC(i); 
/* mapped to col/tex */
+	       else vp->inputmap_rev[j + 1] = VERT_ATTRIB_GENERIC(i); /* mapped 
to pos1 */
 	       break;
 	    }
 	 }
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index e0af6ee..ca80084 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -798,7 +798,7 @@ init_attrib_groups(struct gl_context *ctx)
    ctx->NewState = _NEW_ALL;
    ctx->ErrorValue = (GLenum) GL_NO_ERROR;
    ctx->ResetStatus = (GLenum) GL_NO_ERROR;
-   ctx->varying_vp_inputs = ~0;
+   ctx->varying_vp_inputs = VERT_BIT_ALL;
 
    return GL_TRUE;
 }
diff --git a/src/mesa/main/ff_fragment_shader.cpp 
b/src/mesa/main/ff_fragment_shader.cpp
index 2ce81fe..7d698c3 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -334,7 +334,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx 
)
    else if (!(vertexProgram || vertexShader)) {
       /* Fixed function vertex logic */
       /* _NEW_ARRAY */
-      GLbitfield varying_inputs = ctx->varying_vp_inputs;
+      GLbitfield64 varying_inputs = ctx->varying_vp_inputs;
 
       /* These get generated in the setup routine regardless of the
        * vertex program:
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index 2c93738..f88110f 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -68,7 +68,7 @@ struct state_key {
    unsigned texture_enabled_global:1;
    unsigned fragprog_inputs_read:12;
 
-   unsigned varying_vp_inputs;
+   GLbitfield64 varying_vp_inputs;
 
    struct {
       unsigned light_enabled:1;
@@ -130,16 +130,16 @@ static GLboolean check_active_shininess( struct 
gl_context *ctx,
                                          const struct state_key *key,
                                          GLuint side )
 {
-   GLuint bit = 1 << (MAT_ATTRIB_FRONT_SHININESS + side);
+   GLuint attr = MAT_ATTRIB_FRONT_SHININESS + side;
 
    if ((key->varying_vp_inputs & VERT_BIT_COLOR0) &&
-       (key->light_color_material_mask & bit))
+       (key->light_color_material_mask & (1 << attr)))
       return GL_TRUE;
 
-   if (key->varying_vp_inputs & (bit << 16))
+   if (key->varying_vp_inputs & VERT_ATTRIB_GENERIC(attr))
       return GL_TRUE;
 
-   if (ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS + side][0] != 
0.0F)
+   if (ctx->Light.Material.Attrib[attr][0] != 0.0F)
       return GL_TRUE;
 
    return GL_FALSE;
@@ -445,10 +445,10 @@ static struct ureg register_param5(struct tnl_program 
*p,
  */
 static struct ureg register_input( struct tnl_program *p, GLuint input )
 {
-   assert(input < 32);
+   assert(input < VERT_ATTRIB_MAX);
 
-   if (p->state->varying_vp_inputs & (1<<input)) {
-      p->program->Base.InputsRead |= (1<<input);
+   if (p->state->varying_vp_inputs & VERT_BIT(input)) {
+      p->program->Base.InputsRead |= VERT_BIT(input);
       return make_ureg(PROGRAM_INPUT, input);
    }
    else {
@@ -871,7 +871,7 @@ static void set_material_flags( struct tnl_program *p )
 	 p->color_materials = p->state->light_color_material_mask;
    }
 
-   p->materials |= (p->state->varying_vp_inputs >> 16);
+   p->materials |= (p->state->varying_vp_inputs >> VERT_ATTRIB_GENERIC0);
 }
 
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 5724681..0dc397c 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1865,7 +1865,7 @@ struct gl_program
 
    struct prog_instruction *Instructions;
 
-   GLbitfield InputsRead;     /**< Bitmask of which input regs are read */
+   GLbitfield64 InputsRead;     /**< Bitmask of which input regs are read */
    GLbitfield64 OutputsWritten; /**< Bitmask of which output regs are written 
*/
    GLbitfield SystemValuesRead;   /**< Bitmask of SYSTEM_VALUE_x inputs used 
*/
    GLbitfield InputFlags[MAX_PROGRAM_INPUTS];   /**< PROG_PARAM_BIT_x flags */
@@ -3372,7 +3372,7 @@ struct gl_context
 
    GLboolean ViewportInitialized;  /**< has viewport size been initialized? 
*/
 
-   GLbitfield varying_vp_inputs;  /**< mask of VERT_BIT_* flags */
+   GLbitfield64 varying_vp_inputs;  /**< mask of VERT_BIT_* flags */
 
    /** \name Derived state */
    /*@{*/
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 80fd03b..f57579c 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -737,7 +737,7 @@ _mesa_update_state( struct gl_context *ctx )
  */
 void
 _mesa_set_varying_vp_inputs( struct gl_context *ctx,
-                             GLbitfield varying_inputs )
+                             GLbitfield64 varying_inputs )
 {
    if (ctx->varying_vp_inputs != varying_inputs) {
       ctx->varying_vp_inputs = varying_inputs;
diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h
index 2b5b3d5..29a2540 100644
--- a/src/mesa/main/state.h
+++ b/src/mesa/main/state.h
@@ -39,7 +39,7 @@ _mesa_update_state_locked(struct gl_context *ctx);
 
 
 extern void
-_mesa_set_varying_vp_inputs(struct gl_context *ctx, GLbitfield 
varying_inputs);
+_mesa_set_varying_vp_inputs(struct gl_context *ctx, GLbitfield64 
varying_inputs);
 
 
 extern void
diff --git a/src/mesa/program/program_parse.y 
b/src/mesa/program/program_parse.y
index dec3503..9fdb99d 100644
--- a/src/mesa/program/program_parse.y
+++ b/src/mesa/program/program_parse.y
@@ -802,7 +802,7 @@ srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle 
*/
 	      break;
 	   case at_attrib:
 	      set_src_reg(& $$, PROGRAM_INPUT, s->attrib_binding);
-	      state->prog->InputsRead |= (1U << $$.Base.Index);
+	      state->prog->InputsRead |= BITFIELD64_BIT($$.Base.Index);
 
 	      if (!validate_inputs(& @1, state)) {
 		 YYERROR;
@@ -817,7 +817,7 @@ srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle 
*/
 	| attribBinding
 	{
 	   set_src_reg(& $$, PROGRAM_INPUT, $1);
-	   state->prog->InputsRead |= (1U << $$.Base.Index);
+	   state->prog->InputsRead |= BITFIELD64_BIT($$.Base.Index);
 
 	   if (!validate_inputs(& @1, state)) {
 	      YYERROR;
@@ -2768,7 +2768,7 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum 
target, const GLubyte *st
    state->prog->NumInstructions++;
 
    state->prog->NumParameters = state->prog->Parameters->NumParameters;
-   state->prog->NumAttributes = _mesa_bitcount(state->prog->InputsRead);
+   state->prog->NumAttributes = _mesa_bitcount_64(state->prog->InputsRead);
 
    /*
     * Initialize native counts to logical counts.  The device driver may
diff --git a/src/mesa/program/programopt.c b/src/mesa/program/programopt.c
index c72dfb2..389ea21 100644
--- a/src/mesa/program/programopt.c
+++ b/src/mesa/program/programopt.c
@@ -631,7 +631,7 @@ _mesa_nop_fragment_program(struct gl_context *ctx, struct 
gl_fragment_program *p
 
    prog->Base.Instructions = inst;
    prog->Base.NumInstructions = 2;
-   prog->Base.InputsRead = 1 << inputAttr;
+   prog->Base.InputsRead = BITFIELD64_BIT(inputAttr);
    prog->Base.OutputsWritten = BITFIELD64_BIT(FRAG_RESULT_COLOR);
 }
 
@@ -675,7 +675,7 @@ _mesa_nop_vertex_program(struct gl_context *ctx, struct 
gl_vertex_program *prog)
 
    prog->Base.Instructions = inst;
    prog->Base.NumInstructions = 2;
-   prog->Base.InputsRead = 1 << inputAttr;
+   prog->Base.InputsRead = BITFIELD64_BIT(inputAttr);
    prog->Base.OutputsWritten = BITFIELD64_BIT(VERT_RESULT_COL0);
 
    /*
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c 
b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index 12b5bc5..afca609 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -166,7 +166,7 @@ get_pixel_transfer_program(struct gl_context *ctx, const 
struct state_key *key)
    inst[ic].TexSrcUnit = 0;
    inst[ic].TexSrcTarget = TEXTURE_2D_INDEX;
    ic++;
-   fp->Base.InputsRead = (1 << FRAG_ATTRIB_TEX0);
+   fp->Base.InputsRead = BITFIELD64_BIT(FRAG_ATTRIB_TEX0);
    fp->Base.OutputsWritten = BITFIELD64_BIT(FRAG_RESULT_COLOR);
    fp->Base.SamplersUsed = 0x1;  /* sampler 0 (bit 0) is used */
 
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 74b8fa7..7d1be5e 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -3731,7 +3731,7 @@ get_pixel_transfer_visitor(struct st_fragment_program 
*fp,
    inst->sampler = 0;
    inst->tex_target = TEXTURE_2D_INDEX;
 
-   prog->InputsRead |= (1 << FRAG_ATTRIB_TEX0);
+   prog->InputsRead |= BITFIELD64_BIT(FRAG_ATTRIB_TEX0);
    prog->SamplersUsed |= (1 << 0); /* mark sampler 0 as used */
    v->samplers_used |= (1 << 0);
 
@@ -3802,7 +3802,7 @@ get_pixel_transfer_visitor(struct st_fragment_program 
*fp,
             src_regs[i].index = src0.index;
          }
          else if (src_regs[i].file == PROGRAM_INPUT)
-            prog->InputsRead |= (1 << src_regs[i].index);
+            prog->InputsRead |= BITFIELD64_BIT(src_regs[i].index);
       }
 
       v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], 
src_regs[2]);
@@ -3855,7 +3855,7 @@ get_bitmap_visitor(struct st_fragment_program *fp,
    inst->sampler = samplerIndex;
    inst->tex_target = TEXTURE_2D_INDEX;
 
-   prog->InputsRead |= (1 << FRAG_ATTRIB_TEX0);
+   prog->InputsRead |= BITFIELD64_BIT(FRAG_ATTRIB_TEX0);
    prog->SamplersUsed |= (1 << samplerIndex); /* mark sampler as used */
    v->samplers_used |= (1 << samplerIndex);
 
@@ -3877,7 +3877,7 @@ get_bitmap_visitor(struct st_fragment_program *fp,
       for (int i=0; i<3; i++) {
          src_regs[i] = inst->src[i];
          if (src_regs[i].file == PROGRAM_INPUT)
-            prog->InputsRead |= (1 << src_regs[i].index);
+            prog->InputsRead |= BITFIELD64_BIT(src_regs[i].index);
       }
 
       v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], 
src_regs[2]);
diff --git a/src/mesa/state_tracker/st_program.c 
b/src/mesa/state_tracker/st_program.c
index e031579..768da51 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -194,7 +194,7 @@ st_prepare_vertex_program(struct gl_context *ctx,
     * and TGSI generic input indexes, plus input attrib semantic info.
     */
    for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
-      if (stvp->Base.Base.InputsRead & (1 << attr)) {
+      if ((stvp->Base.Base.InputsRead & BITFIELD64_BIT(attr)) != 0) {
          stvp->input_to_index[attr] = stvp->num_inputs;
          stvp->index_to_input[stvp->num_inputs] = attr;
          stvp->num_inputs++;
@@ -490,7 +490,7 @@ st_translate_fragment_program(struct st_context *st,
       GLuint inputMapping[FRAG_ATTRIB_MAX];
       GLuint interpMode[PIPE_MAX_SHADER_INPUTS];  /* XXX size? */
       GLuint attr;
-      const GLbitfield inputsRead = stfp->Base.Base.InputsRead;
+      const GLbitfield64 inputsRead = stfp->Base.Base.InputsRead;
       struct ureg_program *ureg;
 
       GLboolean write_all = GL_FALSE;
@@ -510,7 +510,7 @@ st_translate_fragment_program(struct st_context *st,
        * Convert Mesa program inputs to TGSI input register semantics.
        */
       for (attr = 0; attr < FRAG_ATTRIB_MAX; attr++) {
-         if (inputsRead & (1 << attr)) {
+         if ((inputsRead & BITFIELD64_BIT(attr)) != 0) {
             const GLuint slot = fs_num_inputs++;
 
             inputMapping[attr] = slot;
@@ -749,7 +749,7 @@ st_translate_geometry_program(struct st_context *st,
    GLuint outputMapping[GEOM_RESULT_MAX];
    struct pipe_context *pipe = st->pipe;
    GLuint attr;
-   const GLbitfield inputsRead = stgp->Base.Base.InputsRead;
+   const GLbitfield64 inputsRead = stgp->Base.Base.InputsRead;
    GLuint vslot = 0;
    GLuint num_generic = 0;
 
@@ -790,7 +790,7 @@ st_translate_geometry_program(struct st_context *st,
     * Convert Mesa program inputs to TGSI input register semantics.
     */
    for (attr = 0; attr < GEOM_ATTRIB_MAX; attr++) {
-      if (inputsRead & (1 << attr)) {
+      if ((inputsRead & BITFIELD64_BIT(attr)) != 0) {
          const GLuint slot = gs_num_inputs;
 
          gs_num_inputs++;
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index 836e8e8..8b060ff 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -379,7 +379,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage 
*stage )
 
       /* the vertex array case */
       for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
-	 if (program->Base.InputsRead & (1 << attr)) {
+	 if (program->Base.InputsRead & BITFIELD64_BIT(attr)) {
 	    const GLubyte *ptr = (const GLubyte*) VB->AttribPtr[attr]->data;
 	    const GLuint size = VB->AttribPtr[attr]->size;
 	    const GLuint stride = VB->AttribPtr[attr]->stride;
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 79e72e4..e1ce345 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -439,7 +439,7 @@ recalculate_input_bindings(struct gl_context *ctx)
    struct vbo_context *vbo = vbo_context(ctx);
    struct vbo_exec_context *exec = &vbo->exec;
    const struct gl_client_array **inputs = &exec->array.inputs[0];
-   GLbitfield const_inputs = 0x0;
+   GLbitfield64 const_inputs = 0x0;
    GLuint i;
 
    switch (get_program_mode(ctx)) {
@@ -548,7 +548,7 @@ recalculate_input_bindings(struct gl_context *ctx)
       break;
    }
 
-   _mesa_set_varying_vp_inputs( ctx, ~const_inputs );
+   _mesa_set_varying_vp_inputs( ctx, VERT_BIT_ALL & (~const_inputs) );
 }
 
 
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 2df408e..4962b54 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -166,7 +166,7 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
    const GLuint count = exec->vtx.vert_count;
    const GLuint *map;
    GLuint attr;
-   GLbitfield varying_inputs = 0x0;
+   GLbitfield64 varying_inputs = 0x0;
 
    /* Install the default (ie Current) attributes first, then overlay
     * all active ones.
diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c
index 08d2e4a..0773786 100644
--- a/src/mesa/vbo/vbo_save_draw.c
+++ b/src/mesa/vbo/vbo_save_draw.c
@@ -137,7 +137,7 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
    const GLuint *map;
    GLuint attr;
    GLubyte node_attrsz[VBO_ATTRIB_MAX];  /* copy of node->attrsz[] */
-   GLbitfield varying_inputs = 0x0;
+   GLbitfield64 varying_inputs = 0x0;
 
    memcpy(node_attrsz, node->attrsz, sizeof(node->attrsz));
 
-- 
1.7.4.4



More information about the mesa-dev mailing list