r300: fix fragment program limits

This commit is contained in:
Maciej Cencora 2009-04-27 16:25:34 +02:00 committed by Alex Deucher
parent 3c6bffa761
commit ce0d10dd6c
4 changed files with 38 additions and 25 deletions

View file

@ -308,16 +308,25 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
ctx->Const.VertexProgram.MaxNativeAddressRegs = 1;
}
ctx->Const.FragmentProgram.MaxNativeTemps = PFS_NUM_TEMP_REGS;
ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */
ctx->Const.FragmentProgram.MaxNativeParameters = PFS_NUM_CONST_REGS;
ctx->Const.FragmentProgram.MaxNativeAluInstructions = PFS_MAX_ALU_INST;
ctx->Const.FragmentProgram.MaxNativeTexInstructions = PFS_MAX_TEX_INST;
ctx->Const.FragmentProgram.MaxNativeInstructions =
PFS_MAX_ALU_INST + PFS_MAX_TEX_INST;
ctx->Const.FragmentProgram.MaxNativeTexIndirections =
PFS_MAX_TEX_INDIRECT;
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0;
if (screen->chip_family >= CHIP_FAMILY_RV515) {
ctx->Const.FragmentProgram.MaxNativeTemps = R500_PFS_NUM_TEMP_REGS;
ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */
ctx->Const.FragmentProgram.MaxNativeParameters = R500_PFS_NUM_CONST_REGS;
ctx->Const.FragmentProgram.MaxNativeAluInstructions = R500_PFS_MAX_INST;
ctx->Const.FragmentProgram.MaxNativeTexInstructions = R500_PFS_MAX_INST;
ctx->Const.FragmentProgram.MaxNativeInstructions = R500_PFS_MAX_INST;
ctx->Const.FragmentProgram.MaxNativeTexIndirections = R500_PFS_MAX_INST;
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0;
} else {
ctx->Const.FragmentProgram.MaxNativeTemps = R300_PFS_NUM_TEMP_REGS;
ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */
ctx->Const.FragmentProgram.MaxNativeParameters = R300_PFS_NUM_CONST_REGS;
ctx->Const.FragmentProgram.MaxNativeAluInstructions = R300_PFS_MAX_ALU_INST;
ctx->Const.FragmentProgram.MaxNativeTexInstructions = R300_PFS_MAX_TEX_INST;
ctx->Const.FragmentProgram.MaxNativeInstructions = R300_PFS_MAX_ALU_INST + R300_PFS_MAX_TEX_INST;
ctx->Const.FragmentProgram.MaxNativeTexIndirections = R300_PFS_MAX_TEX_INDIRECT;
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0;
}
}
/* Create the device specific rendering context.

View file

@ -450,11 +450,15 @@ struct r300_vertex_program_cont {
struct r300_vertex_program *progs;
};
#define PFS_MAX_ALU_INST 64
#define PFS_MAX_TEX_INST 64
#define PFS_MAX_TEX_INDIRECT 4
#define PFS_NUM_TEMP_REGS 32
#define PFS_NUM_CONST_REGS 16
#define R300_PFS_MAX_ALU_INST 64
#define R300_PFS_MAX_TEX_INST 32
#define R300_PFS_MAX_TEX_INDIRECT 4
#define R300_PFS_NUM_TEMP_REGS 32
#define R300_PFS_NUM_CONST_REGS 32
#define R500_PFS_MAX_INST 512
#define R500_PFS_NUM_TEMP_REGS 128
#define R500_PFS_NUM_CONST_REGS 256
struct r300_pfs_compile_state;
struct r500_pfs_compile_state;
@ -500,7 +504,7 @@ struct r300_fragment_program_node {
struct r300_fragment_program_code {
struct {
int length; /**< total # of texture instructions used */
GLuint inst[PFS_MAX_TEX_INST];
GLuint inst[R300_PFS_MAX_TEX_INST];
} tex;
struct {
@ -510,7 +514,7 @@ struct r300_fragment_program_code {
GLuint inst1;
GLuint inst2;
GLuint inst3;
} inst[PFS_MAX_ALU_INST];
} inst[R300_PFS_MAX_ALU_INST];
} alu;
struct r300_fragment_program_node node[4];
@ -521,7 +525,7 @@ struct r300_fragment_program_code {
* Remember which program register a given hardware constant
* belongs to.
*/
struct prog_src_register constant[PFS_NUM_CONST_REGS];
struct prog_src_register constant[R300_PFS_NUM_CONST_REGS];
int const_nr;
int max_temp_idx;
@ -536,7 +540,7 @@ struct r500_fragment_program_code {
GLuint inst3;
GLuint inst4;
GLuint inst5;
} inst[512];
} inst[R500_PFS_MAX_INST];
int inst_offset;
int inst_end;
@ -545,7 +549,7 @@ struct r500_fragment_program_code {
* Remember which program register a given hardware constant
* belongs to.
*/
struct prog_src_register constant[PFS_NUM_CONST_REGS];
struct prog_src_register constant[R500_PFS_NUM_CONST_REGS];
int const_nr;
int max_temp_idx;

View file

@ -66,7 +66,7 @@ static GLboolean emit_const(void* data, GLuint file, GLuint index, GLuint *hwind
}
if (*hwindex >= code->const_nr) {
if (*hwindex >= PFS_NUM_CONST_REGS) {
if (*hwindex >= R300_PFS_NUM_CONST_REGS) {
error("Out of hw constants!\n");
return GL_FALSE;
}
@ -138,7 +138,7 @@ static GLboolean emit_alu(void* data, struct radeon_pair_instruction* inst)
{
PROG_CODE;
if (code->alu.length >= PFS_MAX_ALU_INST) {
if (code->alu.length >= R300_PFS_MAX_ALU_INST) {
error("Too many ALU instructions");
return GL_FALSE;
}
@ -275,7 +275,7 @@ static GLboolean emit_tex(void* data, struct prog_instruction* inst)
{
PROG_CODE;
if (code->tex.length >= PFS_MAX_TEX_INST) {
if (code->tex.length >= R300_PFS_MAX_TEX_INST) {
error("Too many TEX instructions");
return GL_FALSE;
}
@ -318,7 +318,7 @@ static const struct radeon_pair_handler pair_handler = {
.EmitPaired = &emit_alu,
.EmitTex = &emit_tex,
.BeginTexBlock = &begin_tex,
.MaxHwTemps = PFS_NUM_TEMP_REGS
.MaxHwTemps = R300_PFS_NUM_TEMP_REGS
};
/**

View file

@ -72,7 +72,7 @@ static GLboolean emit_const(void *data, GLuint file, GLuint idx, GLuint *hwindex
}
if (*hwindex >= code->const_nr) {
if (*hwindex >= PFS_NUM_CONST_REGS) {
if (*hwindex >= R500_PFS_NUM_CONST_REGS) {
error("Out of hw constants!\n");
return GL_FALSE;
}