Merge commit 'origin/master' into gallium-0.2
authorAlan Hourihane <alanh@tungstengraphics.com>
Mon, 15 Dec 2008 11:16:03 +0000 (11:16 +0000)
committerAlan Hourihane <alanh@tungstengraphics.com>
Mon, 15 Dec 2008 11:16:03 +0000 (11:16 +0000)
35 files changed:
configs/autoconf.in
configs/default
configure.ac
progs/glsl/.gitignore
progs/glsl/Makefile
progs/glsl/multinoise.c [new file with mode: 0644]
progs/glsl/noise.c
src/glu/Makefile
src/glu/glu.pc.in
src/glut/glx/Makefile
src/glut/glx/glut.pc.in
src/glut/mini/Makefile
src/glut/mini/glut.pc.in
src/glw/Makefile
src/glw/glw.pc.in
src/glx/x11/indirect.c
src/mesa/Makefile
src/mesa/drivers/dri/Makefile
src/mesa/drivers/dri/dri.pc.in
src/mesa/drivers/dri/i965/brw_wm_glsl.c
src/mesa/drivers/dri/intel/intel_batchbuffer.h
src/mesa/drivers/dri/intel/intel_decode.c
src/mesa/drivers/dri/intel/intel_mipmap_tree.c
src/mesa/gl.pc.in
src/mesa/glapi/extension_helper.py
src/mesa/glapi/glX_proto_recv.py
src/mesa/glapi/glX_proto_send.py
src/mesa/glapi/glX_proto_size.py
src/mesa/glapi/gl_API.dtd
src/mesa/glapi/gl_API.xml
src/mesa/glapi/gl_XML.py
src/mesa/glapi/gl_apitemp.py
src/mesa/glapi/gl_x86_asm.py
src/mesa/main/texobj.c
src/mesa/osmesa.pc.in [new file with mode: 0644]

index a3eaed5c9d0e8b328f1ababa9910ef2d2c0afdc2..4a89716ab601bb67843f55946d3c0bca326422ad 100644 (file)
@@ -105,3 +105,21 @@ DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@
 
 # Where libGL will look for DRI hardware drivers
 DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)
+
+# pkg-config substitutions
+GL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@
+GL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@
+GL_PC_CFLAGS = @GL_PC_CFLAGS@
+DRI_PC_REQ_PRIV = @DRI_PC_REQ_PRIV@
+GLU_PC_REQ = @GLU_PC_REQ@
+GLU_PC_REQ_PRIV = @GLU_PC_REQ_PRIV@
+GLU_PC_LIB_PRIV = @GLU_PC_LIB_PRIV@
+GLU_PC_CFLAGS = @GLU_PC_CFLAGS@
+GLUT_PC_REQ_PRIV = @GLUT_PC_REQ_PRIV@
+GLUT_PC_LIB_PRIV = @GLUT_PC_LIB_PRIV@
+GLUT_PC_CFLAGS = @GLUT_PC_CFLAGS@
+GLW_PC_REQ_PRIV = @GLW_PC_REQ_PRIV@
+GLW_PC_LIB_PRIV = @GLW_PC_LIB_PRIV@
+GLW_PC_CFLAGS = @GLW_PC_CFLAGS@
+OSMESA_PC_REQ = @OSMESA_PC_REQ@
+OSMESA_PC_LIB_PRIV = @OSMESA_PC_LIB_PRIV@
index d3efc4b3d05d2f235141387ace90cdf029071b6e..1f340a371ed629bce8549ea32e9275033d720048 100644 (file)
@@ -116,3 +116,20 @@ DRI_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/dri
 # Where libGL will look for DRI hardware drivers
 DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)
 
+# pkg-config substitutions
+GL_PC_REQ_PRIV =
+GL_PC_LIB_PRIV =
+GL_PC_CFLAGS =
+DRI_PC_REQ_PRIV =
+GLU_PC_REQ = gl
+GLU_PC_REQ_PRIV =
+GLU_PC_LIB_PRIV =
+GLU_PC_CFLAGS =
+GLUT_PC_REQ_PRIV =
+GLUT_PC_LIB_PRIV =
+GLUT_PC_CFLAGS =
+GLW_PC_REQ_PRIV =
+GLW_PC_LIB_PRIV =
+GLW_PC_CFLAGS =
+OSMESA_PC_REQ =
+OSMESA_PC_LIB_PRIV =
index 66e080eb8e3cf4c004be2d740c56fc036d23c259..97cb298d399088d28fb7b8126f30a27a56613935 100644 (file)
@@ -507,14 +507,18 @@ case "$mesa_driver" in
 xlib)
     if test "$x11_pkgconfig" = yes; then
         PKG_CHECK_MODULES([XLIBGL], [x11 xext])
+        GL_PC_REQ_PRIV="x11 xext"
         X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
         GL_LIB_DEPS="$XLIBGL_LIBS"
     else
         # should check these...
         X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
         GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
+        GL_PC_LIB_PRIV="$GL_LIB_DEPS"
+        GL_PC_CFLAGS="$X11_INCLUDES"
     fi
     GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $OS_LIBS"
+    GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread $OS_LIBS"
 
     # if static, move the external libraries to the programs
     # and empty the libraries for libGL
@@ -532,6 +536,8 @@ dri)
     # Check for libdrm
     PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
     PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
+    GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
+    DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
 
     # find the DRI deps for libGL
     if test "$x11_pkgconfig" = yes; then
@@ -542,16 +548,20 @@ dri)
         fi
 
         PKG_CHECK_MODULES([DRIGL], [$dri_modules])
+        GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
         X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
         GL_LIB_DEPS="$DRIGL_LIBS"
     else
         # should check these...
         X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
         GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
+        GL_PC_LIB_PRIV="$GL_LIB_DEPS"
+        GL_PC_CFLAGS="$X11_INCLUDES"
 
         # XCB can only be used from pkg-config
         if test "$enable_xcb" = yes; then
             PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
+            GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
             X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
             GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
         fi
@@ -559,6 +569,7 @@ dri)
 
     # need DRM libs, -lpthread, etc.
     GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS $OS_LIBS"
+    GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS $OS_LIBS"
     ;;
 osmesa)
     # No libGL for osmesa
@@ -566,6 +577,10 @@ osmesa)
     ;;
 esac
 AC_SUBST([GL_LIB_DEPS])
+AC_SUBST([GL_PC_REQ_PRIV])
+AC_SUBST([GL_PC_LIB_PRIV])
+AC_SUBST([GL_PC_CFLAGS])
+AC_SUBST([DRI_PC_REQ_PRIV])
 
 dnl
 dnl More X11 setup
@@ -786,6 +801,7 @@ osmesa)
         OSMESA_LIB_DEPS=""
     fi
     OSMESA_MESA_DEPS=""
+    OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS"
     ;;
 *)
     # Link OSMesa to libGL otherwise
@@ -796,13 +812,17 @@ osmesa)
     else
         OSMESA_MESA_DEPS=""
     fi
+    OSMESA_PC_REQ="gl"
     ;;
 esac
 if test "$enable_static" = no; then
     OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS $OS_LIBS"
 fi
+OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV $OS_LIBS"
 AC_SUBST([OSMESA_LIB_DEPS])
 AC_SUBST([OSMESA_MESA_DEPS])
+AC_SUBST([OSMESA_PC_REQ])
+AC_SUBST([OSMESA_PC_LIB_PRIV])
 
 dnl
 dnl GLU configuration
@@ -825,6 +845,7 @@ if test "x$enable_glu" = xyes; then
 
         # Link libGLU to libOSMesa instead of libGL
         GLU_LIB_DEPS=""
+        GLU_PC_REQ="osmesa"
         if test "$enable_static" = no; then
             GLU_MESA_DEPS='-l$(OSMESA_LIB)'
         else
@@ -833,6 +854,8 @@ if test "x$enable_glu" = xyes; then
         ;;
     *)
         # If static, empty GLU_LIB_DEPS and add libs for programs to link
+        GLU_PC_REQ="gl"
+        GLU_PC_LIB_PRIV="-lm"
         if test "$enable_static" = no; then
             GLU_LIB_DEPS="-lm"
             GLU_MESA_DEPS='-l$(GL_LIB)'
@@ -847,8 +870,13 @@ fi
 if test "$enable_static" = no; then
     GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
 fi
+GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
 AC_SUBST([GLU_LIB_DEPS])
 AC_SUBST([GLU_MESA_DEPS])
+AC_SUBST([GLU_PC_REQ])
+AC_SUBST([GLU_PC_REQ_PRIV])
+AC_SUBST([GLU_PC_LIB_PRIV])
+AC_SUBST([GLU_PC_CFLAGS])
 
 dnl
 dnl GLw configuration
@@ -873,10 +901,13 @@ if test "x$enable_glw" = xyes; then
     SRC_DIRS="$SRC_DIRS glw"
     if test "$x11_pkgconfig" = yes; then
         PKG_CHECK_MODULES([GLW],[x11 xt])
+        GLW_PC_REQ_PRIV="x11 xt"
         GLW_LIB_DEPS="$GLW_LIBS"
     else
         # should check these...
         GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
+        GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
+        GLW_PC_CFLAGS="$X11_INCLUDES"
     fi
 
     GLW_SOURCES="GLwDrawA.c"
@@ -895,9 +926,12 @@ if test "x$enable_glw" = xyes; then
         fi
         # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
         GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
+        GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
+        GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
     fi
 
     # If static, empty GLW_LIB_DEPS and add libs for programs to link
+    GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV $OS_LIBS"
     if test "$enable_static" = no; then
         GLW_MESA_DEPS='-l$(GL_LIB)'
         GLW_LIB_DEPS="$GLW_LIB_DEPS $OS_LIBS"
@@ -911,6 +945,9 @@ AC_SUBST([GLW_LIB_DEPS])
 AC_SUBST([GLW_MESA_DEPS])
 AC_SUBST([GLW_SOURCES])
 AC_SUBST([MOTIF_CFLAGS])
