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;
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];
}
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);
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;
}
}
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;
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;
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);
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; \
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
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);
}
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;
}
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;
}
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");
}
}
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++)
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 {
}
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] );
return GL_FALSE;
}
- if (!prog->LocalParams) {
- prog->LocalParams = rzalloc_array_size(prog, sizeof(float[4]),
+ if (!prog->arb.LocalParams) {
+ prog->arb.LocalParams = rzalloc_array_size(prog, sizeof(float[4]),
maxParams);
-
- if (!prog->LocalParams)
+ if (!prog->arb.LocalParams)
return GL_FALSE;
}
- *param = prog->LocalParams[index];
+ *param = prog->arb.LocalParams[index];
return GL_TRUE;
}
*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;
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;
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);
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;
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 );
* If we need more, we'll grow the instruction array as needed.
*/
p.max_inst = 32;
- p.program->Instructions = rzalloc_array(program, struct prog_instruction,
- p.max_inst);
+ p.program->arb.Instructions =
+ rzalloc_array(program, struct prog_instruction, 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;
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. */
/** 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;
+ };
};
* 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];
}
* 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])
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);
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;
* 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);
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();
/* 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:
}
break;
case OPCODE_ARL:
- prog->NumAddressRegs = 1;
+ prog->arb.NumAddressRegs = 1;
break;
default:
break;
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).
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;
}
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);
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;
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 */
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];
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;
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:
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) {
{
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++) {
}
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;
}
/* 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) {
{
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:
* 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;
* 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))
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;
}
removeInst =
- calloc(prog->NumInstructions, sizeof(GLboolean));
+ calloc(prog->arb.NumInstructions, sizeof(GLboolean));
/*
* Look for sequences such as this:
* 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:
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 &&
}
/* 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;
*/
replace_regs(prog, PROGRAM_TEMPORARY, registerMap);
- prog->NumTemporaries = maxTemp + 1;
+ prog->arb.NumTemporaries = maxTemp + 1;
}
if (dbg) {
#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");
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. */
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);
}
}
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=[ ");
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 =
rzalloc_array_size(ctx->FragmentProgram.Current,
sizeof(float[4]),
MAX_PROGRAM_LOCAL_PARAMS);
- 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()");
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 =
rzalloc_array_size(ctx->VertexProgram.Current,
sizeof(float[4]),
MAX_PROGRAM_LOCAL_PARAMS);
- 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()");
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;
}
/* 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;
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;
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;
}
/* 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;
}
_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;
}
/* 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;
}
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) {
state->inst_tail = $1;
$1->next = NULL;
- state->prog->NumInstructions++;
+ state->prog->arb.NumInstructions++;
}
}
| namingStatement ';'
instruction: ALU_instruction
{
$$ = $1;
- state->prog->NumAluInstructions++;
+ state->prog->arb.NumAluInstructions++;
}
| TexInstruction
{
$$ = $1;
- state->prog->NumTexInstructions++;
+ state->prog->arb.NumTexInstructions++;
}
;
$$.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;
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;
/* FINISHME: Add support for multiple address registers.
*/
- state->prog->NumAddressRegs++;
+ state->prog->arb.NumAddressRegs++;
break;
default:
/* Add one instruction to store the "END" instruction.
*/
- state->prog->Instructions =
+ state->prog->arb.Instructions =
rzalloc_array(state->mem_ctx, struct prog_instruction,
- 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;
_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;
}
/* 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);
}
_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;
}
/* TEMP hposTemp; */
- hposTemp = vprog->NumTemporaries++;
+ hposTemp = vprog->arb.NumTemporaries++;
/*
* Generated instructions:
/* 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);
}
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 */
}
/* 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
= _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 &&
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));
}
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) &&
tempsOutput |= (1 << inst->DstReg.Index);
}
- prog->NumTexIndirections = indirections;
+ prog->arb.NumTexIndirections = indirections;
}
_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);
}
}
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++) {
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 */
/* 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);
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]; */
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;
_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 */
}
/* 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 );
}
}
}
- 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 );
}
* 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] =
/* 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);
stvp->num_inputs = 0;
- if (stvp->Base.IsPositionInvariant)
+ if (stvp->Base.arb.IsPositionInvariant)
_mesa_insert_mvp_code(st->ctx, &stvp->Base);
/*
{
struct gl_program *fp = ctx->FragmentProgram._Current;
return fp && !(fp == ctx->FragmentProgram._TexEnvProgram
- && fp->NumInstructions == 0);
+ && fp->arb.NumInstructions == 0);
}
/**
*/
/** 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,
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.