r300: fix fragment program limits
authorMaciej Cencora <m.cencora@gmail.com>
Mon, 27 Apr 2009 14:25:34 +0000 (16:25 +0200)
committerAlex Deucher <alexdeucher@gmail.com>
Mon, 27 Apr 2009 18:33:24 +0000 (14:33 -0400)
src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/r300/r300_context.h
src/mesa/drivers/dri/r300/r300_fragprog_emit.c
src/mesa/drivers/dri/r300/r500_fragprog_emit.c

index c80dcd8420bde4d04a5c63b4a2951a2584fdb467..4d1f10ba4d2b304eb3d3bb0ccd9dcb63f41aff40 100644 (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.
index f8d914e7ac4bfff64929bc72da9bddee4d569810..379977b2c764821ae71ce94054a35792907c1c10 100644 (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;
index 693d485de9e620fff08ca277866b2c59c8ceb92d..af8bb3887bccb452884b831fd71bcfad0dfd91a8 100644 (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
 };
 
 /**
index d9f81004e8a30ed3ce3746da425bad98550d2510..277f801c38536f6d16fc52ba3ea2eb7e10814cd1 100644 (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;
                }