+AC_SUBST([GLW_PC_REQ_PRIV])
+AC_SUBST([GLW_PC_LIB_PRIV])
+AC_SUBST([GLW_PC_CFLAGS])
 
 dnl
 dnl GLUT configuration
@@ -945,12 +982,16 @@ if test "x$enable_glut" = xyes; then
     fi
     if test "$x11_pkgconfig" = yes; then
         PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
+        GLUT_PC_REQ_PRIV="x11 xmu xi"
         GLUT_LIB_DEPS="$GLUT_LIBS"
     else
         # should check these...
         GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
+        GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
+        GLUT_PC_CFLAGS="$X11_INCLUDES"
     fi
     GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm $OS_LIBS"
+    GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm $OS_LIBS"
 
     # If glut is available, we can build most programs
     if test "$with_demos" = yes; then
@@ -969,6 +1010,9 @@ fi
 AC_SUBST([GLUT_LIB_DEPS])
 AC_SUBST([GLUT_MESA_DEPS])
 AC_SUBST([GLUT_CFLAGS])
+AC_SUBST([GLUT_PC_REQ_PRIV])
+AC_SUBST([GLUT_PC_LIB_PRIV])
+AC_SUBST([GLUT_PC_CFLAGS])
 
 dnl
 dnl Program library dependencies
index d5d9d915b64f8a6a803f508838f6729c8e658b68..5d954519b24598bd9609b383169c7b2a072cbc46 100644 (file)
@@ -7,6 +7,7 @@ extfuncs.h
 fragcoord
 identity
 mandelbrot
+multinoise
 multitex
 noise
 pointcoord
index 488a4e99513ac977518718d31146cd0082f24890..71ca0af941235214b2832aef7473e0ccba51f2b7 100644 (file)
@@ -18,6 +18,7 @@ PROGS = \
        identity \
        fragcoord \
        mandelbrot \
+       multinoise \
        multitex \
        noise \
        points \
diff --git a/progs/glsl/multinoise.c b/progs/glsl/multinoise.c
new file mode 100644 (file)
index 0000000..2351863
--- /dev/null
@@ -0,0 +1,281 @@
+/**
+ * Another test for noise() functions (noise1 to noise4 tested independently).
+ * 13 Dec 2008
+ */
+
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <GL/gl.h>
+#include <GL/glut.h>
+#include <GL/glext.h>
+#include "extfuncs.h"
+
+static const char *VertShaderText =
+   "void main() {\n"
+   "   gl_TexCoord[0].xyz = gl_Vertex.xyz;\n"
+   "   gl_TexCoord[0].w = gl_MultiTexCoord1.x;\n"
+   "   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
+   "}\n";
+
+static const char *FragShaderText[ 4 ] = {
+   "void main()\n"
+   "{\n"
+   "   gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].w ) * 0.5 + 0.5;\n"
+   "   gl_FragColor.a = 1;\n"
+   "}\n",
+   "void main()\n"
+   "{\n"
+   "   gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xw ) * 0.5 + 0.5;\n"
+   "   gl_FragColor.a = 1;\n"
+   "}\n",
+   "void main()\n"
+   "{\n"
+   "   gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xyw ) * 0.5 + 0.5;\n"
+   "   gl_FragColor.a = 1;\n"
+   "}\n",
+   "void main()\n"
+   "{\n"
+   "   gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xyzw ) * 0.5 + 0.5;\n"
+   "   gl_FragColor.a = 1;\n"
+   "}\n"
+};
+    
+struct uniform_info {
+   const char *name;
+   GLuint size;
+   GLint location;
+   GLfloat value[4];
+};
+
+/* program/shader objects */
+static GLuint fragShader[ 4 ];
+static GLuint vertShader;
+static GLuint program[ 4 ];
+
+static GLint win = 0;
+static GLfloat xRot = 0.0f, yRot = 0.0f, zRot = 0.0f;
+static GLfloat Slice = 0.0;
+static GLboolean Anim = GL_FALSE;
+
+
+static void
+Idle(void)
+{
+   Slice += 0.01;
+   glutPostRedisplay();
+}
+
+
+static void
+Redisplay(void)
+{
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   glMultiTexCoord1f( GL_TEXTURE1, Slice );
+   
+   glPushMatrix();
+   glRotatef(xRot, 1.0f, 0.0f, 0.0f);
+   glRotatef(yRot, 0.0f, 1.0f, 0.0f);
+   glRotatef(zRot, 0.0f, 0.0f, 1.0f);
+
+   glutSolidTeapot( 1.0 );
+
+   glPopMatrix();
+
+   glutSwapBuffers();
+}
+
+
+static void
+Reshape(int width, int height)
+{
+   glViewport(0, 0, width, height);
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
+   glMatrixMode(GL_MODELVIEW);
+   glLoadIdentity();
+   glTranslatef(0.0f, 0.0f, -15.0f);
+}
+
+
+static void
+CleanUp(void)
+{
+   GLint i;
+
+   glDeleteShader_func(vertShader);
+   for( i = 0; i < 4; i++ ) {
+      glDeleteShader_func(fragShader[ i ]);
+      glDeleteProgram_func(program[ i ]);
+   }
+   glutDestroyWindow(win);
+}
+
+
+static void
+Key(unsigned char key, int x, int y)
+{
+   const GLfloat step = 0.01;
+  (void) x;
+  (void) y;
+
+   switch(key) {
+   case 'a':
+      Anim = !Anim;
+      glutIdleFunc(Anim ? Idle : NULL);
+   case 's':
+      Slice -= step;
+      break;
+   case 'S':
+      Slice += step;
+      break;
+   case 'z':
+      zRot -= 1.0;
+      break;
+   case 'Z':
+      zRot += 1.0;
+      break;
+   case '1':
+   case '2':
+   case '3':
+   case '4':
+      glUseProgram_func(program[ key - '1' ]);
+      break;
+   case 27:
+      CleanUp();
+      exit(0);
+      break;
+   }
+   glutPostRedisplay();
+}
+
+
+static void
+SpecialKey(int key, int x, int y)
+{
+   const GLfloat step = 3.0f;
+
+  (void) x;
+  (void) y;
+
+   switch(key) {
+   case GLUT_KEY_UP:
+      xRot -= step;
+      break;
+   case GLUT_KEY_DOWN:
+      xRot += step;
+      break;
+   case GLUT_KEY_LEFT:
+      yRot -= step;
+      break;
+   case GLUT_KEY_RIGHT:
+      yRot += step;
+      break;
+   }
+   glutPostRedisplay();
+}
+
+
+
+static void
+LoadAndCompileShader(GLuint shader, const char *text)
+{
+   GLint stat;
+
+   glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
+
+   glCompileShader_func(shader);
+
+   glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
+   if (!stat) {
+      GLchar log[1000];
+      GLsizei len;
+      glGetShaderInfoLog_func(shader, 1000, &len, log);
+      fprintf(stderr, "noise: problem compiling shader: %s\n", log);
+      exit(1);
+   }
+   else {
+      printf("Shader compiled OK\n");
+   }
+}
+
+
+static void
+CheckLink(GLuint prog)
+{
+   GLint stat;
+   glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
+   if (!stat) {
+      GLchar log[1000];
+      GLsizei len;
+      glGetProgramInfoLog_func(prog, 1000, &len, log);
+      fprintf(stderr, "Linker error:\n%s\n", log);
+   }
+   else {
+      fprintf(stderr, "Link success!\n");
+   }
+}
+
+
+static void
+Init(void)
+{
+   const char *version;
+   GLint i;
+
+   version = (const char *) glGetString(GL_VERSION);
+   if (version[0] != '2' || version[1] != '.') {
+      printf("Warning: this program expects OpenGL 2.0\n");
+      /*exit(1);*/
+   }
+
+   GetExtensionFuncs();
+
+   vertShader = glCreateShader_func(GL_VERTEX_SHADER);
+   LoadAndCompileShader(vertShader, VertShaderText);
+
+   for( i = 0; i < 4; i++ ) {
+      fragShader[ i ] = glCreateShader_func(GL_FRAGMENT_SHADER);
+      LoadAndCompileShader(fragShader[ i ], FragShaderText[ i ]);
+      program[ i ] = glCreateProgram_func();
+      glAttachShader_func(program[ i ], fragShader[ i ]);
+      glAttachShader_func(program[ i ], vertShader);
+      glLinkProgram_func(program[ i ]);
+      CheckLink(program[ i ]);
+   }
+   
+   glUseProgram_func(program[ 0 ]);
+
+   assert(glGetError() == 0);
+
+   glClearColor(0.4f, 0.4f, 0.8f, 0.0f);
+
+   glColor3f(1, 0, 0);
+
+   glFrontFace( GL_CW );
+   glEnable( GL_CULL_FACE );
+   glEnable( GL_DEPTH_TEST );
+}
+
+
+int
+main(int argc, char *argv[])
+{
+   glutInit(&argc, argv);
+   glutInitWindowPosition( 0, 0);
+   glutInitWindowSize(400, 400);
+   glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
+   win = glutCreateWindow(argv[0]);
+   glutReshapeFunc(Reshape);
+   glutKeyboardFunc(Key);
+   glutSpecialFunc(SpecialKey);
+   glutDisplayFunc(Redisplay);
+   Init();
+   glutMainLoop();
+   return 0;
+}
+
index 9da71ac775eaa140da9818ab559c2dfa57b3fae5..bd8f50036bfe6d7a96e0e20cdf568fb16e20f498 100644 (file)
@@ -30,6 +30,7 @@ static const char *FragShaderText =
    "   vec4 p;\n"
    "   p.xy = gl_TexCoord[0].xy;\n"
    "   p.z = Slice;\n"
+   "   p.w = 0;\n"
    "   vec4 n = noise4(p * scale);\n"
    "   gl_FragColor = n * Scale + Bias;\n"
    "}\n";
