From e81aaeba37f5419323d8f88bc10943c77e25ed14 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Thu, 20 Oct 2016 14:24:03 +1100 Subject: r200/i915/st/mesa/compiler: use common inputs read field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jason Ekstrand --- src/mesa/program/arbprogparse.c | 4 ++-- src/mesa/program/prog_print.c | 6 +++--- src/mesa/program/prog_to_nir.c | 5 ++--- src/mesa/program/program_parse.y | 9 +++++---- src/mesa/program/programopt.c | 12 ++++++------ 5 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/mesa/program') diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c index 51cefe33faa..53f661f64f4 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 7a7d2745460..19d578579ee 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 f3c735e65b1..9c3ebc01644 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 5294d58477a..2210c0ce8a8 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 f51005d13d5..3c9839bf248 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++) { -- cgit v1.2.3