r300/compiler: allow 1024 instructions in r5xx vertex shaders
authorMarek Olšák <maraeo@gmail.com>
Wed, 23 Jun 2010 01:58:46 +0000 (03:58 +0200)
committerMarek Olšák <maraeo@gmail.com>
Wed, 23 Jun 2010 01:58:46 +0000 (03:58 +0200)
src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
src/mesa/drivers/dri/r300/compiler/radeon_code.h
src/mesa/drivers/dri/r300/r300_context.c

index 5f66ad8..e984797 100644 (file)
@@ -349,7 +349,8 @@ static void translate_vertex_program(struct r300_vertex_program_compiler * compi
                if (!valid_dst(compiler->code, &vpi->DstReg))
                        continue;
 
-               if (compiler->code->length >= VSF_MAX_FRAGMENT_LENGTH) {
+               if (compiler->code->length >= R500_VS_MAX_ALU_DWORDS ||
+                   (compiler->code->length >= R300_VS_MAX_ALU_DWORDS && !compiler->Base.is_r500)) {
                        rc_error(&compiler->Base, "Vertex program has too many instructions\n");
                        return;
                }
index 7550fca..d036897 100644 (file)
@@ -235,7 +235,10 @@ struct rX00_fragment_program_code {
 };
 
 
-#define VSF_MAX_FRAGMENT_LENGTH (255*4)
+#define R300_VS_MAX_ALU                256
+#define R300_VS_MAX_ALU_DWORDS  (R300_VS_MAX_ALU * 4)
+#define R500_VS_MAX_ALU                1024
+#define R500_VS_MAX_ALU_DWORDS  (R500_VS_MAX_ALU * 4)
 #define R300_VS_MAX_TEMPS      32
 
 #define VSF_MAX_INPUTS 32
@@ -244,8 +247,8 @@ struct rX00_fragment_program_code {
 struct r300_vertex_program_code {
        int length;
        union {
-               uint32_t d[VSF_MAX_FRAGMENT_LENGTH];
-               float f[VSF_MAX_FRAGMENT_LENGTH];
+               uint32_t d[R500_VS_MAX_ALU_DWORDS];
+               float f[R500_VS_MAX_ALU_DWORDS];
        } body;
 
        int pos_end;
index 6992ca5..e4b302b 100644 (file)
@@ -376,13 +376,12 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
        ctx->Const.MaxDrawBuffers = 1;
        ctx->Const.MaxColorAttachments = 1;
 
-       /* currently bogus data */
        if (r300->options.hw_tcl_enabled) {
-               ctx->Const.VertexProgram.MaxNativeInstructions = VSF_MAX_FRAGMENT_LENGTH / 4;
-               ctx->Const.VertexProgram.MaxNativeAluInstructions = VSF_MAX_FRAGMENT_LENGTH / 4;
-               ctx->Const.VertexProgram.MaxNativeAttribs = 16; /* r420 */
+               ctx->Const.VertexProgram.MaxNativeInstructions = 255;
+               ctx->Const.VertexProgram.MaxNativeAluInstructions = 255;
+               ctx->Const.VertexProgram.MaxNativeAttribs = 16;
                ctx->Const.VertexProgram.MaxNativeTemps = 32;
-               ctx->Const.VertexProgram.MaxNativeParameters = 256;     /* r420 */
+               ctx->Const.VertexProgram.MaxNativeParameters = 256;
                ctx->Const.VertexProgram.MaxNativeAddressRegs = 1;
        }