index b025a90b675760ce1e44fd5ad8e51b1fbe52c93d..e519dfeec49488816572a07882956ca2b4e3d6fd 100644 (file)
@@ -18,7 +18,11 @@ pcedit = sed \
        -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
        -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
        -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-       -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),'
+       -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
+       -e 's,@GLU_PC_REQ@,$(GLU_PC_REQ),' \
+       -e 's,@GLU_PC_REQ_PRIV@,$(GLU_PC_REQ_PRIV),' \
+       -e 's,@GLU_PC_LIB_PRIV@,$(GLU_PC_LIB_PRIV),' \
+       -e 's,@GLU_PC_CFLAGS@,$(GLU_PC_CFLAGS),'
 glu.pc: glu.pc.in
        $(pcedit) $< > $@
 
index 8606b9b222c4bcee64d1cd5fae5610f136ef5e14..bc2517e90ed1102e2160160a612ec98fdc76bc32 100644 (file)
@@ -5,7 +5,9 @@ includedir=@INSTALL_INC_DIR@
 
 Name: glu
 Description: Mesa OpenGL Utility library
-Requires: gl
+Requires: @GLU_PC_REQ@
+Requires.private: @GLU_PC_REQ_PRIV@
 Version: @VERSION@
 Libs: -L${libdir} -lGLU
-Cflags: -I${includedir}
+Libs.private: @GLU_PC_LIB_PRIV@
+Cflags: -I${includedir} @GLU_PC_CFLAGS@
index b61d5b04789ddab13e905ca78cc4b9387690327a..c956c5f99c9997d6ad721398220536cc1a1f38aa 100644 (file)
@@ -103,7 +103,10 @@ pcedit = sed \
        -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
        -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
        -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-       -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),'
+       -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' \
+       -e 's,@GLUT_PC_REQ_PRIV@,$(GLUT_PC_REQ_PRIV),' \
+       -e 's,@GLUT_PC_LIB_PRIV@,$(GLUT_PC_LIB_PRIV),' \
+       -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),'
 glut.pc: glut.pc.in
        $(pcedit) $< > $@
 
index e8638fe1488e0667d9336f02249161d6168d3180..ae0689d7e8165ef4940c41e671b8bc1c10be7244 100644 (file)
@@ -6,6 +6,8 @@ includedir=@INSTALL_INC_DIR@
 Name: glut
 Description: Mesa OpenGL Utility Toolkit library
 Requires: gl glu
+Requires.private: @GLUT_PC_REQ_PRIV@
 Version: @VERSION@
 Libs: -L${libdir} -lglut
-Cflags: -I${includedir}
+Libs.private: @GLUT_PC_LIB_PRIV@
+Cflags: -I${includedir} @GLUT_PC_CFLAGS@
index 7e7afc3533703d064cd822c6640a0cf3c7a79b3d..841a473f891acb127a4076637ba5db08ae9b8d3e 100644 (file)
@@ -78,7 +78,10 @@ pcedit = sed \
        -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
        -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
        -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-       -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),'
+       -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' \
+       -e 's,@GLUT_PC_REQ_PRIV@,$(GLUT_PC_REQ_PRIV),' \
+       -e 's,@GLUT_PC_LIB_PRIV@,$(GLUT_PC_LIB_PRIV),' \
+       -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),'
 glut.pc: glut.pc.in
        $(pcedit) $< > $@
 
index e8638fe1488e0667d9336f02249161d6168d3180..ae0689d7e8165ef4940c41e671b8bc1c10be7244 100644 (file)
@@ -6,6 +6,8 @@ includedir=@INSTALL_INC_DIR@
 Name: glut
 Description: Mesa OpenGL Utility Toolkit library
 Requires: gl glu
+Requires.private: @GLUT_PC_REQ_PRIV@
 Version: @VERSION@
 Libs: -L${libdir} -lglut
-Cflags: -I${includedir}
+Libs.private: @GLUT_PC_LIB_PRIV@
+Cflags: -I${includedir} @GLUT_PC_CFLAGS@
index c2e8e3046b541edf9de1328950f6b7a51fe5c05c..b153a6df751feb3115afc3b4fdd649a60c55c951 100644 (file)
@@ -30,7 +30,10 @@ pcedit = sed \
        -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
        -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
        -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-       -e 's,@VERSION@,$(MAJOR).$(MINOR).$(TINY),'
+       -e 's,@VERSION@,$(MAJOR).$(MINOR).$(TINY),' \
+       -e 's,@GLW_PC_REQ_PRIV@,$(GLW_PC_REQ_PRIV),' \
+       -e 's,@GLW_PC_LIB_PRIV@,$(GLW_PC_LIB_PRIV),' \
+       -e 's,@GLW_PC_CFLAGS@,$(GLW_PC_CFLAGS),'
 glw.pc: glw.pc.in
        $(pcedit) $< > $@
 
index 25f3f73b8c6734ce2acd58f3e20cc6d05e4b4c9c..5493093be19a134a2506a46a3a2bc1d6fd8e3898 100644 (file)
@@ -6,6 +6,8 @@ includedir=@INSTALL_INC_DIR@
 Name: glw
 Description: Mesa OpenGL widget library
 Requires: gl
+Requires.private: @GLW_PC_REQ_PRIV@
 Version: @VERSION@
 Libs: -L${libdir} -lGLw
-Cflags: -I${includedir}
+Libs.private: @GLW_PC_LIB_PRIV@
+Cflags: -I${includedir} @GLW_PC_CFLAGS@
index ae426c22a474bf0e179beef904157f44da5b5ff1..fb87abc0a5aec42bf5686bedae273f497cfc6a63 100644 (file)
@@ -5397,8 +5397,7 @@ __glx_TexSubImage_1D2D(unsigned opcode, unsigned dim, GLenum target,
             (void) memcpy((void *) (gc->pc + 44), (void *) (&height), 4);
             (void) memcpy((void *) (gc->pc + 48), (void *) (&format), 4);
             (void) memcpy((void *) (gc->pc + 52), (void *) (&type), 4);
-            (void) memcpy((void *) (gc->pc + 56),
-                          (void *) ((pixels == NULL) ? one : zero), 4);
+            (void) memset((void *) (gc->pc + 56), 0, 4);
             if (compsize > 0) {
                 (*gc->fillImage) (gc, dim, width, height, 1, format, type,
                                   pixels, gc->pc + 60, gc->pc + 4);
@@ -5424,7 +5423,7 @@ __glx_TexSubImage_1D2D(unsigned opcode, unsigned dim, GLenum target,
             (void) memcpy((void *) (pc + 48), (void *) (&height), 4);
             (void) memcpy((void *) (pc + 52), (void *) (&format), 4);
             (void) memcpy((void *) (pc + 56), (void *) (&type), 4);
-            (void) memcpy((void *) (pc + 60), zero, 4);
+            (void) memset((void *) (pc + 60), 0, 4);
             __glXSendLargeImage(gc, compsize, dim, width, height, 1, format,
                                 type, pixels, pc + 64, pc + 8);
         }
@@ -6869,8 +6868,7 @@ __glx_TexSubImage_3D4D(unsigned opcode, unsigned dim, GLenum target,
             (void) memcpy((void *) (gc->pc + 76), (void *) (&extent), 4);
             (void) memcpy((void *) (gc->pc + 80), (void *) (&format), 4);
             (void) memcpy((void *) (gc->pc + 84), (void *) (&type), 4);
-            (void) memcpy((void *) (gc->pc + 88),
-                          (void *) ((pixels == NULL) ? one : zero), 4);
+            (void) memset((void *) (gc->pc + 88), 0, 4);
             if (compsize > 0) {
                 (*gc->fillImage) (gc, dim, width, height, depth, format, type,
                                   pixels, gc->pc + 92, gc->pc + 4);
@@ -6900,7 +6898,7 @@ __glx_TexSubImage_3D4D(unsigned opcode, unsigned dim, GLenum target,
             (void) memcpy((void *) (pc + 80), (void *) (&extent), 4);
             (void) memcpy((void *) (pc + 84), (void *) (&format), 4);
             (void) memcpy((void *) (pc + 88), (void *) (&type), 4);
-            (void) memcpy((void *) (pc + 92), zero, 4);
+            (void) memset((void *) (pc + 92), 0, 4);
             __glXSendLargeImage(gc, compsize, dim, width, height, depth,
                                 format, type, pixels, pc + 96, pc + 8);
         }
index 2fba2e153b8d30c8650df2b48baaba4744a1521f..97b011a7d45cb5af50fa65a6b50bec0ffa3bc34a 100644 (file)
@@ -97,14 +97,29 @@ install: default
        done
 
 
-pcedit = sed \
+gl_pcedit = sed \
        -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
        -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
        -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-       -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),'
+       -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
+       -e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \
+       -e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \
+       -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),'
 
 gl.pc: gl.pc.in
-       $(pcedit) $< > $@
+       $(gl_pcedit) $< > $@
+
+osmesa_pcedit = sed \
+       -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
+       -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
+       -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
+       -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
+       -e 's,@OSMESA_LIB@,$(OSMESA_LIB),' \
+       -e 's,@OSMESA_PC_REQ@,$(OSMESA_PC_REQ),' \
+       -e 's,@OSMESA_PC_LIB_PRIV@,$(OSMESA_PC_LIB_PRIV),'
+
+osmesa.pc: osmesa.pc.in
+       $(osmesa_pcedit) $< > $@
 
 install-headers:
        $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
@@ -118,10 +133,12 @@ install-libgl: default gl.pc install-headers
                $(DESTDIR)$(INSTALL_LIB_DIR)
        $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
 
-install-osmesa: default
+install-osmesa: default osmesa.pc
        $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
+       $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
        $(INSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_GLOB) \
                $(DESTDIR)$(INSTALL_LIB_DIR)
+       $(INSTALL) -m 644 osmesa.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
 
 install-dri: default
        cd drivers/dri && $(MAKE) install
index eef68825bc97b3d8b2e873b05b2382437aa9064e..9e49fb16f53bc6fa787b216d465e9c0ea90b1e8d 100644 (file)
@@ -25,7 +25,8 @@ pcedit = sed \
        -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
        -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
        -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
-       -e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_SEARCH_DIR),'
+       -e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_SEARCH_DIR),' \
+       -e 's,@DRI_PC_REQ_PRIV@,$(DRI_PC_REQ_PRIV),'
 
 dri.pc: dri.pc.in
        $(pcedit) $< > $@
