r300: prepare for some code duplication removal
authorMaciej Cencora <m.cencora@gmail.com>
Sat, 30 May 2009 13:09:19 +0000 (15:09 +0200)
committerDave Airlie <airlied@redhat.com>
Sun, 7 Jun 2009 06:39:43 +0000 (16:39 +1000)
src/mesa/drivers/dri/r300/r300_swtcl.c
src/mesa/drivers/dri/r300/r300_swtcl.h

index fd6312ae261512a399d5896876e31a592022bea1..ecc837745d31bcae4ed32392d5607ef10977c665 100644 (file)
@@ -67,7 +67,7 @@ do { \
        ++num_attrs; \
 } while (0)
 
-static void r300SetVertexFormat( GLcontext *ctx )
+void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead,  GLuint *_OutputsWritten)
 {
        r300ContextPtr rmesa = R300_CONTEXT( ctx );
        TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -219,8 +219,19 @@ static void r300SetVertexFormat( GLcontext *ctx )
                ADD_ATTR(VERT_ATTRIB_FOG, R300_DATA_TYPE_FLOAT_1, SWTCL_OVM_TEX(first_free_tex), swiz, MASK_XYZW, 0);
        }
 
-       R300_NEWPRIM(rmesa);
        rmesa->vbuf.num_attribs = num_attrs;
+       *_InputsRead = InputsRead;
+       *_OutputsWritten = OutputsWritten;
+
+       RENDERINPUTS_COPY(rmesa->render_inputs_bitset, tnl->render_inputs_bitset);
+}
+
+static void r300PrepareVertices(GLcontext *ctx)
+{
+       r300ContextPtr rmesa = R300_CONTEXT(ctx);
+       GLuint InputsRead, OutputsWritten;
+
+       r300ChooseSwtclVertexFormat(ctx, &InputsRead, &OutputsWritten);
        r300SetupVAP(ctx, InputsRead, OutputsWritten);
 
        rmesa->radeon.swtcl.vertex_size =
@@ -230,8 +241,6 @@ static void r300SetVertexFormat( GLcontext *ctx )
                                    NULL, 0 );
 
        rmesa->radeon.swtcl.vertex_size /= 4;
-
-       RENDERINPUTS_COPY(rmesa->render_inputs_bitset, tnl->render_inputs_bitset);
 }
 
 
@@ -487,7 +496,7 @@ void r300RenderStart(GLcontext *ctx)
        r300ContextPtr rmesa = R300_CONTEXT( ctx );
 
        r300ChooseRenderState(ctx);
-       r300SetVertexFormat(ctx);
+       r300PrepareVertices(ctx);
 
        r300ValidateBuffers(ctx);
 
index cebc895c47a29f6634f1f0a4764872f1c0fe61ff..c271d2654687875d4eb3124480c5b5bf07c8d587 100644 (file)
@@ -50,6 +50,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define SWTCL_OVM_TEX(n) ((n) + 6)
 #define SWTCL_OVM_POINT_SIZE 15
 
+extern void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *InputsRead,  GLuint *OutputsWritten);
 
 extern void r300InitSwtcl( GLcontext *ctx );
 extern void r300DestroySwtcl( GLcontext *ctx );