diff options
author | Timothy Arceri <timothy.arceri@collabora.com> | 2016-10-20 14:24:03 +1100 |
---|---|---|
committer | Timothy Arceri <timothy.arceri@collabora.com> | 2016-10-26 14:29:36 +1100 |
commit | e81aaeba37f5419323d8f88bc10943c77e25ed14 (patch) | |
tree | 3dc9c65fd0984128fb559aa71ed4ae4c7493995e /src | |
parent | dfcbdba47119de6c1d81a869f8625bcc3d7560a2 (diff) |
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>
Diffstat (limited to 'src')
30 files changed, 81 insertions, 79 deletions
diff --git a/src/compiler/glsl/ir_set_program_inouts.cpp b/src/compiler/glsl/ir_set_program_inouts.cpp index e68ecfb11c..4529b6c3cd 100644 --- a/src/compiler/glsl/ir_set_program_inouts.cpp +++ b/src/compiler/glsl/ir_set_program_inouts.cpp @@ -24,13 +24,13 @@ /** * \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 * flags indicating which varyings are read and written. Computing * which are actually read from some sort of backend code can be * 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. */ @@ -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 * 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 * something doing a more clever packing would use something other - * than InputsRead/OutputsWritten. + * than inputs_read/OutputsWritten. */ 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) prog->PatchInputsRead |= bitfield; else - prog->InputsRead |= bitfield; + prog->info.inputs_read |= bitfield; /* double inputs read is only for vertex inputs */ 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); - prog->InputsRead = 0; + prog->info.inputs_read = 0; prog->OutputsWritten = 0; prog->SecondaryOutputsWritten = 0; prog->OutputsRead = 0; diff --git a/src/compiler/shader_info.c b/src/compiler/shader_info.c index 34aaf9f21f..2d4292e0a4 100644 --- a/src/compiler/shader_info.c +++ b/src/compiler/shader_info.c @@ -30,7 +30,6 @@ copy_shader_info(const struct gl_shader_program *shader_prog, { shader_info *info = &sh->Program->info; - info->inputs_read = sh->Program->InputsRead; info->double_inputs_read = sh->Program->DoubleInputsRead; info->outputs_written = sh->Program->OutputsWritten; info->outputs_read = sh->Program->OutputsRead; diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index ae230711a7..a57125412e 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -1032,7 +1032,7 @@ fixup_depth_write(struct i915_fragment_program *p) static void check_texcoord_mapping(struct i915_fragment_program *p) { - GLbitfield64 inputs = p->FragProg.InputsRead; + GLbitfield64 inputs = p->FragProg.info.inputs_read; unsigned unit = 0; for (unsigned i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) { @@ -1059,7 +1059,7 @@ check_texcoord_mapping(struct i915_fragment_program *p) static void check_wpos(struct i915_fragment_program *p) { - GLbitfield64 inputs = p->FragProg.InputsRead; + GLbitfield64 inputs = p->FragProg.info.inputs_read; GLint i; unsigned unit = 0; @@ -1257,7 +1257,7 @@ i915ValidateFragmentProgram(struct i915_context *i915) struct i915_fragment_program *p = (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 s2 = S2_TEXCOORD_NONE; int i, offset = 0; diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index 5a0bb3d577..715db1fffa 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -650,7 +650,7 @@ i915_update_sprite_point_enable(struct gl_context *ctx) /* _NEW_PROGRAM */ struct i915_fragment_program *p = (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); GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK; GLuint coord_replace_bits = 0x0; diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index 683d5a679c..36cba22780 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -436,7 +436,7 @@ intel_draw_point(struct intel_context *intel, intelVertexPtr v0) ***********************************************************************/ /* 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 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->Point._Attenuated ? DD_POINT_ATTEN : 0); 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; if (INTEL_DEBUG & DEBUG_STATE) diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c index 5f1b3b7c10..b4574a7eed 100644 --- a/src/mesa/drivers/dri/r200/r200_vertprog.c +++ b/src/mesa/drivers/dri/r200/r200_vertprog.c @@ -413,13 +413,13 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2 return GL_FALSE; #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_FOG | VERT_BIT_TEX0 | VERT_BIT_TEX1 | VERT_BIT_TEX2 | VERT_BIT_TEX3 | VERT_BIT_TEX4 | VERT_BIT_TEX5)) != 0) { if (R200_DEBUG & RADEON_FALLBACKS) { fprintf(stderr, "can't handle vert prog inputs 0x%x\n", - mesa_vp->InputsRead); + mesa_vp->info.inputs_read); } 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 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? */ - if (mesa_vp->InputsRead & VERT_BIT_POS) { + if (mesa_vp->info.inputs_read & VERT_BIT_POS) { vp->inputs[VERT_ATTRIB_POS] = 0; vp->inputmap_rev[0] = VERT_ATTRIB_POS; free_inputs &= ~(1 << 0); 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->inputmap_rev[1] = VERT_ATTRIB_WEIGHT; 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->inputmap_rev[2] = VERT_ATTRIB_NORMAL; 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->inputmap_rev[4] = VERT_ATTRIB_COLOR0; free_inputs &= ~(1 << 2); 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->inputmap_rev[5] = VERT_ATTRIB_COLOR1; free_inputs &= ~(1 << 3); 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->inputmap_rev[3] = VERT_ATTRIB_FOG; array_count++; } /* VERT_ATTRIB_TEX0-5 */ 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->inputmap_rev[8 + i] = VERT_ATTRIB_TEX(i); 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 */ 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) { 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++) { int j; /* completely ignore aliasing? */ - if (mesa_vp->InputsRead & VERT_BIT_GENERIC(i)) { + if (mesa_vp->info.inputs_read & VERT_BIT_GENERIC(i)) { array_count++; if (array_count > 12) { if (R200_DEBUG & RADEON_FALLBACKS) { diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 44b315eec6..65c1b6d0b3 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -743,7 +743,7 @@ check_context_limits(struct gl_context *ctx) assert(VARYING_SLOT_MAX <= (8 * sizeof(ctx->VertexProgram._Current->OutputsWritten))); assert(VARYING_SLOT_MAX <= - (8 * sizeof(ctx->FragmentProgram._Current->InputsRead))); + (8 * sizeof(ctx->FragmentProgram._Current->info.inputs_read))); /* shader-related checks */ assert(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS); diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index b318793fbb..00409cc71d 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -159,7 +159,7 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key ) 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; 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); 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); } else { @@ -1639,7 +1639,7 @@ create_new_program( const struct state_key *key, p.program->NumParameters = p.program->NumAttributes = p.program->NumAddressRegs = 0; p.program->Parameters = _mesa_new_parameter_list(); - p.program->InputsRead = 0; + p.program->info.inputs_read = 0; p.program->OutputsWritten = 0; build_tnl_program( &p ); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index f03f64e129..476ee2dae8 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1922,7 +1922,6 @@ struct gl_program 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 OutputsWritten; /**< Bitmask of which output regs are written */ GLbitfield64 SecondaryOutputsWritten; /**< Subset of OutputsWritten outputs written with non-zero index. */ diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h index 8b6f54b9ca..7a6cdacf47 100644 --- a/src/mesa/main/state.h +++ b/src/mesa/main/state.h @@ -61,12 +61,12 @@ _mesa_need_secondary_color(const struct gl_context *ctx) if (ctx->VertexProgram._Current && (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; if (ctx->FragmentProgram._Current && (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_FALSE; diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 95ea5bd58e..56446c3af0 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -599,7 +599,7 @@ update_program_texture_state(struct gl_context *ctx, struct gl_program **prog, if (prog[MESA_SHADER_FRAGMENT]) { const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1; ctx->Texture._EnabledCoordUnits |= - (prog[MESA_SHADER_FRAGMENT]->InputsRead >> VARYING_SLOT_TEX0) & + (prog[MESA_SHADER_FRAGMENT]->info.inputs_read >> VARYING_SLOT_TEX0) & coordMask; } } diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c index 51cefe33fa..53f661f64f 100644 --- a/src/mesa/program/arbprogparse.c +++ b/src/mesa/program/arbprogparse.c @@ -107,7 +107,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target, program->NumNativeAluInstructions = prog.NumAluInstructions; program->NumNativeTexInstructions = prog.NumTexInstructions; program->NumNativeTexIndirections = prog.NumTexIndirections; - program->InputsRead = prog.InputsRead; + program->info.inputs_read = prog.info.inputs_read; program->OutputsWritten = prog.OutputsWritten; program->IndirectRegisterFiles = prog.IndirectRegisterFiles; 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->NumNativeAttributes = prog.NumNativeAttributes; program->NumNativeAddressRegs = prog.NumNativeAddressRegs; - program->InputsRead = prog.InputsRead; + program->info.inputs_read = prog.info.inputs_read; program->OutputsWritten = prog.OutputsWritten; program->IndirectRegisterFiles = prog.IndirectRegisterFiles; program->IsPositionInvariant = (state.option.PositionInvariant) diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c index 7a7d274546..19d578579e 100644 --- a/src/mesa/program/prog_print.c +++ b/src/mesa/program/prog_print.c @@ -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. */ 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. */ void @@ -872,7 +872,7 @@ _mesa_fprint_program_parameters(FILE *f, GLuint i; 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", (uint64_t) prog->OutputsWritten, binary(prog->OutputsWritten)); fprintf(f, "NumInstructions=%d\n", prog->NumInstructions); diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c index f3c735e65b..9c3ebc0164 100644 --- a/src/mesa/program/prog_to_nir.c +++ b/src/mesa/program/prog_to_nir.c @@ -889,9 +889,9 @@ setup_registers_and_variables(struct ptn_compile *c) struct nir_shader *shader = b->shader; /* 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++) { - if (!(c->prog->InputsRead & BITFIELD64_BIT(i))) + if (!(c->prog->info.inputs_read & BITFIELD64_BIT(i))) continue; nir_variable *var = @@ -1051,7 +1051,6 @@ prog_to_nir(const struct gl_program *prog, s->info->num_abos = 0; s->info->num_ssbos = 0; s->info->num_images = 0; - s->info->inputs_read = prog->InputsRead; s->info->outputs_written = prog->OutputsWritten; s->info->system_values_read = prog->SystemValuesRead; s->info->uses_texture_gather = false; diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y index 5294d58477..2210c0ce8a 100644 --- a/src/mesa/program/program_parse.y +++ b/src/mesa/program/program_parse.y @@ -752,7 +752,7 @@ srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */ break; case at_attrib: 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)) { YYERROR; @@ -767,7 +767,7 @@ srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */ | attribBinding { 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)) { YYERROR; @@ -2218,7 +2218,7 @@ set_src_reg_swz(struct asm_src_register *r, gl_register_file file, GLint index, int 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) { 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->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 diff --git a/src/mesa/program/programopt.c b/src/mesa/program/programopt.c index f51005d13d..3c9839bf24 100644 --- a/src/mesa/program/programopt.c +++ b/src/mesa/program/programopt.c @@ -107,7 +107,7 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_program *vprog) /* install new instructions */ vprog->Instructions = newInst; vprog->NumInstructions = newLen; - vprog->InputsRead |= VERT_BIT_POS; + vprog->info.inputs_read |= VERT_BIT_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 */ vprog->Instructions = newInst; vprog->NumInstructions = newLen; - vprog->InputsRead |= VERT_BIT_POS; + vprog->info.inputs_read |= VERT_BIT_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] * * \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 * to vertex programs too. @@ -408,7 +408,7 @@ _mesa_append_fog_code(struct gl_context *ctx, struct gl_program *fprog, /* install new instructions */ fprog->Instructions = newInst; fprog->NumInstructions = inst - newInst; - fprog->InputsRead |= VARYING_BIT_FOGC; + fprog->info.inputs_read |= VARYING_BIT_FOGC; assert(fprog->OutputsWritten & (1 << FRAG_RESULT_COLOR)); } @@ -592,10 +592,10 @@ _mesa_program_fragment_position_to_sysval(struct gl_program *prog) GLuint i; if (prog->Target != GL_FRAGMENT_PROGRAM_ARB || - !(prog->InputsRead & BITFIELD64_BIT(VARYING_SLOT_POS))) + !(prog->info.inputs_read & BITFIELD64_BIT(VARYING_SLOT_POS))) return; - prog->InputsRead &= ~BITFIELD64_BIT(VARYING_SLOT_POS); + prog->info.inputs_read &= ~BITFIELD64_BIT(VARYING_SLOT_POS); prog->SystemValuesRead |= 1 << SYSTEM_VALUE_FRAG_COORD; for (i = 0; i < prog->NumInstructions; i++) { diff --git a/src/mesa/state_tracker/st_atifs_to_tgsi.c b/src/mesa/state_tracker/st_atifs_to_tgsi.c index ae08796dd5..2f2876b9a6 100644 --- a/src/mesa/state_tracker/st_atifs_to_tgsi.c +++ b/src/mesa/state_tracker/st_atifs_to_tgsi.c @@ -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] = {STATE_FOG_COLOR, 0, 0, 0, 0}; - prog->InputsRead = 0; + prog->info.inputs_read = 0; prog->OutputsWritten = BITFIELD64_BIT(FRAG_RESULT_COLOR); prog->SamplersUsed = 0; 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 (r = 0; r < MAX_NUM_FRAGMENT_REGISTERS_ATI; 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) { /* 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 */ prog->SamplersUsed |= (1 << r); /* the target is unknown here, it will be fixed in the draw call */ prog->TexturesUsed[r] = TEXTURE_2D_BIT; } else if (texinst->Opcode == ATI_FRAGMENT_SHADER_PASS_OP) { 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++) { GLint index = inst->SrcReg[optype][arg].Index; 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) { /* note: ATI_fragment_shader.txt never specifies what * GL_SECONDARY_INTERPOLATOR_ATI is, swrast uses * 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 */ - 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 */ for (i = 0; i < MAX_NUM_FRAGMENT_CONSTANTS_ATI; i++) { diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 7f58c8b8a0..a97a5ac5bc 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -183,7 +183,7 @@ static void update_raster_state( struct st_context *st ) raster->sprite_coord_enable = ctx->Point.CoordReplace & ((1u << MAX_TEXTURE_COORD_UNITS) - 1); if (!st->needs_texcoord_semantic && - fragProg->InputsRead & VARYING_BIT_PNTC) { + fragProg->info.inputs_read & VARYING_BIT_PNTC) { raster->sprite_coord_enable |= 1 << st_get_generic_varying_index(st, VARYING_SLOT_PNTC); } diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index 2991a09f7d..85f9a5390a 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -123,7 +123,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, st_validate_state(st, ST_PIPELINE_RENDER); /* 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; else emitColor = GL_FALSE; diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index 303b36e946..ef491941a2 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -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()? */ 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; num_inputs++; if ((prog->DoubleInputsRead & BITFIELD64_BIT(attr)) != 0) { diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index ff48f9935c..dabd97fd84 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -6099,13 +6099,13 @@ st_translate_program( if (program->shader->info.EarlyFragmentTests) 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. */ emit_wpos(st_context(ctx), t, proginfo, ureg, program->wpos_transform_const); } - if (proginfo->InputsRead & VARYING_BIT_FACE) + if (proginfo->info.inputs_read & VARYING_BIT_FACE) emit_face_var(ctx, t); 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); _mesa_copy_linked_program_data(shader_program, shader); 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, &prog->OutputsWritten, 0ULL, &prog->PatchOutputsWritten); 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. */ 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))) { static const gl_state_index wposTransformState[STATE_LENGTH] = { STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 9e3dd9c331..18948d6a2c 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -832,7 +832,7 @@ st_translate_mesa_program( 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 * emitting constant references, below: */ diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 09e8d43479..5922e7ae7a 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -250,7 +250,7 @@ st_translate_vertex_program(struct st_context *st, * and TGSI generic input indexes, plus input attrib semantic info. */ 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; stvp->index_to_input[stvp->num_inputs] = attr; stvp->num_inputs++; @@ -614,7 +614,7 @@ st_translate_fragment_program(struct st_context *st, /* * 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++) { if ((inputsRead & BITFIELD64_BIT(attr)) != 0) { 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. */ 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++; inputMapping[attr] = slot; diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 3eb931fd3a..a8c2ea3d90 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -499,7 +499,7 @@ _swrast_update_active_attribs(struct gl_context *ctx) */ if (_swrast_use_fragment_program(ctx)) { /* fragment program/shader */ - attribsMask = ctx->FragmentProgram._Current->InputsRead; + attribsMask = ctx->FragmentProgram._Current->info.inputs_read; attribsMask &= ~VARYING_BIT_POS; /* WPOS is always handled specially */ } else if (ctx->ATIFragmentShader._Enabled) { diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index 3530b50eec..bb601db327 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -265,7 +265,7 @@ _swrast_exec_fragment_program( struct gl_context *ctx, SWspan *span ) const struct gl_program *program = ctx->FragmentProgram._Current; /* 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); } diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index 9b7982e854..0319e85587 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -148,7 +148,7 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ) */ 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); } @@ -157,13 +157,13 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ) for (i = 0; i < ctx->Const.MaxTextureCoordUnits; 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)); } } 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. */ tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_FOG); diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index c0a48a0c56..1ed087c0fe 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -347,7 +347,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->InputsRead & BITFIELD64_BIT(attr)) { + if (program->info.inputs_read & 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_attrib.h b/src/mesa/vbo/vbo_attrib.h index 7b7d87af5e..5ee77fe192 100644 --- a/src/mesa/vbo/vbo_attrib.h +++ b/src/mesa/vbo/vbo_attrib.h @@ -79,7 +79,7 @@ enum { VBO_ATTRIB_GENERIC14 = 31, 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 * (whether it is a fixed-function emulation) to * differentiate. Here we must keep them apart instead. diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 19114daa6a..3d1b2f7164 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -211,8 +211,10 @@ vbo_exec_bind_arrays( struct gl_context *ctx ) * glVertexAttrib(0, val) calls to feed into the GENERIC0 input. * The original state gets essentially restored below. */ - if ((ctx->VertexProgram._Current->InputsRead & VERT_BIT_POS) == 0 && - (ctx->VertexProgram._Current->InputsRead & VERT_BIT_GENERIC0)) { + if ((ctx->VertexProgram._Current->info.inputs_read & + VERT_BIT_POS) == 0 && + (ctx->VertexProgram._Current->info.inputs_read & + VERT_BIT_GENERIC0)) { swap_pos = true; exec->vtx.inputs[VERT_ATTRIB_GENERIC0] = exec->vtx.inputs[0]; exec->vtx.attrsz[VERT_ATTRIB_GENERIC0] = exec->vtx.attrsz[0]; diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index cb68e1d258..2aa0095203 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -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 * glVertexAttrib(0, val) calls to feed into the GENERIC0 input. */ - if ((ctx->VertexProgram._Current->InputsRead & VERT_BIT_POS) == 0 && - (ctx->VertexProgram._Current->InputsRead & VERT_BIT_GENERIC0)) { + if ((ctx->VertexProgram._Current->info.inputs_read & + VERT_BIT_POS) == 0 && + (ctx->VertexProgram._Current->info.inputs_read & + VERT_BIT_GENERIC0)) { save->inputs[VERT_ATTRIB_GENERIC0] = save->inputs[0]; node_attrsz[VERT_ATTRIB_GENERIC0] = node_attrsz[0]; node_attrtype[VERT_ATTRIB_GENERIC0] = node_attrtype[0]; |