index c47ee9c7e7dca766578256307a14c091312cb60d..695aa6cfd662cb69ffece1031f3d159e258024c3 100644 (file)
@@ -7,4 +7,5 @@ dridriverdir=@DRI_DRIVER_DIR@
 Name: dri
 Description: Direct Rendering Infrastructure
 Version: @VERSION@
+Requires.private: @DRI_PC_REQ_PRIV@
 Cflags: -I${includedir}
index cb728190f5c5ef2fc3717a4429a54f93b3bc943f..baecfdcb7997e0c4c08541ee89ed496c911dbfb3 100644 (file)
@@ -1095,7 +1095,7 @@ static void noise1_sub( struct brw_wm_compile *c ) {
     /* Arrange the two end coordinates into scalars (itmp0/itmp1) to
        be hashed.  Also compute the remainder (offset within the unit
        length), interleaved to reduce register dependency penalties. */
-    brw_RNDD( p, itmp[ 0 ], param );
+    brw_RNDD( p, retype( itmp[ 0 ], BRW_REGISTER_TYPE_D ), param );
     brw_FRC( p, param, param );
     brw_ADD( p, itmp[ 1 ], itmp[ 0 ], brw_imm_ud( 1 ) );
     brw_MOV( p, itmp[ 3 ], brw_imm_ud( 0x79D9 ) ); /* constant used later */
@@ -1220,8 +1220,8 @@ static void noise2_sub( struct brw_wm_compile *c ) {
     /* Arrange the four corner coordinates into scalars (itmp0..itmp3) to
        be hashed.  Also compute the remainders (offsets within the unit
        square), interleaved to reduce register dependency penalties. */
-    brw_RNDD( p, itmp[ 0 ], param0 );
-    brw_RNDD( p, itmp[ 1 ], param1 );
+    brw_RNDD( p, retype( itmp[ 0 ], BRW_REGISTER_TYPE_D ), param0 );
+    brw_RNDD( p, retype( itmp[ 1 ], BRW_REGISTER_TYPE_D ), param1 );
     brw_FRC( p, param0, param0 );
     brw_FRC( p, param1, param1 );
     brw_MOV( p, itmp[ 4 ], brw_imm_ud( 0xBA97 ) ); /* constant used later */
@@ -1400,21 +1400,19 @@ static void noise3_sub( struct brw_wm_compile *c ) {
     /* Arrange the eight corner coordinates into scalars (itmp0..itmp3) to
        be hashed.  Also compute the remainders (offsets within the unit
        cube), interleaved to reduce register dependency penalties. */
-    brw_RNDD( p, itmp[ 0 ], param0 );
-    brw_RNDD( p, itmp[ 1 ], param1 );
-    brw_RNDD( p, itmp[ 2 ], param2 );
-    brw_MOV( p, itmp[ 4 ], brw_imm_ud( 0xBC8F ) ); /* constant used later */
-    brw_MOV( p, itmp[ 5 ], brw_imm_ud( 0xD0BD ) ); /* constant used later */
-    brw_MOV( p, itmp[ 6 ], brw_imm_ud( 0x9B93 ) ); /* constant used later */
+    brw_RNDD( p, retype( itmp[ 0 ], BRW_REGISTER_TYPE_D ), param0 );
+    brw_RNDD( p, retype( itmp[ 1 ], BRW_REGISTER_TYPE_D ), param1 );
+    brw_RNDD( p, retype( itmp[ 2 ], BRW_REGISTER_TYPE_D ), param2 );
     brw_FRC( p, param0, param0 );
     brw_FRC( p, param1, param1 );
     brw_FRC( p, param2, param2 );
     /* Since we now have only 16 bits of precision in the hash, we must
        be more careful about thorough mixing to maintain entropy as we
        squash the input vector into a small scalar. */
-    brw_MUL( p, brw_acc_reg(), itmp[ 4 ], itmp[ 0 ] );
-    brw_MAC( p, brw_acc_reg(), itmp[ 5 ], itmp[ 1 ] );
-    brw_MAC( p, itmp[ 0 ], itmp[ 6 ], itmp[ 2 ] );
+    brw_MUL( p, brw_null_reg(), low_words( itmp[ 0 ] ), brw_imm_uw( 0xBC8F ) );
+    brw_MAC( p, brw_null_reg(), low_words( itmp[ 1 ] ), brw_imm_uw( 0xD0BD ) );
+    brw_MAC( p, low_words( itmp[ 0 ] ), low_words( itmp[ 2 ] ),
+            brw_imm_uw( 0x9B93 ) );
     brw_ADD( p, high_words( itmp[ 0 ] ), low_words( itmp[ 0 ] ),
             brw_imm_uw( 0xBC8F ) );
 
@@ -1668,6 +1666,430 @@ static void emit_noise3( struct brw_wm_compile *c,
     release_tmps( c, mark );
 }
     
+/* For the four-dimensional case, the little micro-optimisation benefits
+   we obtain by unrolling all the loops aren't worth the massive bloat it
+   now causes.  Instead, we loop twice around performing a similar operation
+   to noise3, once for the w=0 cube and once for the w=1, with a bit more
+   code to glue it all together. */
+static void noise4_sub( struct brw_wm_compile *c ) {
+
+    struct brw_compile *p = &c->func;
+    struct brw_reg param[ 4 ],
+       x0y0, x0y1, x1y0, x1y1, /* gradients at four of the corners */
+       w0, /* noise for the w=0 cube */
+       floors[ 2 ], /* integer coordinates of base corner of hypercube */
+       interp[ 4 ], /* interpolation coefficients */
+       t, tmp[ 8 ], /* float temporaries */
+       itmp[ 8 ], /* unsigned integer temporaries (aliases of floats above) */
+       wtmp[ 8 ]; /* 16-way unsigned word temporaries (aliases of above) */
+    int i, j;
+    int mark = mark_tmps( c );
+    GLuint loop, origin;
+    
+    x0y0 = alloc_tmp( c );
+    x0y1 = alloc_tmp( c );
+    x1y0 = alloc_tmp( c );
+    x1y1 = alloc_tmp( c );
+    t = alloc_tmp( c );
+    w0 = alloc_tmp( c );    
+    floors[ 0 ] = retype( alloc_tmp( c ), BRW_REGISTER_TYPE_UD );
+    floors[ 1 ] = retype( alloc_tmp( c ), BRW_REGISTER_TYPE_UD );
+
+    for( i = 0; i < 4; i++ ) {
+       param[ i ] = lookup_tmp( c, mark - 5 + i );
+       interp[ i ] = alloc_tmp( c );
+    }
+    
+    for( i = 0; i < 8; i++ ) {
+       tmp[ i ] = alloc_tmp( c );
+       itmp[ i ] = retype( tmp[ i ], BRW_REGISTER_TYPE_UD );
+       wtmp[ i ] = brw_uw16_grf( tmp[ i ].nr, 0 );
+    }
+
+    brw_set_access_mode( p, BRW_ALIGN_1 );
+
+    /* We only want 16 bits of precision from the integral part of each
+       co-ordinate, but unfortunately the RNDD semantics would saturate
+       at 16 bits if we performed the operation directly to a 16-bit
+       destination.  Therefore, we round to 32-bit temporaries where
+       appropriate, and then store only the lower 16 bits. */
+    brw_RNDD( p, retype( floors[ 0 ], BRW_REGISTER_TYPE_D ), param[ 0 ] );
+    brw_RNDD( p, retype( itmp[ 0 ], BRW_REGISTER_TYPE_D ), param[ 1 ] );
+    brw_RNDD( p, retype( floors[ 1 ], BRW_REGISTER_TYPE_D ), param[ 2 ] );
+    brw_RNDD( p, retype( itmp[ 1 ], BRW_REGISTER_TYPE_D ), param[ 3 ] );
+    brw_MOV( p, high_words( floors[ 0 ] ), low_words( itmp[ 0 ] ) );
+    brw_MOV( p, high_words( floors[ 1 ] ), low_words( itmp[ 1 ] ) );
+
+    /* Modify the flag register here, because the side effect is useful
+       later (see below).  We know for certain that all flags will be
+       cleared, since the FRC instruction cannot possibly generate
+       negative results.  Even for exceptional inputs (infinities, denormals,
+       NaNs), the architecture guarantees that the L conditional is false. */
+    brw_set_conditionalmod( p, BRW_CONDITIONAL_L );
+    brw_FRC( p, param[ 0 ], param[ 0 ] );
+    brw_set_predicate_control( p, BRW_PREDICATE_NONE );
+    for( i = 1; i < 4; i++ )   
+       brw_FRC( p, param[ i ], param[ i ] );
+    
+    /* Calculate the interpolation coefficients (6t^5 - 15t^4 + 10t^3) first
+       of all. */
+    for( i = 0; i < 4; i++ )
+       brw_MUL( p, interp[ i ], param[ i ], brw_imm_f( 6.0 ) );
+    for( i = 0; i < 4; i++ )
+       brw_ADD( p, interp[ i ], interp[ i ], brw_imm_f( -15.0 ) );
+    for( i = 0; i < 4; i++ )
+       brw_MUL( p, interp[ i ], interp[ i ], param[ i ] );
+    for( i = 0; i < 4; i++ )
+       brw_ADD( p, interp[ i ], interp[ i ], brw_imm_f( 10.0 ) );
+    for( j = 0; j < 3; j++ )
+       for( i = 0; i < 4; i++ )
+           brw_MUL( p, interp[ i ], interp[ i ], param[ i ] );
+
+    /* Mark the current address, as it will be a jump destination.  The
+       following code will be executed twice: first, with the flag
+       register clear indicating the w=0 case, and second with flags
+       set for w=1. */
+    loop = p->nr_insn;
+    
+    /* Arrange the eight corner coordinates into scalars (itmp0..itmp3) to
+       be hashed.  Since we have only 16 bits of precision in the hash, we
+       must be careful about thorough mixing to maintain entropy as we
+       squash the input vector into a small scalar. */
+    brw_MUL( p, brw_null_reg(), low_words( floors[ 0 ] ),
+            brw_imm_uw( 0xBC8F ) );
+    brw_MAC( p, brw_null_reg(), high_words( floors[ 0 ] ),
+            brw_imm_uw( 0xD0BD ) );
+    brw_MAC( p, brw_null_reg(), low_words( floors[ 1 ] ),
+            brw_imm_uw( 0x9B93 ) );
+    brw_MAC( p, low_words( itmp[ 0 ] ), high_words( floors[ 1 ] ),
+            brw_imm_uw( 0xA359 ) );
+    brw_ADD( p, high_words( itmp[ 0 ] ), low_words( itmp[ 0 ] ),
+            brw_imm_uw( 0xBC8F ) );
+
+    /* Temporarily disable the execution mask while we work with ExecSize=16
+       channels (the mask is set for ExecSize=8 and is probably incorrect).
+       Although this might cause execution of unwanted channels, the code
+       writes only to temporary registers and has no side effects, so
+       disabling the mask is harmless. */
+    brw_push_insn_state( p );
+    brw_set_mask_control( p, BRW_MASK_DISABLE );
+    brw_ADD( p, wtmp[ 1 ], wtmp[ 0 ], brw_imm_uw( 0xD0BD ) );
+    brw_ADD( p, wtmp[ 2 ], wtmp[ 0 ], brw_imm_uw( 0x9B93 ) );
+    brw_ADD( p, wtmp[ 3 ], wtmp[ 1 ], brw_imm_uw( 0x9B93 ) );
+
+    /* We're now ready to perform the hashing.  The eight hashes are
+       interleaved for performance.  The hash function used is
+       designed to rapidly achieve avalanche and require only 16x16
+       bit multiplication, and 8-bit swizzles (which we get for
+       free). */
+    for( i = 0; i < 4; i++ )
+       brw_MUL( p, wtmp[ i ], wtmp[ i ], brw_imm_uw( 0x28D9 ) );
+    for( i = 0; i < 4; i++ )
+       brw_XOR( p, even_bytes( wtmp[ i ] ), even_bytes( wtmp[ i ] ),
+                odd_bytes( wtmp[ i ] ) );
+    for( i = 0; i < 4; i++ )
+       brw_MUL( p, wtmp[ i ], wtmp[ i ], brw_imm_uw( 0xC6D5 ) );
+    for( i = 0; i < 4; i++ )
+       brw_XOR( p, even_bytes( wtmp[ i ] ), even_bytes( wtmp[ i ] ),
+                odd_bytes( wtmp[ i ] ) );
+    brw_pop_insn_state( p );
+
+    /* Now we want to initialise the four rear gradients based on the
+       hashes.  Format conversion from signed integer to float leaves
+       everything scaled too high by a factor of pow( 2, 15 ), but
+       we correct for that right at the end. */
+    /* x component */
+    brw_ADD( p, t, param[ 0 ], brw_imm_f( -1.0 ) );
+    brw_MOV( p, x0y0, low_words( tmp[ 0 ] ) );
+    brw_MOV( p, x0y1, low_words( tmp[ 1 ] ) );
+    brw_MOV( p, x1y0, high_words( tmp[ 0 ] ) );
+    brw_MOV( p, x1y1, high_words( tmp[ 1 ] ) );
+
+    brw_push_insn_state( p );
+    brw_set_mask_control( p, BRW_MASK_DISABLE );
+    brw_SHL( p, wtmp[ 0 ], wtmp[ 0 ], brw_imm_uw( 4 ) );
+    brw_SHL( p, wtmp[ 1 ], wtmp[ 1 ], brw_imm_uw( 4 ) );
+    brw_pop_insn_state( p );
+    
+    brw_MUL( p, x1y0, x1y0, t );
+    brw_MUL( p, x1y1, x1y1, t );
+    brw_ADD( p, t, param[ 1 ], brw_imm_f( -1.0 ) );
+    brw_MUL( p, x0y0, x0y0, param[ 0 ] );
+    brw_MUL( p, x0y1, x0y1, param[ 0 ] );
+
+    /* y component */
+    brw_MOV( p, tmp[ 5 ], low_words( tmp[ 1 ] ) );
+    brw_MOV( p, tmp[ 7 ], high_words( tmp[ 1 ] ) );
+    brw_MOV( p, tmp[ 4 ], low_words( tmp[ 0 ] ) );
+    brw_MOV( p, tmp[ 6 ], high_words( tmp[ 0 ] ) );
+    
+    brw_push_insn_state( p );
+    brw_set_mask_control( p, BRW_MASK_DISABLE );
+    brw_SHL( p, wtmp[ 0 ], wtmp[ 0 ], brw_imm_uw( 4 ) );
+    brw_SHL( p, wtmp[ 1 ], wtmp[ 1 ], brw_imm_uw( 4 ) );
+    brw_pop_insn_state( p );
+
+    brw_MUL( p, tmp[ 5 ], tmp[ 5 ], t );
+    brw_MUL( p, tmp[ 7 ], tmp[ 7 ], t );    
+    /* prepare t for the w component (used below): w the first time through
+       the loop; w - 1 the second time) */
+    brw_set_predicate_control( p, BRW_PREDICATE_NORMAL );
+    brw_ADD( p, t, param[ 3 ], brw_imm_f( -1.0 ) );
+    p->current->header.predicate_inverse = 1;
+    brw_MOV( p, t, param[ 3 ] );
+    p->current->header.predicate_inverse = 0;
+    brw_set_predicate_control( p, BRW_PREDICATE_NONE );
+    brw_MUL( p, tmp[ 4 ], tmp[ 4 ], param[ 1 ] );
+    brw_MUL( p, tmp[ 6 ], tmp[ 6 ], param[ 1 ] );
+    
+    brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
+    brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
+    brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
+    brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
+    
+    /* z component */
+    brw_MOV( p, tmp[ 4 ], low_words( tmp[ 0 ] ) );
+    brw_MOV( p, tmp[ 5 ], low_words( tmp[ 1 ] ) );
+    brw_MOV( p, tmp[ 6 ], high_words( tmp[ 0 ] ) );
+    brw_MOV( p, tmp[ 7 ], high_words( tmp[ 1 ] ) );
+
+    brw_push_insn_state( p );
+    brw_set_mask_control( p, BRW_MASK_DISABLE );
+    brw_SHL( p, wtmp[ 0 ], wtmp[ 0 ], brw_imm_uw( 4 ) );
+    brw_SHL( p, wtmp[ 1 ], wtmp[ 1 ], brw_imm_uw( 4 ) );
+    brw_pop_insn_state( p );
+
+    brw_MUL( p, tmp[ 4 ], tmp[ 4 ], param[ 2 ] );
+    brw_MUL( p, tmp[ 5 ], tmp[ 5 ], param[ 2 ] );
+    brw_MUL( p, tmp[ 6 ], tmp[ 6 ], param[ 2 ] );
+    brw_MUL( p, tmp[ 7 ], tmp[ 7 ], param[ 2 ] );
+    
+    brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
+    brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
+    brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
+    brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
+
+    /* w component */
+    brw_MOV( p, tmp[ 4 ], low_words( tmp[ 0 ] ) );
+    brw_MOV( p, tmp[ 5 ], low_words( tmp[ 1 ] ) );
+    brw_MOV( p, tmp[ 6 ], high_words( tmp[ 0 ] ) );
+    brw_MOV( p, tmp[ 7 ], high_words( tmp[ 1 ] ) );
+
+    brw_MUL( p, tmp[ 4 ], tmp[ 4 ], t );
+    brw_MUL( p, tmp[ 5 ], tmp[ 5 ], t );
+    brw_MUL( p, tmp[ 6 ], tmp[ 6 ], t );
+    brw_MUL( p, tmp[ 7 ], tmp[ 7 ], t );
+    brw_ADD( p, t, param[ 0 ], brw_imm_f( -1.0 ) );
+    
+    brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
+    brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
+    brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
+    brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
+
+    /* Here we interpolate in the y dimension... */
+    brw_ADD( p, x0y1, x0y1, negate( x0y0 ) );
+    brw_ADD( p, x1y1, x1y1, negate( x1y0 ) );
+    brw_MUL( p, x0y1, x0y1, interp[ 1 ] );
+    brw_MUL( p, x1y1, x1y1, interp[ 1 ] );
+    brw_ADD( p, x0y0, x0y0, x0y1 );
+    brw_ADD( p, x1y0, x1y0, x1y1 );
+
+    /* And now in x.  Leave the result in tmp[ 0 ] (see below)... */
+    brw_ADD( p, x1y0, x1y0, negate( x0y0 ) );
+    brw_MUL( p, x1y0, x1y0, interp[ 0 ] );
+    brw_ADD( p, tmp[ 0 ], x0y0, x1y0 );
+
+    /* Now do the same thing for the front four gradients... */
+    /* x component */
+    brw_MOV( p, x0y0, low_words( tmp[ 2 ] ) );
+    brw_MOV( p, x0y1, low_words( tmp[ 3 ] ) );
+    brw_MOV( p, x1y0, high_words( tmp[ 2 ] ) );
+    brw_MOV( p, x1y1, high_words( tmp[ 3 ] ) );
+
+    brw_push_insn_state( p );
+    brw_set_mask_control( p, BRW_MASK_DISABLE );
+    brw_SHL( p, wtmp[ 2 ], wtmp[ 2 ], brw_imm_uw( 4 ) );
+    brw_SHL( p, wtmp[ 3 ], wtmp[ 3 ], brw_imm_uw( 4 ) );
+    brw_pop_insn_state( p );
+
+    brw_MUL( p, x1y0, x1y0, t );
+    brw_MUL( p, x1y1, x1y1, t );
+    brw_ADD( p, t, param[ 1 ], brw_imm_f( -1.0 ) );
+    brw_MUL( p, x0y0, x0y0, param[ 0 ] );
+    brw_MUL( p, x0y1, x0y1, param[ 0 ] );
+
+    /* y component */
+    brw_MOV( p, tmp[ 5 ], low_words( tmp[ 3 ] ) );
+    brw_MOV( p, tmp[ 7 ], high_words( tmp[ 3 ] ) );
+    brw_MOV( p, tmp[ 4 ], low_words( tmp[ 2 ] ) );
+    brw_MOV( p, tmp[ 6 ], high_words( tmp[ 2 ] ) );
+    
+    brw_push_insn_state( p );
+    brw_set_mask_control( p, BRW_MASK_DISABLE );
+    brw_SHL( p, wtmp[ 2 ], wtmp[ 2 ], brw_imm_uw( 4 ) );
+    brw_SHL( p, wtmp[ 3 ], wtmp[ 3 ], brw_imm_uw( 4 ) );
+    brw_pop_insn_state( p );
+
+    brw_MUL( p, tmp[ 5 ], tmp[ 5 ], t );
+    brw_MUL( p, tmp[ 7 ], tmp[ 7 ], t );
+    brw_ADD( p, t, param[ 2 ], brw_imm_f( -1.0 ) );
+    brw_MUL( p, tmp[ 4 ], tmp[ 4 ], param[ 1 ] );
+    brw_MUL( p, tmp[ 6 ], tmp[ 6 ], param[ 1 ] );
+    
+    brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
+    brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
+    brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
+    brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
+    
+    /* z component */
+    brw_MOV( p, tmp[ 4 ], low_words( tmp[ 2 ] ) );
+    brw_MOV( p, tmp[ 5 ], low_words( tmp[ 3 ] ) );
+    brw_MOV( p, tmp[ 6 ], high_words( tmp[ 2 ] ) );
+    brw_MOV( p, tmp[ 7 ], high_words( tmp[ 3 ] ) );
+
+    brw_push_insn_state( p );
+    brw_set_mask_control( p, BRW_MASK_DISABLE );
+    brw_SHL( p, wtmp[ 2 ], wtmp[ 2 ], brw_imm_uw( 4 ) );
+    brw_SHL( p, wtmp[ 3 ], wtmp[ 3 ], brw_imm_uw( 4 ) );
+    brw_pop_insn_state( p );
+
+    brw_MUL( p, tmp[ 4 ], tmp[ 4 ], t );
+    brw_MUL( p, tmp[ 5 ], tmp[ 5 ], t );
+    brw_MUL( p, tmp[ 6 ], tmp[ 6 ], t );
+    brw_MUL( p, tmp[ 7 ], tmp[ 7 ], t );
+    /* prepare t for the w component (used below): w the first time through
+       the loop; w - 1 the second time) */
+    brw_set_predicate_control( p, BRW_PREDICATE_NORMAL );
+    brw_ADD( p, t, param[ 3 ], brw_imm_f( -1.0 ) );
+    p->current->header.predicate_inverse = 1;
+    brw_MOV( p, t, param[ 3 ] );
+    p->current->header.predicate_inverse = 0;
+    brw_set_predicate_control( p, BRW_PREDICATE_NONE );
+    
+    brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
+    brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
+    brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
+    brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
+
+    /* w component */
+    brw_MOV( p, tmp[ 4 ], low_words( tmp[ 2 ] ) );
+    brw_MOV( p, tmp[ 5 ], low_words( tmp[ 3 ] ) );
+    brw_MOV( p, tmp[ 6 ], high_words( tmp[ 2 ] ) );
+    brw_MOV( p, tmp[ 7 ], high_words( tmp[ 3 ] ) );
+
+    brw_MUL( p, tmp[ 4 ], tmp[ 4 ], t );
+    brw_MUL( p, tmp[ 5 ], tmp[ 5 ], t );
+    brw_MUL( p, tmp[ 6 ], tmp[ 6 ], t );
+    brw_MUL( p, tmp[ 7 ], tmp[ 7 ], t );
+    
+    brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
+    brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
+    brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
+    brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
+
+    /* Interpolate in the y dimension: */
+    brw_ADD( p, x0y1, x0y1, negate( x0y0 ) );
+    brw_ADD( p, x1y1, x1y1, negate( x1y0 ) );
+    brw_MUL( p, x0y1, x0y1, interp[ 1 ] );
+    brw_MUL( p, x1y1, x1y1, interp[ 1 ] );
+    brw_ADD( p, x0y0, x0y0, x0y1 );
+    brw_ADD( p, x1y0, x1y0, x1y1 );
+
+    /* And now in x.  The rear face is in tmp[ 0 ] (see above), so this
+       time put the front face in tmp[ 1 ] and we're nearly there... */
+    brw_ADD( p, x1y0, x1y0, negate( x0y0 ) );
+    brw_MUL( p, x1y0, x1y0, interp[ 0 ] );
+    brw_ADD( p, tmp[ 1 ], x0y0, x1y0 );
+
+    /* Another interpolation, in the z dimension: */
+    brw_ADD( p, tmp[ 1 ], tmp[ 1 ], negate( tmp[ 0 ] ) );    
+    brw_MUL( p, tmp[ 1 ], tmp[ 1 ], interp[ 2 ] );
+    brw_ADD( p, tmp[ 0 ], tmp[ 0 ], tmp[ 1 ] );
+
+    /* Exit the loop if we've computed both cubes... */
+    origin = p->nr_insn;
+    brw_push_insn_state( p );
+    brw_set_predicate_control( p, BRW_PREDICATE_NORMAL );
+    brw_set_mask_control( p, BRW_MASK_DISABLE );
+    brw_ADD( p, brw_ip_reg(), brw_ip_reg(), brw_imm_d( 0 ) );
+    brw_pop_insn_state( p );
+
+    /* Save the result for the w=0 case, and increment the w coordinate: */
+    brw_MOV( p, w0, tmp[ 0 ] );
+    brw_ADD( p, high_words( floors[ 1 ] ), high_words( floors[ 1 ] ),
+            brw_imm_uw( 1 ) );
+
+    /* Loop around for the other cube.  Explicitly set the flag register
+       (unfortunately we must spend an extra instruction to do this: we
+       can't rely on a side effect of the previous MOV or ADD because
+       conditional modifiers which are normally true might be false in
+       exceptional circumstances, e.g. given a NaN input; the add to
+       brw_ip_reg() is not suitable because the IP is not an 8-vector). */
+    brw_push_insn_state( p );
+    brw_set_mask_control( p, BRW_MASK_DISABLE );
+    brw_MOV( p, brw_flag_reg(), brw_imm_uw( 0xFF ) );
+    brw_ADD( p, brw_ip_reg(), brw_ip_reg(),
+            brw_imm_d( ( loop - p->nr_insn ) << 4 ) );
+    brw_pop_insn_state( p );
+
+    /* Patch the previous conditional branch now that we know the
+       destination address. */
+    brw_set_src1( p->store + origin,
+                 brw_imm_d( ( p->nr_insn - origin ) << 4 ) );
+
+    /* The very last interpolation. */
+    brw_ADD( p, tmp[ 0 ], tmp[ 0 ], negate( w0 ) );    
+    brw_MUL( p, tmp[ 0 ], tmp[ 0 ], interp[ 3 ] );
+    brw_ADD( p, tmp[ 0 ], tmp[ 0 ], w0 );
+
+    /* scale by pow( 2, -15 ), as described above */
+    brw_MUL( p, param[ 0 ], tmp[ 0 ], brw_imm_f( 0.000030517578125 ) );
+
+    release_tmps( c, mark );
+}
+
+static void emit_noise4( struct brw_wm_compile *c,
+                        struct prog_instruction *inst )
+{
+    struct brw_compile *p = &c->func;
+    struct brw_reg src0, src1, src2, src3, param0, param1, param2, param3, dst;
+    GLuint mask = inst->DstReg.WriteMask;
+    int i;
+    int mark = mark_tmps( c );
+
+    assert( mark == 0 );
+    
+    src0 = get_src_reg( c, inst->SrcReg, 0, 1 );
+    src1 = get_src_reg( c, inst->SrcReg, 1, 1 );
+    src2 = get_src_reg( c, inst->SrcReg, 2, 1 );
+    src3 = get_src_reg( c, inst->SrcReg, 3, 1 );
+
+    param0 = alloc_tmp( c );
+    param1 = alloc_tmp( c );
+    param2 = alloc_tmp( c );
+    param3 = alloc_tmp( c );
+
+    brw_MOV( p, param0, src0 );
+    brw_MOV( p, param1, src1 );
+    brw_MOV( p, param2, src2 );
+    brw_MOV( p, param3, src3 );
+
+    invoke_subroutine( c, SUB_NOISE4, noise4_sub );
+    
+    /* Fill in the result: */
+    brw_set_saturate( p, inst->SaturateMode == SATURATE_ZERO_ONE );
+    for (i = 0 ; i < 4; i++) {
+       if (mask & (1<<i)) {
+           dst = get_dst_reg(c, inst, i, 1);
+           brw_MOV( p, dst, param0 );
+       }
+    }
+    if( inst->SaturateMode == SATURATE_ZERO_ONE )
+       brw_set_saturate( p, 0 );
+    
+    release_tmps( c, mark );
+}
+    
 static void emit_wpos_xy(struct brw_wm_compile *c,
                 struct prog_instruction *inst)
 {
@@ -1996,8 +2418,9 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
            case OPCODE_NOISE3:
                emit_noise3(c, inst);
                break;
-           /* case OPCODE_NOISE4: */
-               /* not yet implemented */
+           case OPCODE_NOISE4:
+               emit_noise4(c, inst);
+               break;
            case OPCODE_TEX:
                emit_tex(c, inst);
                break;
index 8129996979f46f9cc6f90c8cd9435b0bf885d7d5..51579df09e771a9750cedaa0520378577ee78101 100644 (file)
@@ -55,6 +55,12 @@ struct intel_batchbuffer
 
    GLuint size;
 
+   /** Tracking of BEGIN_BATCH()/OUT_BATCH()/ADVANCE_BATCH() debugging */
+   struct {
+      GLuint total;
+      GLubyte *start_ptr;
+   } emit;
+
    GLuint dirty_state;
 };
 
@@ -143,9 +149,12 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
 
 #define BEGIN_BATCH(n, cliprect_mode) do {                             \
    intel_batchbuffer_require_space(intel->batch, (n)*4, cliprect_mode); \
+   assert(intel->batch->emit.start_ptr == NULL);                       \
+   intel->batch->emit.total = (n) * 4;                                 \
+   intel->batch->emit.start_ptr = intel->batch->ptr;                   \
 } while (0)
 
-#define OUT_BATCH(d)  intel_batchbuffer_emit_dword(intel->batch, d)
+#define OUT_BATCH(d) intel_batchbuffer_emit_dword(intel->batch, d)
 
 #define OUT_RELOC(buf, read_domains, write_domain, delta) do {         \
    assert((delta) >= 0);                                               \
@@ -153,7 +162,16 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch,
                                read_domains, write_domain, delta);     \
 } while (0)
 
