SOURCES: Mesa-git-fixes.patch (NEW) - new

arekm arekm at pld-linux.org
Thu May 3 23:19:46 CEST 2007


Author: arekm                        Date: Thu May  3 21:19:46 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- new

---- Files affected:
SOURCES:
   Mesa-git-fixes.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/Mesa-git-fixes.patch
diff -u /dev/null SOURCES/Mesa-git-fixes.patch:1.1
--- /dev/null	Thu May  3 23:19:46 2007
+++ SOURCES/Mesa-git-fixes.patch	Thu May  3 23:19:41 2007
@@ -0,0 +1,886 @@
+diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c
+index 90ac988..c4dc97b 100644
+--- a/src/mesa/drivers/dri/r300/r300_ioctl.c
++++ b/src/mesa/drivers/dri/r300/r300_ioctl.c
+@@ -370,7 +370,7 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask)
+ 		_swrast_Clear(ctx, mask);
+ 	}
+ 
+-	swapped = r300->radeon.doPageFlip && (r300->radeon.sarea->pfCurrentPage == 1);
++	swapped = r300->radeon.sarea->pfCurrentPage == 1;
+ 
+ 	/* Make sure it fits there. */
+ 	r300EnsureCmdBufSpace(r300, 421*3, __FUNCTION__);
+diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
+index 52fd1de..e891798 100644
+--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
++++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
+@@ -883,10 +883,11 @@ static void position_invariant(struct gl_program *prog)
+ 
+ 	gl_state_index tokens[STATE_LENGTH] = { STATE_MVP_MATRIX, 0, 0, 0, 0 };
+ 
++        /* tokens[4] = matrix modifier */
+ #ifdef PREFER_DP4
+-	tokens[5] = STATE_MATRIX;
++	tokens[4] = 0;  /* not transposed or inverted */
+ #else
+-	tokens[5] = STATE_MATRIX_TRANSPOSE;
++	tokens[4] = STATE_MATRIX_TRANSPOSE;
+ #endif
+ 	paramList = prog->Parameters;
+ 
+@@ -895,7 +896,7 @@ static void position_invariant(struct gl_program *prog)
+ 
+ 	for (i=0; i < 4; i++) {
+ 		GLint idx;
+-		tokens[3] = tokens[4] = i;
++		tokens[2] = tokens[3] = i;  /* matrix row[i]..row[i] */
+ 		idx = _mesa_add_state_reference(paramList, tokens);
+ #ifdef PREFER_DP4
+ 		vpi[i].Opcode = OPCODE_DP4;
+diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c
+index 22f943e..9b3f890 100644
+--- a/src/mesa/drivers/dri/r300/radeon_context.c
++++ b/src/mesa/drivers/dri/r300/radeon_context.c
+@@ -283,7 +283,6 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
+ 			radeon->dri.drawable = driDrawPriv;
+ 
+ 			radeonSetCliprects(radeon);
+-			r300UpdateWindow(radeon->glCtx);
+ 			r300UpdateViewportOffset(radeon->glCtx);
+ 		}
+ 
+@@ -293,12 +292,9 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
+ 				    (GLframebuffer *) driReadPriv->
+ 				    driverPrivate);
+ 
+-		if (!radeon->glCtx->Viewport.Width) {
+-			_mesa_set_viewport(radeon->glCtx, 0, 0,
+-					   driDrawPriv->w, driDrawPriv->h);
+-		}
+-
+ 		_mesa_update_state(radeon->glCtx);		
++
++		radeonUpdatePageFlipping(radeon);
+ 	} else {
+ 		if (RADEON_DEBUG & DEBUG_DRI)
+ 			fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
+diff --git a/src/mesa/drivers/dri/r300/radeon_lock.c b/src/mesa/drivers/dri/r300/radeon_lock.c
+index ec501c3..0d0d9ab 100644
+--- a/src/mesa/drivers/dri/r300/radeon_lock.c
++++ b/src/mesa/drivers/dri/r300/radeon_lock.c
+@@ -50,16 +50,19 @@ int prevLockLine = 0;
+ 
+ /* Turn on/off page flipping according to the flags in the sarea:
+  */
+-static void radeonUpdatePageFlipping(radeonContextPtr radeon)
++void radeonUpdatePageFlipping(radeonContextPtr radeon)
+ {
+ 	int use_back;
+ 
+ 	radeon->doPageFlip = radeon->sarea->pfState;
+         if (radeon->glCtx->WinSysDrawBuffer) {
+            driFlipRenderbuffers(radeon->glCtx->WinSysDrawBuffer, radeon->sarea->pfCurrentPage);
++           r300UpdateDrawBuffer(radeon->glCtx);
+         }
+ 
+-	use_back = (radeon->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT);
++	use_back = radeon->glCtx->DrawBuffer ?
++		(radeon->glCtx->DrawBuffer->_ColorDrawBufferMask[0] ==
++		 BUFFER_BIT_BACK_LEFT) : 1;
+ 	use_back ^= (radeon->sarea->pfCurrentPage == 1);
+ 
+ 	if (use_back) {
+diff --git a/src/mesa/drivers/dri/r300/radeon_lock.h b/src/mesa/drivers/dri/r300/radeon_lock.h
+index 632329f..b11ddf0 100644
+--- a/src/mesa/drivers/dri/r300/radeon_lock.h
++++ b/src/mesa/drivers/dri/r300/radeon_lock.h
+@@ -41,6 +41,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ #include "radeon_context.h"
+ 
+ extern void radeonGetLock(radeonContextPtr radeon, GLuint flags);
++extern void radeonUpdatePageFlipping(radeonContextPtr radeon);
+ 
+ /* Turn DEBUG_LOCKING on to find locking conflicts.
+  */
+diff --git a/src/mesa/drivers/dri/r300/radeon_state.c b/src/mesa/drivers/dri/r300/radeon_state.c
+index 902e958..82bfd95 100644
+--- a/src/mesa/drivers/dri/r300/radeon_state.c
++++ b/src/mesa/drivers/dri/r300/radeon_state.c
+@@ -154,7 +154,8 @@ void radeonSetCliprects(radeonContextPtr radeon)
+ 
+ 	if (draw_fb->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT) {
+ 		/* Can't ignore 2d windows if we are page flipping. */
+-		if (drawable->numBackClipRects == 0 || radeon->doPageFlip) {
++		if (drawable->numBackClipRects == 0 || radeon->doPageFlip ||
++		    radeon->sarea->pfCurrentPage == 1) {
+ 			radeon->numClipRects = drawable->numClipRects;
+ 			radeon->pClipRects = drawable->pClipRects;
+ 		} else {
+diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
+index 543ff69..c854623 100644
+--- a/src/mesa/drivers/x11/xm_dd.c
++++ b/src/mesa/drivers/x11/xm_dd.c
+@@ -438,7 +438,7 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx,
+ {
+    const SWcontext *swrast = SWRAST_CONTEXT( ctx );
+    struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0];
+-   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb->Wrapped;
++   struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb->Wrapped);
+ 
+    if (swrast->NewState)
+       _swrast_validate_derived( ctx );
+@@ -546,7 +546,7 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx,
+                          const GLvoid *pixels )
+ {
+    struct xmesa_renderbuffer *xrb
+-      = (struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0];
++      = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped);
+    const XMesaContext xmesa = XMESA_CONTEXT(ctx);
+    const SWcontext *swrast = SWRAST_CONTEXT( ctx );
+    XMesaDisplay *dpy = xmesa->xm_visual->display;
+@@ -652,10 +652,10 @@ xmesa_CopyPixels( GLcontext *ctx,
+    const SWcontext *swrast = SWRAST_CONTEXT( ctx );
+    XMesaDisplay *dpy = xmesa->xm_visual->display;
+    const XMesaGC gc = ((XMesaBuffer) ctx->DrawBuffer)->gc;
+-   struct xmesa_renderbuffer *srcXrb = (struct xmesa_renderbuffer *)
+-      ctx->ReadBuffer->_ColorReadBuffer;
+-   struct xmesa_renderbuffer *dstXrb = (struct xmesa_renderbuffer *)
+-      ctx->DrawBuffer->_ColorDrawBuffers[0][0];
++   struct xmesa_renderbuffer *srcXrb
++      = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped);
++   struct xmesa_renderbuffer *dstXrb
++      = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped);
+ 
+    ASSERT(dpy);
+    ASSERT(gc);
+diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c
+index 5583f16..4b5f63e 100644
+--- a/src/mesa/shader/arbprogram.c
++++ b/src/mesa/shader/arbprogram.c
+@@ -1,8 +1,8 @@
+ /*
+  * Mesa 3-D graphics library
+- * Version:  6.5.2
++ * Version:  7.0
+  *
+- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
++ * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
+  *
+  * Permission is hereby granted, free of charge, to any person obtaining a
+  * copy of this software and associated documentation files (the "Software"),
+@@ -703,10 +703,18 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
+           * The spec says that even if this query returns true, there's
+           * no guarantee that the program will run in hardware.
+           */
+-	 if (ctx->Driver.IsProgramNative) 
++         if (prog->Id == 0) {
++            /* default/null program */
++            *params = GL_FALSE;
++         }
++	 else if (ctx->Driver.IsProgramNative) {
++            /* ask the driver */
+ 	    *params = ctx->Driver.IsProgramNative( ctx, target, prog );
+-	 else
++         }
++	 else {
++            /* probably running in software */
+ 	    *params = GL_TRUE;
++         }
+          return;
+       default:
+          /* continue with fragment-program only queries below */
+diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
+index 356d4ce..9faf9d8 100644
+--- a/src/mesa/shader/prog_execute.c
++++ b/src/mesa/shader/prog_execute.c
+@@ -218,120 +218,64 @@ fetch_vector4(const struct prog_src_register *source,
+    }
+ }
+ 
+-#if 0
++
+ /**
+- * Fetch the derivative with respect to X for the given register.
+- * \return GL_TRUE if it was easily computed or GL_FALSE if we
+- * need to execute another instance of the program (ugh)!
++ * Fetch the derivative with respect to X or Y for the given register.
++ * XXX this currently only works for fragment program input attribs.
+  */
+-static GLboolean
++static void
+ fetch_vector4_deriv(GLcontext * ctx,
+                     const struct prog_src_register *source,
+-                    const SWspan * span,
+-                    char xOrY, GLint column, GLfloat result[4])
++                    const struct gl_program_machine *machine,
++                    char xOrY, GLfloat result[4])
+ {
+-   GLfloat src[4];
++   if (source->File == PROGRAM_INPUT && source->Index < machine->NumDeriv) {
++      const GLint col = machine->CurElement;
++      const GLfloat w = machine->Attribs[FRAG_ATTRIB_WPOS][col][3];
++      const GLfloat invQ = 1.0f / w;
++      GLfloat deriv[4];
+ 
+-   ASSERT(xOrY == 'X' || xOrY == 'Y');
+-
+-   switch (source->Index) {
+-   case FRAG_ATTRIB_WPOS:
+       if (xOrY == 'X') {
+-         src[0] = 1.0;
+-         src[1] = 0.0;
+-         src[2] = span->attrStepX[FRAG_ATTRIB_WPOS][2]
+-            / ctx->DrawBuffer->_DepthMaxF;
+-         src[3] = span->attrStepX[FRAG_ATTRIB_WPOS][3];
++         deriv[0] = machine->DerivX[source->Index][0] * invQ;
++         deriv[1] = machine->DerivX[source->Index][1] * invQ;
++         deriv[2] = machine->DerivX[source->Index][2] * invQ;
++         deriv[3] = machine->DerivX[source->Index][3] * invQ;
+       }
+       else {
+-         src[0] = 0.0;
+-         src[1] = 1.0;
+-         src[2] = span->attrStepY[FRAG_ATTRIB_WPOS][2]
+-            / ctx->DrawBuffer->_DepthMaxF;
+-         src[3] = span->attrStepY[FRAG_ATTRIB_WPOS][3];
+-      }
+-      break;
+-   case FRAG_ATTRIB_COL0:
+-   case FRAG_ATTRIB_COL1:
+-      if (xOrY == 'X') {
+-         src[0] = span->attrStepX[source->Index][0] * (1.0F / CHAN_MAXF);
+-         src[1] = span->attrStepX[source->Index][1] * (1.0F / CHAN_MAXF);
+-         src[2] = span->attrStepX[source->Index][2] * (1.0F / CHAN_MAXF);
+-         src[3] = span->attrStepX[source->Index][3] * (1.0F / CHAN_MAXF);
+-      }
+-      else {
+-         src[0] = span->attrStepY[source->Index][0] * (1.0F / CHAN_MAXF);
+-         src[1] = span->attrStepY[source->Index][1] * (1.0F / CHAN_MAXF);
+-         src[2] = span->attrStepY[source->Index][2] * (1.0F / CHAN_MAXF);
+-         src[3] = span->attrStepY[source->Index][3] * (1.0F / CHAN_MAXF);
+-      }
+-      break;
+-   case FRAG_ATTRIB_FOGC:
+-      if (xOrY == 'X') {
+-         src[0] = span->attrStepX[FRAG_ATTRIB_FOGC][0] * (1.0F / CHAN_MAXF);
+-         src[1] = 0.0;
+-         src[2] = 0.0;
+-         src[3] = 0.0;
++         deriv[0] = machine->DerivY[source->Index][0] * invQ;
++         deriv[1] = machine->DerivY[source->Index][1] * invQ;
++         deriv[2] = machine->DerivY[source->Index][2] * invQ;
++         deriv[3] = machine->DerivY[source->Index][3] * invQ;
+       }
+-      else {
+-         src[0] = span->attrStepY[FRAG_ATTRIB_FOGC][0] * (1.0F / CHAN_MAXF);
+-         src[1] = 0.0;
+-         src[2] = 0.0;
+-         src[3] = 0.0;
++
++      result[0] = deriv[GET_SWZ(source->Swizzle, 0)];
++      result[1] = deriv[GET_SWZ(source->Swizzle, 1)];
++      result[2] = deriv[GET_SWZ(source->Swizzle, 2)];
++      result[3] = deriv[GET_SWZ(source->Swizzle, 3)];
++      
++      if (source->NegateBase) {
++         result[0] = -result[0];
++         result[1] = -result[1];
++         result[2] = -result[2];
++         result[3] = -result[3];
+       }
+-      break;
+-   default:
+-      assert(source->Index < FRAG_ATTRIB_MAX);
+-      /* texcoord or varying */
+-      if (xOrY == 'X') {
+-         /* this is a little tricky - I think I've got it right */
+-         const GLfloat invQ = 1.0f / (span->attrStart[source->Index][3]
+-                                      +
+-                                      span->attrStepX[source->Index][3] *
+-                                      column);
+-         src[0] = span->attrStepX[source->Index][0] * invQ;
+-         src[1] = span->attrStepX[source->Index][1] * invQ;
+-         src[2] = span->attrStepX[source->Index][2] * invQ;
+-         src[3] = span->attrStepX[source->Index][3] * invQ;
++      if (source->Abs) {
++         result[0] = FABSF(result[0]);
++         result[1] = FABSF(result[1]);
++         result[2] = FABSF(result[2]);
++         result[3] = FABSF(result[3]);
+       }
+-      else {
+-         /* Tricky, as above, but in Y direction */
+-         const GLfloat invQ = 1.0f / (span->attrStart[source->Index][3]
+-                                      + span->attrStepY[source->Index][3]);
+-         src[0] = span->attrStepY[source->Index][0] * invQ;
+-         src[1] = span->attrStepY[source->Index][1] * invQ;
+-         src[2] = span->attrStepY[source->Index][2] * invQ;
+-         src[3] = span->attrStepY[source->Index][3] * invQ;
++      if (source->NegateAbs) {
++         result[0] = -result[0];
++         result[1] = -result[1];
++         result[2] = -result[2];
++         result[3] = -result[3];
+       }
+-      break;
+    }
+-
+-   result[0] = src[GET_SWZ(source->Swizzle, 0)];
+-   result[1] = src[GET_SWZ(source->Swizzle, 1)];
+-   result[2] = src[GET_SWZ(source->Swizzle, 2)];
+-   result[3] = src[GET_SWZ(source->Swizzle, 3)];
+-
+-   if (source->NegateBase) {
+-      result[0] = -result[0];
+-      result[1] = -result[1];
+-      result[2] = -result[2];
+-      result[3] = -result[3];
+-   }
+-   if (source->Abs) {
+-      result[0] = FABSF(result[0]);
+-      result[1] = FABSF(result[1]);
+-      result[2] = FABSF(result[2]);
+-      result[3] = FABSF(result[3]);
+-   }
+-   if (source->NegateAbs) {
+-      result[0] = -result[0];
+-      result[1] = -result[1];
+-      result[2] = -result[2];
+-      result[3] = -result[3];
++   else {
++      ASSIGN_4V(result, 0.0, 0.0, 0.0, 0.0);
+    }
+-   return GL_TRUE;
+ }
+-#endif
+ 
+ 
+ /**
+@@ -519,106 +463,6 @@ store_vector4(const struct prog_instruction *inst,
+ }
+ 
+ 
+-#if 0
+-/**
+- * Initialize a new machine state instance from an existing one, adding
+- * the partial derivatives onto the input registers.
+- * Used to implement DDX and DDY instructions in non-trivial cases.
+- */
+-static void
+-init_machine_deriv(GLcontext * ctx,
+-                   const struct gl_program_machine *machine,
+-                   const struct gl_fragment_program *program,
+-                   const SWspan * span, char xOrY,
+-                   struct gl_program_machine *dMachine)
+-{
+-   GLuint attr;
+-
+-   ASSERT(xOrY == 'X' || xOrY == 'Y');
+-
+-   /* copy existing machine */
+-   _mesa_memcpy(dMachine, machine, sizeof(struct gl_program_machine));
+-
+-   if (program->Base.Target == GL_FRAGMENT_PROGRAM_NV) {
+-      /* XXX also need to do this when using valgrind */
+-      /* Clear temporary registers (undefined for ARB_f_p) */
+-      _mesa_bzero((void *) machine->Temporaries,
+-                  MAX_PROGRAM_TEMPS * 4 * sizeof(GLfloat));
+-   }
+-
+-   /* Add derivatives */
+-   if (program->Base.InputsRead & FRAG_BIT_WPOS) {
+-      GLfloat *wpos = machine->Attribs[FRAG_ATTRIB_WPOS][machine->CurElement];
+-      if (xOrY == 'X') {
+-         wpos[0] += 1.0F;
+-         wpos[1] += 0.0F;
+-         wpos[2] += span->attrStepX[FRAG_ATTRIB_WPOS][2];
+-         wpos[3] += span->attrStepX[FRAG_ATTRIB_WPOS][3];
+-      }
+-      else {
+-         wpos[0] += 0.0F;
+-         wpos[1] += 1.0F;
+-         wpos[2] += span->attrStepY[FRAG_ATTRIB_WPOS][2];
+-         wpos[3] += span->attrStepY[FRAG_ATTRIB_WPOS][3];
+-      }
+-   }
+-
+-   /* primary, secondary colors */
+-   for (attr = FRAG_ATTRIB_COL0; attr <= FRAG_ATTRIB_COL1; attr++) {
+-      if (program->Base.InputsRead & (1 << attr)) {
+-         GLfloat *col = machine->Attribs[attr][machine->CurElement];
+-         if (xOrY == 'X') {
+-            col[0] += span->attrStepX[attr][0] * (1.0F / CHAN_MAXF);
+-            col[1] += span->attrStepX[attr][1] * (1.0F / CHAN_MAXF);
+-            col[2] += span->attrStepX[attr][2] * (1.0F / CHAN_MAXF);
+-            col[3] += span->attrStepX[attr][3] * (1.0F / CHAN_MAXF);
+-         }
+-         else {
+-            col[0] += span->attrStepY[attr][0] * (1.0F / CHAN_MAXF);
+-            col[1] += span->attrStepY[attr][1] * (1.0F / CHAN_MAXF);
+-            col[2] += span->attrStepY[attr][2] * (1.0F / CHAN_MAXF);
+-            col[3] += span->attrStepY[attr][3] * (1.0F / CHAN_MAXF);
+-         }
+-      }
+-   }
+-   if (program->Base.InputsRead & FRAG_BIT_FOGC) {
+-      GLfloat *fogc = machine->Attribs[FRAG_ATTRIB_FOGC][machine->CurElement];
+-      if (xOrY == 'X') {
+-         fogc[0] += span->attrStepX[FRAG_ATTRIB_FOGC][0];
+-      }
+-      else {
+-         fogc[0] += span->attrStepY[FRAG_ATTRIB_FOGC][0];
+-      }
+-   }
+-   /* texcoord and varying vars */
+-   for (attr = FRAG_ATTRIB_TEX0; attr < FRAG_ATTRIB_MAX; attr++) {
+-      if (program->Base.InputsRead & (1 << attr)) {
+-         GLfloat *val = machine->Attribs[attr][machine->CurElement];
+-         /* XXX perspective-correct interpolation */
+-         if (xOrY == 'X') {
+-            val[0] += span->attrStepX[attr][0];
+-            val[1] += span->attrStepX[attr][1];
+-            val[2] += span->attrStepX[attr][2];
+-            val[3] += span->attrStepX[attr][3];
+-         }
+-         else {
+-            val[0] += span->attrStepY[attr][0];
+-            val[1] += span->attrStepY[attr][1];
+-            val[2] += span->attrStepY[attr][2];
+-            val[3] += span->attrStepY[attr][3];
+-         }
+-      }
+-   }
+-
+-   /* init condition codes */
+-   dMachine->CondCodes[0] = COND_EQ;
+-   dMachine->CondCodes[1] = COND_EQ;
+-   dMachine->CondCodes[2] = COND_EQ;
+-   dMachine->CondCodes[3] = COND_EQ;
+-}
+-#endif
+-
+-
+ /**
+  * Execute the given vertex/fragment program.
+  *
+@@ -762,57 +606,18 @@ _mesa_execute_program(GLcontext * ctx,
+          break;
+       case OPCODE_DDX:         /* Partial derivative with respect to X */
+          {
+-#if 0
+-            GLfloat a[4], aNext[4], result[4];
+-            struct gl_program_machine dMachine;
+-            if (!fetch_vector4_deriv(ctx, &inst->SrcReg[0], span, 'X',
+-                                     column, result)) {
+-               /* This is tricky.  Make a copy of the current machine state,
+-                * increment the input registers by the dx or dy partial
+-                * derivatives, then re-execute the program up to the
+-                * preceeding instruction, then fetch the source register.
+-                * Finally, find the difference in the register values for
+-                * the original and derivative runs.
+-                */
+-               fetch_vector4(&inst->SrcReg[0], machine, program, a);
+-               init_machine_deriv(ctx, machine, program, span,
+-                                  'X', &dMachine);
+-               execute_program(ctx, program, pc, &dMachine, span, column);
+-               fetch_vector4(&inst->SrcReg[0], &dMachine, program,
+-                             aNext);
+-               result[0] = aNext[0] - a[0];
+-               result[1] = aNext[1] - a[1];
+-               result[2] = aNext[2] - a[2];
+-               result[3] = aNext[3] - a[3];
+-            }
++            GLfloat result[4];
++            fetch_vector4_deriv(ctx, &inst->SrcReg[0], machine,
++                                'X', result);
+             store_vector4(inst, machine, result);
+-#else
+-            store_vector4(inst, machine, ZeroVec);
+-#endif
+          }
+          break;
+       case OPCODE_DDY:         /* Partial derivative with respect to Y */
+          {
+-#if 0
+-            GLfloat a[4], aNext[4], result[4];
+-            struct gl_program_machine dMachine;
+-            if (!fetch_vector4_deriv(ctx, &inst->SrcReg[0], span, 'Y',
+-                                     column, result)) {
+-               init_machine_deriv(ctx, machine, program, span,
+-                                  'Y', &dMachine);
+-               fetch_vector4(&inst->SrcReg[0], machine, program, a);
+-               execute_program(ctx, program, pc, &dMachine, span, column);
+-               fetch_vector4(&inst->SrcReg[0], &dMachine, program,
+-                             aNext);
+-               result[0] = aNext[0] - a[0];
+-               result[1] = aNext[1] - a[1];
+-               result[2] = aNext[2] - a[2];
+-               result[3] = aNext[3] - a[3];
+-            }
++            GLfloat result[4];
++            fetch_vector4_deriv(ctx, &inst->SrcReg[0], machine,
++                                'Y', result);
+             store_vector4(inst, machine, result);
+-#else
+-            store_vector4(inst, machine, ZeroVec);
+-#endif
+          }
+          break;
+       case OPCODE_DP3:
+diff --git a/src/mesa/shader/prog_execute.h b/src/mesa/shader/prog_execute.h
+index 47845e9..be29ece 100644
+--- a/src/mesa/shader/prog_execute.h
++++ b/src/mesa/shader/prog_execute.h
+@@ -48,6 +48,9 @@ struct gl_program_machine
+ 
+    /** Fragment Input attributes */
+    GLfloat (*Attribs)[MAX_WIDTH][4];
++   GLfloat (*DerivX)[4];
++   GLfloat (*DerivY)[4];
++   GLuint NumDeriv; /**< Max index into DerivX/Y arrays */
+    GLuint CurElement; /**< Index into Attribs arrays */
+ 
+    /** Vertex Input attribs */
+diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
+index c6151f8..cf32b50 100644
+--- a/src/mesa/shader/slang/slang_codegen.c
++++ b/src/mesa/shader/slang/slang_codegen.c
+@@ -700,37 +700,6 @@ _slang_find_node_type(slang_operation *oper, slang_operation_type type)
+ }
+ 
+ 
+-/**
+- * Produce inline code for a call to an assembly instruction.
+- * XXX Note: children are passed as asm args in-order, not by name!
+- */
+-static slang_operation *
+-slang_inline_asm_function(slang_assemble_ctx *A,
+-                          slang_function *fun, slang_operation *oper)
+-{
+-   const GLuint numArgs = oper->num_children;
+-   const slang_operation *args = oper->children;
+-   GLuint i;
+-   slang_operation *inlined = slang_operation_new(1);
+-
+-   /*assert(oper->type == SLANG_OPER_CALL);  or vec4_add, etc */
+-   /*
+-   printf("Inline asm %s\n", (char*) fun->header.a_name);
+-   */
+-   inlined->type = fun->body->children[0].type;
+-   inlined->a_id = fun->body->children[0].a_id;
+-   inlined->num_children = numArgs;
+-   inlined->children = slang_operation_new(numArgs);
+-   inlined->locals->outer_scope = oper->locals->outer_scope;
+-
+-   for (i = 0; i < numArgs; i++) {
+-      slang_operation_copy(inlined->children + i, args + i);
+-   }
+-
+-   return inlined;
+-}
+-
+-
+ static void
+ slang_resolve_variable(slang_operation *oper)
+ {
+@@ -892,6 +861,70 @@ slang_substitute(slang_assemble_ctx *A, slang_operation *oper,
+ 
+ 
+ /**
++ * Produce inline code for a call to an assembly instruction.
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list