Yes you're right, I just used fixed numbers matching those in r200_hw_state in r200_context.h. (Note this will also try to emit mtl[1] and pix[2-5] which is unncessary, as they are never ALLOC_STATE'd nor used, but I guess it shouldn't hurt as they'll never have their dirty flag set.)
Attached straightforward patch to do the same as the radeon driver does regarding number of texture units.


Felix Kühling wrote:
I think Roland's patch can't cope with more than two texture units. As I
experimented with this while I had Andreas Stenglein's 3TMU patch
applied some of the time I decided to make something that can handle a
variable number of texture units. Since the number of texture units is
going to be configurable this will be a good thing even after Andreas'
patch is committed. On r200 this affects the tex, cube and mat arrays.
See the radeon driver for details.

Regards,
  Felix

On Fri, 09 Jan 2004 09:27:59 +0000
Keith Whitwell <[EMAIL PROTECTED]> wrote:
The patch looks fine to me, however I did get this error applying:


$ patch < /home/progs/r200_changeemitorder.diff patching file r200_cmdbuf.c patching file r200_context.h patch unexpectedly ends in middle of line Hunk #1 succeeded at 187 with fuzz 1.


In general it makes me more confident if patches are well-formed... It looks fine though & I've committed the change.
Sorry about that, I've edited the diff manually because I had some other unrelated things applied (texture compression stuff).

Roland
Index: r200_cmdbuf.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r200/r200_cmdbuf.c,v
retrieving revision 1.4
diff -u -r1.4 r200_cmdbuf.c
--- r200_cmdbuf.c       9 Jan 2004 09:28:40 -0000       1.4
+++ r200_cmdbuf.c       9 Jan 2004 14:17:49 -0000
@@ -63,7 +63,7 @@
 {
    struct r200_state_atom *state, *tmp;
    char *dest;
-   int i, size;
+   int i, size, texunits;
 
    size = 0;
    foreach_s( state, tmp, list ) {
@@ -84,6 +84,7 @@
       return;
 
    dest = r200AllocCmdBuf( rmesa, size * 4, __FUNCTION__);
+   texunits = rmesa->glCtx->Const.MaxTextureUnits;
 
 #define EMIT_ATOM(ATOM) \
 do { \
@@ -112,13 +113,13 @@
    EMIT_ATOM (fog);
    EMIT_ATOM (tam);
    EMIT_ATOM (tf);
-   for (i = 0; i < 2; ++i) {
+   for (i = 0; i < texunits; ++i) {
        EMIT_ATOM (tex[i]);
    }
-   for (i = 0; i < 2; ++i) {
+   for (i = 0; i < texunits; ++i) {
        EMIT_ATOM (cube[i]);
    }
-   for (i = 0; i < 5; ++i)
+   for (i = 0; i < 3 + texunits; ++i)
        EMIT_ATOM (mat[i]);
    EMIT_ATOM (eye);
    EMIT_ATOM (glt);

Reply via email to