-#define ADVANCE_BATCH() do { } while(0)
+#define ADVANCE_BATCH() do {                                           \
+   unsigned int _n = intel->batch->ptr - intel->batch->emit.start_ptr; \
+   assert(intel->batch->emit.start_ptr != NULL);                       \
+   if (_n != intel->batch->emit.total) {                               \
+      fprintf(stderr, "ADVANCE_BATCH: %d of %d dwords emitted\n",      \
+             _n, intel->batch->emit.total);                            \
+      abort();                                                         \
+   }                                                                   \
+   intel->batch->emit.start_ptr = NULL;                                        \
+} while(0)
 
 
 static INLINE void
index 0e72ca08b2279f517b34fe733273ea37cb38bae6..0b8a287f6fe435ea4aff0a8d872c9bbfcf268f6e 100644 (file)
@@ -836,10 +836,71 @@ get_965_depthformat(unsigned int depthformat)
     }
 }
 
+static const char *
+get_965_element_component(uint32_t data, int component)
+{
+    uint32_t component_control = (data >> (16 + (3 - component) * 4)) & 0x7;
+
+    switch (component_control) {
+    case 0:
+       return "nostore";
+    case 1:
+       switch (component) {
+       case 0: return "X";
+       case 1: return "Y";
+       case 2: return "Z";
+       case 3: return "W";
+       default: return "fail";
+       }
+    case 2:
+       return "0.0";
+    case 3:
+       return "1.0";
+    case 4:
+       return "0x1";
+    case 5:
+       return "VID";
+    default:
+       return "fail";
+    }
+}
+
+static const char *
+get_965_prim_type(uint32_t data)
+{
+    uint32_t primtype = (data >> 10) & 0x1f;
+
+    switch (primtype) {
+    case 0x01: return "point list";
+    case 0x02: return "line list";
+    case 0x03: return "line strip";
+    case 0x04: return "tri list";
+    case 0x05: return "tri strip";
+    case 0x06: return "tri fan";
+    case 0x07: return "quad list";
+    case 0x08: return "quad strip";
+    case 0x09: return "line list adj";
+    case 0x0a: return "line strip adj";
+    case 0x0b: return "tri list adj";
+    case 0x0c: return "tri strip adj";
+    case 0x0d: return "tri strip reverse";
+    case 0x0e: return "polygon";
+    case 0x0f: return "rect list";
+    case 0x10: return "line loop";
+    case 0x11: return "point list bf";
+    case 0x12: return "line strip cont";
+    case 0x13: return "line strip bf";
+    case 0x14: return "line strip cont bf";
+    case 0x15: return "tri fan no stipple";
+    default: return "fail";
+    }
+}
+
 static int
 decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, int *failures)
 {
     unsigned int opcode, len;
+    int i;
 
     struct {
        uint32_t opcode;
@@ -860,8 +921,7 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, int *failures)
        { 0x780b, 1, 1, "3DSTATE_VF_STATISTICS" },
        { 0x7808, 5, 257, "3DSTATE_VERTEX_BUFFERS" },
        { 0x7809, 3, 256, "3DSTATE_VERTEX_ELEMENTS" },
-       /* 0x7808: 3DSTATE_VERTEX_BUFFERS */
-       /* 0x7809: 3DSTATE_VERTEX_ELEMENTS */
+       { 0x780a, 3, 3, "3DSTATE_INDEX_BUFFER" },
        { 0x7900, 4, 4, "3DSTATE_DRAWING_RECTANGLE" },
        { 0x7901, 5, 5, "3DSTATE_CONSTANT_COLOR" },
        { 0x7905, 5, 7, "3DSTATE_DEPTH_BUFFER" },
@@ -947,6 +1007,64 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, int *failures)
 
        return len;
 
