[Mesa-dev] [PATCH 04/21] st/mesa: use common inputs read field
Marek Olšák
maraeo at gmail.com
Thu Oct 20 15:40:13 UTC 2016
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Thu, Oct 20, 2016 at 10:46 AM, Timothy Arceri
<timothy.arceri at collabora.com> wrote:
> ---
> src/mesa/state_tracker/st_atifs_to_tgsi.c | 14 +++++++-------
> src/mesa/state_tracker/st_atom_rasterizer.c | 2 +-
> src/mesa/state_tracker/st_cb_drawtex.c | 2 +-
> src/mesa/state_tracker/st_glsl_to_nir.cpp | 2 +-
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 ++++----
> src/mesa/state_tracker/st_mesa_to_tgsi.c | 2 +-
> src/mesa/state_tracker/st_program.c | 6 +++---
> 7 files changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_atifs_to_tgsi.c b/src/mesa/state_tracker/st_atifs_to_tgsi.c
> index ae08796..2f2876b 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 7f58c8b..a97a5ac 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 2991a09..85f9a53 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 303b36e..ef49194 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 1c400d4..028457d 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -6069,13 +6069,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++) {
> @@ -6475,7 +6475,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);
> @@ -6486,7 +6486,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 9e3dd9c..18948d6 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 09e8d43..5922e7a 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;
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list