summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300
diff options
context:
space:
mode:
authorMaciej Cencora <m.cencora@gmail.com>2009-04-27 16:25:34 +0200
committerAlex Deucher <alexdeucher@gmail.com>2009-04-27 14:33:24 -0400
commitce0d10dd6cd688d16e004c33ea4418cd7254a7f7 (patch)
tree7afe6139cbf6f2c49c8d74cd7b4ca75698ccca03 /src/mesa/drivers/dri/r300
parent3c6bffa7618494a465ecb6ab6103143c12abb0c4 (diff)
r300: fix fragment program limits
Diffstat (limited to 'src/mesa/drivers/dri/r300')
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c29
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h24
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog_emit.c8
-rw-r--r--src/mesa/drivers/dri/r300/r500_fragprog_emit.c2
4 files changed, 38 insertions, 25 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index c80dcd8420..4d1f10ba4d 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -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.
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index f8d914e7ac..379977b2c7 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -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;
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/r300_fragprog_emit.c
index 693d485de9..af8bb3887b 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog_emit.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog_emit.c
@@ -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
};
/**
diff --git a/src/mesa/drivers/dri/r300/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/r500_fragprog_emit.c
index d9f81004e8..277f801c38 100644
--- a/src/mesa/drivers/dri/r300/r500_fragprog_emit.c
+++ b/src/mesa/drivers/dri/r300/r500_fragprog_emit.c
@@ -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;
}