+    case 0x7808:
+       len = (data[0] & 0xff) + 2;
+       if ((len - 1) % 4 != 0)
+           fprintf(out, "Bad count in 3DSTATE_VERTEX_BUFFERS\n");
+       if (count < len)
+           BUFFER_FAIL(count, len, "3DSTATE_VERTEX_BUFFERS");
+       instr_out(data, hw_offset, 0, "3DSTATE_VERTEX_BUFFERS\n");
+
+       for (i = 1; i < len;) {
+           instr_out(data, hw_offset, i, "buffer %d: %s, pitch %db\n",
+                     data[i] >> 27,
+                     data[i] & (1 << 26) ? "random" : "sequential",
+                     data[i] & 0x07ff);
+           i++;
+           instr_out(data, hw_offset, i++, "buffer address\n");
+           instr_out(data, hw_offset, i++, "max index\n");
+           instr_out(data, hw_offset, i++, "mbz\n");
+       }
+       return len;
+
+    case 0x7809:
+       len = (data[0] & 0xff) + 2;
+       if ((len + 1) % 2 != 0)
+           fprintf(out, "Bad count in 3DSTATE_VERTEX_ELEMENTS\n");
+       if (count < len)
+           BUFFER_FAIL(count, len, "3DSTATE_VERTEX_ELEMENTS");
+       instr_out(data, hw_offset, 0, "3DSTATE_VERTEX_ELEMENTS\n");
+
+       for (i = 1; i < len;) {
+           instr_out(data, hw_offset, i, "buffer %d: %svalid, type 0x%04x, "
+                     "src offset 0x%04xd bytes\n",
+                     data[i] >> 27,
+                     data[i] & (1 << 26) ? "" : "in",
+                     (data[i] >> 16) & 0x1ff,
+                     data[i] & 0x07ff);
+           i++;
+           instr_out(data, hw_offset, i, "(%s, %s, %s, %s), "
+                     "dst offset 0x%02x bytes\n",
+                     get_965_element_component(data[i], 0),
+                     get_965_element_component(data[i], 1),
+                     get_965_element_component(data[i], 2),
+                     get_965_element_component(data[i], 3),
+                     (data[i] & 0xff) * 4);
+           i++;
+       }
+       return len;
+
+    case 0x780a:
+       len = (data[0] & 0xff) + 2;
+       if (len != 3)
+           fprintf(out, "Bad count in 3DSTATE_INDEX_BUFFER\n");
+       if (count < len)
+           BUFFER_FAIL(count, len, "3DSTATE_INDEX_BUFFER");
+       instr_out(data, hw_offset, 0, "3DSTATE_INDEX_BUFFER\n");
+       instr_out(data, hw_offset, 1, "beginning buffer address\n");
+       instr_out(data, hw_offset, 2, "ending buffer address\n");
+       return len;
+
     case 0x7900:
        if (len != 4)
            fprintf(out, "Bad count in 3DSTATE_DRAWING_RECTANGLE\n");
