[Mesa-dev] [PATCH 09/70] st/mesa/r200/i915/i965: move ARB program fields into a union
Timothy Arceri
timothy.arceri at collabora.com
Fri Nov 11 00:45:51 UTC 2016
It's common for games to compile 2000 programs or more so at
32bits x 2000 programs x 22 fields x 2 (at least) stages
This should give us something like 352 kilobytes in savings.
---
src/mesa/drivers/dri/i915/i915_fragprog.c | 12 ++--
src/mesa/drivers/dri/i915/i915_program.c | 16 ++---
src/mesa/drivers/dri/i965/brw_program.c | 4 +-
src/mesa/drivers/dri/r200/r200_state_init.c | 4 +-
src/mesa/drivers/dri/r200/r200_vertprog.c | 36 ++++++------
src/mesa/main/arbprogram.c | 40 ++++++-------
src/mesa/main/ffvertex_prog.c | 31 +++++-----
src/mesa/main/mtypes.h | 91 +++++++++++++++--------------
src/mesa/main/state.c | 4 +-
src/mesa/program/arbprogparse.c | 68 ++++++++++-----------
src/mesa/program/ir_to_mesa.cpp | 12 ++--
src/mesa/program/prog_execute.c | 18 +++---
src/mesa/program/prog_opt_constant_fold.c | 4 +-
src/mesa/program/prog_optimize.c | 53 ++++++++---------
src/mesa/program/prog_print.c | 17 +++---
src/mesa/program/prog_statevars.c | 18 +++---
src/mesa/program/prog_to_nir.c | 12 ++--
src/mesa/program/program.c | 36 ++++++------
src/mesa/program/program_parse.y | 51 ++++++++--------
src/mesa/program/programopt.c | 69 +++++++++++-----------
src/mesa/state_tracker/st_atifs_to_tgsi.c | 6 +-
src/mesa/state_tracker/st_glsl_to_nir.cpp | 3 -
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 -
src/mesa/state_tracker/st_mesa_to_tgsi.c | 14 ++---
src/mesa/state_tracker/st_program.c | 2 +-
src/mesa/swrast/s_fragprog.c | 2 +-
src/mesa/tnl/t_vb_program.c | 4 +-
27 files changed, 319 insertions(+), 311 deletions(-)
diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c
index 2ad9eb2..fc45ae4 100644
--- a/src/mesa/drivers/dri/i915/i915_fragprog.c
+++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
@@ -318,8 +318,8 @@ static bool calc_live_regs( struct i915_fragment_program *p )
uint8_t live_components[I915_MAX_TEMPORARY] = { 0, };
GLint i;
- for (i = program->NumInstructions - 1; i >= 0; i--) {
- struct prog_instruction *inst = &program->Instructions[i];
+ for (i = program->arb.NumInstructions - 1; i >= 0; i--) {
+ struct prog_instruction *inst = &program->arb.Instructions[i];
int opArgs = _mesa_num_inst_src_regs(inst->Opcode);
int a;
@@ -362,7 +362,7 @@ static GLuint get_live_regs( struct i915_fragment_program *p,
const struct prog_instruction *inst )
{
const struct gl_program *program = &p->FragProg;
- GLuint nr = inst - program->Instructions;
+ GLuint nr = inst - program->arb.Instructions;
return p->usedRegs[nr];
}
@@ -383,7 +383,7 @@ static void
upload_program(struct i915_fragment_program *p)
{
const struct gl_program *program = &p->FragProg;
- const struct prog_instruction *inst = program->Instructions;
+ const struct prog_instruction *inst = program->arb.Instructions;
if (INTEL_DEBUG & DEBUG_WM)
_mesa_print_program(program);
@@ -402,9 +402,9 @@ upload_program(struct i915_fragment_program *p)
return;
}
- if (program->NumInstructions > I915_MAX_INSN) {
+ if (program->arb.NumInstructions > I915_MAX_INSN) {
i915_program_error(p, "Exceeded max instructions (%d out of %d)",
- program->NumInstructions, I915_MAX_INSN);
+ program->arb.NumInstructions, I915_MAX_INSN);
return;
}
diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c
index 0abc7e2..a8f693f 100644
--- a/src/mesa/drivers/dri/i915/i915_program.c
+++ b/src/mesa/drivers/dri/i915/i915_program.c
@@ -517,18 +517,18 @@ i915_fini_program(struct i915_fragment_program *p)
}
if (p->error) {
- p->FragProg.NumNativeInstructions = 0;
- p->FragProg.NumNativeAluInstructions = 0;
- p->FragProg.NumNativeTexInstructions = 0;
- p->FragProg.NumNativeTexIndirections = 0;
+ p->FragProg.arb.NumNativeInstructions = 0;
+ p->FragProg.arb.NumNativeAluInstructions = 0;
+ p->FragProg.arb.NumNativeTexInstructions = 0;
+ p->FragProg.arb.NumNativeTexIndirections = 0;
}
else {
- p->FragProg.NumNativeInstructions = (p->nr_alu_insn +
+ p->FragProg.arb.NumNativeInstructions = (p->nr_alu_insn +
p->nr_tex_insn +
p->nr_decl_insn);
- p->FragProg.NumNativeAluInstructions = p->nr_alu_insn;
- p->FragProg.NumNativeTexInstructions = p->nr_tex_insn;
- p->FragProg.NumNativeTexIndirections = p->nr_tex_indirect;
+ p->FragProg.arb.NumNativeAluInstructions = p->nr_alu_insn;
+ p->FragProg.arb.NumNativeTexInstructions = p->nr_tex_insn;
+ p->FragProg.arb.NumNativeTexIndirections = p->nr_tex_indirect;
}
p->declarations[0] |= program_size + decl_size - 2;
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 2f84e86..a502b8e 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -183,7 +183,7 @@ brwProgramStringNotify(struct gl_context *ctx,
GLenum target,
struct gl_program *prog)
{
- assert(target == GL_VERTEX_PROGRAM_ARB || !prog->IsPositionInvariant);
+ assert(target == GL_VERTEX_PROGRAM_ARB || !prog->arb.IsPositionInvariant);
struct brw_context *brw = brw_context(ctx);
const struct brw_compiler *compiler = brw->screen->compiler;
@@ -212,7 +212,7 @@ brwProgramStringNotify(struct gl_context *ctx,
if (newVP == curVP)
brw->ctx.NewDriverState |= BRW_NEW_VERTEX_PROGRAM;
- if (newVP->program.IsPositionInvariant) {
+ if (newVP->program.arb.IsPositionInvariant) {
_mesa_insert_mvp_code(ctx, &newVP->program);
}
newVP->id = get_new_program_id(brw->screen);
diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c
index f31a191..8e14ba7 100644
--- a/src/mesa/drivers/dri/r200/r200_state_init.c
+++ b/src/mesa/drivers/dri/r200/r200_state_init.c
@@ -271,8 +271,8 @@ TCL_OR_VP_CHECK( tcl_or_vp, GL_TRUE, 0 )
TCL_OR_VP_CHECK( tcl_or_vp_add2, GL_TRUE, 2 )
VP_CHECK( tcl_vp, GL_TRUE, 0 )
VP_CHECK( tcl_vp_add4, GL_TRUE, 4 )
-VP_CHECK( tcl_vp_size_add4, ctx->VertexProgram.Current->NumNativeInstructions > 64, 4 )
-VP_CHECK( tcl_vpp_size_add4, ctx->VertexProgram.Current->NumNativeParameters > 96, 4 )
+VP_CHECK( tcl_vp_size_add4, ctx->VertexProgram.Current->arb.NumNativeInstructions > 64, 4 )
+VP_CHECK( tcl_vpp_size_add4, ctx->VertexProgram.Current->arb.NumNativeParameters > 96, 4 )
#define OUT_VEC(hdr, data) do { \
drm_radeon_cmd_header_t h; \
diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c
index 5965c6e..2b38810 100644
--- a/src/mesa/drivers/dri/r200/r200_vertprog.c
+++ b/src/mesa/drivers/dri/r200/r200_vertprog.c
@@ -409,7 +409,7 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
vp->translated = GL_TRUE;
vp->fogmode = ctx->Fog.Mode;
- if (mesa_vp->NumInstructions == 0)
+ if (mesa_vp->arb.NumInstructions == 0)
return GL_FALSE;
#if 0
@@ -445,7 +445,7 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
struct prog_dst_register dst;
/* FIXME: is changing the prog safe to do here? */
- if (mesa_vp->IsPositionInvariant &&
+ if (mesa_vp->arb.IsPositionInvariant &&
/* make sure we only do this once */
!(mesa_vp->info.outputs_written & (1 << VARYING_SLOT_POS))) {
_mesa_insert_mvp_code(ctx, mesa_vp);
@@ -462,11 +462,11 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
}
vp->pos_end = 0;
- mesa_vp->NumNativeInstructions = 0;
+ mesa_vp->arb.NumNativeInstructions = 0;
if (mesa_vp->Parameters)
- mesa_vp->NumNativeParameters = mesa_vp->Parameters->NumParameters;
+ mesa_vp->arb.NumNativeParameters = mesa_vp->Parameters->NumParameters;
else
- mesa_vp->NumNativeParameters = 0;
+ mesa_vp->arb.NumNativeParameters = 0;
for(i = 0; i < VERT_ATTRIB_MAX; i++)
vp->inputs[i] = -1;
@@ -590,7 +590,7 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
}
o_inst = vp->instr;
- for (vpi = mesa_vp->Instructions; vpi->Opcode != OPCODE_END; vpi++, o_inst++){
+ for (vpi = mesa_vp->arb.Instructions; vpi->Opcode != OPCODE_END; vpi++, o_inst++){
operands = op_operands(vpi->Opcode);
are_srcs_scalar = operands & SCALAR_FLAG;
operands &= OP_MASK;
@@ -1070,20 +1070,20 @@ else {
}
u_temp_used = (R200_VSF_MAX_TEMPS - 1) - u_temp_i;
- if (mesa_vp->NumNativeTemporaries <
- (mesa_vp->NumTemporaries + u_temp_used)) {
- mesa_vp->NumNativeTemporaries =
- mesa_vp->NumTemporaries + u_temp_used;
+ if (mesa_vp->arb.NumNativeTemporaries <
+ (mesa_vp->arb.NumTemporaries + u_temp_used)) {
+ mesa_vp->arb.NumNativeTemporaries =
+ mesa_vp->arb.NumTemporaries + u_temp_used;
}
- if ((mesa_vp->NumTemporaries + u_temp_used) > R200_VSF_MAX_TEMPS) {
+ if ((mesa_vp->arb.NumTemporaries + u_temp_used) > R200_VSF_MAX_TEMPS) {
if (R200_DEBUG & RADEON_FALLBACKS) {
- fprintf(stderr, "Ran out of temps, num temps %d, us %d\n", mesa_vp->NumTemporaries, u_temp_used);
+ fprintf(stderr, "Ran out of temps, num temps %d, us %d\n", mesa_vp->arb.NumTemporaries, u_temp_used);
}
return GL_FALSE;
}
u_temp_i = R200_VSF_MAX_TEMPS - 1;
if(o_inst - vp->instr >= R200_VSF_MAX_INST) {
- mesa_vp->NumNativeInstructions = 129;
+ mesa_vp->arb.NumNativeInstructions = 129;
if (R200_DEBUG & RADEON_FALLBACKS) {
fprintf(stderr, "more than 128 native instructions\n");
}
@@ -1095,7 +1095,7 @@ else {
}
vp->native = GL_TRUE;
- mesa_vp->NumNativeInstructions = (o_inst - vp->instr);
+ mesa_vp->arb.NumNativeInstructions = (o_inst - vp->instr);
#if 0
fprintf(stderr, "hw program:\n");
for(i=0; i < vp->program.length; i++)
@@ -1127,15 +1127,15 @@ void r200SetupVertexProg( struct gl_context *ctx ) {
R200_STATECHANGE( rmesa, pvs );
rmesa->hw.pvs.cmd[PVS_CNTL_1] = (0 << R200_PVS_CNTL_1_PROGRAM_START_SHIFT) |
- ((vp->mesa_program.NumNativeInstructions - 1) << R200_PVS_CNTL_1_PROGRAM_END_SHIFT) |
+ ((vp->mesa_program.arb.NumNativeInstructions - 1) << R200_PVS_CNTL_1_PROGRAM_END_SHIFT) |
(vp->pos_end << R200_PVS_CNTL_1_POS_END_SHIFT);
rmesa->hw.pvs.cmd[PVS_CNTL_2] = (0 << R200_PVS_CNTL_2_PARAM_OFFSET_SHIFT) |
- (vp->mesa_program.NumNativeParameters << R200_PVS_CNTL_2_PARAM_COUNT_SHIFT);
+ (vp->mesa_program.arb.NumNativeParameters << R200_PVS_CNTL_2_PARAM_COUNT_SHIFT);
/* maybe user clip planes just work with vertex progs... untested */
if (ctx->Transform.ClipPlanesEnabled) {
R200_STATECHANGE( rmesa, tcl );
- if (vp->mesa_program.IsPositionInvariant) {
+ if (vp->mesa_program.arb.IsPositionInvariant) {
rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= (ctx->Transform.ClipPlanesEnabled << 2);
}
else {
@@ -1144,7 +1144,7 @@ void r200SetupVertexProg( struct gl_context *ctx ) {
}
if (vp != rmesa->curr_vp_hw) {
- GLuint count = vp->mesa_program.NumNativeInstructions;
+ GLuint count = vp->mesa_program.arb.NumNativeInstructions;
drm_radeon_cmd_header_t tmp;
R200_STATECHANGE( rmesa, vpi[0] );
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c
index 9c7622a..c64ab91 100644
--- a/src/mesa/main/arbprogram.c
+++ b/src/mesa/main/arbprogram.c
@@ -274,13 +274,13 @@ get_local_param_pointer(struct gl_context *ctx, const char *func,
return GL_FALSE;
}
- if (!prog->LocalParams) {
- prog->LocalParams = calloc(maxParams, sizeof(float[4]));
- if (!prog->LocalParams)
+ if (!prog->arb.LocalParams) {
+ prog->arb.LocalParams = calloc(maxParams, sizeof(float[4]));
+ if (!prog->arb.LocalParams)
return GL_FALSE;
}
- *param = prog->LocalParams[index];
+ *param = prog->arb.LocalParams[index];
return GL_TRUE;
}
@@ -680,61 +680,61 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
*params = prog->Id;
return;
case GL_PROGRAM_INSTRUCTIONS_ARB:
- *params = prog->NumInstructions;
+ *params = prog->arb.NumInstructions;
return;
case GL_MAX_PROGRAM_INSTRUCTIONS_ARB:
*params = limits->MaxInstructions;
return;
case GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB:
- *params = prog->NumNativeInstructions;
+ *params = prog->arb.NumNativeInstructions;
return;
case GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB:
*params = limits->MaxNativeInstructions;
return;
case GL_PROGRAM_TEMPORARIES_ARB:
- *params = prog->NumTemporaries;
+ *params = prog->arb.NumTemporaries;
return;
case GL_MAX_PROGRAM_TEMPORARIES_ARB:
*params = limits->MaxTemps;
return;
case GL_PROGRAM_NATIVE_TEMPORARIES_ARB:
- *params = prog->NumNativeTemporaries;
+ *params = prog->arb.NumNativeTemporaries;
return;
case GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB:
*params = limits->MaxNativeTemps;
return;
case GL_PROGRAM_PARAMETERS_ARB:
- *params = prog->NumParameters;
+ *params = prog->arb.NumParameters;
return;
case GL_MAX_PROGRAM_PARAMETERS_ARB:
*params = limits->MaxParameters;
return;
case GL_PROGRAM_NATIVE_PARAMETERS_ARB:
- *params = prog->NumNativeParameters;
+ *params = prog->arb.NumNativeParameters;
return;
case GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB:
*params = limits->MaxNativeParameters;
return;
case GL_PROGRAM_ATTRIBS_ARB:
- *params = prog->NumAttributes;
+ *params = prog->arb.NumAttributes;
return;
case GL_MAX_PROGRAM_ATTRIBS_ARB:
*params = limits->MaxAttribs;
return;
case GL_PROGRAM_NATIVE_ATTRIBS_ARB:
- *params = prog->NumNativeAttributes;
+ *params = prog->arb.NumNativeAttributes;
return;
case GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB:
*params = limits->MaxNativeAttribs;
return;
case GL_PROGRAM_ADDRESS_REGISTERS_ARB:
- *params = prog->NumAddressRegs;
+ *params = prog->arb.NumAddressRegs;
return;
case GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB:
*params = limits->MaxAddressRegs;
return;
case GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB:
- *params = prog->NumNativeAddressRegs;
+ *params = prog->arb.NumNativeAddressRegs;
return;
case GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB:
*params = limits->MaxNativeAddressRegs;
@@ -778,22 +778,22 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
const struct gl_program *fp = ctx->FragmentProgram.Current;
switch (pname) {
case GL_PROGRAM_ALU_INSTRUCTIONS_ARB:
- *params = fp->NumNativeAluInstructions;
+ *params = fp->arb.NumNativeAluInstructions;
return;
case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB:
- *params = fp->NumAluInstructions;
+ *params = fp->arb.NumAluInstructions;
return;
case GL_PROGRAM_TEX_INSTRUCTIONS_ARB:
- *params = fp->NumTexInstructions;
+ *params = fp->arb.NumTexInstructions;
return;
case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB:
- *params = fp->NumNativeTexInstructions;
+ *params = fp->arb.NumNativeTexInstructions;
return;
case GL_PROGRAM_TEX_INDIRECTIONS_ARB:
- *params = fp->NumTexIndirections;
+ *params = fp->arb.NumTexIndirections;
return;
case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB:
- *params = fp->NumNativeTexIndirections;
+ *params = fp->arb.NumNativeTexIndirections;
return;
case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB:
*params = limits->MaxAluInstructions;
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index d4a22c1..c9bff3f 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -383,8 +383,8 @@ static struct ureg get_temp( struct tnl_program *p )
exit(1);
}
- if ((GLuint) bit > p->program->NumTemporaries)
- p->program->NumTemporaries = bit;
+ if ((GLuint) bit > p->program->arb.NumTemporaries)
+ p->program->arb.NumTemporaries = bit;
p->temp_in_use |= 1<<(bit-1);
return make_ureg(PROGRAM_TEMPORARY, bit-1);
@@ -577,9 +577,9 @@ static void emit_op3fn(struct tnl_program *p,
GLuint nr;
struct prog_instruction *inst;
- assert(p->program->NumInstructions <= p->max_inst);
+ assert(p->program->arb.NumInstructions <= p->max_inst);
- if (p->program->NumInstructions == p->max_inst) {
+ if (p->program->arb.NumInstructions == p->max_inst) {
/* need to extend the program's instruction array */
struct prog_instruction *newInst;
@@ -592,17 +592,17 @@ static void emit_op3fn(struct tnl_program *p,
return;
}
- _mesa_copy_instructions(newInst, p->program->Instructions,
- p->program->NumInstructions);
+ _mesa_copy_instructions(newInst, p->program->arb.Instructions,
+ p->program->arb.NumInstructions);
- ralloc_free(p->program->Instructions);
+ ralloc_free(p->program->arb.Instructions);
- p->program->Instructions = newInst;
+ p->program->arb.Instructions = newInst;
}
- nr = p->program->NumInstructions++;
+ nr = p->program->arb.NumInstructions++;
- inst = &p->program->Instructions[nr];
+ inst = &p->program->arb.Instructions[nr];
inst->Opcode = (enum prog_opcode) op;
emit_arg( &inst->SrcReg[0], src0 );
@@ -1631,12 +1631,13 @@ create_new_program( const struct state_key *key,
* If we need more, we'll grow the instruction array as needed.
*/
p.max_inst = 32;
- p.program->Instructions = _mesa_alloc_instructions(program, p.max_inst);
+ p.program->arb.Instructions = _mesa_alloc_instructions(program,
+ p.max_inst);
p.program->String = NULL;
- p.program->NumInstructions =
- p.program->NumTemporaries =
- p.program->NumParameters =
- p.program->NumAttributes = p.program->NumAddressRegs = 0;
+ p.program->arb.NumInstructions =
+ p.program->arb.NumTemporaries =
+ p.program->arb.NumParameters =
+ p.program->arb.NumAttributes = p.program->arb.NumAddressRegs = 0;
p.program->Parameters = _mesa_new_parameter_list();
p.program->info.inputs_read = 0;
p.program->info.outputs_written = 0;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 08f72e0..7312179 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1921,8 +1921,6 @@ struct gl_program
GLenum Target; /**< GL_VERTEX/FRAGMENT_PROGRAM_ARB, GL_GEOMETRY_PROGRAM_NV */
GLenum Format; /**< String encoding format */
- struct prog_instruction *Instructions;
-
struct nir_shader *nir;
GLbitfield64 SecondaryOutputsWritten; /**< Subset of OutputsWritten outputs written with non-zero index. */
@@ -1942,50 +1940,57 @@ struct gl_program
/** Named parameters, constants, etc. from program text */
struct gl_program_parameter_list *Parameters;
- /**
- * Local parameters used by the program.
- *
- * It's dynamically allocated because it is rarely used (just
- * assembly-style programs), and MAX_PROGRAM_LOCAL_PARAMS entries once it's
- * allocated.
- */
- GLfloat (*LocalParams)[4];
-
/** Map from sampler unit to texture unit (set by glUniform1i()) */
GLubyte SamplerUnits[MAX_SAMPLERS];
- /** Bitmask of which register files are read/written with indirect
- * addressing. Mask of (1 << PROGRAM_x) bits.
- */
- GLbitfield IndirectRegisterFiles;
-
- /** Logical counts */
- /*@{*/
- GLuint NumInstructions;
- GLuint NumTemporaries;
- GLuint NumParameters;
- GLuint NumAttributes;
- GLuint NumAddressRegs;
- GLuint NumAluInstructions;
- GLuint NumTexInstructions;
- GLuint NumTexIndirections;
- /*@}*/
- /** Native, actual h/w counts */
- /*@{*/
- GLuint NumNativeInstructions;
- GLuint NumNativeTemporaries;
- GLuint NumNativeParameters;
- GLuint NumNativeAttributes;
- GLuint NumNativeAddressRegs;
- GLuint NumNativeAluInstructions;
- GLuint NumNativeTexInstructions;
- GLuint NumNativeTexIndirections;
- /*@}*/
-
- /** Used by ARB assembly-style programs. Can only be true for vertex
- * programs.
- */
- GLboolean IsPositionInvariant;
+ union {
+ /** ARB assembly-style program fields */
+ struct {
+ struct prog_instruction *Instructions;
+
+ /**
+ * Local parameters used by the program.
+ *
+ * It's dynamically allocated because it is rarely used (just
+ * assembly-style programs), and MAX_PROGRAM_LOCAL_PARAMS entries
+ * once it's allocated.
+ */
+ GLfloat (*LocalParams)[4];
+
+ /** Bitmask of which register files are read/written with indirect
+ * addressing. Mask of (1 << PROGRAM_x) bits.
+ */
+ GLbitfield IndirectRegisterFiles;
+
+ /** Logical counts */
+ /*@{*/
+ GLuint NumInstructions;
+ GLuint NumTemporaries;
+ GLuint NumParameters;
+ GLuint NumAttributes;
+ GLuint NumAddressRegs;
+ GLuint NumAluInstructions;
+ GLuint NumTexInstructions;
+ GLuint NumTexIndirections;
+ /*@}*/
+ /** Native, actual h/w counts */
+ /*@{*/
+ GLuint NumNativeInstructions;
+ GLuint NumNativeTemporaries;
+ GLuint NumNativeParameters;
+ GLuint NumNativeAttributes;
+ GLuint NumNativeAddressRegs;
+ GLuint NumNativeAluInstructions;
+ GLuint NumNativeTexInstructions;
+ GLuint NumNativeTexIndirections;
+ /*@}*/
+
+ /** Used by ARB assembly-style programs. Can only be true for vertex
+ * programs.
+ */
+ GLboolean IsPositionInvariant;
+ } arb;
+ };
};
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 721f0ef..42956fd 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -70,9 +70,9 @@ update_program_enables(struct gl_context *ctx)
* GLSL shaders not relevant here.
*/
ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled
- && ctx->VertexProgram.Current->Instructions;
+ && ctx->VertexProgram.Current->arb.Instructions;
ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled
- && ctx->FragmentProgram.Current->Instructions;
+ && ctx->FragmentProgram.Current->arb.Instructions;
ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled
&& ctx->ATIFragmentShader.Current->Instructions[0];
}
diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c
index a7e21d9..196d30f 100644
--- a/src/mesa/program/arbprogparse.c
+++ b/src/mesa/program/arbprogparse.c
@@ -91,25 +91,25 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
* fragment_program struct.
*/
program->String = prog.String;
- program->NumInstructions = prog.NumInstructions;
- program->NumTemporaries = prog.NumTemporaries;
- program->NumParameters = prog.NumParameters;
- program->NumAttributes = prog.NumAttributes;
- program->NumAddressRegs = prog.NumAddressRegs;
- program->NumNativeInstructions = prog.NumNativeInstructions;
- program->NumNativeTemporaries = prog.NumNativeTemporaries;
- program->NumNativeParameters = prog.NumNativeParameters;
- program->NumNativeAttributes = prog.NumNativeAttributes;
- program->NumNativeAddressRegs = prog.NumNativeAddressRegs;
- program->NumAluInstructions = prog.NumAluInstructions;
- program->NumTexInstructions = prog.NumTexInstructions;
- program->NumTexIndirections = prog.NumTexIndirections;
- program->NumNativeAluInstructions = prog.NumAluInstructions;
- program->NumNativeTexInstructions = prog.NumTexInstructions;
- program->NumNativeTexIndirections = prog.NumTexIndirections;
+ program->arb.NumInstructions = prog.arb.NumInstructions;
+ program->arb.NumTemporaries = prog.arb.NumTemporaries;
+ program->arb.NumParameters = prog.arb.NumParameters;
+ program->arb.NumAttributes = prog.arb.NumAttributes;
+ program->arb.NumAddressRegs = prog.arb.NumAddressRegs;
+ program->arb.NumNativeInstructions = prog.arb.NumNativeInstructions;
+ program->arb.NumNativeTemporaries = prog.arb.NumNativeTemporaries;
+ program->arb.NumNativeParameters = prog.arb.NumNativeParameters;
+ program->arb.NumNativeAttributes = prog.arb.NumNativeAttributes;
+ program->arb.NumNativeAddressRegs = prog.arb.NumNativeAddressRegs;
+ program->arb.NumAluInstructions = prog.arb.NumAluInstructions;
+ program->arb.NumTexInstructions = prog.arb.NumTexInstructions;
+ program->arb.NumTexIndirections = prog.arb.NumTexIndirections;
+ program->arb.NumNativeAluInstructions = prog.arb.NumAluInstructions;
+ program->arb.NumNativeTexInstructions = prog.arb.NumTexInstructions;
+ program->arb.NumNativeTexIndirections = prog.arb.NumTexIndirections;
program->info.inputs_read = prog.info.inputs_read;
program->info.outputs_written = prog.info.outputs_written;
- program->IndirectRegisterFiles = prog.IndirectRegisterFiles;
+ program->arb.IndirectRegisterFiles = prog.arb.IndirectRegisterFiles;
for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) {
program->TexturesUsed[i] = prog.TexturesUsed[i];
if (prog.TexturesUsed[i])
@@ -121,8 +121,8 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
program->info.fs.uses_discard = state.fragment.UsesKill;
- free(program->Instructions);
- program->Instructions = prog.Instructions;
+ free(program->arb.Instructions);
+ program->arb.Instructions = prog.arb.Instructions;
if (program->Parameters)
_mesa_free_parameter_list(program->Parameters);
@@ -174,7 +174,7 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
if (!_mesa_parse_arb_program(ctx, target, (const GLubyte*) str, len,
&state)) {
- ralloc_free(prog.Instructions);
+ ralloc_free(prog.arb.Instructions);
ralloc_free(prog.String);
_mesa_error(ctx, GL_INVALID_OPERATION, "glProgramString(bad program)");
return;
@@ -189,24 +189,24 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
* vertex_program struct.
*/
program->String = prog.String;
- program->NumInstructions = prog.NumInstructions;
- program->NumTemporaries = prog.NumTemporaries;
- program->NumParameters = prog.NumParameters;
- program->NumAttributes = prog.NumAttributes;
- program->NumAddressRegs = prog.NumAddressRegs;
- program->NumNativeInstructions = prog.NumNativeInstructions;
- program->NumNativeTemporaries = prog.NumNativeTemporaries;
- program->NumNativeParameters = prog.NumNativeParameters;
- program->NumNativeAttributes = prog.NumNativeAttributes;
- program->NumNativeAddressRegs = prog.NumNativeAddressRegs;
+ program->arb.NumInstructions = prog.arb.NumInstructions;
+ program->arb.NumTemporaries = prog.arb.NumTemporaries;
+ program->arb.NumParameters = prog.arb.NumParameters;
+ program->arb.NumAttributes = prog.arb.NumAttributes;
+ program->arb.NumAddressRegs = prog.arb.NumAddressRegs;
+ program->arb.NumNativeInstructions = prog.arb.NumNativeInstructions;
+ program->arb.NumNativeTemporaries = prog.arb.NumNativeTemporaries;
+ program->arb.NumNativeParameters = prog.arb.NumNativeParameters;
+ program->arb.NumNativeAttributes = prog.arb.NumNativeAttributes;
+ program->arb.NumNativeAddressRegs = prog.arb.NumNativeAddressRegs;
program->info.inputs_read = prog.info.inputs_read;
program->info.outputs_written = prog.info.outputs_written;
- program->IndirectRegisterFiles = prog.IndirectRegisterFiles;
- program->IsPositionInvariant = (state.option.PositionInvariant)
+ program->arb.IndirectRegisterFiles = prog.arb.IndirectRegisterFiles;
+ program->arb.IsPositionInvariant = (state.option.PositionInvariant)
? GL_TRUE : GL_FALSE;
- ralloc_free(program->Instructions);
- program->Instructions = prog.Instructions;
+ ralloc_free(program->arb.Instructions);
+ program->arb.Instructions = prog.arb.Instructions;
if (program->Parameters)
_mesa_free_parameter_list(program->Parameters);
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index c2231fb..e24fb50b 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2807,7 +2807,7 @@ get_mesa_program(struct gl_context *ctx,
visit_exec_list(shader->ir, &v);
v.emit(NULL, OPCODE_END);
- prog->NumTemporaries = v.next_temp;
+ prog->arb.NumTemporaries = v.next_temp;
unsigned num_instructions = v.instructions.length();
@@ -2841,12 +2841,12 @@ get_mesa_program(struct gl_context *ctx,
/* Set IndirectRegisterFiles. */
if (mesa_inst->DstReg.RelAddr)
- prog->IndirectRegisterFiles |= 1 << mesa_inst->DstReg.File;
+ prog->arb.IndirectRegisterFiles |= 1 << mesa_inst->DstReg.File;
/* Update program's bitmask of indirectly accessed register files */
for (unsigned src = 0; src < 3; src++)
if (mesa_inst->SrcReg[src].RelAddr)
- prog->IndirectRegisterFiles |= 1 << mesa_inst->SrcReg[src].File;
+ prog->arb.IndirectRegisterFiles |= 1 << mesa_inst->SrcReg[src].File;
switch (mesa_inst->Opcode) {
case OPCODE_IF:
@@ -2874,7 +2874,7 @@ get_mesa_program(struct gl_context *ctx,
}
break;
case OPCODE_ARL:
- prog->NumAddressRegs = 1;
+ prog->arb.NumAddressRegs = 1;
break;
default:
break;
@@ -2907,8 +2907,8 @@ get_mesa_program(struct gl_context *ctx,
fflush(stderr);
}
- prog->Instructions = mesa_instructions;
- prog->NumInstructions = num_instructions;
+ prog->arb.Instructions = mesa_instructions;
+ prog->arb.NumInstructions = num_instructions;
/* Setting this to NULL prevents a possible double free in the fail_exit
* path (far below).
diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c
index cb06e62..1268476 100644
--- a/src/mesa/program/prog_execute.c
+++ b/src/mesa/program/prog_execute.c
@@ -374,7 +374,7 @@ _mesa_execute_program(struct gl_context * ctx,
const struct gl_program *program,
struct gl_program_machine *machine)
{
- const GLuint numInst = program->NumInstructions;
+ const GLuint numInst = program->arb.NumInstructions;
const GLuint maxExec = 65536;
GLuint pc, numExec = 0;
@@ -392,7 +392,7 @@ _mesa_execute_program(struct gl_context * ctx,
}
for (pc = 0; pc < numInst; pc++) {
- const struct prog_instruction *inst = program->Instructions + pc;
+ const struct prog_instruction *inst = program->arb.Instructions + pc;
if (DEBUG_PROG) {
_mesa_print_instruction(inst);
@@ -439,12 +439,12 @@ _mesa_execute_program(struct gl_context * ctx,
break;
case OPCODE_BGNLOOP:
/* no-op */
- assert(program->Instructions[inst->BranchTarget].Opcode
+ assert(program->arb.Instructions[inst->BranchTarget].Opcode
== OPCODE_ENDLOOP);
break;
case OPCODE_ENDLOOP:
/* subtract 1 here since pc is incremented by for(pc) loop */
- assert(program->Instructions[inst->BranchTarget].Opcode
+ assert(program->arb.Instructions[inst->BranchTarget].Opcode
== OPCODE_BGNLOOP);
pc = inst->BranchTarget - 1; /* go to matching BNGLOOP */
break;
@@ -453,14 +453,14 @@ _mesa_execute_program(struct gl_context * ctx,
case OPCODE_ENDSUB: /* end subroutine */
break;
case OPCODE_BRK: /* break out of loop (conditional) */
- assert(program->Instructions[inst->BranchTarget].Opcode
+ assert(program->arb.Instructions[inst->BranchTarget].Opcode
== OPCODE_ENDLOOP);
/* break out of loop */
/* pc++ at end of for-loop will put us after the ENDLOOP inst */
pc = inst->BranchTarget;
break;
case OPCODE_CONT: /* continue loop (conditional) */
- assert(program->Instructions[inst->BranchTarget].Opcode
+ assert(program->arb.Instructions[inst->BranchTarget].Opcode
== OPCODE_ENDLOOP);
/* continue at ENDLOOP */
/* Subtract 1 here since we'll do pc++ at end of for-loop */
@@ -645,9 +645,9 @@ _mesa_execute_program(struct gl_context * ctx,
case OPCODE_IF:
{
GLboolean cond;
- assert(program->Instructions[inst->BranchTarget].Opcode
+ assert(program->arb.Instructions[inst->BranchTarget].Opcode
== OPCODE_ELSE ||
- program->Instructions[inst->BranchTarget].Opcode
+ program->arb.Instructions[inst->BranchTarget].Opcode
== OPCODE_ENDIF);
/* eval condition */
GLfloat a[4];
@@ -669,7 +669,7 @@ _mesa_execute_program(struct gl_context * ctx,
break;
case OPCODE_ELSE:
/* goto ENDIF */
- assert(program->Instructions[inst->BranchTarget].Opcode
+ assert(program->arb.Instructions[inst->BranchTarget].Opcode
== OPCODE_ENDIF);
assert(inst->BranchTarget >= 0);
pc = inst->BranchTarget;
diff --git a/src/mesa/program/prog_opt_constant_fold.c b/src/mesa/program/prog_opt_constant_fold.c
index d17e206..ba4a954 100644
--- a/src/mesa/program/prog_opt_constant_fold.c
+++ b/src/mesa/program/prog_opt_constant_fold.c
@@ -127,8 +127,8 @@ _mesa_constant_fold(struct gl_program *prog)
bool progress = false;
unsigned i;
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *const inst = &prog->Instructions[i];
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ struct prog_instruction *const inst = &prog->arb.Instructions[i];
switch (inst->Opcode) {
case OPCODE_ADD:
diff --git a/src/mesa/program/prog_optimize.c b/src/mesa/program/prog_optimize.c
index d8bba6d..f3a6306 100644
--- a/src/mesa/program/prog_optimize.c
+++ b/src/mesa/program/prog_optimize.c
@@ -166,7 +166,7 @@ remove_instructions(struct gl_program *prog, const GLboolean *removeFlags,
GLuint totalRemoved = 0;
/* go backward */
- for (i = prog->NumInstructions - 1; i >= 0; i--) {
+ for (i = prog->arb.NumInstructions - 1; i >= 0; i--) {
if (removeFlags[i]) {
totalRemoved++;
if (removeCount == 0) {
@@ -210,8 +210,8 @@ replace_regs(struct gl_program *prog, gl_register_file file, const GLint map[])
{
GLuint i;
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ struct prog_instruction *inst = prog->arb.Instructions + i;
const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
GLuint j;
for (j = 0; j < numSrc; j++) {
@@ -251,11 +251,11 @@ _mesa_remove_dead_code_global(struct gl_program *prog, void *mem_ctx)
}
removeInst =
- calloc(prog->NumInstructions, sizeof(GLboolean));
+ calloc(prog->arb.NumInstructions, sizeof(GLboolean));
/* Determine which temps are read and written */
- for (i = 0; i < prog->NumInstructions; i++) {
- const struct prog_instruction *inst = prog->Instructions + i;
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ const struct prog_instruction *inst = prog->arb.Instructions + i;
const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
GLuint j;
@@ -297,8 +297,8 @@ _mesa_remove_dead_code_global(struct gl_program *prog, void *mem_ctx)
}
/* find instructions that write to dead registers, flag for removal */
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ struct prog_instruction *inst = prog->arb.Instructions + i;
const GLuint numDst = _mesa_num_inst_dst_regs(inst->Opcode);
if (numDst != 0 && inst->DstReg.File == PROGRAM_TEMPORARY) {
@@ -365,8 +365,8 @@ find_next_use(const struct gl_program *prog,
{
GLuint i;
- for (i = start; i < prog->NumInstructions; i++) {
- const struct prog_instruction *inst = prog->Instructions + i;
+ for (i = start; i < prog->arb.NumInstructions; i++) {
+ const struct prog_instruction *inst = prog->arb.Instructions + i;
switch (inst->Opcode) {
case OPCODE_BGNLOOP:
case OPCODE_BGNSUB:
@@ -482,8 +482,8 @@ _mesa_remove_extra_move_use(struct gl_program *prog)
* FOO tmpY, arg0, arg1;
*/
- for (i = 0; i + 1 < prog->NumInstructions; i++) {
- const struct prog_instruction *mov = prog->Instructions + i;
+ for (i = 0; i + 1 < prog->arb.NumInstructions; i++) {
+ const struct prog_instruction *mov = prog->arb.Instructions + i;
GLuint dst_mask, src_mask;
if (can_upward_mov_be_modifed(mov) == GL_FALSE)
continue;
@@ -498,8 +498,8 @@ _mesa_remove_extra_move_use(struct gl_program *prog)
* rewritten or we get into some flow-control, eliminating the use of
* this MOV.
*/
- for (j = i + 1; j < prog->NumInstructions; j++) {
- struct prog_instruction *inst2 = prog->Instructions + j;
+ for (j = i + 1; j < prog->arb.NumInstructions; j++) {
+ struct prog_instruction *inst2 = prog->arb.Instructions + j;
GLuint arg;
if (_mesa_is_flow_control_opcode(inst2->Opcode))
@@ -575,10 +575,10 @@ _mesa_remove_dead_code_local(struct gl_program *prog, void *mem_ctx)
GLuint i, arg, rem = 0;
removeInst =
- calloc(prog->NumInstructions, sizeof(GLboolean));
+ calloc(prog->arb.NumInstructions, sizeof(GLboolean));
- for (i = 0; i < prog->NumInstructions; i++) {
- const struct prog_instruction *inst = prog->Instructions + i;
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ const struct prog_instruction *inst = prog->arb.Instructions + i;
const GLuint index = inst->DstReg.Index;
const GLuint mask = inst->DstReg.WriteMask;
enum inst_use use;
@@ -716,7 +716,7 @@ _mesa_remove_extra_moves(struct gl_program *prog, void *mem_ctx)
}
removeInst =
- calloc(prog->NumInstructions, sizeof(GLboolean));
+ calloc(prog->arb.NumInstructions, sizeof(GLboolean));
/*
* Look for sequences such as this:
@@ -726,8 +726,8 @@ _mesa_remove_extra_moves(struct gl_program *prog, void *mem_ctx)
* FOO tmpY, arg0, arg1;
*/
- for (i = 0; i < prog->NumInstructions; i++) {
- const struct prog_instruction *mov = prog->Instructions + i;
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ const struct prog_instruction *mov = prog->arb.Instructions + i;
switch (mov->Opcode) {
case OPCODE_BGNLOOP:
@@ -756,7 +756,7 @@ _mesa_remove_extra_moves(struct gl_program *prog, void *mem_ctx)
prevI = i - 1;
while (prevI > 0 && removeInst[prevI])
prevI--;
- prevInst = prog->Instructions + prevI;
+ prevInst = prog->arb.Instructions + prevI;
if (prevInst->DstReg.File == PROGRAM_TEMPORARY &&
prevInst->DstReg.Index == id &&
@@ -1034,7 +1034,8 @@ find_live_intervals(struct gl_program *prog,
}
/* build intermediate arrays */
- if (!_mesa_find_temp_intervals(prog->Instructions, prog->NumInstructions,
+ if (!_mesa_find_temp_intervals(prog->arb.Instructions,
+ prog->arb.NumInstructions,
intBegin, intEnd))
return GL_FALSE;
@@ -1194,7 +1195,7 @@ _mesa_reallocate_registers(struct gl_program *prog)
*/
replace_regs(prog, PROGRAM_TEMPORARY, registerMap);
- prog->NumTemporaries = maxTemp + 1;
+ prog->arb.NumTemporaries = maxTemp + 1;
}
if (dbg) {
@@ -1209,7 +1210,7 @@ _mesa_reallocate_registers(struct gl_program *prog)
#if 0
static void
print_it(struct gl_context *ctx, struct gl_program *program, const char *txt) {
- fprintf(stderr, "%s (%u inst):\n", txt, program->NumInstructions);
+ fprintf(stderr, "%s (%u inst):\n", txt, program->arb.NumInstructions);
_mesa_print_program(program);
_mesa_print_program_parameters(ctx, program);
fprintf(stderr, "\n\n");
@@ -1257,8 +1258,8 @@ _mesa_simplify_cmp(struct gl_program * program)
outputWrites[i] = 0;
}
- for (i = 0; i < program->NumInstructions; i++) {
- struct prog_instruction *inst = program->Instructions + i;
+ for (i = 0; i < program->arb.NumInstructions; i++) {
+ struct prog_instruction *inst = program->arb.Instructions + i;
GLuint prevWriteMask;
/* Give up if we encounter relative addressing or flow control. */
diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c
index d34187f..bdeb8fd 100644
--- a/src/mesa/program/prog_print.c
+++ b/src/mesa/program/prog_print.c
@@ -803,10 +803,10 @@ _mesa_fprint_program_opt(FILE *f,
fprintf(f, "# Geometry Shader\n");
}
- for (i = 0; i < prog->NumInstructions; i++) {
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
if (lineNumbers)
fprintf(f, "%3d: ", i);
- indent = _mesa_fprint_instruction_opt(f, prog->Instructions + i,
+ indent = _mesa_fprint_instruction_opt(f, prog->arb.Instructions + i,
indent, mode, prog);
}
}
@@ -862,13 +862,14 @@ _mesa_fprint_program_parameters(FILE *f,
fprintf(f, "OutputsWritten: %" PRIx64 " (0b%s)\n",
(uint64_t) prog->info.outputs_written,
binary(prog->info.outputs_written));
- fprintf(f, "NumInstructions=%d\n", prog->NumInstructions);
- fprintf(f, "NumTemporaries=%d\n", prog->NumTemporaries);
- fprintf(f, "NumParameters=%d\n", prog->NumParameters);
- fprintf(f, "NumAttributes=%d\n", prog->NumAttributes);
- fprintf(f, "NumAddressRegs=%d\n", prog->NumAddressRegs);
+ fprintf(f, "NumInstructions=%d\n", prog->arb.NumInstructions);
+ fprintf(f, "NumTemporaries=%d\n", prog->arb.NumTemporaries);
+ fprintf(f, "NumParameters=%d\n", prog->arb.NumParameters);
+ fprintf(f, "NumAttributes=%d\n", prog->arb.NumAttributes);
+ fprintf(f, "NumAddressRegs=%d\n", prog->arb.NumAddressRegs);
fprintf(f, "IndirectRegisterFiles: 0x%x (0b%s)\n",
- prog->IndirectRegisterFiles, binary(prog->IndirectRegisterFiles));
+ prog->arb.IndirectRegisterFiles,
+ binary(prog->arb.IndirectRegisterFiles));
fprintf(f, "SamplersUsed: 0x%x (0b%s)\n",
prog->SamplersUsed, binary(prog->SamplersUsed));
fprintf(f, "Samplers=[ ");
diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
index f1786e5..13e221a 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -373,14 +373,15 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
COPY_4V(value, ctx->FragmentProgram.Parameters[idx]);
return;
case STATE_LOCAL:
- if (!ctx->FragmentProgram.Current->LocalParams) {
- ctx->FragmentProgram.Current->LocalParams =
+ if (!ctx->FragmentProgram.Current->arb.LocalParams) {
+ ctx->FragmentProgram.Current->arb.LocalParams =
calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
- if (!ctx->FragmentProgram.Current->LocalParams)
+ if (!ctx->FragmentProgram.Current->arb.LocalParams)
return;
}
- COPY_4V(value, ctx->FragmentProgram.Current->LocalParams[idx]);
+ COPY_4V(value,
+ ctx->FragmentProgram.Current->arb.LocalParams[idx]);
return;
default:
_mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()");
@@ -399,14 +400,15 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
COPY_4V(value, ctx->VertexProgram.Parameters[idx]);
return;
case STATE_LOCAL:
- if (!ctx->VertexProgram.Current->LocalParams) {
- ctx->VertexProgram.Current->LocalParams =
+ if (!ctx->VertexProgram.Current->arb.LocalParams) {
+ ctx->VertexProgram.Current->arb.LocalParams =
calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
- if (!ctx->VertexProgram.Current->LocalParams)
+ if (!ctx->VertexProgram.Current->arb.LocalParams)
return;
}
- COPY_4V(value, ctx->VertexProgram.Current->LocalParams[idx]);
+ COPY_4V(value,
+ ctx->VertexProgram.Current->arb.LocalParams[idx]);
return;
default:
_mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()");
diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c
index 08df05d..f4eb8b6 100644
--- a/src/mesa/program/prog_to_nir.c
+++ b/src/mesa/program/prog_to_nir.c
@@ -159,7 +159,8 @@ ptn_get_src(struct ptn_compile *c, const struct prog_src_register *prog_src)
switch (file) {
case PROGRAM_CONSTANT:
- if ((c->prog->IndirectRegisterFiles & (1 << PROGRAM_CONSTANT)) == 0) {
+ if ((c->prog->arb.IndirectRegisterFiles &
+ (1 << PROGRAM_CONSTANT)) == 0) {
float *v = (float *) plist->ParameterValues[prog_src->Index];
src.src = nir_src_for_ssa(nir_imm_vec4(b, v[0], v[1], v[2], v[3]));
break;
@@ -977,10 +978,11 @@ setup_registers_and_variables(struct ptn_compile *c)
}
/* Create temporary registers. */
- c->temp_regs = rzalloc_array(c, nir_register *, c->prog->NumTemporaries);
+ c->temp_regs = rzalloc_array(c, nir_register *,
+ c->prog->arb.NumTemporaries);
nir_register *reg;
- for (unsigned i = 0; i < c->prog->NumTemporaries; i++) {
+ for (unsigned i = 0; i < c->prog->arb.NumTemporaries; i++) {
reg = nir_local_reg_create(b->impl);
if (!reg) {
c->error = true;
@@ -1036,8 +1038,8 @@ prog_to_nir(const struct gl_program *prog,
if (unlikely(c->error))
goto fail;
- for (unsigned int i = 0; i < prog->NumInstructions; i++) {
- ptn_emit_instruction(c, &prog->Instructions[i]);
+ for (unsigned int i = 0; i < prog->arb.NumInstructions; i++) {
+ ptn_emit_instruction(c, &prog->arb.Instructions[i]);
if (unlikely(c->error))
break;
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index 75e9b5b..1248da4 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -336,14 +336,14 @@ _mesa_reference_program_(struct gl_context *ctx,
GLboolean
_mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count)
{
- const GLuint origLen = prog->NumInstructions;
+ const GLuint origLen = prog->arb.NumInstructions;
const GLuint newLen = origLen + count;
struct prog_instruction *newInst;
GLuint i;
/* adjust branches */
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ struct prog_instruction *inst = prog->arb.Instructions + i;
if (inst->BranchTarget > 0) {
if ((GLuint)inst->BranchTarget >= start) {
inst->BranchTarget += count;
@@ -358,22 +358,22 @@ _mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count)
}
/* Copy 'start' instructions into new instruction buffer */
- _mesa_copy_instructions(newInst, prog->Instructions, start);
+ _mesa_copy_instructions(newInst, prog->arb.Instructions, start);
/* init the new instructions */
_mesa_init_instructions(newInst + start, count);
/* Copy the remaining/tail instructions to new inst buffer */
_mesa_copy_instructions(newInst + start + count,
- prog->Instructions + start,
+ prog->arb.Instructions + start,
origLen - start);
/* free old instructions */
- ralloc_free(prog->Instructions);
+ ralloc_free(prog->arb.Instructions);
/* install new instructions */
- prog->Instructions = newInst;
- prog->NumInstructions = newLen;
+ prog->arb.Instructions = newInst;
+ prog->arb.NumInstructions = newLen;
return GL_TRUE;
}
@@ -386,14 +386,14 @@ GLboolean
_mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count,
void *mem_ctx)
{
- const GLuint origLen = prog->NumInstructions;
+ const GLuint origLen = prog->arb.NumInstructions;
const GLuint newLen = origLen - count;
struct prog_instruction *newInst;
GLuint i;
/* adjust branches */
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ struct prog_instruction *inst = prog->arb.Instructions + i;
if (inst->BranchTarget > 0) {
if (inst->BranchTarget > (GLint) start) {
inst->BranchTarget -= count;
@@ -408,19 +408,19 @@ _mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count,
}
/* Copy 'start' instructions into new instruction buffer */
- _mesa_copy_instructions(newInst, prog->Instructions, start);
+ _mesa_copy_instructions(newInst, prog->arb.Instructions, start);
/* Copy the remaining/tail instructions to new inst buffer */
_mesa_copy_instructions(newInst + start,
- prog->Instructions + start + count,
+ prog->arb.Instructions + start + count,
newLen - start);
/* free old instructions */
- ralloc_free(prog->Instructions);
+ ralloc_free(prog->arb.Instructions);
/* install new instructions */
- prog->Instructions = newInst;
- prog->NumInstructions = newLen;
+ prog->arb.Instructions = newInst;
+ prog->arb.NumInstructions = newLen;
return GL_TRUE;
}
@@ -442,8 +442,8 @@ _mesa_find_used_registers(const struct gl_program *prog,
memset(used, 0, usedSize);
- for (i = 0; i < prog->NumInstructions; i++) {
- const struct prog_instruction *inst = prog->Instructions + i;
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ const struct prog_instruction *inst = prog->arb.Instructions + i;
const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
if (inst->DstReg.File == file) {
diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y
index 760b592..1addf57 100644
--- a/src/mesa/program/program_parse.y
+++ b/src/mesa/program/program_parse.y
@@ -348,7 +348,7 @@ statement: instruction ';'
state->inst_tail = $1;
$1->next = NULL;
- state->prog->NumInstructions++;
+ state->prog->arb.NumInstructions++;
}
}
| namingStatement ';'
@@ -357,12 +357,12 @@ statement: instruction ';'
instruction: ALU_instruction
{
$$ = $1;
- state->prog->NumAluInstructions++;
+ state->prog->arb.NumAluInstructions++;
}
| TexInstruction
{
$$ = $1;
- state->prog->NumTexInstructions++;
+ state->prog->arb.NumTexInstructions++;
}
;
@@ -785,7 +785,7 @@ srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */
$$.Base.File = $1->param_binding_type;
if ($3.Base.RelAddr) {
- state->prog->IndirectRegisterFiles |= (1 << $$.Base.File);
+ state->prog->arb.IndirectRegisterFiles |= (1 << $$.Base.File);
$1->param_accessed_indirectly = 1;
$$.Base.RelAddr = 1;
@@ -2247,18 +2247,19 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
switch (t) {
case at_temp:
- if (state->prog->NumTemporaries >= state->limits->MaxTemps) {
+ if (state->prog->arb.NumTemporaries >= state->limits->MaxTemps) {
yyerror(locp, state, "too many temporaries declared");
free(s);
return NULL;
}
- s->temp_binding = state->prog->NumTemporaries;
- state->prog->NumTemporaries++;
+ s->temp_binding = state->prog->arb.NumTemporaries;
+ state->prog->arb.NumTemporaries++;
break;
case at_address:
- if (state->prog->NumAddressRegs >= state->limits->MaxAddressRegs) {
+ if (state->prog->arb.NumAddressRegs >=
+ state->limits->MaxAddressRegs) {
yyerror(locp, state, "too many address registers declared");
free(s);
return NULL;
@@ -2266,7 +2267,7 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
/* FINISHME: Add support for multiple address registers.
*/
- state->prog->NumAddressRegs++;
+ state->prog->arb.NumAddressRegs++;
break;
default:
@@ -2564,43 +2565,43 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st
/* Add one instruction to store the "END" instruction.
*/
- state->prog->Instructions =
+ state->prog->arb.Instructions =
_mesa_alloc_instructions(state->mem_ctx,
- state->prog->NumInstructions + 1);
+ state->prog->arb.NumInstructions + 1);
- if (state->prog->Instructions == NULL) {
+ if (state->prog->arb.Instructions == NULL) {
goto error;
}
inst = state->inst_head;
- for (i = 0; i < state->prog->NumInstructions; i++) {
+ for (i = 0; i < state->prog->arb.NumInstructions; i++) {
struct asm_instruction *const temp = inst->next;
- state->prog->Instructions[i] = inst->Base;
+ state->prog->arb.Instructions[i] = inst->Base;
inst = temp;
}
/* Finally, tag on an OPCODE_END instruction */
{
- const GLuint numInst = state->prog->NumInstructions;
- _mesa_init_instructions(state->prog->Instructions + numInst, 1);
- state->prog->Instructions[numInst].Opcode = OPCODE_END;
+ const GLuint numInst = state->prog->arb.NumInstructions;
+ _mesa_init_instructions(state->prog->arb.Instructions + numInst, 1);
+ state->prog->arb.Instructions[numInst].Opcode = OPCODE_END;
}
- state->prog->NumInstructions++;
+ state->prog->arb.NumInstructions++;
- state->prog->NumParameters = state->prog->Parameters->NumParameters;
- state->prog->NumAttributes =
+ state->prog->arb.NumParameters = state->prog->Parameters->NumParameters;
+ state->prog->arb.NumAttributes =
_mesa_bitcount_64(state->prog->info.inputs_read);
/*
* Initialize native counts to logical counts. The device driver may
* change them if program is translated into a hardware program.
*/
- state->prog->NumNativeInstructions = state->prog->NumInstructions;
- state->prog->NumNativeTemporaries = state->prog->NumTemporaries;
- state->prog->NumNativeParameters = state->prog->NumParameters;
- state->prog->NumNativeAttributes = state->prog->NumAttributes;
- state->prog->NumNativeAddressRegs = state->prog->NumAddressRegs;
+ state->prog->arb.NumNativeInstructions = state->prog->arb.NumInstructions;
+ state->prog->arb.NumNativeTemporaries = state->prog->arb.NumTemporaries;
+ state->prog->arb.NumNativeParameters = state->prog->arb.NumParameters;
+ state->prog->arb.NumNativeAttributes = state->prog->arb.NumAttributes;
+ state->prog->arb.NumNativeAddressRegs = state->prog->arb.NumAddressRegs;
result = GL_TRUE;
diff --git a/src/mesa/program/programopt.c b/src/mesa/program/programopt.c
index 2d03376..e23c1c5 100644
--- a/src/mesa/program/programopt.c
+++ b/src/mesa/program/programopt.c
@@ -49,7 +49,7 @@ static void
_mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_program *vprog)
{
struct prog_instruction *newInst;
- const GLuint origLen = vprog->NumInstructions;
+ const GLuint origLen = vprog->arb.NumInstructions;
const GLuint newLen = origLen + 4;
GLuint i;
@@ -99,14 +99,14 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_program *vprog)
}
/* Append original instructions after new instructions */
- _mesa_copy_instructions (newInst + 4, vprog->Instructions, origLen);
+ _mesa_copy_instructions (newInst + 4, vprog->arb.Instructions, origLen);
/* free old instructions */
- ralloc_free(vprog->Instructions);
+ ralloc_free(vprog->arb.Instructions);
/* install new instructions */
- vprog->Instructions = newInst;
- vprog->NumInstructions = newLen;
+ vprog->arb.Instructions = newInst;
+ vprog->arb.NumInstructions = newLen;
vprog->info.inputs_read |= VERT_BIT_POS;
vprog->info.outputs_written |= BITFIELD64_BIT(VARYING_SLOT_POS);
}
@@ -116,7 +116,7 @@ static void
_mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_program *vprog)
{
struct prog_instruction *newInst;
- const GLuint origLen = vprog->NumInstructions;
+ const GLuint origLen = vprog->arb.NumInstructions;
const GLuint newLen = origLen + 4;
GLuint hposTemp;
GLuint i;
@@ -146,7 +146,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_program *vprog)
}
/* TEMP hposTemp; */
- hposTemp = vprog->NumTemporaries++;
+ hposTemp = vprog->arb.NumTemporaries++;
/*
* Generated instructions:
@@ -200,14 +200,14 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_program *vprog)
/* Append original instructions after new instructions */
- _mesa_copy_instructions (newInst + 4, vprog->Instructions, origLen);
+ _mesa_copy_instructions (newInst + 4, vprog->arb.Instructions, origLen);
/* free old instructions */
- ralloc_free(vprog->Instructions);
+ ralloc_free(vprog->arb.Instructions);
/* install new instructions */
- vprog->Instructions = newInst;
- vprog->NumInstructions = newLen;
+ vprog->arb.Instructions = newInst;
+ vprog->arb.NumInstructions = newLen;
vprog->info.inputs_read |= VERT_BIT_POS;
vprog->info.outputs_written |= BITFIELD64_BIT(VARYING_SLOT_POS);
}
@@ -252,7 +252,7 @@ _mesa_append_fog_code(struct gl_context *ctx, struct gl_program *fprog,
static const gl_state_index fogColorState[STATE_LENGTH]
= { STATE_FOG_COLOR, 0, 0, 0, 0};
struct prog_instruction *newInst, *inst;
- const GLuint origLen = fprog->NumInstructions;
+ const GLuint origLen = fprog->arb.NumInstructions;
const GLuint newLen = origLen + 5;
GLuint i;
GLint fogPRefOpt, fogColorRef; /* state references */
@@ -278,7 +278,7 @@ _mesa_append_fog_code(struct gl_context *ctx, struct gl_program *fprog,
}
/* Copy orig instructions into new instruction buffer */
- _mesa_copy_instructions(newInst, fprog->Instructions, origLen);
+ _mesa_copy_instructions(newInst, fprog->arb.Instructions, origLen);
/* PARAM fogParamsRefOpt = internal optimized fog params; */
fogPRefOpt
@@ -288,13 +288,13 @@ _mesa_append_fog_code(struct gl_context *ctx, struct gl_program *fprog,
= _mesa_add_state_reference(fprog->Parameters, fogColorState);
/* TEMP colorTemp; */
- colorTemp = fprog->NumTemporaries++;
+ colorTemp = fprog->arb.NumTemporaries++;
/* TEMP fogFactorTemp; */
- fogFactorTemp = fprog->NumTemporaries++;
+ fogFactorTemp = fprog->arb.NumTemporaries++;
/* Scan program to find where result.color is written */
inst = newInst;
- for (i = 0; i < fprog->NumInstructions; i++) {
+ for (i = 0; i < fprog->arb.NumInstructions; i++) {
if (inst->Opcode == OPCODE_END)
break;
if (inst->DstReg.File == PROGRAM_OUTPUT &&
@@ -403,11 +403,11 @@ _mesa_append_fog_code(struct gl_context *ctx, struct gl_program *fprog,
inst++;
/* free old instructions */
- ralloc_free(fprog->Instructions);
+ ralloc_free(fprog->arb.Instructions);
/* install new instructions */
- fprog->Instructions = newInst;
- fprog->NumInstructions = inst - newInst;
+ fprog->arb.Instructions = newInst;
+ fprog->arb.NumInstructions = inst - newInst;
fprog->info.inputs_read |= VARYING_BIT_FOGC;
assert(fprog->info.outputs_written & (1 << FRAG_RESULT_COLOR));
}
@@ -445,8 +445,8 @@ _mesa_count_texture_indirections(struct gl_program *prog)
GLbitfield aluTemps = 0x0;
GLuint i;
- for (i = 0; i < prog->NumInstructions; i++) {
- const struct prog_instruction *inst = prog->Instructions + i;
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ const struct prog_instruction *inst = prog->arb.Instructions + i;
if (is_texture_instruction(inst)) {
if (((inst->SrcReg[0].File == PROGRAM_TEMPORARY) &&
@@ -474,7 +474,7 @@ _mesa_count_texture_indirections(struct gl_program *prog)
tempsOutput |= (1 << inst->DstReg.Index);
}
- prog->NumTexIndirections = indirections;
+ prog->arb.NumTexIndirections = indirections;
}
@@ -486,9 +486,10 @@ void
_mesa_count_texture_instructions(struct gl_program *prog)
{
GLuint i;
- prog->NumTexInstructions = 0;
- for (i = 0; i < prog->NumInstructions; i++) {
- prog->NumTexInstructions += is_texture_instruction(prog->Instructions + i);
+ prog->arb.NumTexInstructions = 0;
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ prog->arb.NumTexInstructions +=
+ is_texture_instruction(prog->arb.Instructions + i);
}
}
@@ -517,8 +518,8 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type)
outputMap[i] = -1;
/* look for instructions which read from varying vars */
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ struct prog_instruction *inst = prog->arb.Instructions + i;
const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
GLuint j;
for (j = 0; j < numSrc; j++) {
@@ -542,8 +543,8 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type)
return; /* nothing to be done */
/* look for instructions which write to the varying vars identified above */
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ struct prog_instruction *inst = prog->arb.Instructions + i;
if (inst->DstReg.File == type &&
outputMap[inst->DstReg.Index] >= 0) {
/* change inst to write to the temp reg, instead of the varying */
@@ -559,8 +560,8 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type)
/* Look for END instruction and insert the new varying writes */
endPos = -1;
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ struct prog_instruction *inst = prog->arb.Instructions + i;
if (inst->Opcode == OPCODE_END) {
endPos = i;
_mesa_insert_instructions(prog, i, numVaryingReads);
@@ -571,7 +572,7 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type)
assert(endPos >= 0);
/* insert new MOV instructions here */
- inst = prog->Instructions + endPos;
+ inst = prog->arb.Instructions + endPos;
for (var = 0; var < VARYING_SLOT_MAX; var++) {
if (outputMap[var] >= 0) {
/* MOV VAR[var], TEMP[tmp]; */
@@ -598,8 +599,8 @@ _mesa_program_fragment_position_to_sysval(struct gl_program *prog)
prog->info.inputs_read &= ~BITFIELD64_BIT(VARYING_SLOT_POS);
prog->info.system_values_read |= 1 << SYSTEM_VALUE_FRAG_COORD;
- for (i = 0; i < prog->NumInstructions; i++) {
- struct prog_instruction *inst = prog->Instructions + i;
+ for (i = 0; i < prog->arb.NumInstructions; i++) {
+ struct prog_instruction *inst = prog->arb.Instructions + i;
const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
GLuint j;
diff --git a/src/mesa/state_tracker/st_atifs_to_tgsi.c b/src/mesa/state_tracker/st_atifs_to_tgsi.c
index aaa7a4b..3aa7f84 100644
--- a/src/mesa/state_tracker/st_atifs_to_tgsi.c
+++ b/src/mesa/state_tracker/st_atifs_to_tgsi.c
@@ -604,9 +604,9 @@ st_init_atifs_prog(struct gl_context *ctx, struct gl_program *prog)
_mesa_add_state_reference(prog->Parameters, fog_params_state);
_mesa_add_state_reference(prog->Parameters, fog_color);
- prog->NumInstructions = 0;
- prog->NumTemporaries = MAX_NUM_FRAGMENT_REGISTERS_ATI + 3; /* 3 input temps for arith ops */
- prog->NumParameters = MAX_NUM_FRAGMENT_CONSTANTS_ATI + 2; /* 2 state variables for fog */
+ prog->arb.NumInstructions = 0;
+ prog->arb.NumTemporaries = MAX_NUM_FRAGMENT_REGISTERS_ATI + 3; /* 3 input temps for arith ops */
+ prog->arb.NumParameters = MAX_NUM_FRAGMENT_CONSTANTS_ATI + 2; /* 2 state variables for fog */
}
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index a412806..36531ad 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -417,9 +417,6 @@ st_nir_get_mesa_program(struct gl_context *ctx,
_mesa_log("\n\n");
}
- prog->Instructions = NULL;
- prog->NumInstructions = 0;
-
prog->SamplersUsed = shader->active_samplers;
prog->ShadowSamplers = shader->shadow_samplers;
prog->ExternalSamplersUsed = gl_external_samplers(shader);
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index a4679e5..7a4ee36 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -6501,9 +6501,6 @@ get_mesa_program_tgsi(struct gl_context *ctx,
_mesa_log("\n\n");
}
- prog->Instructions = NULL;
- prog->NumInstructions = 0;
-
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,
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 9dc8f22..0a225ae 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -906,8 +906,8 @@ st_translate_mesa_program(
/* Declare address register.
*/
- if (program->NumAddressRegs > 0) {
- debug_assert( program->NumAddressRegs == 1 );
+ if (program->arb.NumAddressRegs > 0) {
+ debug_assert( program->arb.NumAddressRegs == 1 );
t->address[0] = ureg_DECL_address( ureg );
}
@@ -952,11 +952,11 @@ st_translate_mesa_program(
}
}
- if (program->IndirectRegisterFiles & (1 << PROGRAM_TEMPORARY)) {
+ if (program->arb.IndirectRegisterFiles & (1 << PROGRAM_TEMPORARY)) {
/* If temps are accessed with indirect addressing, declare temporaries
* in sequential order. Else, we declare them on demand elsewhere.
*/
- for (i = 0; i < program->NumTemporaries; i++) {
+ for (i = 0; i < program->arb.NumTemporaries; i++) {
/* XXX use TGSI_FILE_TEMPORARY_ARRAY when it's supported by ureg */
t->temps[i] = ureg_DECL_temporary( t->ureg );
}
@@ -987,7 +987,7 @@ st_translate_mesa_program(
* array.
*/
case PROGRAM_CONSTANT:
- if (program->IndirectRegisterFiles & PROGRAM_ANY_CONST)
+ if (program->arb.IndirectRegisterFiles & PROGRAM_ANY_CONST)
t->constants[i] = ureg_DECL_constant( ureg, i );
else
t->constants[i] =
@@ -1019,8 +1019,8 @@ st_translate_mesa_program(
/* Emit each instruction in turn:
*/
- for (i = 0; i < program->NumInstructions; i++)
- compile_instruction(ctx, t, &program->Instructions[i]);
+ for (i = 0; i < program->arb.NumInstructions; i++)
+ compile_instruction(ctx, t, &program->arb.Instructions[i]);
out:
free(t->constants);
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 0822509..bf15031 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -242,7 +242,7 @@ st_translate_vertex_program(struct st_context *st,
stvp->num_inputs = 0;
- if (stvp->Base.IsPositionInvariant)
+ if (stvp->Base.arb.IsPositionInvariant)
_mesa_insert_mvp_code(st->ctx, &stvp->Base);
/*
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 9bd357d..8b47e48 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -43,7 +43,7 @@ _swrast_use_fragment_program(struct gl_context *ctx)
{
struct gl_program *fp = ctx->FragmentProgram._Current;
return fp && !(fp == ctx->FragmentProgram._TexEnvProgram
- && fp->NumInstructions == 0);
+ && fp->arb.NumInstructions == 0);
}
/**
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index 695821a..23e09a2 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -163,7 +163,7 @@ do_ndc_cliptest(struct gl_context *ctx, struct vp_stage_data *store)
*/
/** XXX NEW_SLANG _Enabled ??? */
if (ctx->Transform.ClipPlanesEnabled && (!ctx->VertexProgram._Enabled ||
- ctx->VertexProgram.Current->IsPositionInvariant)) {
+ ctx->VertexProgram.Current->arb.IsPositionInvariant)) {
userclip( ctx,
VB->ClipPtr,
store->clipmask,
@@ -397,7 +397,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
unmap_textures(ctx, program);
- if (program->IsPositionInvariant) {
+ if (program->arb.IsPositionInvariant) {
/* We need the exact same transform as in the fixed function path here
* to guarantee invariance, depending on compiler optimization flags
* results could be different otherwise.
--
2.7.4
More information about the mesa-dev
mailing list