Needed for vertex shaders too.
compiler.code = &shader->code;
compiler.state = shader->compare_state;
- compiler.is_r500 = r300->screen->caps.is_r500;
- compiler.max_temp_regs = compiler.is_r500 ? 128 : 32;
+ compiler.Base.is_r500 = r300->screen->caps.is_r500;
+ compiler.Base.max_temp_regs = compiler.Base.is_r500 ? 128 : 32;
compiler.AllocateHwInputs = &allocate_hardware_inputs;
compiler.UserData = &shader->inputs;
compiler.Base.Debug = DBG_ON(r300, DBG_VP);
compiler.code = &vs->code;
compiler.UserData = vs;
+ compiler.Base.is_r500 = r300->screen->caps.is_r500;
+ compiler.Base.max_temp_regs = 32;
if (compiler.Base.Debug) {
debug_printf("r300: Initial vertex program\n");
}
}
- if (code->pixsize >= compiler->max_temp_regs)
+ if (code->pixsize >= compiler->Base.max_temp_regs)
rc_error(&compiler->Base, "Too many hardware temporaries used.\n");
if (compiler->Base.Error)
debug_program_log(c, "after emulate branches");
- if (c->is_r500) {
+ if (c->Base.is_r500) {
struct radeon_program_transformation transformations[] = {
{ &r500_transform_IF, 0 },
{ &radeonTransformALU, 0 },
debug_program_log(c, "after pair scheduling");
- rc_pair_regalloc(c, c->max_temp_regs);
+ rc_pair_regalloc(c, c->Base.max_temp_regs);
if (c->Base.Error)
return;
debug_program_log(c, "after register allocation");
- if (c->is_r500) {
+ if (c->Base.is_r500) {
r500BuildFragmentProgramHwCode(c);
} else {
r300BuildFragmentProgramHwCode(c);
rc_constants_copy(&c->code->constants, &c->Base.Program.Constants);
if (c->Base.Debug) {
- if (c->is_r500) {
+ if (c->Base.is_r500) {
r500FragmentProgramDump(c->code);
} else {
r300FragmentProgramDump(c->code);
unsigned Error:1;
char * ErrorMsg;
+ /* Hardware specification. */
+ unsigned is_r500;
+ unsigned max_temp_regs;
+
/**
* Variables used internally, not be touched by callers
* of the compiler
/* Optional transformations and features. */
struct r300_fragment_program_external_state state;
unsigned enable_shadow_ambient;
- /* Hardware specification. */
- unsigned is_r500;
- unsigned max_temp_regs;
- /* Register corresponding to the depthbuffer. */
+ /* Register corresponding to the depthbuffer. */
unsigned OutputDepth;
- /* Registers corresponding to the four colorbuffers. */
+ /* Registers corresponding to the four colorbuffers. */
unsigned OutputColor[4];
void * UserData;
rc_wrap_mode wrapmode = compiler->state.unit[inst->U.I.TexSrcUnit].wrap_mode;
/* R300 cannot sample from rectangles. */
- if (!compiler->is_r500) {
+ if (!c->is_r500) {
lower_texture_rect(compiler, inst);
}
unsigned temp = rc_find_free_temporary(c);
/* For NPOT fallback, we need normalized coordinates anyway. */
- if (compiler->is_r500) {
+ if (c->is_r500) {
lower_texture_rect(compiler, inst);
}
/* Cannot write texture to output registers (all chips) or with masks (non-r500) */
if (inst->U.I.Opcode != RC_OPCODE_KIL &&
(inst->U.I.DstReg.File != RC_FILE_TEMPORARY ||
- (!compiler->is_r500 && inst->U.I.DstReg.WriteMask != RC_MASK_XYZW))) {
+ (!c->is_r500 && inst->U.I.DstReg.WriteMask != RC_MASK_XYZW))) {
struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst);
inst_mov->U.I.Opcode = RC_OPCODE_MOV;
compiler.OutputColor[0] = FRAG_RESULT_COLOR;
compiler.OutputDepth = FRAG_RESULT_DEPTH;
compiler.enable_shadow_ambient = GL_TRUE;
- compiler.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515);
- compiler.max_temp_regs = (compiler.is_r500) ? 128 : 32;
+ compiler.Base.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515);
+ compiler.Base.max_temp_regs = (compiler.Base.is_r500) ? 128 : 32;
compiler.code = &r300->blit.fp_code;
compiler.AllocateHwInputs = fp_allocate_hw_inputs;
compiler.code = &fp->code;
compiler.state = fp->state;
compiler.enable_shadow_ambient = GL_TRUE;
- compiler.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) ? GL_TRUE : GL_FALSE;
- compiler.max_temp_regs = (compiler.is_r500) ? 128 : 32;
+ compiler.Base.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) ? GL_TRUE : GL_FALSE;
+ compiler.Base.max_temp_regs = (compiler.Base.is_r500) ? 128 : 32;
compiler.OutputDepth = FRAG_RESULT_DEPTH;
memset(compiler.OutputColor, 0, 4 * sizeof(unsigned));
compiler.OutputColor[0] = FRAG_RESULT_COLOR;
r3xx_compile_fragment_program(&compiler);
- if (compiler.is_r500) {
+ if (compiler.Base.is_r500) {
/* We need to support the non-KMS DRM interface, which
* artificially limits the number of instructions and
* constants which are available to us.