[Mesa-dev] [PATCH 05/21] mesa: use common inputs read field
Timothy Arceri
timothy.arceri at collabora.com
Thu Oct 20 08:46:55 UTC 2016
---
src/mesa/main/context.c | 2 +-
src/mesa/main/ffvertex_prog.c | 6 +++---
src/mesa/main/state.h | 4 ++--
src/mesa/main/texstate.c | 2 +-
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 ++++++------
src/mesa/swrast/s_context.c | 2 +-
src/mesa/swrast/s_fragprog.c | 2 +-
src/mesa/tnl/t_context.c | 6 +++---
src/mesa/tnl/t_vb_program.c | 2 +-
src/mesa/vbo/vbo_attrib.h | 2 +-
src/mesa/vbo/vbo_exec_draw.c | 6 ++++--
src/mesa/vbo/vbo_save_draw.c | 6 ++++--
16 files changed, 40 insertions(+), 36 deletions(-)
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 44b315e..65c1b6d 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 b318793..00409cc 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/state.h b/src/mesa/main/state.h
index 8b6f54b..7a6cdac 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 95ea5bd..56446c3 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 51cefe3..53f661f 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 7a7d274..19d5785 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 f3c735e..9c3ebc0 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 fc8eed7..294ada1 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 f51005d..3c9839b 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/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 3eb931f..a8c2ea3 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 3530b50..bb601db 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 9b7982e..0319e85 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 c0a48a0..1ed087c 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 7b7d87a..5ee77fe 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 19114da..3d1b2f7 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 cb68e1d..2aa0095 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];
--
2.7.4
More information about the mesa-dev
mailing list