r200/i915/st/mesa/compiler: use common inputs read field

And set set inputs_read directly in shader_info.

To avoid regressions between changes this change is a squashed
version of the following patches.

st/mesa changes where:
Reviewed-by: Marek Olšák <marek.olsak@amd.com>

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Timothy Arceri
2016-10-20 14:24:03 +11:00
parent dfcbdba471
commit e81aaeba37
30 changed files with 81 additions and 79 deletions

View File

@@ -24,13 +24,13 @@
/** /**
* \file ir_set_program_inouts.cpp * \file ir_set_program_inouts.cpp
* *
* Sets the InputsRead and OutputsWritten of Mesa programs. * Sets the inputs_read and OutputsWritten of Mesa programs.
* *
* Mesa programs (gl_program, not gl_shader_program) have a set of * Mesa programs (gl_program, not gl_shader_program) have a set of
* flags indicating which varyings are read and written. Computing * flags indicating which varyings are read and written. Computing
* which are actually read from some sort of backend code can be * which are actually read from some sort of backend code can be
* tricky when variable array indexing involved. So this pass * tricky when variable array indexing involved. So this pass
* provides support for setting InputsRead and OutputsWritten right * provides support for setting inputs_read and OutputsWritten right
* from the GLSL IR. * from the GLSL IR.
*/ */
@@ -83,10 +83,10 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len,
{ {
/* As of GLSL 1.20, varyings can only be floats, floating-point /* As of GLSL 1.20, varyings can only be floats, floating-point
* vectors or matrices, or arrays of them. For Mesa programs using * vectors or matrices, or arrays of them. For Mesa programs using
* InputsRead/OutputsWritten, everything but matrices uses one * inputs_read/OutputsWritten, everything but matrices uses one
* slot, while matrices use a slot per column. Presumably * slot, while matrices use a slot per column. Presumably
* something doing a more clever packing would use something other * something doing a more clever packing would use something other
* than InputsRead/OutputsWritten. * than inputs_read/OutputsWritten.
*/ */
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
@@ -113,7 +113,7 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len,
if (is_patch_generic) if (is_patch_generic)
prog->PatchInputsRead |= bitfield; prog->PatchInputsRead |= bitfield;
else else
prog->InputsRead |= bitfield; prog->info.inputs_read |= bitfield;
/* double inputs read is only for vertex inputs */ /* double inputs read is only for vertex inputs */
if (stage == MESA_SHADER_VERTEX && if (stage == MESA_SHADER_VERTEX &&
@@ -426,7 +426,7 @@ do_set_program_inouts(exec_list *instructions, struct gl_program *prog,
{ {
ir_set_program_inouts_visitor v(prog, shader_stage); ir_set_program_inouts_visitor v(prog, shader_stage);
prog->InputsRead = 0; prog->info.inputs_read = 0;
prog->OutputsWritten = 0; prog->OutputsWritten = 0;
prog->SecondaryOutputsWritten = 0; prog->SecondaryOutputsWritten = 0;
prog->OutputsRead = 0; prog->OutputsRead = 0;

View File

@@ -30,7 +30,6 @@ copy_shader_info(const struct gl_shader_program *shader_prog,
{ {
shader_info *info = &sh->Program->info; shader_info *info = &sh->Program->info;
info->inputs_read = sh->Program->InputsRead;
info->double_inputs_read = sh->Program->DoubleInputsRead; info->double_inputs_read = sh->Program->DoubleInputsRead;
info->outputs_written = sh->Program->OutputsWritten; info->outputs_written = sh->Program->OutputsWritten;
info->outputs_read = sh->Program->OutputsRead; info->outputs_read = sh->Program->OutputsRead;

View File

@@ -1032,7 +1032,7 @@ fixup_depth_write(struct i915_fragment_program *p)
static void static void
check_texcoord_mapping(struct i915_fragment_program *p) check_texcoord_mapping(struct i915_fragment_program *p)
{ {
GLbitfield64 inputs = p->FragProg.InputsRead; GLbitfield64 inputs = p->FragProg.info.inputs_read;
unsigned unit = 0; unsigned unit = 0;
for (unsigned i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) { for (unsigned i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) {
@@ -1059,7 +1059,7 @@ check_texcoord_mapping(struct i915_fragment_program *p)
static void static void
check_wpos(struct i915_fragment_program *p) check_wpos(struct i915_fragment_program *p)
{ {
GLbitfield64 inputs = p->FragProg.InputsRead; GLbitfield64 inputs = p->FragProg.info.inputs_read;
GLint i; GLint i;
unsigned unit = 0; unsigned unit = 0;
@@ -1257,7 +1257,7 @@ i915ValidateFragmentProgram(struct i915_context *i915)
struct i915_fragment_program *p = struct i915_fragment_program *p =
(struct i915_fragment_program *) ctx->FragmentProgram._Current; (struct i915_fragment_program *) ctx->FragmentProgram._Current;
const GLbitfield64 inputsRead = p->FragProg.InputsRead; const GLbitfield64 inputsRead = p->FragProg.info.inputs_read;
GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK; GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK;
GLuint s2 = S2_TEXCOORD_NONE; GLuint s2 = S2_TEXCOORD_NONE;
int i, offset = 0; int i, offset = 0;

View File

@@ -650,7 +650,7 @@ i915_update_sprite_point_enable(struct gl_context *ctx)
/* _NEW_PROGRAM */ /* _NEW_PROGRAM */
struct i915_fragment_program *p = struct i915_fragment_program *p =
(struct i915_fragment_program *) ctx->FragmentProgram._Current; (struct i915_fragment_program *) ctx->FragmentProgram._Current;
const GLbitfield64 inputsRead = p->FragProg.InputsRead; const GLbitfield64 inputsRead = p->FragProg.info.inputs_read;
struct i915_context *i915 = i915_context(ctx); struct i915_context *i915 = i915_context(ctx);
GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK; GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK;
GLuint coord_replace_bits = 0x0; GLuint coord_replace_bits = 0x0;

View File

@@ -436,7 +436,7 @@ intel_draw_point(struct intel_context *intel, intelVertexPtr v0)
***********************************************************************/ ***********************************************************************/
/* Currently not working - VERT_ATTRIB_POINTSIZE isn't correctly /* Currently not working - VERT_ATTRIB_POINTSIZE isn't correctly
* represented in the fragment program InputsRead field. * represented in the fragment program info.inputs_read field.
*/ */
static void static void
intel_atten_point(struct intel_context *intel, intelVertexPtr v0) intel_atten_point(struct intel_context *intel, intelVertexPtr v0)
@@ -956,7 +956,7 @@ intelChooseRenderState(struct gl_context * ctx)
(ctx->Line.StippleFlag ? DD_LINE_STIPPLE : 0) | (ctx->Line.StippleFlag ? DD_LINE_STIPPLE : 0) |
(ctx->Point._Attenuated ? DD_POINT_ATTEN : 0); (ctx->Point._Attenuated ? DD_POINT_ATTEN : 0);
const struct gl_program *fprog = ctx->FragmentProgram._Current; const struct gl_program *fprog = ctx->FragmentProgram._Current;
bool have_wpos = (fprog && (fprog->InputsRead & VARYING_BIT_POS)); bool have_wpos = (fprog && (fprog->info.inputs_read & VARYING_BIT_POS));
GLuint index = 0; GLuint index = 0;
if (INTEL_DEBUG & DEBUG_STATE) if (INTEL_DEBUG & DEBUG_STATE)

View File

@@ -413,13 +413,13 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
return GL_FALSE; return GL_FALSE;
#if 0 #if 0
if ((mesa_vp->InputsRead & if ((mesa_vp->info.inputs_read &
~(VERT_BIT_POS | VERT_BIT_NORMAL | VERT_BIT_COLOR0 | VERT_BIT_COLOR1 | ~(VERT_BIT_POS | VERT_BIT_NORMAL | VERT_BIT_COLOR0 | VERT_BIT_COLOR1 |
VERT_BIT_FOG | VERT_BIT_TEX0 | VERT_BIT_TEX1 | VERT_BIT_TEX2 | VERT_BIT_FOG | VERT_BIT_TEX0 | VERT_BIT_TEX1 | VERT_BIT_TEX2 |
VERT_BIT_TEX3 | VERT_BIT_TEX4 | VERT_BIT_TEX5)) != 0) { VERT_BIT_TEX3 | VERT_BIT_TEX4 | VERT_BIT_TEX5)) != 0) {
if (R200_DEBUG & RADEON_FALLBACKS) { if (R200_DEBUG & RADEON_FALLBACKS) {
fprintf(stderr, "can't handle vert prog inputs 0x%x\n", fprintf(stderr, "can't handle vert prog inputs 0x%x\n",
mesa_vp->InputsRead); mesa_vp->info.inputs_read);
} }
return GL_FALSE; return GL_FALSE;
} }
@@ -491,42 +491,42 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
Haven't seen attr 14 used, maybe that's for the hw pointsize vec1 (which is Haven't seen attr 14 used, maybe that's for the hw pointsize vec1 (which is
not possibe to use with vertex progs as it is lacking in vert prog specification) */ not possibe to use with vertex progs as it is lacking in vert prog specification) */
/* may look different when using idx buf / input_route instead of se_vtx_fmt? */ /* may look different when using idx buf / input_route instead of se_vtx_fmt? */
if (mesa_vp->InputsRead & VERT_BIT_POS) { if (mesa_vp->info.inputs_read & VERT_BIT_POS) {
vp->inputs[VERT_ATTRIB_POS] = 0; vp->inputs[VERT_ATTRIB_POS] = 0;
vp->inputmap_rev[0] = VERT_ATTRIB_POS; vp->inputmap_rev[0] = VERT_ATTRIB_POS;
free_inputs &= ~(1 << 0); free_inputs &= ~(1 << 0);
array_count++; array_count++;
} }
if (mesa_vp->InputsRead & VERT_BIT_WEIGHT) { if (mesa_vp->info.inputs_read & VERT_BIT_WEIGHT) {
vp->inputs[VERT_ATTRIB_WEIGHT] = 12; vp->inputs[VERT_ATTRIB_WEIGHT] = 12;
vp->inputmap_rev[1] = VERT_ATTRIB_WEIGHT; vp->inputmap_rev[1] = VERT_ATTRIB_WEIGHT;
array_count++; array_count++;
} }
if (mesa_vp->InputsRead & VERT_BIT_NORMAL) { if (mesa_vp->info.inputs_read & VERT_BIT_NORMAL) {
vp->inputs[VERT_ATTRIB_NORMAL] = 1; vp->inputs[VERT_ATTRIB_NORMAL] = 1;
vp->inputmap_rev[2] = VERT_ATTRIB_NORMAL; vp->inputmap_rev[2] = VERT_ATTRIB_NORMAL;
array_count++; array_count++;
} }
if (mesa_vp->InputsRead & VERT_BIT_COLOR0) { if (mesa_vp->info.inputs_read & VERT_BIT_COLOR0) {
vp->inputs[VERT_ATTRIB_COLOR0] = 2; vp->inputs[VERT_ATTRIB_COLOR0] = 2;
vp->inputmap_rev[4] = VERT_ATTRIB_COLOR0; vp->inputmap_rev[4] = VERT_ATTRIB_COLOR0;
free_inputs &= ~(1 << 2); free_inputs &= ~(1 << 2);
array_count++; array_count++;
} }
if (mesa_vp->InputsRead & VERT_BIT_COLOR1) { if (mesa_vp->info.inputs_read & VERT_BIT_COLOR1) {
vp->inputs[VERT_ATTRIB_COLOR1] = 3; vp->inputs[VERT_ATTRIB_COLOR1] = 3;
vp->inputmap_rev[5] = VERT_ATTRIB_COLOR1; vp->inputmap_rev[5] = VERT_ATTRIB_COLOR1;
free_inputs &= ~(1 << 3); free_inputs &= ~(1 << 3);
array_count++; array_count++;
} }
if (mesa_vp->InputsRead & VERT_BIT_FOG) { if (mesa_vp->info.inputs_read & VERT_BIT_FOG) {
vp->inputs[VERT_ATTRIB_FOG] = 15; array_count++; vp->inputs[VERT_ATTRIB_FOG] = 15; array_count++;
vp->inputmap_rev[3] = VERT_ATTRIB_FOG; vp->inputmap_rev[3] = VERT_ATTRIB_FOG;
array_count++; array_count++;
} }
/* VERT_ATTRIB_TEX0-5 */ /* VERT_ATTRIB_TEX0-5 */
for (i = 0; i <= 5; i++) { for (i = 0; i <= 5; i++) {
if (mesa_vp->InputsRead & VERT_BIT_TEX(i)) { if (mesa_vp->info.inputs_read & VERT_BIT_TEX(i)) {
vp->inputs[VERT_ATTRIB_TEX(i)] = i + 6; vp->inputs[VERT_ATTRIB_TEX(i)] = i + 6;
vp->inputmap_rev[8 + i] = VERT_ATTRIB_TEX(i); vp->inputmap_rev[8 + i] = VERT_ATTRIB_TEX(i);
free_inputs &= ~(1 << (i + 6)); free_inputs &= ~(1 << (i + 6));
@@ -535,7 +535,7 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
} }
/* using VERT_ATTRIB_TEX6/7 would be illegal */ /* using VERT_ATTRIB_TEX6/7 would be illegal */
for (; i < VERT_ATTRIB_TEX_MAX; i++) { for (; i < VERT_ATTRIB_TEX_MAX; i++) {
if (mesa_vp->InputsRead & VERT_BIT_TEX(i)) { if (mesa_vp->info.inputs_read & VERT_BIT_TEX(i)) {
if (R200_DEBUG & RADEON_FALLBACKS) { if (R200_DEBUG & RADEON_FALLBACKS) {
fprintf(stderr, "texture attribute %d in vert prog\n", i); fprintf(stderr, "texture attribute %d in vert prog\n", i);
} }
@@ -546,7 +546,7 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) { for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
int j; int j;
/* completely ignore aliasing? */ /* completely ignore aliasing? */
if (mesa_vp->InputsRead & VERT_BIT_GENERIC(i)) { if (mesa_vp->info.inputs_read & VERT_BIT_GENERIC(i)) {
array_count++; array_count++;
if (array_count > 12) { if (array_count > 12) {
if (R200_DEBUG & RADEON_FALLBACKS) { if (R200_DEBUG & RADEON_FALLBACKS) {

View File

@@ -743,7 +743,7 @@ check_context_limits(struct gl_context *ctx)
assert(VARYING_SLOT_MAX <= assert(VARYING_SLOT_MAX <=
(8 * sizeof(ctx->VertexProgram._Current->OutputsWritten))); (8 * sizeof(ctx->VertexProgram._Current->OutputsWritten)));
assert(VARYING_SLOT_MAX <= assert(VARYING_SLOT_MAX <=
(8 * sizeof(ctx->FragmentProgram._Current->InputsRead))); (8 * sizeof(ctx->FragmentProgram._Current->info.inputs_read)));
/* shader-related checks */ /* shader-related checks */
assert(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS); assert(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS);

View File

@@ -159,7 +159,7 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key )
key->need_eye_coords = ctx->_NeedEyeCoords; key->need_eye_coords = ctx->_NeedEyeCoords;
key->fragprog_inputs_read = fp->InputsRead; key->fragprog_inputs_read = fp->info.inputs_read;
key->varying_vp_inputs = ctx->varying_vp_inputs; key->varying_vp_inputs = ctx->varying_vp_inputs;
if (ctx->RenderMode == GL_FEEDBACK) { if (ctx->RenderMode == GL_FEEDBACK) {
@@ -447,7 +447,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input )
assert(input < VERT_ATTRIB_MAX); assert(input < VERT_ATTRIB_MAX);
if (p->state->varying_vp_inputs & VERT_BIT(input)) { if (p->state->varying_vp_inputs & VERT_BIT(input)) {
p->program->InputsRead |= VERT_BIT(input); p->program->info.inputs_read |= VERT_BIT(input);
return make_ureg(PROGRAM_INPUT, input); return make_ureg(PROGRAM_INPUT, input);
} }
else { else {
@@ -1639,7 +1639,7 @@ create_new_program( const struct state_key *key,
p.program->NumParameters = p.program->NumParameters =
p.program->NumAttributes = p.program->NumAddressRegs = 0; p.program->NumAttributes = p.program->NumAddressRegs = 0;
p.program->Parameters = _mesa_new_parameter_list(); p.program->Parameters = _mesa_new_parameter_list();
p.program->InputsRead = 0; p.program->info.inputs_read = 0;
p.program->OutputsWritten = 0; p.program->OutputsWritten = 0;
build_tnl_program( &p ); build_tnl_program( &p );

View File

@@ -1922,7 +1922,6 @@ struct gl_program
struct shader_info info; struct shader_info info;
GLbitfield64 InputsRead; /**< Bitmask of which input regs are read */
GLbitfield64 DoubleInputsRead; /**< Bitmask of which input regs are read and are doubles */ GLbitfield64 DoubleInputsRead; /**< Bitmask of which input regs are read and are doubles */
GLbitfield64 OutputsWritten; /**< Bitmask of which output regs are written */ GLbitfield64 OutputsWritten; /**< Bitmask of which output regs are written */
GLbitfield64 SecondaryOutputsWritten; /**< Subset of OutputsWritten outputs written with non-zero index. */ GLbitfield64 SecondaryOutputsWritten; /**< Subset of OutputsWritten outputs written with non-zero index. */

View File

@@ -61,12 +61,12 @@ _mesa_need_secondary_color(const struct gl_context *ctx)
if (ctx->VertexProgram._Current && if (ctx->VertexProgram._Current &&
(ctx->VertexProgram._Current != ctx->VertexProgram._TnlProgram) && (ctx->VertexProgram._Current != ctx->VertexProgram._TnlProgram) &&
(ctx->VertexProgram._Current->InputsRead & VERT_BIT_COLOR1)) (ctx->VertexProgram._Current->info.inputs_read & VERT_BIT_COLOR1))
return GL_TRUE; return GL_TRUE;
if (ctx->FragmentProgram._Current && if (ctx->FragmentProgram._Current &&
(ctx->FragmentProgram._Current != ctx->FragmentProgram._TexEnvProgram) && (ctx->FragmentProgram._Current != ctx->FragmentProgram._TexEnvProgram) &&
(ctx->FragmentProgram._Current->InputsRead & VARYING_BIT_COL1)) (ctx->FragmentProgram._Current->info.inputs_read & VARYING_BIT_COL1))
return GL_TRUE; return GL_TRUE;
return GL_FALSE; return GL_FALSE;

View File

@@ -599,7 +599,7 @@ update_program_texture_state(struct gl_context *ctx, struct gl_program **prog,
if (prog[MESA_SHADER_FRAGMENT]) { if (prog[MESA_SHADER_FRAGMENT]) {
const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1; const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1;
ctx->Texture._EnabledCoordUnits |= ctx->Texture._EnabledCoordUnits |=
(prog[MESA_SHADER_FRAGMENT]->InputsRead >> VARYING_SLOT_TEX0) & (prog[MESA_SHADER_FRAGMENT]->info.inputs_read >> VARYING_SLOT_TEX0) &
coordMask; coordMask;
} }
} }

View File

@@ -107,7 +107,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
program->NumNativeAluInstructions = prog.NumAluInstructions; program->NumNativeAluInstructions = prog.NumAluInstructions;
program->NumNativeTexInstructions = prog.NumTexInstructions; program->NumNativeTexInstructions = prog.NumTexInstructions;
program->NumNativeTexIndirections = prog.NumTexIndirections; program->NumNativeTexIndirections = prog.NumTexIndirections;
program->InputsRead = prog.InputsRead; program->info.inputs_read = prog.info.inputs_read;
program->OutputsWritten = prog.OutputsWritten; program->OutputsWritten = prog.OutputsWritten;
program->IndirectRegisterFiles = prog.IndirectRegisterFiles; program->IndirectRegisterFiles = prog.IndirectRegisterFiles;
for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) { for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) {
@@ -196,7 +196,7 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
program->NumNativeParameters = prog.NumNativeParameters; program->NumNativeParameters = prog.NumNativeParameters;
program->NumNativeAttributes = prog.NumNativeAttributes; program->NumNativeAttributes = prog.NumNativeAttributes;
program->NumNativeAddressRegs = prog.NumNativeAddressRegs; program->NumNativeAddressRegs = prog.NumNativeAddressRegs;
program->InputsRead = prog.InputsRead; program->info.inputs_read = prog.info.inputs_read;
program->OutputsWritten = prog.OutputsWritten; program->OutputsWritten = prog.OutputsWritten;
program->IndirectRegisterFiles = prog.IndirectRegisterFiles; program->IndirectRegisterFiles = prog.IndirectRegisterFiles;
program->IsPositionInvariant = (state.option.PositionInvariant) program->IsPositionInvariant = (state.option.PositionInvariant)

View File

@@ -208,7 +208,7 @@ arb_input_attrib_string(GLuint index, GLenum progType)
/** /**
* Print a vertex program's InputsRead field in human-readable format. * Print a vertex program's inputs_read field in human-readable format.
* For debugging. * For debugging.
*/ */
void void
@@ -226,7 +226,7 @@ _mesa_print_vp_inputs(GLbitfield inputs)
/** /**
* Print a fragment program's InputsRead field in human-readable format. * Print a fragment program's inputs_read field in human-readable format.
* For debugging. * For debugging.
*/ */
void void
@@ -872,7 +872,7 @@ _mesa_fprint_program_parameters(FILE *f,
GLuint i; GLuint i;
fprintf(f, "InputsRead: %" PRIx64 " (0b%s)\n", fprintf(f, "InputsRead: %" PRIx64 " (0b%s)\n",
(uint64_t) prog->InputsRead, binary(prog->InputsRead)); (uint64_t) prog->info.inputs_read, binary(prog->info.inputs_read));
fprintf(f, "OutputsWritten: %" PRIx64 " (0b%s)\n", fprintf(f, "OutputsWritten: %" PRIx64 " (0b%s)\n",
(uint64_t) prog->OutputsWritten, binary(prog->OutputsWritten)); (uint64_t) prog->OutputsWritten, binary(prog->OutputsWritten));
fprintf(f, "NumInstructions=%d\n", prog->NumInstructions); fprintf(f, "NumInstructions=%d\n", prog->NumInstructions);

View File

@@ -889,9 +889,9 @@ setup_registers_and_variables(struct ptn_compile *c)
struct nir_shader *shader = b->shader; struct nir_shader *shader = b->shader;
/* Create input variables. */ /* Create input variables. */
const int num_inputs = util_last_bit64(c->prog->InputsRead); const int num_inputs = util_last_bit64(c->prog->info.inputs_read);
for (int i = 0; i < num_inputs; i++) { for (int i = 0; i < num_inputs; i++) {
if (!(c->prog->InputsRead & BITFIELD64_BIT(i))) if (!(c->prog->info.inputs_read & BITFIELD64_BIT(i)))
continue; continue;
nir_variable *var = nir_variable *var =
@@ -1051,7 +1051,6 @@ prog_to_nir(const struct gl_program *prog,
s->info->num_abos = 0; s->info->num_abos = 0;
s->info->num_ssbos = 0; s->info->num_ssbos = 0;
s->info->num_images = 0; s->info->num_images = 0;
s->info->inputs_read = prog->InputsRead;
s->info->outputs_written = prog->OutputsWritten; s->info->outputs_written = prog->OutputsWritten;
s->info->system_values_read = prog->SystemValuesRead; s->info->system_values_read = prog->SystemValuesRead;
s->info->uses_texture_gather = false; s->info->uses_texture_gather = false;

View File

@@ -752,7 +752,7 @@ srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */
break; break;
case at_attrib: case at_attrib:
set_src_reg(& $$, PROGRAM_INPUT, s->attrib_binding); set_src_reg(& $$, PROGRAM_INPUT, s->attrib_binding);
state->prog->InputsRead |= BITFIELD64_BIT($$.Base.Index); state->prog->info.inputs_read |= BITFIELD64_BIT($$.Base.Index);
if (!validate_inputs(& @1, state)) { if (!validate_inputs(& @1, state)) {
YYERROR; YYERROR;
@@ -767,7 +767,7 @@ srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */
| attribBinding | attribBinding
{ {
set_src_reg(& $$, PROGRAM_INPUT, $1); set_src_reg(& $$, PROGRAM_INPUT, $1);
state->prog->InputsRead |= BITFIELD64_BIT($$.Base.Index); state->prog->info.inputs_read |= BITFIELD64_BIT($$.Base.Index);
if (!validate_inputs(& @1, state)) { if (!validate_inputs(& @1, state)) {
YYERROR; YYERROR;
@@ -2218,7 +2218,7 @@ set_src_reg_swz(struct asm_src_register *r, gl_register_file file, GLint index,
int int
validate_inputs(struct YYLTYPE *locp, struct asm_parser_state *state) validate_inputs(struct YYLTYPE *locp, struct asm_parser_state *state)
{ {
const GLbitfield64 inputs = state->prog->InputsRead | state->InputsBound; const GLbitfield64 inputs = state->prog->info.inputs_read | state->InputsBound;
if (((inputs & VERT_BIT_FF_ALL) & (inputs >> VERT_ATTRIB_GENERIC0)) != 0) { if (((inputs & VERT_BIT_FF_ALL) & (inputs >> VERT_ATTRIB_GENERIC0)) != 0) {
yyerror(locp, state, "illegal use of generic attribute and name attribute"); yyerror(locp, state, "illegal use of generic attribute and name attribute");
@@ -2588,7 +2588,8 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st
state->prog->NumInstructions++; state->prog->NumInstructions++;
state->prog->NumParameters = state->prog->Parameters->NumParameters; state->prog->NumParameters = state->prog->Parameters->NumParameters;
state->prog->NumAttributes = _mesa_bitcount_64(state->prog->InputsRead); state->prog->NumAttributes =
_mesa_bitcount_64(state->prog->info.inputs_read);
/* /*
* Initialize native counts to logical counts. The device driver may * Initialize native counts to logical counts. The device driver may

View File

@@ -107,7 +107,7 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_program *vprog)
/* install new instructions */ /* install new instructions */
vprog->Instructions = newInst; vprog->Instructions = newInst;
vprog->NumInstructions = newLen; vprog->NumInstructions = newLen;
vprog->InputsRead |= VERT_BIT_POS; vprog->info.inputs_read |= VERT_BIT_POS;
vprog->OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS); vprog->OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
} }
@@ -208,7 +208,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_program *vprog)
/* install new instructions */ /* install new instructions */
vprog->Instructions = newInst; vprog->Instructions = newInst;
vprog->NumInstructions = newLen; vprog->NumInstructions = newLen;
vprog->InputsRead |= VERT_BIT_POS; vprog->info.inputs_read |= VERT_BIT_POS;
vprog->OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS); vprog->OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
} }
@@ -238,7 +238,7 @@ _mesa_insert_mvp_code(struct gl_context *ctx, struct gl_program *vprog)
* \param saturate True if writes to color outputs should be clamped to [0, 1] * \param saturate True if writes to color outputs should be clamped to [0, 1]
* *
* \note * \note
* This function sets \c VARYING_BIT_FOGC in \c fprog->Base.InputsRead. * This function sets \c VARYING_BIT_FOGC in \c fprog->info.inputs_read.
* *
* \todo With a little work, this function could be adapted to add fog code * \todo With a little work, this function could be adapted to add fog code
* to vertex programs too. * to vertex programs too.
@@ -408,7 +408,7 @@ _mesa_append_fog_code(struct gl_context *ctx, struct gl_program *fprog,
/* install new instructions */ /* install new instructions */
fprog->Instructions = newInst; fprog->Instructions = newInst;
fprog->NumInstructions = inst - newInst; fprog->NumInstructions = inst - newInst;
fprog->InputsRead |= VARYING_BIT_FOGC; fprog->info.inputs_read |= VARYING_BIT_FOGC;
assert(fprog->OutputsWritten & (1 << FRAG_RESULT_COLOR)); assert(fprog->OutputsWritten & (1 << FRAG_RESULT_COLOR));
} }
@@ -592,10 +592,10 @@ _mesa_program_fragment_position_to_sysval(struct gl_program *prog)
GLuint i; GLuint i;
if (prog->Target != GL_FRAGMENT_PROGRAM_ARB || if (prog->Target != GL_FRAGMENT_PROGRAM_ARB ||
!(prog->InputsRead & BITFIELD64_BIT(VARYING_SLOT_POS))) !(prog->info.inputs_read & BITFIELD64_BIT(VARYING_SLOT_POS)))
return; return;
prog->InputsRead &= ~BITFIELD64_BIT(VARYING_SLOT_POS); prog->info.inputs_read &= ~BITFIELD64_BIT(VARYING_SLOT_POS);
prog->SystemValuesRead |= 1 << SYSTEM_VALUE_FRAG_COORD; prog->SystemValuesRead |= 1 << SYSTEM_VALUE_FRAG_COORD;
for (i = 0; i < prog->NumInstructions; i++) { for (i = 0; i < prog->NumInstructions; i++) {

View File

@@ -547,12 +547,12 @@ st_init_atifs_prog(struct gl_context *ctx, struct gl_program *prog)
static const gl_state_index fog_color[STATE_LENGTH] = static const gl_state_index fog_color[STATE_LENGTH] =
{STATE_FOG_COLOR, 0, 0, 0, 0}; {STATE_FOG_COLOR, 0, 0, 0, 0};
prog->InputsRead = 0; prog->info.inputs_read = 0;
prog->OutputsWritten = BITFIELD64_BIT(FRAG_RESULT_COLOR); prog->OutputsWritten = BITFIELD64_BIT(FRAG_RESULT_COLOR);
prog->SamplersUsed = 0; prog->SamplersUsed = 0;
prog->Parameters = _mesa_new_parameter_list(); prog->Parameters = _mesa_new_parameter_list();
/* fill in InputsRead, SamplersUsed, TexturesUsed */ /* fill in inputs_read, SamplersUsed, TexturesUsed */
for (pass = 0; pass < atifs->NumPasses; pass++) { for (pass = 0; pass < atifs->NumPasses; pass++) {
for (r = 0; r < MAX_NUM_FRAGMENT_REGISTERS_ATI; r++) { for (r = 0; r < MAX_NUM_FRAGMENT_REGISTERS_ATI; r++) {
struct atifs_setupinst *texinst = &atifs->SetupInst[pass][r]; struct atifs_setupinst *texinst = &atifs->SetupInst[pass][r];
@@ -560,14 +560,14 @@ st_init_atifs_prog(struct gl_context *ctx, struct gl_program *prog)
if (texinst->Opcode == ATI_FRAGMENT_SHADER_SAMPLE_OP) { if (texinst->Opcode == ATI_FRAGMENT_SHADER_SAMPLE_OP) {
/* mark which texcoords are used */ /* mark which texcoords are used */
prog->InputsRead |= BITFIELD64_BIT(VARYING_SLOT_TEX0 + pass_tex - GL_TEXTURE0_ARB); prog->info.inputs_read |= BITFIELD64_BIT(VARYING_SLOT_TEX0 + pass_tex - GL_TEXTURE0_ARB);
/* by default there is 1:1 mapping between samplers and textures */ /* by default there is 1:1 mapping between samplers and textures */
prog->SamplersUsed |= (1 << r); prog->SamplersUsed |= (1 << r);
/* the target is unknown here, it will be fixed in the draw call */ /* the target is unknown here, it will be fixed in the draw call */
prog->TexturesUsed[r] = TEXTURE_2D_BIT; prog->TexturesUsed[r] = TEXTURE_2D_BIT;
} else if (texinst->Opcode == ATI_FRAGMENT_SHADER_PASS_OP) { } else if (texinst->Opcode == ATI_FRAGMENT_SHADER_PASS_OP) {
if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) { if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) {
prog->InputsRead |= BITFIELD64_BIT(VARYING_SLOT_TEX0 + pass_tex - GL_TEXTURE0_ARB); prog->info.inputs_read |= BITFIELD64_BIT(VARYING_SLOT_TEX0 + pass_tex - GL_TEXTURE0_ARB);
} }
} }
} }
@@ -581,12 +581,12 @@ st_init_atifs_prog(struct gl_context *ctx, struct gl_program *prog)
for (arg = 0; arg < inst->ArgCount[optype]; arg++) { for (arg = 0; arg < inst->ArgCount[optype]; arg++) {
GLint index = inst->SrcReg[optype][arg].Index; GLint index = inst->SrcReg[optype][arg].Index;
if (index == GL_PRIMARY_COLOR_EXT) { if (index == GL_PRIMARY_COLOR_EXT) {
prog->InputsRead |= BITFIELD64_BIT(VARYING_SLOT_COL0); prog->info.inputs_read |= BITFIELD64_BIT(VARYING_SLOT_COL0);
} else if (index == GL_SECONDARY_INTERPOLATOR_ATI) { } else if (index == GL_SECONDARY_INTERPOLATOR_ATI) {
/* note: ATI_fragment_shader.txt never specifies what /* note: ATI_fragment_shader.txt never specifies what
* GL_SECONDARY_INTERPOLATOR_ATI is, swrast uses * GL_SECONDARY_INTERPOLATOR_ATI is, swrast uses
* VARYING_SLOT_COL1 for this input */ * VARYING_SLOT_COL1 for this input */
prog->InputsRead |= BITFIELD64_BIT(VARYING_SLOT_COL1); prog->info.inputs_read |= BITFIELD64_BIT(VARYING_SLOT_COL1);
} }
} }
} }
@@ -594,7 +594,7 @@ st_init_atifs_prog(struct gl_context *ctx, struct gl_program *prog)
} }
} }
/* we may need fog */ /* we may need fog */
prog->InputsRead |= BITFIELD64_BIT(VARYING_SLOT_FOGC); prog->info.inputs_read |= BITFIELD64_BIT(VARYING_SLOT_FOGC);
/* we always have the ATI_fs constants, and the fog params */ /* we always have the ATI_fs constants, and the fog params */
for (i = 0; i < MAX_NUM_FRAGMENT_CONSTANTS_ATI; i++) { for (i = 0; i < MAX_NUM_FRAGMENT_CONSTANTS_ATI; i++) {

View File

@@ -183,7 +183,7 @@ static void update_raster_state( struct st_context *st )
raster->sprite_coord_enable = ctx->Point.CoordReplace & raster->sprite_coord_enable = ctx->Point.CoordReplace &
((1u << MAX_TEXTURE_COORD_UNITS) - 1); ((1u << MAX_TEXTURE_COORD_UNITS) - 1);
if (!st->needs_texcoord_semantic && if (!st->needs_texcoord_semantic &&
fragProg->InputsRead & VARYING_BIT_PNTC) { fragProg->info.inputs_read & VARYING_BIT_PNTC) {
raster->sprite_coord_enable |= raster->sprite_coord_enable |=
1 << st_get_generic_varying_index(st, VARYING_SLOT_PNTC); 1 << st_get_generic_varying_index(st, VARYING_SLOT_PNTC);
} }

View File

@@ -123,7 +123,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
st_validate_state(st, ST_PIPELINE_RENDER); st_validate_state(st, ST_PIPELINE_RENDER);
/* determine if we need vertex color */ /* determine if we need vertex color */
if (ctx->FragmentProgram._Current->InputsRead & VARYING_BIT_COL0) if (ctx->FragmentProgram._Current->info.inputs_read & VARYING_BIT_COL0)
emitColor = GL_TRUE; emitColor = GL_TRUE;
else else
emitColor = GL_FALSE; emitColor = GL_FALSE;

View File

@@ -80,7 +80,7 @@ st_nir_assign_vs_in_locations(struct gl_program *prog, nir_shader *nir)
/* TODO de-duplicate w/ similar code in st_translate_vertex_program()? */ /* TODO de-duplicate w/ similar code in st_translate_vertex_program()? */
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
if ((prog->InputsRead & BITFIELD64_BIT(attr)) != 0) { if ((prog->info.inputs_read & BITFIELD64_BIT(attr)) != 0) {
input_to_index[attr] = num_inputs; input_to_index[attr] = num_inputs;
num_inputs++; num_inputs++;
if ((prog->DoubleInputsRead & BITFIELD64_BIT(attr)) != 0) { if ((prog->DoubleInputsRead & BITFIELD64_BIT(attr)) != 0) {

View File

@@ -6099,13 +6099,13 @@ st_translate_program(
if (program->shader->info.EarlyFragmentTests) if (program->shader->info.EarlyFragmentTests)
ureg_property(ureg, TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL, 1); ureg_property(ureg, TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL, 1);
if (proginfo->InputsRead & VARYING_BIT_POS) { if (proginfo->info.inputs_read & VARYING_BIT_POS) {
/* Must do this after setting up t->inputs. */ /* Must do this after setting up t->inputs. */
emit_wpos(st_context(ctx), t, proginfo, ureg, emit_wpos(st_context(ctx), t, proginfo, ureg,
program->wpos_transform_const); program->wpos_transform_const);
} }
if (proginfo->InputsRead & VARYING_BIT_FACE) if (proginfo->info.inputs_read & VARYING_BIT_FACE)
emit_face_var(ctx, t); emit_face_var(ctx, t);
for (i = 0; i < numOutputs; i++) { for (i = 0; i < numOutputs; i++) {
@@ -6505,7 +6505,7 @@ get_mesa_program_tgsi(struct gl_context *ctx,
do_set_program_inouts(shader->ir, prog, shader->Stage); do_set_program_inouts(shader->ir, prog, shader->Stage);
_mesa_copy_linked_program_data(shader_program, shader); _mesa_copy_linked_program_data(shader_program, shader);
shrink_array_declarations(v->inputs, v->num_inputs, shrink_array_declarations(v->inputs, v->num_inputs,
&prog->InputsRead, prog->DoubleInputsRead, &prog->PatchInputsRead); &prog->info.inputs_read, prog->DoubleInputsRead, &prog->PatchInputsRead);
shrink_array_declarations(v->outputs, v->num_outputs, shrink_array_declarations(v->outputs, v->num_outputs,
&prog->OutputsWritten, 0ULL, &prog->PatchOutputsWritten); &prog->OutputsWritten, 0ULL, &prog->PatchOutputsWritten);
count_resources(v, prog); count_resources(v, prog);
@@ -6516,7 +6516,7 @@ get_mesa_program_tgsi(struct gl_context *ctx,
/* This must be done before the uniform storage is associated. */ /* This must be done before the uniform storage is associated. */
if (shader->Stage == MESA_SHADER_FRAGMENT && if (shader->Stage == MESA_SHADER_FRAGMENT &&
(prog->InputsRead & VARYING_BIT_POS || (prog->info.inputs_read & VARYING_BIT_POS ||
prog->SystemValuesRead & (1 << SYSTEM_VALUE_FRAG_COORD))) { prog->SystemValuesRead & (1 << SYSTEM_VALUE_FRAG_COORD))) {
static const gl_state_index wposTransformState[STATE_LENGTH] = { static const gl_state_index wposTransformState[STATE_LENGTH] = {
STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM

View File

@@ -832,7 +832,7 @@ st_translate_mesa_program(
interpMode[i]); interpMode[i]);
} }
if (program->InputsRead & VARYING_BIT_POS) { if (program->info.inputs_read & VARYING_BIT_POS) {
/* Must do this after setting up t->inputs, and before /* Must do this after setting up t->inputs, and before
* emitting constant references, below: * emitting constant references, below:
*/ */

View File

@@ -250,7 +250,7 @@ st_translate_vertex_program(struct st_context *st,
* and TGSI generic input indexes, plus input attrib semantic info. * and TGSI generic input indexes, plus input attrib semantic info.
*/ */
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
if ((stvp->Base.InputsRead & BITFIELD64_BIT(attr)) != 0) { if ((stvp->Base.info.inputs_read & BITFIELD64_BIT(attr)) != 0) {
input_to_index[attr] = stvp->num_inputs; input_to_index[attr] = stvp->num_inputs;
stvp->index_to_input[stvp->num_inputs] = attr; stvp->index_to_input[stvp->num_inputs] = attr;
stvp->num_inputs++; stvp->num_inputs++;
@@ -614,7 +614,7 @@ st_translate_fragment_program(struct st_context *st,
/* /*
* Convert Mesa program inputs to TGSI input register semantics. * Convert Mesa program inputs to TGSI input register semantics.
*/ */
inputsRead = stfp->Base.InputsRead; inputsRead = stfp->Base.info.inputs_read;
for (attr = 0; attr < VARYING_SLOT_MAX; attr++) { for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
if ((inputsRead & BITFIELD64_BIT(attr)) != 0) { if ((inputsRead & BITFIELD64_BIT(attr)) != 0) {
const GLuint slot = fs_num_inputs++; const GLuint slot = fs_num_inputs++;
@@ -1225,7 +1225,7 @@ st_translate_program_common(struct st_context *st,
* Convert Mesa program inputs to TGSI input register semantics. * Convert Mesa program inputs to TGSI input register semantics.
*/ */
for (attr = 0; attr < VARYING_SLOT_MAX; attr++) { for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
if ((prog->InputsRead & BITFIELD64_BIT(attr)) != 0) { if ((prog->info.inputs_read & BITFIELD64_BIT(attr)) != 0) {
const GLuint slot = num_inputs++; const GLuint slot = num_inputs++;
inputMapping[attr] = slot; inputMapping[attr] = slot;

View File

@@ -499,7 +499,7 @@ _swrast_update_active_attribs(struct gl_context *ctx)
*/ */
if (_swrast_use_fragment_program(ctx)) { if (_swrast_use_fragment_program(ctx)) {
/* fragment program/shader */ /* fragment program/shader */
attribsMask = ctx->FragmentProgram._Current->InputsRead; attribsMask = ctx->FragmentProgram._Current->info.inputs_read;
attribsMask &= ~VARYING_BIT_POS; /* WPOS is always handled specially */ attribsMask &= ~VARYING_BIT_POS; /* WPOS is always handled specially */
} }
else if (ctx->ATIFragmentShader._Enabled) { else if (ctx->ATIFragmentShader._Enabled) {

View File

@@ -265,7 +265,7 @@ _swrast_exec_fragment_program( struct gl_context *ctx, SWspan *span )
const struct gl_program *program = ctx->FragmentProgram._Current; const struct gl_program *program = ctx->FragmentProgram._Current;
/* incoming colors should be floats */ /* incoming colors should be floats */
if (program->InputsRead & VARYING_BIT_COL0) { if (program->info.inputs_read & VARYING_BIT_COL0) {
assert(span->array->ChanType == GL_FLOAT); assert(span->array->ChanType == GL_FLOAT);
} }

View File

@@ -148,7 +148,7 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
*/ */
tnl->render_inputs_bitset = BITFIELD64_BIT(_TNL_ATTRIB_POS); tnl->render_inputs_bitset = BITFIELD64_BIT(_TNL_ATTRIB_POS);
if (!fp || (fp->InputsRead & VARYING_BIT_COL0)) { if (!fp || (fp->info.inputs_read & VARYING_BIT_COL0)) {
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_COLOR0); tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_COLOR0);
} }
@@ -157,13 +157,13 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
if (ctx->Texture._EnabledCoordUnits & (1 << i) || if (ctx->Texture._EnabledCoordUnits & (1 << i) ||
(fp && fp->InputsRead & VARYING_BIT_TEX(i))) { (fp && fp->info.inputs_read & VARYING_BIT_TEX(i))) {
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_TEX(i)); tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_TEX(i));
} }
} }
if (ctx->Fog.Enabled if (ctx->Fog.Enabled
|| (fp != NULL && (fp->InputsRead & VARYING_BIT_FOGC) != 0)) { || (fp != NULL && (fp->info.inputs_read & VARYING_BIT_FOGC) != 0)) {
/* Either fixed-function fog or a fragment program needs fog coord. /* Either fixed-function fog or a fragment program needs fog coord.
*/ */
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_FOG); tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_FOG);

View File

@@ -347,7 +347,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
/* the vertex array case */ /* the vertex array case */
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
if (program->InputsRead & BITFIELD64_BIT(attr)) { if (program->info.inputs_read & BITFIELD64_BIT(attr)) {
const GLubyte *ptr = (const GLubyte*) VB->AttribPtr[attr]->data; const GLubyte *ptr = (const GLubyte*) VB->AttribPtr[attr]->data;
const GLuint size = VB->AttribPtr[attr]->size; const GLuint size = VB->AttribPtr[attr]->size;
const GLuint stride = VB->AttribPtr[attr]->stride; const GLuint stride = VB->AttribPtr[attr]->stride;

View File

@@ -79,7 +79,7 @@ enum {
VBO_ATTRIB_GENERIC14 = 31, VBO_ATTRIB_GENERIC14 = 31,
VBO_ATTRIB_GENERIC15 = 32, VBO_ATTRIB_GENERIC15 = 32,
/* XXX: in the vertex program InputsRead flag, we alias /* XXX: in the vertex program inputs_read flag, we alias
* materials and generics and use knowledge about the program * materials and generics and use knowledge about the program
* (whether it is a fixed-function emulation) to * (whether it is a fixed-function emulation) to
* differentiate. Here we must keep them apart instead. * differentiate. Here we must keep them apart instead.

View File

@@ -211,8 +211,10 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
* glVertexAttrib(0, val) calls to feed into the GENERIC0 input. * glVertexAttrib(0, val) calls to feed into the GENERIC0 input.
* The original state gets essentially restored below. * The original state gets essentially restored below.
*/ */
if ((ctx->VertexProgram._Current->InputsRead & VERT_BIT_POS) == 0 && if ((ctx->VertexProgram._Current->info.inputs_read &
(ctx->VertexProgram._Current->InputsRead & VERT_BIT_GENERIC0)) { VERT_BIT_POS) == 0 &&
(ctx->VertexProgram._Current->info.inputs_read &
VERT_BIT_GENERIC0)) {
swap_pos = true; swap_pos = true;
exec->vtx.inputs[VERT_ATTRIB_GENERIC0] = exec->vtx.inputs[0]; exec->vtx.inputs[VERT_ATTRIB_GENERIC0] = exec->vtx.inputs[0];
exec->vtx.attrsz[VERT_ATTRIB_GENERIC0] = exec->vtx.attrsz[0]; exec->vtx.attrsz[VERT_ATTRIB_GENERIC0] = exec->vtx.attrsz[0];

View File

@@ -174,8 +174,10 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
* In that case we effectively need to route the data from * In that case we effectively need to route the data from
* glVertexAttrib(0, val) calls to feed into the GENERIC0 input. * glVertexAttrib(0, val) calls to feed into the GENERIC0 input.
*/ */
if ((ctx->VertexProgram._Current->InputsRead & VERT_BIT_POS) == 0 && if ((ctx->VertexProgram._Current->info.inputs_read &
(ctx->VertexProgram._Current->InputsRead & VERT_BIT_GENERIC0)) { VERT_BIT_POS) == 0 &&
(ctx->VertexProgram._Current->info.inputs_read &
VERT_BIT_GENERIC0)) {
save->inputs[VERT_ATTRIB_GENERIC0] = save->inputs[0]; save->inputs[VERT_ATTRIB_GENERIC0] = save->inputs[0];
node_attrsz[VERT_ATTRIB_GENERIC0] = node_attrsz[0]; node_attrsz[VERT_ATTRIB_GENERIC0] = node_attrsz[0];
node_attrtype[VERT_ATTRIB_GENERIC0] = node_attrtype[0]; node_attrtype[VERT_ATTRIB_GENERIC0] = node_attrtype[0];