@@ -968,9 +1086,9 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, int *failures)
        return len;
 
     case 0x7905:
-       if (len != 5)
+       if (len != 5 && len != 6)
            fprintf(out, "Bad count in 3DSTATE_DEPTH_BUFFER\n");
-       if (count < 5)
+       if (count < len)
            BUFFER_FAIL(count, len, "3DSTATE_DEPTH_BUFFER");
 
        instr_out(data, hw_offset, 0,
@@ -985,7 +1103,27 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, int *failures)
                  ((data[3] & 0x0007ffc0) >> 6) + 1,
                  ((data[3] & 0xfff80000) >> 19) + 1);
        instr_out(data, hw_offset, 4, "volume depth\n");
+       if (len == 6)
+           instr_out(data, hw_offset, 5, "\n");
+
+       return len;
 
+    case 0x7b00:
+       len = (data[0] & 0xff) + 2;
+       if (len != 6)
+           fprintf(out, "Bad count in 3DPRIMITIVE\n");
+       if (count < len)
+           BUFFER_FAIL(count, len, "3DPRIMITIVE");
+
+       instr_out(data, hw_offset, 0,
+                 "3DPRIMITIVE: %s %s\n",
+                 get_965_prim_type(data[0]),
+                 (data[0] & (1 << 15)) ? "random" : "sequential");
+       instr_out(data, hw_offset, 1, "primitive count\n");
+       instr_out(data, hw_offset, 2, "start vertex\n");
+       instr_out(data, hw_offset, 3, "instance count\n");
+       instr_out(data, hw_offset, 4, "start instance\n");
+       instr_out(data, hw_offset, 5, "index bias\n");
        return len;
     }
 
index c677ddd63c52f204431910b72ae3d2b9b3e8f8dd..bf1c3f03f0e1983e3d09e8bb9e2fe3467e01c094 100644 (file)
@@ -163,7 +163,7 @@ intel_miptree_create_for_region(struct intel_context *intel,
    mt->pitch = region->pitch;
 #endif
 
-   mt->region = region;
+   intel_region_reference(&mt->region, region);
 
    return mt;
  }
