r600: ensure we have enough room for full state emit
authorAlex Deucher <alexdeucher@gmail.com>
Fri, 31 Jul 2009 15:33:16 +0000 (11:33 -0400)
committerAlex Deucher <alexdeucher@gmail.com>
Fri, 31 Jul 2009 18:52:56 +0000 (14:52 -0400)
full state is roughly 4000 dwords, but will vary depending
on the rendering.
Also fix some warnings.

src/mesa/drivers/dri/r600/r600_cmdbuf.c
src/mesa/drivers/dri/r600/r700_fragprog.c
src/mesa/drivers/dri/r600/r700_render.c
src/mesa/drivers/dri/r600/r700_vertprog.c

index e9ad9ba64c65b496703b3c44c622fa45b0c51543..15b99926d228c39a0e696ded250f90c2dbf76f71 100644 (file)
@@ -483,8 +483,9 @@ struct radeon_cs_manager * r600_radeon_cs_manager_legacy_ctor(struct radeon_cont
 void r600InitCmdBuf(context_t *r600) /* from rcommonInitCmdBuf */
 {
     radeonContextPtr rmesa = &r600->radeon;
-       
     GLuint size;
+    rmesa->hw.max_state_size = 4000; /* rough estimate */
+
        /* Initialize command buffer */
        size = 256 * driQueryOptioni(&rmesa->optionCache,
                                     "command_buffer_size");
index 587134676bcbaec2ca532de78d37f5c79f564fa2..4ac37f1dfe8288b0b2d291345f0113a15fe4df20 100644 (file)
@@ -262,15 +262,12 @@ void * r700GetActiveFpShaderBo(GLcontext * ctx)
 GLboolean r700SetupFragmentProgram(GLcontext * ctx)
 {
     context_t *context = R700_CONTEXT(ctx);
-    BATCH_LOCALS(&context->radeon);
     R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
 
     struct r700_fragment_program *fp = (struct r700_fragment_program *)
                                           (ctx->FragmentProgram._Current);
     r700_AssemblerBase         *pAsm = &(fp->r700AsmCode);
     struct gl_fragment_program *mesa_fp = &(fp->mesa_program);
-    struct gl_program_parameter_list *paramList;
-    unsigned int unNumParamData;
     unsigned int ui, i;
     unsigned int unNumOfReg;
     unsigned int unBit;
@@ -398,7 +395,6 @@ GLboolean r700SendPSConstants(GLcontext * ctx)
 {
     context_t *context = R700_CONTEXT(ctx);
     BATCH_LOCALS(&context->radeon);
-    R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
     struct r700_fragment_program *fp = (struct r700_fragment_program *)
                                           (ctx->FragmentProgram._Current);
     struct gl_program_parameter_list *paramList;
index c26c20e6ee500e8d95adb74bdb99294775b59175..bd4e0bfff42ea400f7825988e47fdb29a4c02460 100644 (file)
@@ -277,6 +277,9 @@ void r700EmitState(GLcontext * ctx)
 {
        context_t *context = R700_CONTEXT(ctx);
 
+       rcommonEnsureCmdBufSpace(&context->radeon,
+                                context->radeon.hw.max_state_size, __FUNCTION__);
+
        r700Start3D(context);
        r700SendSQConfig(context);
        r700SendFSState(context); // FIXME just a place holder for now
index fda6f7568725eafd020574e1103404cc26946c1b..8652f1d472d06bfa46425aef7a4ddca7f84bc9ec 100644 (file)
@@ -335,18 +335,12 @@ void * r700GetActiveVpShaderBo(GLcontext * ctx)
 GLboolean r700SetupVertexProgram(GLcontext * ctx)
 {
     context_t *context = R700_CONTEXT(ctx);
-
-    BATCH_LOCALS(&context->radeon);
-
     R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
 
     struct r700_vertex_program *vp
              = (struct r700_vertex_program *)ctx->VertexProgram._Current;
 
     struct gl_program_parameter_list *paramList;
-    unsigned int unNumParamData;
-
-    unsigned int ui;
 
     if(GL_FALSE == vp->loaded)
     {
@@ -400,7 +394,6 @@ GLboolean r700SendVSConstants(GLcontext * ctx)
 {
     context_t *context = R700_CONTEXT(ctx);
     BATCH_LOCALS(&context->radeon);
-    R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
     struct r700_vertex_program *vp
              = (struct r700_vertex_program *)ctx->VertexProgram._Current;
     struct gl_program_parameter_list *paramList;