index 1927880d5f9233499f50dedf428878a7b679149c..0462b9fca2b8572acd033d5fbeaf95a6dce6a2df 100644 (file)
@@ -5,7 +5,8 @@ includedir=@INSTALL_INC_DIR@
 
 Name: gl
 Description: Mesa OpenGL library
-Requires:
+Requires.private: @GL_PC_REQ_PRIV@
 Version: @VERSION@
 Libs: -L${libdir} -lGL
-Cflags: -I${includedir}
+Libs.private: @GL_PC_LIB_PRIV@
+Cflags: -I${includedir} @GL_PC_CFLAGS@
index 375e3ea59e7c53a0ef7840be80869a66cdc1ccb9..64f64a2fd8681ff381a8bf67fecaef7bd280ae90 100644 (file)
@@ -174,6 +174,9 @@ class PrintGlExtensionGlue(gl_XML.gl_print_base):
 
                                parameter_signature = ''
                                for p in f.parameterIterator():
+                                       if p.is_padding:
+                                               continue
+
                                        # FIXME: This is a *really* ugly hack. :(
 
                                        tn = p.type_expr.get_base_type_node()
index 20f75575cf1d8e13e1c5e42377b8eb3b3b0b4325..923c1958f0fab361f06a4cb997d2ec4b7926b486 100644 (file)
@@ -89,8 +89,8 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
                print '#include "glxbyteorder.h"'
                print '#include "indirect_util.h"'
                print '#include "singlesize.h"'
-               print '#include "glapitable.h"'
                print '#include "glapi.h"'
+               print '#include "glapitable.h"'
                print '#include "glthread.h"'
                print '#include "dispatch.h"'
                print ''
@@ -225,6 +225,8 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
                list = []
 
                for param in f.parameterIterator():
+                       if param.is_padding:
+                               continue
 
                        if param.is_counter or param.is_image() or param.is_output or param.name in f.count_parameter_list or len(param.count_parameter_list):
                                location = param.name
index b00b8a1ba6d712df074672b86b7eea27feff9aa0..501706acc774af67650bad8c212f42c103965f33 100644 (file)
@@ -333,7 +333,7 @@ const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
                                        if image.img_pad_dimensions:
                                                do_it = 1
                                                break
-                       
+
 
                                if do_it:
                                        [h, n] = hash_pixel_function(func)
@@ -422,7 +422,10 @@ generic_%u_byte( GLint rop, const void * ptr )
                else:
                        src_ptr = "&" + p.name
 
-               if not extra_offset:
+               if p.is_padding:
+                       print '(void) memset((void *)(%s + %u), 0, %s);' \
+                           % (pc, p.offset + adjust, p.size_string() )
+               elif not extra_offset:
                        print '(void) memcpy((void *)(%s + %u), (void *)(%s), %s);' \
                            % (pc, p.offset + adjust, src_ptr, p.size_string() )
                else:
@@ -472,6 +475,10 @@ generic_%u_byte( GLint rop, const void * ptr )
                                else:
                                        dim_str = str(dim)
 
+                               if param.is_padding:
+                                       print '(void) memset((void *)(%s + %u), 0, %s);' \
+                                       % (pc, (param.offset - 4) + adjust, param.size_string() )
+
                                if param.img_null_flag:
                                        if large:
                                                print '(void) memcpy((void *)(%s + %u), zero, 4);' % (pc, (param.offset - 4) + adjust)
@@ -739,6 +746,9 @@ generic_%u_byte( GLint rop, const void * ptr )
 
                        p_string = ""
                        for param in f.parameterIterateGlxSend():
+                               if param.is_padding:
+                                       continue
+
                                p_string += ", " + param.name
 
                                if param.is_image():
index 2b9a643362282c30e57c4d8f34b17f4d93a66aca..95cb5110cc3cc8d7dd08619883a90ddd33d15432 100644 (file)
@@ -581,6 +581,11 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
 
                self.common_emit_fixups(fixup)
 
+               if img.img_null_flag:
+                       print ''
+                       print '    if (*(CARD32 *) (pc + %s))' % (img.offset - 4)
+                       print '        return 0;'
+
                print ''
                print '    return __glXImageSize(%s, %s, %s, %s, %s, %s,' % (img.img_format, img.img_type, img.img_target, w, h, d )
                print '                          image_height, row_length, skip_images,'
index f89d3818663a8a9a14c70a367accafe5ba5afce1..30c646c9244a467fc8ac3283f1ee3f8a3a7cd2ac 100644 (file)
@@ -45,6 +45,7 @@
                    counter             (true | false) "false"
                    count_scale         NMTOKEN "1"
                    output              (true | false) "false"
+                   padding             (true | false) "false"
                    img_width           NMTOKEN #IMPLIED
                    img_height          NMTOKEN #IMPLIED
                    img_depth           NMTOKEN #IMPLIED
index 6c0367aad794bff6a2ea0aeb2af0071ddeda4de9..951fd9579944580b4c8b3907c62edc66db8cac2c 100644 (file)
         <param name="width" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="type" type="GLenum"/>
-        <param name="pixels" type="const GLvoid *" img_width="width" img_xoff="xoffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
+        <param name="UNUSED" type="GLuint" padding="true"/>
+        <param name="pixels" type="const GLvoid *" img_width="width" img_xoff="xoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
         <glx rop="4099" large="true"/>
     </function>
 
         <param name="height" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="type" type="GLenum"/>
-        <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_xoff="xoffset" img_yoff="yoffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
+        <param name="UNUSED" type="GLuint" padding="true"/>
+        <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_xoff="xoffset" img_yoff="yoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
         <glx rop="4100" large="true"/>
     </function>
 
         <param name="depth" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="type" type="GLenum"/>
-        <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
+        <param name="UNUSED" type="GLuint" padding="true"/>
+        <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
         <glx rop="4115" large="true"/>
     </function>
 
         <param name="depth" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="type" type="GLenum"/>
+        <param name="UNUSED" type="GLuint" padding="true"/>
         <param name="pixels" type="const GLvoid *"/>
     </function>
 </category>
         <param name="width" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="type" type="GLenum"/>
+        <param name="UNUSED" type="GLuint" padding="true"/>
         <param name="pixels" type="const GLvoid *"/>
     </function>
 
         <param name="height" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="type" type="GLenum"/>
+        <param name="UNUSED" type="GLuint" padding="true"/>
         <param name="pixels" type="const GLvoid *"/>
     </function>
 </category>
         <param name="size4d" type="GLsizei"/>
         <param name="format" type="GLenum"/>
         <param name="type" type="GLenum"/>
-        <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_extent="size4d" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_woff="woffset" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
+        <param name="UNUSED" type="GLuint" padding="true"/>
+        <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_extent="size4d" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_woff="woffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
         <glx rop="2058" ignore="true"/>
     </function>
 </category>
index b7a7388400dd261b303d3239998362ecdf134558..b98919134fbb5c1a0a386caf59fae544a2336c29 100644 (file)
@@ -309,6 +309,9 @@ def create_parameter_string(parameters, include_names):
 
        list = []
        for p in parameters:
+               if p.is_padding:
+                       continue
+
                if include_names:
                        list.append( p.string() )
                else:
@@ -463,6 +466,7 @@ class gl_parameter:
                self.img_null_flag      = is_attr_true( element, 'img_null_flag' )
                self.img_send_null      = is_attr_true( element, 'img_send_null' )
 
+               self.is_padding = is_attr_true( element, 'padding' )
                return
 
 
index 6e35571e143ae635cacce61e627c0e374e7bd290..a37c08d6ce1744258d6a006a66a1e5f416671757 100644 (file)
@@ -63,6 +63,9 @@ class PrintGlOffsets(gl_XML.gl_print_base):
                n = f.static_name(name)
 
                for p in f.parameterIterator():
+                       if p.is_padding:
+                               continue
+
                        if p.is_pointer():
                                cast = "(const void *) "
                        else:
index 651cb03f14d36e580c420ee9b3df4faaeceda248..0dbf3ebe0ab92a6b444ec2e2967e5b322f29f126 100644 (file)
@@ -44,6 +44,9 @@ class PrintGenericStubs(gl_XML.gl_print_base):
        def get_stack_size(self, f):
                size = 0
                for p in f.parameterIterator():
+                       if p.is_padding:
+                               continue
+
                        size += p.get_stack_size()
 
                return size
index 2a54ff7ff9078d8fbb7b87347fad1d3ce7111067..d8e8b559f53a604328898183fb1013d270186358 100644 (file)
@@ -383,6 +383,18 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
 
    t->_Complete = GL_TRUE;  /* be optimistic */
 
+   /* Detect cases where the application set the base level to an invalid
+    * value.
+    */
+   if ((baseLevel < 0) || (baseLevel > MAX_TEXTURE_LEVELS)) {
+      char s[100];
+      _mesa_sprintf(s, "obj %p (%d) base level = %d is invalid",
+              (void *) t, t->Name, baseLevel);
+      incomplete(t, s);
+      t->_Complete = GL_FALSE;
+      return;
+   }
+
    /* Always need the base level image */
    if (!t->Image[0][baseLevel]) {
       char s[100];
diff --git a/src/mesa/osmesa.pc.in b/src/mesa/osmesa.pc.in
new file mode 100644 (file)
index 0000000..05327f4
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@INSTALL_DIR@
+exec_prefix=${prefix}
+libdir=@INSTALL_LIB_DIR@
+includedir=@INSTALL_INC_DIR@
+
+Name: osmesa
+Description: Mesa Off-screen Rendering library
+Requires: @OSMESA_PC_REQ@
+Version: @VERSION@
+Libs: -L${libdir} -l@OSMESA_LIB@
+Libs.private: @OSMESA_PC_LIB_PRIV@
+Cflags: -I${includedir}