Merge branch 'master' of git+ssh://michal@git.freedesktop.org/git/mesa/mesa into...
authormichal <michal@michal-laptop.(none)>
Fri, 27 Jul 2007 08:05:40 +0000 (10:05 +0200)
committermichal <michal@michal-laptop.(none)>
Fri, 27 Jul 2007 08:05:40 +0000 (10:05 +0200)
65 files changed:
Makefile
Makefile.mgw
configs/config.mgw [new file with mode: 0644]
docs/README.MINGW32
include/GL/gl.h
include/GL/glut.h
include/GL/mesa_wgl.h
progs/osdemos/ostest1.c
progs/samples/Makefile.mgw
progs/xdemos/pbdemo.c
src/glu/sgi/Makefile.mgw [new file with mode: 0644]
src/glu/sgi/libnurbs/interface/glcurveval.h
src/glu/sgi/libnurbs/interface/glsurfeval.cc
src/glu/sgi/libnurbs/interface/glsurfeval.h
src/glut/glx/Makefile.mgw [new file with mode: 0644]
src/glut/glx/glut_fbc.c
src/glut/glx/glutint.h
src/glut/glx/win32_winproc.c
src/mesa/Makefile.mgw
src/mesa/drivers/dri/i810/i810state.c
src/mesa/drivers/dri/i810/i810tris.c
src/mesa/drivers/dri/i915tex/intel_batchbuffer.h
src/mesa/drivers/dri/i915tex/intel_fbo.c
src/mesa/drivers/dri/i965/brw_sf_state.c
src/mesa/drivers/dri/mach64/mach64_native_vb.c
src/mesa/drivers/dri/mach64/mach64_tris.c
src/mesa/drivers/dri/mga/mgatris.c
src/mesa/drivers/dri/nouveau/nouveau_buffers.c
src/mesa/drivers/dri/r200/r200_state.c
src/mesa/drivers/dri/r300/r300_context.h
src/mesa/drivers/dri/r300/r300_state.c
src/mesa/drivers/dri/r300/r300_vertprog.c
src/mesa/drivers/dri/r300/r300_vertprog.h
src/mesa/drivers/dri/savage/savagetris.c
src/mesa/drivers/dri/tdfx/tdfx_tris.c
src/mesa/drivers/windows/gdi/wgl.c
src/mesa/drivers/windows/gdi/wmesa.c
src/mesa/drivers/windows/gdi/wmesadef.h
src/mesa/drivers/x11/fakeglx.c
src/mesa/main/attrib.c
src/mesa/main/buffers.c
src/mesa/main/buffers.h
src/mesa/main/context.c
src/mesa/main/dd.h
src/mesa/main/fbobject.c
src/mesa/main/framebuffer.c
src/mesa/main/glheader.h
src/mesa/main/imports.c
src/mesa/main/imports.h
src/mesa/main/lines.c
src/mesa/main/mtypes.h
src/mesa/main/points.c
src/mesa/main/shaders.c
src/mesa/main/state.c
src/mesa/main/texcompress_fxt1.c
src/mesa/shader/slang/slang_codegen.c
src/mesa/shader/slang/slang_emit.c
src/mesa/shader/slang/slang_ir.c
src/mesa/shader/slang/slang_ir.h
src/mesa/swrast/s_aalinetemp.h
src/mesa/swrast/s_lines.c
src/mesa/swrast/s_points.c
src/mesa/swrast/s_span.c
src/mesa/tnl/t_vertex.c
src/mesa/tnl_dd/t_dd_vb.c

index 60a14665cca1ad4e1a2661b589db7946a2b00188..9a6557571c5029cf477ad2e9d44b41ff46d1cabf 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -288,17 +288,6 @@ MAIN_FILES = \
        $(DIRECTORY)/vms/analyze_map.com                                \
        $(DIRECTORY)/vms/xlib.opt                                       \
        $(DIRECTORY)/vms/xlib_share.opt                                 \
-       $(DIRECTORY)/windows/VC6/mesa/gdi/gdi.dsp                       \
-       $(DIRECTORY)/windows/VC6/mesa/glu/*.txt                         \
-       $(DIRECTORY)/windows/VC6/mesa/glu/glu.dsp                       \
-       $(DIRECTORY)/windows/VC6/mesa/mesa.dsw                          \
-       $(DIRECTORY)/windows/VC6/mesa/mesa/mesa.dsp                     \
-       $(DIRECTORY)/windows/VC6/mesa/osmesa/osmesa.dsp                 \
-       $(DIRECTORY)/windows/VC7/mesa/gdi/gdi.vcproj                    \
-       $(DIRECTORY)/windows/VC7/mesa/glu/glu.vcproj                    \
-       $(DIRECTORY)/windows/VC7/mesa/mesa.sln                          \
-       $(DIRECTORY)/windows/VC7/mesa/mesa/mesa.vcproj                  \
-       $(DIRECTORY)/windows/VC7/mesa/osmesa/osmesa.vcproj              \
        $(DIRECTORY)/windows/VC8/mesa/mesa.sln                          \
        $(DIRECTORY)/windows/VC8/mesa/gdi/gdi.vcproj                    \
        $(DIRECTORY)/windows/VC8/mesa/glu/glu.vcproj                    \
@@ -328,6 +317,7 @@ SGI_GLU_FILES = \
        $(DIRECTORY)/src/glu/Makefile                                   \
        $(DIRECTORY)/src/glu/descrip.mms                                \
        $(DIRECTORY)/src/glu/sgi/Makefile                               \
+       $(DIRECTORY)/src/glu/sgi/Makefile.mgw                           \
        $(DIRECTORY)/src/glu/sgi/Makefile.win                           \
        $(DIRECTORY)/src/glu/sgi/Makefile.DJ                            \
        $(DIRECTORY)/src/glu/sgi/glu.def                                \
index 948860890c05510d7b6bd1d6d72eeebc2858f46c..3dc9f626438cafa5e5a5c281942be2725762222c 100644 (file)
 
 # MinGW core makefile updated for Mesa 7.0
 #
-#  updated : by Heromyth, 2007-6-25
+#  Updated : by Heromyth, on 2007-7-21
 #  Email   : zxpmyth@yahoo.com.cn
-#  Bug     : All the default settings work fine. But the setting X86=1 can't work. 
+#  Bugs    : 1) All the default settings work fine. But the setting X86=1 can't work. 
 #            The others havn't been tested yet.
-
+#            2) The generated DLLs are *not* compatible with the ones built
+#            with the other compilers like VC8, especially for GLUT. 
+#            3) MAlthough more tests are needed, it can be used individually!
 
 
 .PHONY : all libgl clean realclean
@@ -73,13 +75,14 @@ CFLAGS += -O2 -ffast-math
 
 export CFLAGS
 
+
 ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
 UNLINK = del $(subst /,\,$(1))
 else
 UNLINK = $(RM) $(1)
 endif
 
-all: libgl libglu libglut
+all: libgl libglu libglut example
 
 libgl: lib
        $(MAKE) -f Makefile.mgw -C src/mesa
diff --git a/configs/config.mgw b/configs/config.mgw
new file mode 100644 (file)
index 0000000..b961eb9
--- /dev/null
@@ -0,0 +1,42 @@
+# MinGW config include file updated for Mesa 7.0\r
+#\r
+#  Updated : by Heromyth, on 2007-7-21\r
+#  Email   : zxpmyth@yahoo.com.cn\r
+#  Bugs    : 1) All the default settings work fine. But the setting X86=1 can't work. \r
+#            The others havn't been tested yet.\r
+#            2) The generated DLLs are *not* compatible with the ones built\r
+#            with the other compilers like VC8, especially for GLUT. \r
+#            3) Although more tests are needed, it can be used individually!\r
+\r
+# The generated DLLs by MingW with STDCALL are not totally compatible \r
+# with the ones linked by Microsoft's compilers.\r
+#\r
+# xxx_USING_STDCALL = 1          Compiling MESA with __stdcall. This is default!\r
+# \r
+# xxx_USING_STDCALL = 0          Compiling MESA without __stdcall. I like this:)\r
+#  \r
+\r
+# In fact, GL_USING_STDCALL and GLUT_USING_STDCALL can be\r
+# different. For example:\r
+#\r
+#   GL_USING_STDCALL = 0\r
+#   GLUT_USING_STDCALL = 1\r
+# \r
+# Suggested setting:\r
+#\r
+#     ALL_USING_STDCALL = 1\r
+#\r
+# That's default!\r
+#\r
+\r
+\r
+ALL_USING_STDCALL = 1\r
+\r
+\r
+ifeq ($(ALL_USING_STDCALL),1)\r
+  GL_USING_STDCALL = 1\r
+  GLUT_USING_STDCALL = 1\r
+else\r
+  GL_USING_STDCALL = 0\r
+  GLUT_USING_STDCALL = 0\r
+endif\r
index 2b39f120908a0a040386b2d88acc6a11f491bd59..138dd43eaccfe0d3b3ddc6f308ae800f0ee3624d 100644 (file)
@@ -88,3 +88,52 @@ Running the Build:
 
                Paul G. <pgarceau@users.sourceforge.net>
                Daniel Borca <dborca@users.sourceforge.net>
+
+
+
+*******************This section is added by Heromyth*****************************
+Updated on 2007-7-21, by Heromyth <zxpmyth@yahoo.com.cn>
+
+
+Notice:
+       1) The generated DLLs are *not* compatible with the ones built
+with the other compilers like VC8, especially for GLUT. 
+
+       2) Although more tests are needed, it can be used individually!
+
+       3) You can set the options about whether using STDCALL to build MESA. The 
+config file is <Mesa3D-root>\configs\config.mgw. The default setting is that:
+               ALL_USING_STDCALL = 1
+, which means using STDCALL to build MESA. 
+
+       4) Of course, you can MESA without using STDCALL,I like this:) 
+The setting is :
+               ALL_USING_STDCALL = 0
+To do this, however, you must modify wingdi.h which is in MingW's include dir. 
+For example, run:
+       notepad C:\MingW\include\wingdi.h
+, and delete all the lines where all the wgl*() functions are. Because they would 
+be conflicted with the ones in <Mesa3D-root>\include\GL\mesa_wgl.h.
+
+======= Conflicted Functions List ======
+WINGDIAPI BOOL WINAPI wglCopyContext(HGLRC,HGLRC,UINT);
+WINGDIAPI HGLRC WINAPI wglCreateContext(HDC);
+WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC,int);
+WINGDIAPI BOOL WINAPI wglDeleteContext(HGLRC);
+WINGDIAPI BOOL WINAPI wglDescribeLayerPlane(HDC,int,int,UINT,LPLAYERPLANEDESCRIPTOR);
+WINGDIAPI HGLRC WINAPI wglGetCurrentContext(void);
+WINGDIAPI HDC WINAPI wglGetCurrentDC(void);
+WINGDIAPI int WINAPI wglGetLayerPaletteEntries(HDC,int,int,int,COLORREF*);
+WINGDIAPI PROC WINAPI wglGetProcAddress(LPCSTR);
+WINGDIAPI BOOL WINAPI wglMakeCurrent(HDC,HGLRC);
+WINGDIAPI BOOL WINAPI wglRealizeLayerPalette(HDC,int,BOOL);
+WINGDIAPI int WINAPI wglSetLayerPaletteEntries(HDC,int,int,int,const COLORREF*);
+WINGDIAPI BOOL WINAPI wglShareLists(HGLRC,HGLRC);
+WINGDIAPI BOOL WINAPI wglSwapLayerBuffers(HDC,UINT);
+WINGDIAPI BOOL WINAPI wglUseFontBitmapsA(HDC,DWORD,DWORD,DWORD);
+WINGDIAPI BOOL WINAPI wglUseFontBitmapsW(HDC,DWORD,DWORD,DWORD);
+WINGDIAPI BOOL WINAPI wglUseFontOutlinesA(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT);
+WINGDIAPI BOOL WINAPI wglUseFontOutlinesW(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT);
+===================
+
+*********************************************************************************
\ No newline at end of file
index a388de36e4995ed1fa8839d277a50483401f68c7..09195aa136108ca1859a3aa3e30ab26af64127bf 100644 (file)
 #  else /* for use with static link lib build of Win32 edition only */
 #    define GLAPI extern
 #  endif /* _STATIC_MESA support */
-#  define GLAPIENTRY __stdcall
+#  if defined(__MINGW32__) && defined(GL_NO_STDCALL)  /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */
+#    define GLAPIENTRY 
+#  else
+#    define GLAPIENTRY __stdcall
+#  endif
 #elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
 #  define GLAPI extern
 #  define GLAPIENTRY __stdcall
@@ -84,7 +88,8 @@
 #include <windows.h>
 #endif
 
-#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) \
+     && !defined(OPENSTEP) && !defined(__CYGWIN__) || defined(__MINGW32__)
 #include <GL/mesa_wgl.h>
 #endif
 
@@ -2161,11 +2166,11 @@ typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLsh
 #define GL_DEBUG_PRINT_MESA               0x875A
 #define GL_DEBUG_ASSERT_MESA              0x875B
 
-GLAPI GLhandleARB APIENTRY glCreateDebugObjectMESA (void);
-GLAPI void APIENTRY glClearDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
-GLAPI void APIENTRY glGetDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType, GLsizei maxLength,
+GLAPI GLhandleARB GLAPIENTRY glCreateDebugObjectMESA (void);
+GLAPI void GLAPIENTRY glClearDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
+GLAPI void GLAPIENTRY glGetDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType, GLsizei maxLength,
                                          GLsizei *length, GLcharARB *debugLog);
-GLAPI GLsizei APIENTRY glGetDebugLogLengthMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
+GLAPI GLsizei GLAPIENTRY glGetDebugLogLengthMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
 
 #endif /* GL_MESA_shader_debug */
 
index e0fad6e5cb08b039520f06b1d094e7746765566d..e286349f9b01c3903b4f9104c9aaf36ba1531661 100644 (file)
 #include <GL/gl.h>
 #include <GL/glu.h>
 
+#if defined(__MINGW32__)
+#include <GL/mesa_wgl.h>
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -108,7 +112,7 @@ extern _CRTIMP void __cdecl exit(int);
    and redifinition of Windows system defs, also removes requirement of
    pretty much any standard windows header from this file */
 
-#if (_MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
+#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
 #      define GLUTAPIENTRY __stdcall
 #else
 #      define GLUTAPIENTRY
@@ -130,8 +134,9 @@ extern _CRTIMP void __cdecl exit(int);
 #              pragma message( "----: being multiply defined you should include WINDOWS.H priot to gl/glut.h" )
 #      endif
 #      define CALLBACK __stdcall
-typedef int (GLUTAPIENTRY *PROC)();
+
 #if !defined(__MINGW32__)
+       typedef int (GLUTAPIENTRY *PROC)();
        typedef void *HGLRC;
        typedef void *HDC;
 #endif
index acc7eac2a718a41f23bd392514597d5e89ab0f01..1d774571d94db40dfb08160961a83df01a9d5795 100644 (file)
 /* prototypes for the Mesa WGL functions */
 /* relocated here so that I could make GLUT get them properly */
 
-#define _mesa_wgl_h_
-
 #ifndef _mesa_wgl_h_
 #define _mesa_wgl_h_
 
+#if defined(__MINGW32__)
+#  define __W32API_USE_DLLIMPORT__
+#endif
 
 #include <GL/gl.h>
 
@@ -39,23 +40,16 @@ extern "C" {
 #endif
 
 
-#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN32__))
-#  if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
-#    define GLAPI __declspec(dllexport)
-#    define WGLAPI __declspec(dllexport)
-#  elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
-#    define GLAPI __declspec(dllimport)
-#    define WGLAPI __declspec(dllimport)
-#  else /* for use with static link lib build of Win32 edition only */
-#    define GLAPI extern
-#    define WGLAPI __declspec(dllimport)
-#  endif /* _STATIC_MESA support */
-#  define GLAPIENTRY __stdcall
-#else
-/* non-Windows compilation */
-#  define GLAPI extern
-#  define GLAPIENTRY
-#endif /* WIN32 / CYGWIN32 bracket */
+#ifndef WGLAPI
+#define WGLAPI GLAPI
+#endif
+
+#if defined(__MINGW32__)
+#  ifndef WIN32_LEAN_AND_MEAN
+#    define WIN32_LEAN_AND_MEAN 1
+#  endif
+#  include <windows.h>
+#endif
 
 
 #if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP)
@@ -80,23 +74,25 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC
 #  pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */
 #endif
 
-WGLAPI int   GLAPIENTRY wglDeleteContext(HGLRC);
-WGLAPI int   GLAPIENTRY wglMakeCurrent(HDC,HGLRC);
+
 WGLAPI int   GLAPIENTRY wglSetPixelFormat(HDC, int, const PIXELFORMATDESCRIPTOR *);
 WGLAPI int   GLAPIENTRY wglSwapBuffers(HDC hdc);
-WGLAPI HDC   GLAPIENTRY wglGetCurrentDC(void);
-WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC);
-WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int);
-WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
-WGLAPI PROC  GLAPIENTRY wglGetProcAddress(const char*);
 WGLAPI int   GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *);
+WGLAPI int   GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR);
+WGLAPI int   GLAPIENTRY wglGetPixelFormat(HDC hdc);
+
+
+#if defined(GL_NO_STDCALL) || !defined(__MINGW32__)
 WGLAPI int   GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
+WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC);
+WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int);
 WGLAPI int   GLAPIENTRY wglDeleteContext(HGLRC);
 WGLAPI int   GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR);
-WGLAPI int   GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR);
+WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
+WGLAPI HDC   GLAPIENTRY wglGetCurrentDC(void);
 WGLAPI int   GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *);
-WGLAPI int   GLAPIENTRY wglGetPixelFormat(HDC hdc);
-WGLAPI int   GLAPIENTRY wglMakeCurrent(HDC, HGLRC);
+WGLAPI PROC  GLAPIENTRY wglGetProcAddress(const char*);
+WGLAPI int   GLAPIENTRY wglMakeCurrent(HDC,HGLRC);
 WGLAPI int   GLAPIENTRY wglRealizeLayerPalette(HDC, int, int);
 WGLAPI int   GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *);
 WGLAPI int   GLAPIENTRY wglShareLists(HGLRC, HGLRC);
@@ -105,12 +101,15 @@ WGLAPI int   GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, un
 WGLAPI int   GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long);
 WGLAPI int   GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
 WGLAPI int   GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
+#endif
+
+#ifndef __MINGW32__
 WGLAPI int   GLAPIENTRY SwapBuffers(HDC);
 WGLAPI int   GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *);
 WGLAPI int   GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR);
 WGLAPI int   GLAPIENTRY GetPixelFormat(HDC);
 WGLAPI int   GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
-
+#endif
 
 #ifndef WGL_ARB_extensions_string
 #define WGL_ARB_extensions_string 1
index 001e3686162fbb2c03098098155621bae3c9cbc8..2c7adfc3537aeb8d0a422e462c892e8d61333db6 100644 (file)
@@ -409,6 +409,8 @@ test(GLenum type, GLint bits, const char *filename)
 
    printf("Rendering %d bit/channel image: %s\n", bits, filename);
 
+   OSMesaColorClamp(GL_TRUE);
+
    init_context();
    render_image();
    if (Gradient)
@@ -421,7 +423,7 @@ test(GLenum type, GLint bits, const char *filename)
    if (WriteFiles && filename != NULL) {
       if (type == GL_UNSIGNED_SHORT) {
          GLushort *buffer16 = (GLushort *) buffer;
-         GLubyte *buffer8 = malloc(WIDTH * HEIGHT * 4);
+         GLubyte *buffer8 = (GLubyte *) malloc(WIDTH * HEIGHT * 4);
          int i;
          for (i = 0; i < WIDTH * HEIGHT * 4; i++)
             buffer8[i] = buffer16[i] >> 8;
@@ -430,8 +432,9 @@ test(GLenum type, GLint bits, const char *filename)
       }
       else if (type == GL_FLOAT) {
          GLfloat *buffer32 = (GLfloat *) buffer;
-         GLubyte *buffer8 = malloc(WIDTH * HEIGHT * 4);
+         GLubyte *buffer8 = (GLubyte *) malloc(WIDTH * HEIGHT * 4);
          int i;
+         /* colors may be outside [0,1] so we need to clamp */
          for (i = 0; i < WIDTH * HEIGHT * 4; i++)
             buffer8[i] = (GLubyte) (buffer32[i] * 255.0);
          write_ppm(filename, buffer8, WIDTH, HEIGHT);
index 11935405783d9798a76045d1631fd23904ba0da3..3b2fd785def74956a484574461fe66b6ffaf1fa2 100644 (file)
 #  Email : dborca@users.sourceforge.net
 #  Web   : http://www.geocities.com/dborca
 
+# MinGW samples makefile updated for Mesa 7.0
+#
+#  Updated : by Heromyth, on 2007-7-21
+#  Email   : zxpmyth@yahoo.com.cn
+#  Bugs    : 1) All the default settings work fine. But the setting X86=1 can't work. 
+#            The others havn't been tested yet.
+#            2) The generated DLLs are *not* compatible with the ones built
+#            with the other compilers like VC8, especially for GLUT. 
+#            3) Although more tests are needed, it can be used individually!
 
 #
 #  Available options:
 
 TOP = ../..
 
+include $(TOP)/configs/config.mgw
+ALL_USING_STDCALL ?= 1
+GL_USING_STDCALL ?= 1
+GLUT_USING_STDCALL ?= 1
+
 CC = mingw32-gcc
-CFLAGS = -Wall -W -pedantic
+CFLAGS = -Wall -pedantic
 CFLAGS += -O2 -ffast-math
 CFLAGS += -I$(TOP)/include -I../util
 ifeq ($(FX),1)
-CFLAGS += -DFX
+  CFLAGS += -DFX
+endif
+
+CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK
+
+ifeq ($(GL_USING_STDCALL),0)
+  CFLAGS += -DGL_NO_STDCALL
+endif
+
+ifeq ($(GLUT_USING_STDCALL),1)
+  CFLAGS += -D_STDCALL_SUPPORTED
+else
+  CFLAGS += -DGLUT_NO_STDCALL
 endif
-CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK -D_STDCALL_SUPPORTED
-CFLAGS += -D_WINDEF_ -D_WINGDI_
+
 
 LD = mingw32-g++
 LDFLAGS = -s -L$(TOP)/lib
index efdfdfa452227f8086418263321db281ce28abba..7db0017b33ec283a5643308b73f434145f09f7ed 100644 (file)
@@ -93,7 +93,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
          None
       },
       {
-         /* Single bufferd, without depth buffer */
+         /* Single buffered, without depth buffer */
          GLX_RENDER_TYPE, GLX_RGBA_BIT,
          GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
          GLX_RED_SIZE, 1,
@@ -105,7 +105,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
          None
       },
       {
-         /* Double bufferd, without depth buffer */
+         /* Double buffered, without depth buffer */
          GLX_RENDER_TYPE, GLX_RGBA_BIT,
          GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
          GLX_RED_SIZE, 1,
@@ -130,9 +130,8 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
       /* Get list of possible frame buffer configurations */
       fbConfigs = ChooseFBConfig(dpy, screen, fbAttribs[attempt], &nConfigs);
       if (nConfigs==0 || !fbConfigs) {
-         printf("Error: glXChooseFBConfig failed\n");
-         XCloseDisplay(dpy);
-         return 0;
+         printf("Note: glXChooseFBConfig(%s) failed\n", fbString[attempt]);
+         continue;
       }
 
 #if 0 /*DEBUG*/
diff --git a/src/glu/sgi/Makefile.mgw b/src/glu/sgi/Makefile.mgw
new file mode 100644 (file)
index 0000000..43b421e
--- /dev/null
@@ -0,0 +1,229 @@
+# Mesa 3-D graphics library
+# Version:  5.1
+# 
+# Copyright (C) 1999-2003  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"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+# MinGW core makefile v1.4 for Mesa
+#
+#  Copyright (C) 2002 - Daniel Borca
+#  Email : dborca@users.sourceforge.net
+#  Web   : http://www.geocities.com/dborca
+
+# MinGW core-glu makefile updated for Mesa 7.0
+#
+#  Updated : by Heromyth, on 2007-7-21
+#  Email   : zxpmyth@yahoo.com.cn
+#  Bugs    : 1) All the default settings work fine. But the setting X86=1 can't work. 
+#            The others havn't been tested yet.
+#            2) The generated DLLs are *not* compatible with the ones built
+#            with the other compilers like VC8, especially for GLUT. 
+#            3) Although more tests are needed, it can be used individually!
+
+#
+#  Available options:
+#
+#    Environment variables:
+#      CFLAGS
+#
+#      GLIDE           path to Glide3 SDK; used with FX.
+#                      default = $(TOP)/glide3
+#      FX=1            build for 3dfx Glide3. Note that this disables
+#                      compilation of most WMesa code and requires fxMesa.
+#                      As a consequence, you'll need the Win32 Glide3
+#                      library to build any application.
+#                      default = no
+#      ICD=1           build the installable client driver interface
+#                      (windows opengl driver interface)
+#                      default = no
+#      X86=1           optimize for x86 (if possible, use MMX, SSE, 3DNow).
+#                      default = no
+#
+#    Targets:
+#      all:            build GL
+#      clean:          remove object files
+#
+
+
+
+.PHONY: all clean
+.INTERMEDIATE: x86/gen_matypes.exe
+.SUFFIXES: .rc .res
+
+# Set this to the prefix of your build tools, i.e. mingw32-
+TOOLS_PREFIX = mingw32-
+
+TOP = ../../..
+
+LIBDIR = $(TOP)/lib
+
+GLU_DLL = glu32.dll
+GLU_IMP = libglu32.a
+GLU_DEF = glu.def
+
+include $(TOP)/configs/config.mgw
+GL_USING_STDCALL ?= 1
+
+LDLIBS = -L$(LIBDIR) -lopengl32
+LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GLU_IMP) -Wl,--output-def=$(LIBDIR)/$(GLU_DEF)
+
+CFLAGS += -DBUILD_GLU32 -D_DLL
+
+ifeq ($(GL_USING_STDCALL),1)
+  LDFLAGS += -Wl,--add-stdcall-alias
+else
+  CFLAGS += -DGL_NO_STDCALL
+endif
+
+CC = gcc
+CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include -Iinclude
+CXX = g++
+CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess
+
+AR = ar
+ARFLAGS = crus
+
+UNLINK = del $(subst /,\,$(1))
+ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
+UNLINK = $(RM) $(1)
+endif
+ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
+UNLINK = $(RM) $(1)
+endif
+
+C_SOURCES = \
+       libutil/error.c \
+       libutil/glue.c \
+       libutil/mipmap.c \
+       libutil/project.c \
+       libutil/quad.c \
+       libutil/registry.c \
+       libtess/dict.c \
+       libtess/geom.c \
+       libtess/memalloc.c \
+       libtess/mesh.c \
+       libtess/normal.c \
+       libtess/priorityq.c \
+       libtess/render.c \
+       libtess/sweep.c \
+       libtess/tess.c \
+       libtess/tessmono.c
+
+CC_SOURCES = \
+       libnurbs/interface/bezierEval.cc \
+       libnurbs/interface/bezierPatch.cc \
+       libnurbs/interface/bezierPatchMesh.cc \
+       libnurbs/interface/glcurveval.cc \
+       libnurbs/interface/glinterface.cc \
+       libnurbs/interface/glrenderer.cc \
+       libnurbs/interface/glsurfeval.cc \
+       libnurbs/interface/incurveeval.cc \
+       libnurbs/interface/insurfeval.cc \
+       libnurbs/internals/arc.cc \
+       libnurbs/internals/arcsorter.cc \
+       libnurbs/internals/arctess.cc \
+       libnurbs/internals/backend.cc \
+       libnurbs/internals/basiccrveval.cc \
+       libnurbs/internals/basicsurfeval.cc \
+       libnurbs/internals/bin.cc \
+       libnurbs/internals/bufpool.cc \
+       libnurbs/internals/cachingeval.cc \
+       libnurbs/internals/ccw.cc \
+       libnurbs/internals/coveandtiler.cc \
+       libnurbs/internals/curve.cc \
+       libnurbs/internals/curvelist.cc \
+       libnurbs/internals/curvesub.cc \
+       libnurbs/internals/dataTransform.cc \
+       libnurbs/internals/displaylist.cc \
+       libnurbs/internals/flist.cc \
+       libnurbs/internals/flistsorter.cc \
+       libnurbs/internals/hull.cc \
+       libnurbs/internals/intersect.cc \
+       libnurbs/internals/knotvector.cc \
+       libnurbs/internals/mapdesc.cc \
+       libnurbs/internals/mapdescv.cc \
+       libnurbs/internals/maplist.cc \
+       libnurbs/internals/mesher.cc \
+       libnurbs/internals/monoTriangulationBackend.cc \
+       libnurbs/internals/monotonizer.cc \
+       libnurbs/internals/mycode.cc \
+       libnurbs/internals/nurbsinterfac.cc \
+       libnurbs/internals/nurbstess.cc \
+       libnurbs/internals/patch.cc \
+       libnurbs/internals/patchlist.cc \
+       libnurbs/internals/quilt.cc \
+       libnurbs/internals/reader.cc \
+       libnurbs/internals/renderhints.cc \
+       libnurbs/internals/slicer.cc \
+       libnurbs/internals/sorter.cc \
+       libnurbs/internals/splitarcs.cc \
+       libnurbs/internals/subdivider.cc \
+       libnurbs/internals/tobezier.cc \
+       libnurbs/internals/trimline.cc \
+       libnurbs/internals/trimregion.cc \
+       libnurbs/internals/trimvertpool.cc \
+       libnurbs/internals/uarray.cc \
+       libnurbs/internals/varray.cc \
+       libnurbs/nurbtess/directedLine.cc \
+       libnurbs/nurbtess/gridWrap.cc \
+       libnurbs/nurbtess/monoChain.cc \
+       libnurbs/nurbtess/monoPolyPart.cc \
+       libnurbs/nurbtess/monoTriangulation.cc \
+       libnurbs/nurbtess/partitionX.cc \
+       libnurbs/nurbtess/partitionY.cc \
+       libnurbs/nurbtess/polyDBG.cc \
+       libnurbs/nurbtess/polyUtil.cc \
+       libnurbs/nurbtess/primitiveStream.cc \
+       libnurbs/nurbtess/quicksort.cc \
+       libnurbs/nurbtess/rectBlock.cc \
+       libnurbs/nurbtess/sampleComp.cc \
+       libnurbs/nurbtess/sampleCompBot.cc \
+       libnurbs/nurbtess/sampleCompRight.cc \
+       libnurbs/nurbtess/sampleCompTop.cc \
+       libnurbs/nurbtess/sampleMonoPoly.cc \
+       libnurbs/nurbtess/sampledLine.cc \
+       libnurbs/nurbtess/searchTree.cc
+
+SOURCES = $(C_SOURCES) $(CC_SOURCES)
+
+OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
+
+.c.o:
+       $(CC) -o $@ $(CFLAGS) -c $<
+.cc.o:
+       $(CXX) -o $@ $(CXXFLAGS) -c $<
+
+
+all: $(LIBDIR) $(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP)
+
+$(LIBDIR):
+       mkdir -p $(LIBDIR)
+
+$(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP): $(OBJECTS)
+       g++ -shared -fPIC -o $(LIBDIR)/$(GLU_DLL) $(LDFLAGS) \
+    $^ $(LDLIBS)
+
+
+
+clean:
+       -$(call UNLINK,libutil/*.o)
+       -$(call UNLINK,libtess/*.o)
+       -$(call UNLINK,libnurbs/interface/*.o)
+       -$(call UNLINK,libnurbs/internals/*.o)
+       -$(call UNLINK,libnurbs/nurbtess/*.o)
index 4b44f6e847e242666174fe8cae06cf1964332661..a09a74d04c3de6d9b870959f0540f2f5b0eb204c 100644 (file)
@@ -93,7 +93,7 @@ public:
        output_triangles = flag;
       }
 #ifdef _WIN32
-    void               putCallBack(GLenum which, void (APIENTRY *fn)() );
+    void               putCallBack(GLenum which, void (GLAPIENTRY *fn)() );
 #else
     void               putCallBack(GLenum which, _GLUfuncptr fn );
 #endif
index a36b304508c456bc08c8ea3eafb10832bd836672..b5bfab1e2811a449d12ea664dba66dda0c83b737 100644 (file)
@@ -1184,8 +1184,11 @@ return;
 
 }
 
-void
-OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn )
+#ifdef _WIN32
+void OpenGLSurfaceEvaluator::putCallBack(GLenum which, void (GLAPIENTRY *fn)() )
+#else
+void OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn )
+#endif
 {
   switch(which)
     {
index c34a58cb9b91df86be77f8f13b07cdd8dabb723e..b7a88069f5ad9038e6e3eed6cd26b24860fab4b7 100644 (file)
@@ -145,7 +145,7 @@ public:
     void               newtmeshvert( long, long );
 
 #ifdef _WIN32
-    void               putCallBack(GLenum which, void (APIENTRY *fn)() );
+    void               putCallBack(GLenum which, void (GLAPIENTRY *fn)() );
 #else
     void               putCallBack(GLenum which, _GLUfuncptr fn );
 #endif
diff --git a/src/glut/glx/Makefile.mgw b/src/glut/glx/Makefile.mgw
new file mode 100644 (file)
index 0000000..ae4eb6a
--- /dev/null
@@ -0,0 +1,198 @@
+# Mesa 3-D graphics library
+# Version:  5.1
+# 
+# Copyright (C) 1999-2003  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"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+# MinGW core makefile v1.4 for Mesa
+#
+#  Copyright (C) 2002 - Daniel Borca
+#  Email : dborca@users.sourceforge.net
+#  Web   : http://www.geocities.com/dborca
+
+# MinGW core-glut makefile updated for Mesa 7.0
+#
+#  Updated : by Heromyth, on 2007-7-21
+#  Email   : zxpmyth@yahoo.com.cn
+#  Bugs    : 1) All the default settings work fine. But the setting X86=1 can't work. 
+#            The others havn't been tested yet.
+#            2) The generated DLLs are *not* compatible with the ones built
+#            with the other compilers like VC8, especially for GLUT. 
+#            3) Although more tests are needed, it can be used individually!
+
+
+#
+#  Available options:
+#
+#    Environment variables:
+#      CFLAGS
+#
+#      GLIDE           path to Glide3 SDK; used with FX.
+#                      default = $(TOP)/glide3
+#      FX=1            build for 3dfx Glide3. Note that this disables
+#                      compilation of most WMesa code and requires fxMesa.
+#                      As a consequence, you'll need the Win32 Glide3
+#                      library to build any application.
+#                      default = no
+#      ICD=1           build the installable client driver interface
+#                      (windows opengl driver interface)
+#                      default = no
+#      X86=1           optimize for x86 (if possible, use MMX, SSE, 3DNow).
+#                      default = no
+#
+#    Targets:
+#      all:            build GL
+#      clean:          remove object files
+#
+
+
+
+.PHONY: all clean
+.INTERMEDIATE: x86/gen_matypes.exe
+.SUFFIXES: .rc .res
+
+# Set this to the prefix of your build tools, i.e. mingw32-
+TOOLS_PREFIX = mingw32-
+
+TOP = ../../..
+
+LIBDIR = $(TOP)/lib
+
+GLUT_DLL = glut32.dll
+GLUT_IMP = libglut32.a
+GLUT_DEF = glut.def
+
+include $(TOP)/configs/config.mgw
+GLUT_USING_STDCALL ?= 1
+
+
+
+LDLIBS = -L$(LIBDIR) -lwinmm -lgdi32 -luser32 -lopengl32 -lglu32 
+LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GLUT_IMP) -Wl,--output-def=$(LIBDIR)/$(GLUT_DEF) 
+
+CFLAGS += -DBUILD_GLUT32 -DGLUT_BUILDING_LIB -DMESA -D_DLL
+
+ifeq ($(GL_USING_STDCALL),0)
+  CFLAGS += -DGL_NO_STDCALL
+endif
+
+ifeq ($(GLUT_USING_STDCALL),1)
+  CFLAGS += -D_STDCALL_SUPPORTED
+  LDFLAGS += -Wl,--add-stdcall-alias
+else
+  CFLAGS += -DGLUT_NO_STDCALL
+endif
+
+CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include 
+
+CC = gcc
+CXX = g++
+CXXFLAGS = $(CFLAGS)
+
+AR = ar
+ARFLAGS = crus
+
+UNLINK = del $(subst /,\,$(1))
+ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
+UNLINK = $(RM) $(1)
+endif
+ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
+UNLINK = $(RM) $(1)
+endif
+
+HDRS = glutint.h glutstroke.h glutbitmap.h glutwin32.h stroke.h win32_glx.h win32_x11.h
+
+SRCS = \
+       glut_bitmap.c \
+       glut_bwidth.c \
+       glut_cindex.c \
+       glut_cmap.c \
+       glut_cursor.c \
+       glut_dials.c \
+       glut_dstr.c \
+       glut_event.c \
+       glut_ext.c \
+       glut_fbc.c \
+       glut_fullscrn.c \
+       glut_gamemode.c \
+       glut_get.c \
+       glut_init.c \
+       glut_input.c \
+       glut_joy.c \
+       glut_key.c \
+       glut_keyctrl.c \
+       glut_keyup.c \
+       glut_mesa.c \
+       glut_modifier.c \
+       glut_overlay.c \
+       glut_shapes.c \
+       glut_space.c \
+       glut_stroke.c \
+       glut_swap.c \
+       glut_swidth.c \
+       glut_tablet.c \
+       glut_teapot.c \
+       glut_util.c \
+       glut_vidresize.c \
+       glut_warp.c \
+       glut_win.c \
+       glut_winmisc.c \
+       win32_glx.c \
+       win32_menu.c \
+       win32_util.c \
+       win32_winproc.c \
+       win32_x11.c
+       
+
+SRCSSEMIGENS = \
+       glut_8x13.c \
+       glut_9x15.c \
+       glut_hel10.c \
+       glut_hel12.c \
+       glut_hel18.c \
+       glut_mroman.c \
+       glut_roman.c \
+       glut_tr10.c \
+       glut_tr24.c
+
+
+
+SOURCES = $(SRCS) $(SRCSSEMIGENS)
+
+OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
+
+.c.o:
+       $(CC) -o $@ $(CFLAGS) -c $<
+.cc.o:
+       $(CXX) -o $@ $(CXXFLAGS) -c $<
+
+
+all: $(LIBDIR) $(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP)
+
+$(LIBDIR):
+       mkdir -p $(LIBDIR)
+
+$(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)
+       $(CXX) -shared -fPIC -o $(LIBDIR)/$(GLUT_DLL) $(LDFLAGS) \
+       $^ $(LDLIBS)
+
+
+
+clean:
+       -$(call UNLINK,*.o)
\ No newline at end of file
index deb46c3d8db28fdcc40e60decbe7b3ee0c1b4eef..e93188b86221e6882cf9cb4fdb94ca179d330333 100644 (file)
@@ -18,7 +18,7 @@
 
 /* Set a Fortran callback function. */
 
-void GLUTAPIENTRY
+void APIENTRY
 __glutSetFCB(int which, void *func)
 {
 #ifdef SUPPORT_FORTRAN
@@ -100,7 +100,7 @@ __glutSetFCB(int which, void *func)
 
 /* Get a Fortran callback function. */
 
-void* GLUTAPIENTRY
+void* APIENTRY
 __glutGetFCB(int which)
 {
 #ifdef SUPPORT_FORTRAN
index 6fe09ffe7e708e914b23a38345111c830797966f..a962c780238d17171bac4001bd0a68e2fa50e14d 100644 (file)
 #include <GL/glx.h>
 #endif
 
+#ifndef GLUT_BUILDING_LIB
 #define GLUT_BUILDING_LIB  /* Building the GLUT library itself. */
+#endif
+
 #include <GL/glut.h>
 
 #if defined(MESA) && defined(_WIN32) && !defined(__CYGWIN32__)
index a54bac75fa0af63e7188e757e168cca595599a04..e1fc785ebb7fff95053eb179cab5b12965031014 100644 (file)
@@ -9,6 +9,9 @@
 
 #include "glutint.h"
 #include <sys/timeb.h>
+#ifdef __MINGW32__
+#include <ctype.h>
+#endif
 
 #if defined(_WIN32) && !defined(__CYGWIN32__)
 #include <mmsystem.h>  /* Win32 Multimedia API header. */
index ebec5c055a87cc757efd3750fc1c8a518fb7051e..3b52834bd1c327fe429e8acf5197dc3c741fca4a 100644 (file)
@@ -1,5 +1,5 @@
 # Mesa 3-D graphics library
-# Version:  5.1
+# Version:  7.0
 # 
 # Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
 # 
 #  Email : dborca@users.sourceforge.net
 #  Web   : http://www.geocities.com/dborca
 
+# MinGW core-gl makefile updated for Mesa 7.0
+#
+#  updated : by Heromyth, on 2007-7-21
+#  Email   : zxpmyth@yahoo.com.cn
+#  Bugs    : 1) All the default settings work fine. But the setting X86=1 can't work. 
+#            The others havn't been tested yet.
+#            2) The generated DLLs are *not* compatible with the ones built
+#            with the other compilers like VC8, especially for GLUT. 
+#            3) Although more tests are needed, it can be used individually!
+
 
 #
 #  Available options:
@@ -52,7 +62,6 @@
 #
 
 
-
 .PHONY: all clean
 .INTERMEDIATE: x86/gen_matypes.exe
 .SUFFIXES: .rc .res
@@ -60,6 +69,8 @@
 # Set this to the prefix of your build tools, i.e. mingw32-
 TOOLS_PREFIX = mingw32-
 
+
+
 TOP = ../..
 GLIDE ?= $(TOP)/glide3
 LIBDIR = $(TOP)/lib
@@ -71,11 +82,25 @@ else
   GL_IMP = libopengl32.a
 endif
 
-LDLIBS = -lgdi32
+GL_DEF = gl.def
+
+include $(TOP)/configs/config.mgw
+GL_USING_STDCALL ?= 1
+
+MESA_LIB = libmesa.a
+
+LDLIBS = -lgdi32 -luser32 -liberty
+LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GL_IMP) -Wl,--output-def=$(LIBDIR)/gl.def
 
 CC = $(TOOLS_PREFIX)gcc
-CFLAGS += -DBUILD_GL32 -D_OPENGL32_
-CFLAGS += $(INCLUDE_DIRS)
+CFLAGS += -DBUILD_GL32 -D_OPENGL32_ -D_DLL -DMESA_MINWARN -DNDEBUG -D_USRDLL -DGDI_EXPORTS
+
+ifeq ($(GL_USING_STDCALL),1)
+  LDFLAGS += -Wl,--add-stdcall-alias
+else
+  CFLAGS += -DGL_NO_STDCALL
+endif
+
 CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1
 ifeq ($(FX),1)
   CFLAGS += -I$(GLIDE)/include -DFX
@@ -104,6 +129,8 @@ endif
 
 include sources
 
+CFLAGS += $(INCLUDE_DIRS) 
+
 ifeq ($(X86),1)
 CFLAGS += -DUSE_X86_ASM
 CFLAGS += -DUSE_MMX_ASM
@@ -140,10 +167,9 @@ RESOURCE = $(GL_RES:.rc=.res)
 
 .c.o:
        $(CC) -o $@ $(CFLAGS) -c $<
-.S.o:
-       $(CC) -o $@ $(CFLAGS) -c $<
 .s.o:
        $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
+
 .rc.res:
        windres -o $@ -Irc -Ocoff $<
 
@@ -153,9 +179,8 @@ $(LIBDIR):
        mkdir -p $(LIBDIR)
 
 $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE)
-       $(TOOLS_PREFIX)dllwrap -o $(LIBDIR)/$(GL_DLL) --output-lib $(LIBDIR)/$(GL_IMP) \
-                              --target i386-mingw32 --def $(GL_DEF) -Wl,-enable-stdcall-fixup \
-                              $^ $(LDLIBS)
+       $(CC) -shared -fPIC -o $(LIBDIR)/$(GL_DLL) $(LDFLAGS) \
+       $^ $(LDLIBS)
 
 $(X86_OBJECTS): x86/matypes.h
 
@@ -187,17 +212,21 @@ tnl/t_vtx_x86_gcc.o: tnl/t_vtx_x86_gcc.S
        $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $<
 
 clean:
-       -$(call UNLINK,array_cache/*.o)
        -$(call UNLINK,glapi/*.o)
        -$(call UNLINK,main/*.o)
        -$(call UNLINK,math/*.o)
+       -$(call UNLINK,vbo/*.o)
        -$(call UNLINK,shader/*.o)
+       -$(call UNLINK,shader/slang/*.o)
+       -$(call UNLINK,shader/grammar/*.o)
        -$(call UNLINK,sparc/*.o)
        -$(call UNLINK,ppc/*.o)
        -$(call UNLINK,swrast/*.o)
        -$(call UNLINK,swrast_setup/*.o)
        -$(call UNLINK,tnl/*.o)
        -$(call UNLINK,x86/*.o)
+       -$(call UNLINK,x86/rtasm/*.o)
+       -$(call UNLINK,x86-64/*.o)
        -$(call UNLINK,drivers/common/*.o)
        -$(call UNLINK,drivers/glide/*.o)
        -$(call UNLINK,drivers/windows/fx/*.o)
index 3ad25282d90d599ad71aaba270e26ee91c51b26c..e0d5b2b4876da5a3f3e0373dfa75bd07dcf0b91f 100644 (file)
@@ -380,7 +380,10 @@ static void i810CullFaceFrontFace(GLcontext *ctx, GLenum unused)
 static void i810LineWidth( GLcontext *ctx, GLfloat widthf )
 {
    i810ContextPtr imesa = I810_CONTEXT( ctx );
-   int width = (int)ctx->Line._Width;
+   /* AA, non-AA limits are same */
+   const int width = (int) CLAMP(ctx->Line.Width,
+                                 ctx->Const.MinLineWidth,
+                                 ctx->Const.MaxLineWidth);
 
    imesa->LcsLineWidth = 0;
    if (width & 1) imesa->LcsLineWidth |= LCS_LINEWIDTH_1_0;
@@ -396,7 +399,10 @@ static void i810LineWidth( GLcontext *ctx, GLfloat widthf )
 static void i810PointSize( GLcontext *ctx, GLfloat sz )
 {
    i810ContextPtr imesa = I810_CONTEXT( ctx );
-   int size = (int)ctx->Point._Size;
+   /* AA, non-AA limits are same */
+   const int size = (int) CLAMP(ctx->Point.Size,
+                                ctx->Const.MinPointSize,
+                                ctx->Const.MaxPointSize);
 
    imesa->LcsPointSize = 0;
    if (size & 1) imesa->LcsPointSize |= LCS_LINEWIDTH_1_0;
index 3e09427bb94f631c1fa6efcdf2ac55744a143de2..2c4ee06633d671dc6589481f493c00017b809c43 100644 (file)
@@ -112,7 +112,9 @@ static __inline__ void i810_draw_quad( i810ContextPtr imesa,
 static __inline__ void i810_draw_point( i810ContextPtr imesa,
                                        i810VertexPtr tmp )
 {
-   GLfloat sz = imesa->glCtx->Point._Size * .5;
+   GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
+                            imesa->glCtx->Const.MinPointSize,
+                            imesa->glCtx->Const.MaxPointSize);
    int vertsize = imesa->vertex_size;
    GLuint *vb = i810AllocDmaLow( imesa, 2 * 4 * vertsize );
    int j;
index 59261f727419d854361a091402f1a36deba05e5a..212f1301012e8b92a55529d9b9f053300863c532 100644 (file)
@@ -9,7 +9,7 @@ struct intel_context;
 #define BATCH_SZ 16384
 #define BATCH_RESERVED 16
 
-#define MAX_RELOCS 400
+#define MAX_RELOCS 4096
 
 #define INTEL_BATCH_NO_CLIPRECTS 0x1
 #define INTEL_BATCH_CLIPRECTS    0x2
index 2dd3617f93a5f9586066ad603c28f5642c0ccea6..a09db46163d51dc36bde5dc2aa648a81a21480a2 100644 (file)
@@ -509,7 +509,7 @@ intel_new_renderbuffer(GLcontext * ctx, GLuint name)
  */
 static void
 intel_bind_framebuffer(GLcontext * ctx, GLenum target,
-                       struct gl_framebuffer *fb)
+                       struct gl_framebuffer *fb, struct gl_framebuffer *fbread)
 {
    if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) {
       intel_draw_buffer(ctx, fb);
index bfac52d765b370e2086e5d29845b3af8f7d08ff7..9a6e5f5f192ae7097e5069bf43dde34756d94162 100644 (file)
@@ -173,7 +173,8 @@ static void upload_sf_unit( struct brw_context *brw )
       
 
    /* _NEW_LINE */
-   sf.sf6.line_width = brw->attribs.Line->_Width * (1<<1);
+   /* XXX use ctx->Const.Min/MaxLineWidth here */
+   sf.sf6.line_width = CLAMP(brw->attribs.Line->Width, 1.0, 5.0) * (1<<1);
 
    sf.sf6.line_endcap_aa_region_width = 1;
    if (brw->attribs.Line->SmoothFlag)
@@ -183,7 +184,8 @@ static void upload_sf_unit( struct brw_context *brw )
 
    /* _NEW_POINT */
    sf.sf6.point_rast_rule = 1; /* opengl conventions */
-   sf.sf7.point_size = brw->attribs.Point->_Size * (1<<3);
+   /* XXX clamp max depends on AA vs. non-AA */
+   sf.sf7.point_size = CLAMP(brw->attribs.Point->Size, 1.0, 3.0) * (1<<3);
    sf.sf7.use_point_size_state = !brw->attribs.Point->_Attenuated;
       
    /* might be BRW_NEW_PRIMITIVE if we have to adjust pv for polygons:
index 75cf0e2ed2d41c46c1c237d161ba8ee91fb1c654..248fa2a9a29c54d95184d621eaefb046858b320b 100644 (file)
@@ -103,7 +103,7 @@ void TAG(translate_vertex)(GLcontext *ctx,
 
    assert( p + 1 - (CARD32 *)src == 10 );
         
-   dst->pointSize = ctx->Point._Size;
+   dst->pointSize = ctx->Point.Size;
 }
 
 
index 08cc1849a12dfcdb918cbfec3e383bbd0942338b..369f610442890854ddfc5e65d6e783ec62602ebf 100644 (file)
@@ -673,7 +673,10 @@ static __inline void mach64_draw_line( mach64ContextPtr mmesa,
 #if MACH64_NATIVE_VTXFMT
    GLcontext *ctx = mmesa->glCtx;
    const GLuint vertsize = mmesa->vertex_size;
-   GLint width = (GLint)(mmesa->glCtx->Line._Width * 2.0); /* 2 fractional bits for hardware */
+   /* 2 fractional bits for hardware: */
+   const int width = (int) (2.0 * CLAMP(mmesa->glCtx->Line.Width,
+                                        mmesa->glCtx->Const.MinLineWidth,
+                                        mmesa->glCtx->Const.MaxLineWidth));
    GLfloat ooa;
    GLuint *pxy0, *pxy1;
    GLuint xy0old, xy0, xy1old, xy1;
@@ -691,9 +694,6 @@ static __inline void mach64_draw_line( mach64ContextPtr mmesa,
       mach64_print_vertex( ctx, v1 );
    }
   
-   if( !width )
-      width = 1;       /* round to the nearest supported width */
-      
    pxy0 = &v0->ui[xyoffset];
    xy0old = *pxy0;
    xy0 = LE32_IN( &xy0old );
@@ -961,7 +961,10 @@ static __inline void mach64_draw_point( mach64ContextPtr mmesa,
 #if MACH64_NATIVE_VTXFMT
    GLcontext *ctx = mmesa->glCtx;
    const GLuint vertsize = mmesa->vertex_size;
-   GLint sz = (GLint)(mmesa->glCtx->Point._Size * 2.0); /* 2 fractional bits for hardware */
+   /* 2 fractional bits for hardware: */
+   GLint sz = (GLint) (2.0 * CLAMP(mmesa->glCtx->Point.Size,
+                                   ctx->Const.MinPointSize,
+                                   ctx->Const.MaxPointSize));
    GLfloat ooa;
    GLuint *pxy;
    GLuint xyold, xy;
index 2b7ea05b142cbba262508e660c13e4494ed1ea06..91b413ae760872b8adc108dbdd6a3ce23cf6e61c 100644 (file)
@@ -104,8 +104,10 @@ static void __inline__ mga_draw_quad( mgaContextPtr mmesa,
 static __inline__ void mga_draw_point( mgaContextPtr mmesa,
                                        mgaVertexPtr tmp )
 {
-   GLfloat sz = mmesa->glCtx->Point._Size * .5;
-   int vertex_size = mmesa->vertex_size;
+   const GLfloat sz = 0.5 * CLAMP(mmesa->glCtx->Point.Size,
+                                  mmesa->glCtx->Const.MinPointSize,
+                                  mmesa->glCtx->Const.MaxPointSize);
+   const int vertex_size = mmesa->vertex_size;
    GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
    int j;
    
@@ -165,7 +167,9 @@ static __inline__ void mga_draw_line( mgaContextPtr mmesa,
    GLuint vertex_size = mmesa->vertex_size;
    GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
    GLfloat dx, dy, ix, iy;
-   GLfloat width = mmesa->glCtx->Line._Width;
+   const GLfloat width = CLAMP(mmesa->glCtx->Line.Width,
+                               mmesa->glCtx->Const.MinLineWidth,
+                               mmesa->glCtx->Const.MaxLineWidth);
    GLint j;
 
 #if 0
index f98d66656355716319db2de7ad4bb94408a6553e..d498f616c908358553760d26c3888540b95c0698 100644 (file)
@@ -390,9 +390,12 @@ nouveauNewRenderbuffer(GLcontext *ctx, GLuint name)
 }
 
 static void
-nouveauBindFramebuffer(GLcontext *ctx, GLenum target, struct gl_framebuffer *fb)
+nouveauBindFramebuffer(GLcontext *ctx, GLenum target,
+                       struct gl_framebuffer *fb, struct gl_framebuffer *fbread)
 {
-   nouveau_build_framebuffer(ctx, fb);
+   if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) {
+      nouveau_build_framebuffer(ctx, fb);
+   }
 }
 
 static void
index 2115799b9b6f0402ec3881e79385e25300961b4c..1d975ecd57d679af5f6f061ee593c0e6a61c5ba9 100644 (file)
@@ -772,9 +772,11 @@ static void r200LineWidth( GLcontext *ctx, GLfloat widthf )
    R200_STATECHANGE( rmesa, set );
 
    /* Line width is stored in U6.4 format.
+    * Same min/max limits for AA, non-AA lines.
     */
    rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] &= ~0xffff;
-   rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] |= (GLuint)(ctx->Line._Width * 16.0);
+   rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] |= (GLuint)
+      (CLAMP(widthf, ctx->Const.MinLineWidth, ctx->Const.MaxLineWidth) * 16.0);
 
    if ( widthf > 1.0 ) {
       rmesa->hw.set.cmd[SET_SE_CNTL] |=  R200_WIDELINE_ENABLE;
index 0349bac9a26a69ec838388eccf7b1bcd2575c1e5..be6909724a380081b28e4351ff6ae4bcb91566c7 100644 (file)
@@ -568,7 +568,7 @@ struct r300_vertex_shader_fragment {
        union {
                GLuint d[VSF_MAX_FRAGMENT_LENGTH];
                float f[VSF_MAX_FRAGMENT_LENGTH];
-               struct r300_vertprog_instruction i[VSF_MAX_FRAGMENT_LENGTH / 4];
+               GLuint i[VSF_MAX_FRAGMENT_LENGTH];
        } body;
 };
 
index 6789efd428121dcf42a41a95bfa435d1156548f6..088216c76ee952467047b7ff99ca9ffef3730cf3 100644 (file)
@@ -733,8 +733,8 @@ static void r300Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
 static void r300PointSize(GLcontext * ctx, GLfloat size)
 {
        r300ContextPtr r300 = R300_CONTEXT(ctx);
-
-       size = ctx->Point._Size;
+        /* same size limits for AA, non-AA points */
+       size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
 
        R300_STATECHANGE(r300, ps);
        r300->hw.ps.cmd[R300_PS_POINTSIZE] =
@@ -749,8 +749,9 @@ static void r300LineWidth(GLcontext * ctx, GLfloat widthf)
 {
        r300ContextPtr r300 = R300_CONTEXT(ctx);
 
-       widthf = ctx->Line._Width;
-
+       widthf = CLAMP(widthf,
+                       ctx->Const.MinPointSize,
+                       ctx->Const.MaxPointSize);
        R300_STATECHANGE(r300, lcntl);
        r300->hw.lcntl.cmd[1] =
            R300_LINE_CNT_HO | R300_LINE_CNT_VE | (int)(widthf * 6.0);
@@ -1566,30 +1567,31 @@ static void r300SetupDefaultVertexProgram(r300ContextPtr rmesa)
 
        for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_MAX; i++) {
                if (rmesa->state.sw_tcl_inputs[i] != -1) {
-                       prog->program.body.i[program_end].opcode = EASY_VSF_OP(MUL, o_reg++, ALL, RESULT);
-                       prog->program.body.i[program_end].src[0] = VSF_REG(rmesa->state.sw_tcl_inputs[i]);
-                       prog->program.body.i[program_end].src[1] = VSF_ATTR_UNITY(rmesa->state.sw_tcl_inputs[i]);
-                       prog->program.body.i[program_end].src[2] = VSF_UNITY(rmesa->state.sw_tcl_inputs[i]);
-                       program_end++;
+                       prog->program.body.i[program_end + 0] = EASY_VSF_OP(MUL, o_reg++, ALL, RESULT);
+                       prog->program.body.i[program_end + 1] = VSF_REG(rmesa->state.sw_tcl_inputs[i]);
+                       prog->program.body.i[program_end + 2] = VSF_ATTR_UNITY(rmesa->state.sw_tcl_inputs[i]);
+                       prog->program.body.i[program_end + 3] = VSF_UNITY(rmesa->state.sw_tcl_inputs[i]);
+                       program_end += 4;
                }
        }
 
-       prog->program.length = program_end * 4;
+       prog->program.length = program_end;
 
-       r300SetupVertexProgramFragment(rmesa, R300_PVS_UPLOAD_PROGRAM, &(prog->program));
+       r300SetupVertexProgramFragment(rmesa, R300_PVS_UPLOAD_PROGRAM,
+                                      &(prog->program));
        inst_count = (prog->program.length / 4) - 1;
 
        R300_STATECHANGE(rmesa, pvs);
        rmesa->hw.pvs.cmd[R300_PVS_CNTL_1] =
-         (0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) |
-         (inst_count << R300_PVS_CNTL_1_POS_END_SHIFT) |
-         (inst_count << R300_PVS_CNTL_1_PROGRAM_END_SHIFT);
+           (0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) |
+           (inst_count << R300_PVS_CNTL_1_POS_END_SHIFT) |
+           (inst_count << R300_PVS_CNTL_1_PROGRAM_END_SHIFT);
        rmesa->hw.pvs.cmd[R300_PVS_CNTL_2] =
-         (0 << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT) |
-         (param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT);
+           (0 << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT) |
+           (param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT);
        rmesa->hw.pvs.cmd[R300_PVS_CNTL_3] =
-         (inst_count << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT) |
-         (inst_count << R300_PVS_CNTL_3_PROGRAM_UNKNOWN2_SHIFT);
+           (inst_count << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT) |
+           (inst_count << R300_PVS_CNTL_3_PROGRAM_UNKNOWN2_SHIFT);
 }
 
 static void r300SetupRealVertexProgram(r300ContextPtr rmesa)
index 0fb6110494be23f1351db7a12b9bcab4cc25870d..7d4e8c95112b1e0ce5410f139cbaafb37ed51923 100644 (file)
@@ -31,6 +31,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
  * \author Aapo Tahkola <aet@rasterburn.org>
  *
  * \author Oliver McFadden <z3ro.geek@gmail.com>
+ *
+ * For a description of the vertex program instruction set see r300_reg.h.
  */
 
 #include "glheader.h"
@@ -366,20 +368,19 @@ static GLboolean valid_dst(struct r300_vertex_program *vp,
  * component.
  */
 
-static void t_opcode_abs(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_abs(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
        //MAX RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W
 
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_MAX, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] =
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] =
            MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
                            t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
                            t_swizzle(GET_SWZ(src[0].Swizzle, 1)),
@@ -389,13 +390,14 @@ static void t_opcode_abs(struct r300_vertex_program *vp,
                            (!src[0].
                             NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) |
            (src[0].RelAddr << 4);
-       o_inst->src[2] = 0;
+       inst[3] = 0;
+
+       return inst;
 }
 
-static void t_opcode_add(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_add(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
        unsigned long hw_op;
 
@@ -405,53 +407,55 @@ static void t_opcode_add(struct r300_vertex_program *vp,
                 PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 :
            R300_VPI_OUT_OP_MAD;
 
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
-       o_inst->src[0] = ONE_SRC_0;
-       o_inst->src[1] = t_src(vp, &src[0]);
-       o_inst->src[2] = t_src(vp, &src[1]);
+       inst[1] = ONE_SRC_0;
+       inst[2] = t_src(vp, &src[0]);
+       inst[3] = t_src(vp, &src[1]);
 #else
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = t_src(vp, &src[1]);
-       o_inst->src[2] = ZERO_SRC_1;
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = t_src(vp, &src[1]);
+       inst[3] = ZERO_SRC_1;
 
 #endif
+
+       return inst;
 }
 
-static void t_opcode_arl(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_arl(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_ARL, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = ZERO_SRC_0;
-       o_inst->src[2] = ZERO_SRC_0;
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = ZERO_SRC_0;
+       inst[3] = ZERO_SRC_0;
+
+       return inst;
 }
 
-static void t_opcode_dp3(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_dp3(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
        //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ZERO} PARAM 0{} {X Y Z ZERO}
 
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] =
+       inst[1] =
            MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
                            t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
                            t_swizzle(GET_SWZ(src[0].Swizzle, 1)),
@@ -461,7 +465,7 @@ static void t_opcode_dp3(struct r300_vertex_program *vp,
                            NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) |
            (src[0].RelAddr << 4);
 
-       o_inst->src[1] =
+       inst[2] =
            MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
                            t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
                            t_swizzle(GET_SWZ(src[1].Swizzle, 1)),
@@ -471,36 +475,38 @@ static void t_opcode_dp3(struct r300_vertex_program *vp,
                            NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) |
            (src[1].RelAddr << 4);
 
-       o_inst->src[2] = ZERO_SRC_1;
+       inst[3] = ZERO_SRC_1;
+
+       return inst;
 }
 
-static void t_opcode_dp4(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_dp4(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = t_src(vp, &src[1]);
-       o_inst->src[2] = ZERO_SRC_1;
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = t_src(vp, &src[1]);
+       inst[3] = ZERO_SRC_1;
+
+       return inst;
 }
 
-static void t_opcode_dph(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_dph(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
        //DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ONE} PARAM 0{} {X Y Z W}
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] =
+       inst[1] =
            MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
                            t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
                            t_swizzle(GET_SWZ(src[0].Swizzle, 1)),
@@ -509,81 +515,84 @@ static void t_opcode_dph(struct r300_vertex_program *vp,
                            src[0].
                            NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) |
            (src[0].RelAddr << 4);
-       o_inst->src[1] = t_src(vp, &src[1]);
-       o_inst->src[2] = ZERO_SRC_1;
+       inst[2] = t_src(vp, &src[1]);
+       inst[3] = ZERO_SRC_1;
+
+       return inst;
 }
 
-static void t_opcode_dst(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_dst(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_DST, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = t_src(vp, &src[1]);
-       o_inst->src[2] = ZERO_SRC_1;
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = t_src(vp, &src[1]);
+       inst[3] = ZERO_SRC_1;
+
+       return inst;
 }
 
-static void t_opcode_ex2(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_ex2(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_EX2, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src_scalar(vp, &src[0]);
-       o_inst->src[1] = ZERO_SRC_0;
-       o_inst->src[2] = ZERO_SRC_0;
+       inst[1] = t_src_scalar(vp, &src[0]);
+       inst[2] = ZERO_SRC_0;
+       inst[3] = ZERO_SRC_0;
+
+       return inst;
 }
 
-static void t_opcode_exp(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_exp(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_EXP, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src_scalar(vp, &src[0]);
-       o_inst->src[1] = ZERO_SRC_0;
-       o_inst->src[2] = ZERO_SRC_0;
+       inst[1] = t_src_scalar(vp, &src[0]);
+       inst[2] = ZERO_SRC_0;
+       inst[3] = ZERO_SRC_0;
+
+       return inst;
 }
 
-static struct r300_vertprog_instruction *t_opcode_flr(struct r300_vertex_program *vp,
-                                                     struct prog_instruction *vpi,
-                                                     struct r300_vertprog_instruction *o_inst,
-                                                     struct prog_src_register src[3],
-                                                     int *u_temp_i)
+static GLuint *t_opcode_flr(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3], int *u_temp_i)
 {
        /* FRC TMP 0.X Y Z W PARAM 0{} {X Y Z W}
           ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} TMP 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W */
 
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_FRC, *u_temp_i,
                        t_dst_mask(vpi->DstReg.WriteMask),
                        VSF_OUT_CLASS_TMP);
 
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = ZERO_SRC_0;
-       o_inst->src[2] = ZERO_SRC_0;
-       o_inst++;
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = ZERO_SRC_0;
+       inst[3] = ZERO_SRC_0;
+       inst += 4;
 
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] =
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] =
            MAKE_VSF_SOURCE(*u_temp_i, VSF_IN_COMPONENT_X,
                            VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z,
                            VSF_IN_COMPONENT_W, VSF_IN_CLASS_TMP,
@@ -592,40 +601,40 @@ static struct r300_vertprog_instruction *t_opcode_flr(struct r300_vertex_program
                             NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE
                            /*VSF_FLAG_ALL */ );
 
-       o_inst->src[2] = ZERO_SRC_0;
+       inst[3] = ZERO_SRC_0;
        (*u_temp_i)--;
 
-       return o_inst;
+       return inst;
 }
 
-static void t_opcode_frc(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_frc(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_FRC, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = ZERO_SRC_0;
-       o_inst->src[2] = ZERO_SRC_0;
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = ZERO_SRC_0;
+       inst[3] = ZERO_SRC_0;
+
+       return inst;
 }
 
-static void t_opcode_lg2(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_lg2(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
        // LG2 RESULT 1.X Y Z W PARAM 0{} {X X X X}
 
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_LG2, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] =
+       inst[1] =
            MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
                            t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
                            t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
@@ -635,70 +644,70 @@ static void t_opcode_lg2(struct r300_vertex_program *vp,
                            src[0].
                            NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) |
            (src[0].RelAddr << 4);
-       o_inst->src[1] = ZERO_SRC_0;
-       o_inst->src[2] = ZERO_SRC_0;
+       inst[2] = ZERO_SRC_0;
+       inst[3] = ZERO_SRC_0;
+
+       return inst;
 }
 
-static void t_opcode_lit(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_lit(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
        //LIT TMP 1.Y Z TMP 1{} {X W Z Y} TMP 1{} {Y W Z X} TMP 1{} {Y X Z W}
 
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_LIT, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
        /* NOTE: Users swizzling might not work. */
-       o_inst->src[0] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)),       // x
-                                        t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
-                                        VSF_IN_COMPONENT_ZERO, // z
-                                        t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
-                                        t_src_class(src[0].File),
-                                        src[0].
-                                        NegateBase ? VSF_FLAG_ALL :
-                                        VSF_FLAG_NONE) | (src[0].
-                                                          RelAddr << 4);
-       o_inst->src[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)),       // y
-                                        t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
-                                        VSF_IN_COMPONENT_ZERO, // z
-                                        t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
-                                        t_src_class(src[0].File),
-                                        src[0].
-                                        NegateBase ? VSF_FLAG_ALL :
-                                        VSF_FLAG_NONE) | (src[0].
-                                                          RelAddr << 4);
-       o_inst->src[2] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)),       // y
-                                        t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
-                                        VSF_IN_COMPONENT_ZERO, // z
-                                        t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
-                                        t_src_class(src[0].File),
-                                        src[0].
-                                        NegateBase ? VSF_FLAG_ALL :
-                                        VSF_FLAG_NONE) | (src[0].
-                                                          RelAddr << 4);
+       inst[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 0)),      // x
+                                 t_swizzle(GET_SWZ(src[0].Swizzle, 3)),        // w
+                                 VSF_IN_COMPONENT_ZERO,        // z
+                                 t_swizzle(GET_SWZ(src[0].Swizzle, 1)),        // y
+                                 t_src_class(src[0].File),
+                                 src[0].
+                                 NegateBase ? VSF_FLAG_ALL :
+                                 VSF_FLAG_NONE) | (src[0].RelAddr << 4);
+       inst[2] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)),      // y
+                                 t_swizzle(GET_SWZ(src[0].Swizzle, 3)),        // w
+                                 VSF_IN_COMPONENT_ZERO,        // z
+                                 t_swizzle(GET_SWZ(src[0].Swizzle, 0)),        // x
+                                 t_src_class(src[0].File),
+                                 src[0].
+                                 NegateBase ? VSF_FLAG_ALL :
+                                 VSF_FLAG_NONE) | (src[0].RelAddr << 4);
+       inst[3] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)),      // y
+                                 t_swizzle(GET_SWZ(src[0].Swizzle, 0)),        // x
+                                 VSF_IN_COMPONENT_ZERO,        // z
+                                 t_swizzle(GET_SWZ(src[0].Swizzle, 3)),        // w
+                                 t_src_class(src[0].File),
+                                 src[0].
+                                 NegateBase ? VSF_FLAG_ALL :
+                                 VSF_FLAG_NONE) | (src[0].RelAddr << 4);
+
+       return inst;
 }
 
-static void t_opcode_log(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_log(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_LOG, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src_scalar(vp, &src[0]);
-       o_inst->src[1] = ZERO_SRC_0;
-       o_inst->src[2] = ZERO_SRC_0;
+       inst[1] = t_src_scalar(vp, &src[0]);
+       inst[2] = ZERO_SRC_0;
+       inst[3] = ZERO_SRC_0;
+
+       return inst;
 }
 
-static void t_opcode_mad(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_mad(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
        unsigned long hw_op;
 
@@ -708,80 +717,84 @@ static void t_opcode_mad(struct r300_vertex_program *vp,
                 PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 :
            R300_VPI_OUT_OP_MAD;
 
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = t_src(vp, &src[1]);
-       o_inst->src[2] = t_src(vp, &src[2]);
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = t_src(vp, &src[1]);
+       inst[3] = t_src(vp, &src[2]);
+
+       return inst;
 }
 
-static void t_opcode_max(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_max(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_MAX, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = t_src(vp, &src[1]);
-       o_inst->src[2] = ZERO_SRC_1;
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = t_src(vp, &src[1]);
+       inst[3] = ZERO_SRC_1;
+
+       return inst;
 }
 
-static void t_opcode_min(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_min(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_MIN, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = t_src(vp, &src[1]);
-       o_inst->src[2] = ZERO_SRC_1;
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = t_src(vp, &src[1]);
+       inst[3] = ZERO_SRC_1;
+
+       return inst;
 }
 
-static void t_opcode_mov(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_mov(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
        //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO}
 
 #if 1
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = ZERO_SRC_0;
-       o_inst->src[2] = ZERO_SRC_0;
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = ZERO_SRC_0;
+       inst[3] = ZERO_SRC_0;
 #else
        hw_op =
            (src[0].File ==
             PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 :
            R300_VPI_OUT_OP_MAD;
 
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = ONE_SRC_0;
-       o_inst->src[2] = ZERO_SRC_0;
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = ONE_SRC_0;
+       inst[3] = ZERO_SRC_0;
 #endif
+
+       return inst;
 }
 
-static void t_opcode_mul(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_mul(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
        unsigned long hw_op;
 
@@ -792,94 +805,100 @@ static void t_opcode_mul(struct r300_vertex_program *vp,
                 PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 :
            R300_VPI_OUT_OP_MAD;
 
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = t_src(vp, &src[1]);
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = t_src(vp, &src[1]);
+
+       inst[3] = ZERO_SRC_1;
 
-       o_inst->src[2] = ZERO_SRC_1;
+       return inst;
 }
 
-static void t_opcode_pow(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_pow(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_POW, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
-       o_inst->src[0] = t_src_scalar(vp, &src[0]);
-       o_inst->src[1] = ZERO_SRC_0;
-       o_inst->src[2] = t_src_scalar(vp, &src[1]);
+       inst[1] = t_src_scalar(vp, &src[0]);
+       inst[2] = ZERO_SRC_0;
+       inst[3] = t_src_scalar(vp, &src[1]);
+
+       return inst;
 }
 
-static void t_opcode_rcp(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_rcp(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_RCP, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src_scalar(vp, &src[0]);
-       o_inst->src[1] = ZERO_SRC_0;
-       o_inst->src[2] = ZERO_SRC_0;
+       inst[1] = t_src_scalar(vp, &src[0]);
+       inst[2] = ZERO_SRC_0;
+       inst[3] = ZERO_SRC_0;
+
+       return inst;
 }
 
-static void t_opcode_rsq(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_rsq(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_RSQ, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src_scalar(vp, &src[0]);
-       o_inst->src[1] = ZERO_SRC_0;
-       o_inst->src[2] = ZERO_SRC_0;
+       inst[1] = t_src_scalar(vp, &src[0]);
+       inst[2] = ZERO_SRC_0;
+       inst[3] = ZERO_SRC_0;
+
+       return inst;
 }
 
-static void t_opcode_sge(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_sge(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_SGE, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = t_src(vp, &src[1]);
-       o_inst->src[2] = ZERO_SRC_1;
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = t_src(vp, &src[1]);
+       inst[3] = ZERO_SRC_1;
+
+       return inst;
 }
 
-static void t_opcode_slt(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_slt(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_SLT, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = t_src(vp, &src[1]);
-       o_inst->src[2] = ZERO_SRC_1;
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = t_src(vp, &src[1]);
+       inst[3] = ZERO_SRC_1;
+
+       return inst;
 }
 
-static void t_opcode_sub(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_sub(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
        unsigned long hw_op;
 
@@ -891,13 +910,13 @@ static void t_opcode_sub(struct r300_vertex_program *vp,
                 PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 :
            R300_VPI_OUT_OP_MAD;
 
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = ONE_SRC_0;
-       o_inst->src[2] =
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = ONE_SRC_0;
+       inst[3] =
            MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
                            t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
                            t_swizzle(GET_SWZ(src[1].Swizzle, 1)),
@@ -908,13 +927,13 @@ static void t_opcode_sub(struct r300_vertex_program *vp,
                             NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) |
            (src[1].RelAddr << 4);
 #else
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] =
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] =
            MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
                            t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
                            t_swizzle(GET_SWZ(src[1].Swizzle, 1)),
@@ -924,113 +943,110 @@ static void t_opcode_sub(struct r300_vertex_program *vp,
                            (!src[1].
                             NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) |
            (src[1].RelAddr << 4);
-       o_inst->src[2] = 0;
+       inst[3] = 0;
 #endif
+
+       return inst;
 }
 
-static void t_opcode_swz(struct r300_vertex_program *vp,
-                        struct prog_instruction *vpi,
-                        struct r300_vertprog_instruction *o_inst,
-                        struct prog_src_register src[3])
+static GLuint *t_opcode_swz(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3])
 {
        //ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO}
 
 #if 1
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = ZERO_SRC_0;
-       o_inst->src[2] = ZERO_SRC_0;
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = ZERO_SRC_0;
+       inst[3] = ZERO_SRC_0;
 #else
        hw_op =
            (src[0].File ==
             PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 :
            R300_VPI_OUT_OP_MAD;
 
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
-       o_inst->src[0] = t_src(vp, &src[0]);
-       o_inst->src[1] = ONE_SRC_0;
-       o_inst->src[2] = ZERO_SRC_0;
+       inst[1] = t_src(vp, &src[0]);
+       inst[2] = ONE_SRC_0;
+       inst[3] = ZERO_SRC_0;
 #endif
+
+       return inst;
 }
 
-static struct r300_vertprog_instruction *t_opcode_xpd(struct r300_vertex_program *vp,
-                                                     struct prog_instruction *vpi,
-                                                     struct r300_vertprog_instruction *o_inst,
-                                                     struct prog_src_register src[3],
-                                                     int *u_temp_i)
+static GLuint *t_opcode_xpd(struct r300_vertex_program *vp,
+                           struct prog_instruction *vpi, GLuint * inst,
+                           struct prog_src_register src[3], int *u_temp_i)
 {
        /* mul r0, r1.yzxw, r2.zxyw
           mad r0, -r2.yzxw, r1.zxyw, r0
           NOTE: might need MAD_2
         */
 
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, *u_temp_i,
                        t_dst_mask(vpi->DstReg.WriteMask),
                        VSF_OUT_CLASS_TMP);
 
-       o_inst->src[0] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)),       // y
-                                        t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
-                                        t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
-                                        t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
-                                        t_src_class(src[0].File),
-                                        src[0].
-                                        NegateBase ? VSF_FLAG_ALL :
-                                        VSF_FLAG_NONE) | (src[0].
-                                                          RelAddr << 4);
-
-       o_inst->src[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 2)),       // z
-                                        t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x
-                                        t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y
-                                        t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w
-                                        t_src_class(src[1].File),
-                                        src[1].
-                                        NegateBase ? VSF_FLAG_ALL :
-                                        VSF_FLAG_NONE) | (src[1].
-                                                          RelAddr << 4);
-
-       o_inst->src[2] = ZERO_SRC_1;
-       o_inst++;
+       inst[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 1)),      // y
+                                 t_swizzle(GET_SWZ(src[0].Swizzle, 2)),        // z
+                                 t_swizzle(GET_SWZ(src[0].Swizzle, 0)),        // x
+                                 t_swizzle(GET_SWZ(src[0].Swizzle, 3)),        // w
+                                 t_src_class(src[0].File),
+                                 src[0].
+                                 NegateBase ? VSF_FLAG_ALL :
+                                 VSF_FLAG_NONE) | (src[0].RelAddr << 4);
+
+       inst[2] = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 2)),      // z
+                                 t_swizzle(GET_SWZ(src[1].Swizzle, 0)),        // x
+                                 t_swizzle(GET_SWZ(src[1].Swizzle, 1)),        // y
+                                 t_swizzle(GET_SWZ(src[1].Swizzle, 3)),        // w
+                                 t_src_class(src[1].File),
+                                 src[1].
+                                 NegateBase ? VSF_FLAG_ALL :
+                                 VSF_FLAG_NONE) | (src[1].RelAddr << 4);
+
+       inst[3] = ZERO_SRC_1;
+       inst += 4;
        (*u_temp_i)--;
 
-       o_inst->opcode =
+       inst[0] =
            MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, t_dst_index(vp, &vpi->DstReg),
                        t_dst_mask(vpi->DstReg.WriteMask),
                        t_dst_class(vpi->DstReg.File));
 
-       o_inst->src[0] = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 1)),       // y
-                                        t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z
-                                        t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x
-                                        t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w
-                                        t_src_class(src[1].File),
-                                        (!src[1].
-                                         NegateBase) ? VSF_FLAG_ALL :
-                                        VSF_FLAG_NONE) | (src[1].
-                                                          RelAddr << 4);
-
-       o_inst->src[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 2)),       // z
-                                        t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
-                                        t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
-                                        t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
-                                        t_src_class(src[0].File),
-                                        src[0].
-                                        NegateBase ? VSF_FLAG_ALL :
-                                        VSF_FLAG_NONE) | (src[0].
-                                                          RelAddr << 4);
-
-       o_inst->src[2] =
+       inst[1] = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), t_swizzle(GET_SWZ(src[1].Swizzle, 1)),      // y
+                                 t_swizzle(GET_SWZ(src[1].Swizzle, 2)),        // z
+                                 t_swizzle(GET_SWZ(src[1].Swizzle, 0)),        // x
+                                 t_swizzle(GET_SWZ(src[1].Swizzle, 3)),        // w
+                                 t_src_class(src[1].File),
+                                 (!src[1].
+                                  NegateBase) ? VSF_FLAG_ALL :
+                                 VSF_FLAG_NONE) | (src[1].RelAddr << 4);
+
+       inst[2] = MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), t_swizzle(GET_SWZ(src[0].Swizzle, 2)),      // z
+                                 t_swizzle(GET_SWZ(src[0].Swizzle, 0)),        // x
+                                 t_swizzle(GET_SWZ(src[0].Swizzle, 1)),        // y
+                                 t_swizzle(GET_SWZ(src[0].Swizzle, 3)),        // w
+                                 t_src_class(src[0].File),
+                                 src[0].
+                                 NegateBase ? VSF_FLAG_ALL :
+                                 VSF_FLAG_NONE) | (src[0].RelAddr << 4);
+
+       inst[3] =
            MAKE_VSF_SOURCE(*u_temp_i + 1, VSF_IN_COMPONENT_X,
                            VSF_IN_COMPONENT_Y, VSF_IN_COMPONENT_Z,
                            VSF_IN_COMPONENT_W, VSF_IN_CLASS_TMP,
                            VSF_FLAG_NONE);
 
-       return o_inst;
+       return inst;
 }
 
 static void t_inputs_outputs(struct r300_vertex_program *vp)
@@ -1067,7 +1083,7 @@ static void t_inputs_outputs(struct r300_vertex_program *vp)
        if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0)) {
                vp->outputs[VERT_RESULT_BFC0] =
                    vp->outputs[VERT_RESULT_COL0] + 2;
-               cur_reg = vp->outputs[VERT_RESULT_BFC0] + 1;
+               cur_reg = vp->outputs[VERT_RESULT_BFC0] + 2;
        }
 
        if (vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1)) {
@@ -1092,7 +1108,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
                                      struct prog_instruction *vpi)
 {
        int i;
-       struct r300_vertprog_instruction *o_inst;
+       GLuint *inst;
        unsigned long num_operands;
        /* Initial value should be last tmp reg that hw supports.
           Strangely enough r300 doesnt mind even though these would be out of range.
@@ -1108,8 +1124,8 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
 
        t_inputs_outputs(vp);
 
-       for (o_inst = vp->program.body.i; vpi->Opcode != OPCODE_END;
-            vpi++, o_inst++) {
+       for (inst = vp->program.body.i; vpi->Opcode != OPCODE_END;
+            vpi++, inst += 4) {
 
                FREE_TEMPS();
 
@@ -1129,12 +1145,12 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
                if (num_operands == 3) {        /* TODO: scalars */
                        if (CMP_SRCS(src[1], src[2])
                            || CMP_SRCS(src[0], src[2])) {
-                               o_inst->opcode =
+                               inst[0] =
                                    MAKE_VSF_OP(R300_VPI_OUT_OP_ADD,
                                                u_temp_i, VSF_FLAG_ALL,
                                                VSF_OUT_CLASS_TMP);
 
-                               o_inst->src[0] =
+                               inst[1] =
                                    MAKE_VSF_SOURCE(t_src_index
                                                    (vp, &src[2]),
                                                    SWIZZLE_X, SWIZZLE_Y,
@@ -1144,9 +1160,9 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
                                                    VSF_FLAG_NONE) |
                                    (src[2].RelAddr << 4);
 
-                               o_inst->src[1] = ZERO_SRC_2;
-                               o_inst->src[2] = ZERO_SRC_2;
-                               o_inst++;
+                               inst[2] = ZERO_SRC_2;
+                               inst[3] = ZERO_SRC_2;
+                               inst += 4;
 
                                src[2].File = PROGRAM_TEMPORARY;
                                src[2].Index = u_temp_i;
@@ -1157,12 +1173,12 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
 
                if (num_operands >= 2) {
                        if (CMP_SRCS(src[1], src[0])) {
-                               o_inst->opcode =
+                               inst[0] =
                                    MAKE_VSF_OP(R300_VPI_OUT_OP_ADD,
                                                u_temp_i, VSF_FLAG_ALL,
                                                VSF_OUT_CLASS_TMP);
 
-                               o_inst->src[0] =
+                               inst[1] =
                                    MAKE_VSF_SOURCE(t_src_index
                                                    (vp, &src[0]),
                                                    SWIZZLE_X, SWIZZLE_Y,
@@ -1172,9 +1188,9 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
                                                    VSF_FLAG_NONE) |
                                    (src[0].RelAddr << 4);
 
-                               o_inst->src[1] = ZERO_SRC_0;
-                               o_inst->src[2] = ZERO_SRC_0;
-                               o_inst++;
+                               inst[2] = ZERO_SRC_0;
+                               inst[3] = ZERO_SRC_0;
+                               inst += 4;
 
                                src[0].File = PROGRAM_TEMPORARY;
                                src[0].Index = u_temp_i;
@@ -1185,87 +1201,89 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
 
                switch (vpi->Opcode) {
                case OPCODE_ABS:
-                       t_opcode_abs(vp, vpi, o_inst, src);
+                       inst = t_opcode_abs(vp, vpi, inst, src);
                        break;
                case OPCODE_ADD:
-                       t_opcode_add(vp, vpi, o_inst, src);
+                       inst = t_opcode_add(vp, vpi, inst, src);
                        break;
                case OPCODE_ARL:
-                       t_opcode_arl(vp, vpi, o_inst, src);
+                       inst = t_opcode_arl(vp, vpi, inst, src);
                        break;
                case OPCODE_DP3:
-                       t_opcode_dp3(vp, vpi, o_inst, src);
+                       inst = t_opcode_dp3(vp, vpi, inst, src);
                        break;
                case OPCODE_DP4:
-                       t_opcode_dp4(vp, vpi, o_inst, src);
+                       inst = t_opcode_dp4(vp, vpi, inst, src);
                        break;
                case OPCODE_DPH:
-                       t_opcode_dph(vp, vpi, o_inst, src);
+                       inst = t_opcode_dph(vp, vpi, inst, src);
                        break;
                case OPCODE_DST:
-                       t_opcode_dst(vp, vpi, o_inst, src);
+                       inst = t_opcode_dst(vp, vpi, inst, src);
                        break;
                case OPCODE_EX2:
-                       t_opcode_ex2(vp, vpi, o_inst, src);
+                       inst = t_opcode_ex2(vp, vpi, inst, src);
                        break;
                case OPCODE_EXP:
-                       t_opcode_exp(vp, vpi, o_inst, src);
+                       inst = t_opcode_exp(vp, vpi, inst, src);
                        break;
                case OPCODE_FLR:
-                       /* FIXME */
-                       o_inst = t_opcode_flr(vp, vpi, o_inst, src, &u_temp_i);
+                       inst =
+                           t_opcode_flr(vp, vpi, inst, src, /* FIXME */
+                                        &u_temp_i);
                        break;
                case OPCODE_FRC:
-                       t_opcode_frc(vp, vpi, o_inst, src);
+                       inst = t_opcode_frc(vp, vpi, inst, src);
                        break;
                case OPCODE_LG2:
-                       t_opcode_lg2(vp, vpi, o_inst, src);
+                       inst = t_opcode_lg2(vp, vpi, inst, src);
                        break;
                case OPCODE_LIT:
-                       t_opcode_lit(vp, vpi, o_inst, src);
+                       inst = t_opcode_lit(vp, vpi, inst, src);
                        break;
                case OPCODE_LOG:
-                       t_opcode_log(vp, vpi, o_inst, src);
+                       inst = t_opcode_log(vp, vpi, inst, src);
                        break;
                case OPCODE_MAD:
-                       t_opcode_mad(vp, vpi, o_inst, src);
+                       inst = t_opcode_mad(vp, vpi, inst, src);
                        break;
                case OPCODE_MAX:
-                       t_opcode_max(vp, vpi, o_inst, src);
+                       inst = t_opcode_max(vp, vpi, inst, src);
                        break;
                case OPCODE_MIN:
-                       t_opcode_min(vp, vpi, o_inst, src);
+                       inst = t_opcode_min(vp, vpi, inst, src);
                        break;
                case OPCODE_MOV:
-                       t_opcode_mov(vp, vpi, o_inst, src);
+                       inst = t_opcode_mov(vp, vpi, inst, src);
                        break;
                case OPCODE_MUL:
-                       t_opcode_mul(vp, vpi, o_inst, src);
+                       inst = t_opcode_mul(vp, vpi, inst, src);
                        break;
                case OPCODE_POW:
-                       t_opcode_pow(vp, vpi, o_inst, src);
+                       inst = t_opcode_pow(vp, vpi, inst, src);
                        break;
                case OPCODE_RCP:
-                       t_opcode_rcp(vp, vpi, o_inst, src);
+                       inst = t_opcode_rcp(vp, vpi, inst, src);
                        break;
                case OPCODE_RSQ:
-                       t_opcode_rsq(vp, vpi, o_inst, src);
+                       inst = t_opcode_rsq(vp, vpi, inst, src);
                        break;
                case OPCODE_SGE:
-                       t_opcode_sge(vp, vpi, o_inst, src);
+                       inst = t_opcode_sge(vp, vpi, inst, src);
                        break;
                case OPCODE_SLT:
-                       t_opcode_slt(vp, vpi, o_inst, src);
+                       inst = t_opcode_slt(vp, vpi, inst, src);
                        break;
                case OPCODE_SUB:
-                       t_opcode_sub(vp, vpi, o_inst, src);
+                       inst = t_opcode_sub(vp, vpi, inst, src);
                        break;
                case OPCODE_SWZ:
-                       t_opcode_swz(vp, vpi, o_inst, src);
+                       inst = t_opcode_swz(vp, vpi, inst, src);
                        break;
                case OPCODE_XPD:
-                       /* FIXME */
-                       o_inst = t_opcode_xpd(vp, vpi, o_inst, src, &u_temp_i);
+                       inst =
+                           t_opcode_xpd(vp, vpi, inst, src, /* FIXME */
+                                        &u_temp_i);
                        break;
                default:
                        assert(0);
@@ -1273,7 +1291,7 @@ static void r300TranslateVertexShader(struct r300_vertex_program *vp,
                }
        }
 
-       vp->program.length = (o_inst - vp->program.body.i) * 4;
+       vp->program.length = (inst - vp->program.body.i);
        if (vp->program.length >= VSF_MAX_FRAGMENT_LENGTH) {
                vp->program.length = 0;
                vp->native = GL_FALSE;
index 2d399e243a89bebb5f71af36393494c8d68cc9b6..3df0eee799108b83af29504abea50bc85593ade9 100644 (file)
@@ -3,11 +3,6 @@
 
 #include "r300_reg.h"
 
-struct r300_vertprog_instruction {
-       GLuint opcode;
-       GLuint src[3];
-};
-
 #define VSF_FLAG_X     1
 #define VSF_FLAG_Y     2
 #define VSF_FLAG_Z     4
index 3dd821a4d396621a107c9eb6cf8a3a6ab8c98de6..4ce2f60b4f329d460eb03b7fd25193752639465c 100644 (file)
@@ -131,7 +131,9 @@ static __inline__ void savage_draw_point (savageContextPtr imesa,
    u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
    const GLfloat x = tmp->v.x;
    const GLfloat y = tmp->v.y;
-   const GLfloat sz = imesa->glCtx->Point._Size * .5;
+   const GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
+                                  imesa->glCtx->Const.MinPointSize,
+                                  imesa->glCtx->Const.MaxPointSize);
    GLuint j;
 
    *(float *)&vb[0] = x - sz;
@@ -164,7 +166,9 @@ static __inline__ void savage_draw_line (savageContextPtr imesa,
                                         savageVertexPtr v1 ) {
    GLuint vertsize = imesa->HwVertexSize;
    u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
-   GLfloat width = imesa->glCtx->Line._Width;
+   const GLfloat width = CLAMP(imesa->glCtx->Line.Width,
+                               imesa->glCtx->Const.MinLineWidth,
+                               imesa->glCtx->Const.MaxLineWidth);
    GLfloat dx, dy, ix, iy;
    GLuint j;
 
@@ -234,7 +238,9 @@ static __inline__ void savage_ptex_line (savageContextPtr imesa,
                                         savageVertexPtr v1 ) {
    GLuint vertsize = imesa->HwVertexSize;
    u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
-   GLfloat width = imesa->glCtx->Line._Width;
+   const GLfloat width = CLAMP(imesa->glCtx->Line.Width,
+                               imesa->glCtx->Const.MinLineWidth,
+                               imesa->glCtx->Const.MaxLineWidth);
    GLfloat dx, dy, ix, iy;
    savageVertex tmp0, tmp1;
    GLuint j;
@@ -281,7 +287,9 @@ static __inline__ void savage_ptex_point (savageContextPtr imesa,
    u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
    const GLfloat x = v0->v.x;
    const GLfloat y = v0->v.y;
-   const GLfloat sz = imesa->glCtx->Point._Size * .5;
+   const GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
+                                  imesa->glCtx->Const.MinPointSize,
+                                  imesa->glCtx->Const.MaxPointSize);
    savageVertex tmp;
    GLuint j;
 
index 96f9ae27fc1a63e9c81b272f92d2303b716127d9..7252a7e7dc6402304880c83627be974c74e389b7 100644 (file)
@@ -184,7 +184,7 @@ tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst)
       }
    }
 
-   dst->pointSize = ctx->Point._Size;
+   dst->pointSize = ctx->Point.Size;
 }
 
 
index fb23d210db7bc60de11f86349f355c143b219323..dad3dc116043c5bbc752e3bb1bdfd41233069a29 100644 (file)
 /* We're essentially building part of GDI here, so define this so that
  * we get the right export linkage. */
 #ifdef __MINGW32__
-#include <GL/gl.h>
+
+#include <stdarg.h>
+#include <windef.h>
+#include <wincon.h>
+#include <winbase.h>
+
+#  if defined(BUILD_GL32)
+#    define WINGDIAPI __declspec(dllexport)    
+#  else
+#    define __W32API_USE_DLLIMPORT__
+#  endif
+
+#include <wingdi.h>
+#include "GL/mesa_wgl.h"
 #include <stdlib.h>
+
 #else
+
 #define _GDI32_
-#endif
 #include <windows.h>
 
-#include "glapi.h"
+#endif
 
+#include "glapi.h"
 #include "GL/wmesa.h"   /* protos for wmesa* functions */
 
 /*
@@ -339,7 +354,7 @@ WINGDIAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc)
 }
 
 WINGDIAPI BOOL GLAPIENTRY wglSetPixelFormat(HDC hdc,int iPixelFormat,
-                                           const PIXELFORMATDESCRIPTOR *ppfd)
+                                       const PIXELFORMATDESCRIPTOR *ppfd)
 {
     (void) hdc;
     
@@ -392,12 +407,12 @@ static BOOL wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar,
     
     bitDevice = CreateCompatibleDC(fontDevice);
     
-    // Swap fore and back colors so the bitmap has the right polarity
+    /* Swap fore and back colors so the bitmap has the right polarity */
     tempColor = GetBkColor(bitDevice);
     SetBkColor(bitDevice, GetTextColor(bitDevice));
     SetTextColor(bitDevice, tempColor);
     
-    // Place chars based on base line
+    /* Place chars based on base line */
     VERIFY(SetTextAlign(bitDevice, TA_BASELINE) != GDI_ERROR ? 1 : 0);
     
     for(i = 0; i < (int)numChars; i++) {
@@ -410,36 +425,36 @@ static BOOL wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar,
        
        curChar = (char)(i + firstChar);
        
-       // Find how high/wide this character is
+       /* Find how high/wide this character is */
        VERIFY(GetTextExtentPoint32(bitDevice, &curChar, 1, &size));
        
-       // Create the output bitmap
+       /* Create the output bitmap */
        charWidth = size.cx;
        charHeight = size.cy;
-       // Round up to the next multiple of 32 bits
+       /* Round up to the next multiple of 32 bits */
        bmapWidth = ((charWidth + 31) / 32) * 32;   
        bmapHeight = charHeight;
        bitObject = CreateCompatibleBitmap(bitDevice,
                                           bmapWidth,
                                           bmapHeight);
-       //VERIFY(bitObject);
+       /* VERIFY(bitObject); */
        
-       // Assign the output bitmap to the device
+       /* Assign the output bitmap to the device */
        origBmap = SelectObject(bitDevice, bitObject);
        (void) VERIFY(origBmap);
        
        VERIFY( PatBlt( bitDevice, 0, 0, bmapWidth, bmapHeight,BLACKNESS ) );
        
-       // Use our source font on the device
+       /* Use our source font on the device */
        VERIFY(SelectObject(bitDevice, GetCurrentObject(fontDevice,OBJ_FONT)));
        
-       // Draw the character
+       /* Draw the character */
        VERIFY(TextOut(bitDevice, 0, metric.tmAscent, &curChar, 1));
        
-       // Unselect our bmap object
+       /* Unselect our bmap object */
        VERIFY(SelectObject(bitDevice, origBmap));
        
-       // Convert the display dependant representation to a 1 bit deep DIB
+       /* Convert the display dependant representation to a 1 bit deep DIB */
        numBytes = (bmapWidth * bmapHeight) / 8;
        bmap = malloc(numBytes);
        dibInfo->bmiHeader.biWidth = bmapWidth;
@@ -447,24 +462,24 @@ static BOOL wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar,
        res = GetDIBits(bitDevice, bitObject, 0, bmapHeight, bmap,
                        dibInfo,
                        DIB_RGB_COLORS);
-       //VERIFY(res);
+       /* VERIFY(res); */
        
-       // Create the GL object
+       /* Create the GL object */
        glNewList(i + listBase, GL_COMPILE);
        glBitmap(bmapWidth, bmapHeight, 0.0, (GLfloat)metric.tmDescent,
                 (GLfloat)charWidth, 0.0,
                 bmap);
        glEndList();
-       // CheckGL();
+       /* CheckGL(); */
        
-       // Destroy the bmap object
+       /* Destroy the bmap object */
        DeleteObject(bitObject);
        
-       // Deallocate the bitmap data
+       /* Deallocate the bitmap data */
        free(bmap);
     }
     
-    // Destroy the DC
+    /* Destroy the DC */
     VERIFY(DeleteDC(bitDevice));
     
     free(dibInfo);
index 2eec188912e28a425c77bf5212d97f4458aa192e..5b67439f0f2577f106e63491b698ff7b804132e0 100644 (file)
@@ -6,6 +6,7 @@
 #include "wmesadef.h"
 #include "colors.h"
 #include <GL/wmesa.h>
+#include <winuser.h>
 #include "context.h"
 #include "extensions.h"
 #include "framebuffer.h"
@@ -114,7 +115,7 @@ static void wmSetPixelFormat(WMesaFramebuffer pwfb, HDC hDC)
 {
     pwfb->cColorBits = GetDeviceCaps(hDC, BITSPIXEL);
 
-    // Only 16 and 32 bit targets are supported now
+    /* Only 16 and 32 bit targets are supported now */
     assert(pwfb->cColorBits == 0 ||
           pwfb->cColorBits == 16 || 
           pwfb->cColorBits == 32);
@@ -1171,7 +1172,7 @@ WMesaContext WMesaCreateContext(HDC hDC,
     /* I do not understand this contributed code */
     /* Support memory and device contexts */
     if(WindowFromDC(hDC) != NULL) {
-       c->hDC = GetDC(WindowFromDC(hDC)); // huh ????
+       c->hDC = GetDC(WindowFromDC(hDC)); /* huh ???? */
     }
     else {
        c->hDC = hDC;
@@ -1404,6 +1405,7 @@ void WMesaSwapBuffers( HDC hdc )
  * table entries.  Hopefully, I'll find a better solution.  The
  * dispatch table generation scripts ought to be making these dummy
  * stubs as well. */
+#if !defined(__MINGW32__) || !defined(GL_NO_STDCALL)
 void gl_dispatch_stub_543(void){}
 void gl_dispatch_stub_544(void){}
 void gl_dispatch_stub_545(void){}
@@ -1471,3 +1473,4 @@ void gl_dispatch_stub_769(void){}
 void gl_dispatch_stub_770(void){}
 void gl_dispatch_stub_771(void){}
 
+#endif
index 97b063a8babbf2bc3d80e5c375e0c30eac49afd6..83a42e608241d2ddf0913278d08e0ab2039d11a4 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef WMESADEF_H
 #define WMESADEF_H
-
+#ifdef __MINGW32__
+#include <windows.h>
+#endif
 #include "context.h"
 
 
index 1587df66bcd48f1ce8e8db76427d1cc30826326b..7a170b4d3d10b7e0eb3fddd5b9e03bc4397e10ff 100644 (file)
@@ -296,6 +296,11 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
       }
    }
 
+   if (stereoFlag) {
+      /* stereo not supported */
+      return NULL;
+   }
+
    /* Comparing IDs uses less memory but sometimes fails. */
    /* XXX revisit this after 3.0 is finished. */
    if (_mesa_getenv("MESA_GLX_VISUAL_HACK"))
@@ -1079,7 +1084,7 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
             else {
                stereo_flag = GL_TRUE;
             }
-            return NULL; /* stereo not supported */
+            break;
         case GLX_AUX_BUFFERS:
            parselist++;
             numAux = *parselist++;
index 1aa0a02fc789d894368d27d9cabcc1c291a5d653..b422198f929c1b71e4c958043f64f81e01947b73 100644 (file)
@@ -98,9 +98,13 @@ _mesa_PushAttrib(GLbitfield mask)
    }
 
    if (mask & GL_COLOR_BUFFER_BIT) {
+      GLuint i;
       struct gl_colorbuffer_attrib *attr;
       attr = MALLOC_STRUCT( gl_colorbuffer_attrib );
       MEMCPY( attr, &ctx->Color, sizeof(struct gl_colorbuffer_attrib) );
+      /* push the Draw FBO's DrawBuffer[] state, not ctx->Color.DrawBuffer[] */
+      for (i = 0; i < ctx->Const.MaxDrawBuffers; i ++)
+         attr->DrawBuffer[i] = ctx->DrawBuffer->ColorDrawBuffer[i];
       newnode = new_attrib_node( GL_COLOR_BUFFER_BIT );
       newnode->data = attr;
       newnode->next = head;
index c280f89e1d1ba15e0735ec25d102fed5747fb335..0e6ca8ea1c2053f850b180cbb9a4218299536403 100644 (file)
@@ -370,6 +370,14 @@ _mesa_DrawBuffer(GLenum buffer)
 
    /* if we get here, there's no error so set new state */
    _mesa_drawbuffers(ctx, 1, &buffer, &destMask);
+
+   /*
+    * Call device driver function.
+    */
+   if (ctx->Driver.DrawBuffers)
+      ctx->Driver.DrawBuffers(ctx, 1, &buffer);
+   else if (ctx->Driver.DrawBuffer)
+      ctx->Driver.DrawBuffer(ctx, buffer);
 }
 
 
@@ -435,6 +443,14 @@ _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers)
 
    /* OK, if we get here, there were no errors so set the new state */
    _mesa_drawbuffers(ctx, n, buffers, destMask);
+
+   /*
+    * Call device driver function.
+    */
+   if (ctx->Driver.DrawBuffers)
+      ctx->Driver.DrawBuffers(ctx, n, buffers);
+   else if (ctx->Driver.DrawBuffer)
+      ctx->Driver.DrawBuffer(ctx, buffers[0]);
 }
 
 
@@ -463,14 +479,15 @@ set_color_output(GLcontext *ctx, GLuint output, GLenum buffer,
    /* not really needed, will be set later */
    fb->_NumColorDrawBuffers[output] = 0;
 
+   if (fb->Name == 0)
    /* Set traditional state var */
-   ctx->Color.DrawBuffer[output] = buffer;
+      ctx->Color.DrawBuffer[output] = buffer;
 }
 
 
 /**
  * Helper routine used by _mesa_DrawBuffer, _mesa_DrawBuffersARB and
- * _mesa_PopAttrib to set drawbuffer state.
+ * other places (window fbo fixup) to set fbo (and the old ctx) fields.
  * All error checking will have been done prior to calling this function
  * so nothing should go wrong at this point.
  * \param ctx  current context
@@ -509,30 +526,15 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers,
    }
 
    ctx->NewState |= _NEW_COLOR;
-
-   /*
-    * Call device driver function.
-    */
-   if (ctx->Driver.DrawBuffers)
-      ctx->Driver.DrawBuffers(ctx, n, buffers);
-   else if (ctx->Driver.DrawBuffer)
-      ctx->Driver.DrawBuffer(ctx, buffers[0]);
 }
 
 
-
-/**
- * Called by glReadBuffer to set the source renderbuffer for reading pixels.
- * \param mode color buffer such as GL_FRONT, GL_BACK, etc.
- */
-void GLAPIENTRY
-_mesa_ReadBuffer(GLenum buffer)
+GLboolean
+_mesa_readbuffer_update_fields(GLcontext *ctx, GLenum buffer)
 {
    struct gl_framebuffer *fb;
    GLbitfield supportedMask;
    GLint srcBuffer;
-   GET_CURRENT_CONTEXT(ctx);
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
    fb = ctx->ReadBuffer;
 
@@ -548,12 +550,12 @@ _mesa_ReadBuffer(GLenum buffer)
       srcBuffer = read_buffer_enum_to_index(buffer);
       if (srcBuffer == -1) {
          _mesa_error(ctx, GL_INVALID_ENUM, "glReadBuffer(buffer=0x%x)", buffer);
-         return;
+         return GL_FALSE;
       }
       supportedMask = supported_buffer_bitmask(ctx, fb);
       if (((1 << srcBuffer) & supportedMask) == 0) {
          _mesa_error(ctx, GL_INVALID_OPERATION, "glReadBuffer(buffer=0x%x)", buffer);
-         return;
+         return GL_FALSE;
       }
    }
 
@@ -563,6 +565,27 @@ _mesa_ReadBuffer(GLenum buffer)
    fb->ColorReadBuffer = buffer;
    fb->_ColorReadBufferIndex = srcBuffer;
 
+   return GL_TRUE;
+}
+
+
+
+/**
+ * Called by glReadBuffer to set the source renderbuffer for reading pixels.
+ * \param mode color buffer such as GL_FRONT, GL_BACK, etc.
+ */
+void GLAPIENTRY
+_mesa_ReadBuffer(GLenum buffer)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_API)
+      _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
+
+   if (!_mesa_readbuffer_update_fields(ctx, buffer))
+      return;
+
    ctx->NewState |= _NEW_PIXEL;
 
    /*
index fcc21523421ec5ac8abed55bdd8513bb3da35578..208e7af2b933a9bf9e127c1c6bbbc1e8d092f71f 100644 (file)
@@ -56,6 +56,9 @@ extern void
 _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers,
                   const GLbitfield *destMask);
 
+extern GLboolean
+_mesa_readbuffer_update_fields(GLcontext *ctx, GLenum buffer);
+
 extern void GLAPIENTRY
 _mesa_ReadBuffer( GLenum mode );
 
index 2ad1badac7095137cccf7e8a24c241d524a1224c..00e4c8328e559edc2047de55d091f5a9ca1332f0 100644 (file)
@@ -1496,9 +1496,8 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
          if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) {
             _mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer);
          /* fix up the fb fields - these will end up wrong otherwise
-            if the DRIdrawable changes, and someone may rely on them.
-          */
-            /* What a mess!?! */
+            if the DRIdrawable changes, and everything relies on them.
+            This is a bit messy (same as needed in _mesa_BindFramebufferEXT) */
             int i;
             GLenum buffers[MAX_DRAW_BUFFERS];
             for(i = 0; i < newCtx->Const.MaxDrawBuffers; i++) {
@@ -1508,7 +1507,7 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
          }
          if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) {
             _mesa_reference_framebuffer(&newCtx->ReadBuffer, readBuffer);
-            _mesa_ReadBuffer(newCtx->Pixel.ReadBuffer);
+            _mesa_readbuffer_update_fields(newCtx, newCtx->Pixel.ReadBuffer);
          }
 
         newCtx->NewState |= _NEW_BUFFERS;
index 88f33943b3153292d42eef33ee4bec9f448bf6fa..caa50dd6826c6173bd52022ce7ff040bf0b44522 100644 (file)
@@ -782,7 +782,7 @@ struct dd_function_table {
    struct gl_framebuffer * (*NewFramebuffer)(GLcontext *ctx, GLuint name);
    struct gl_renderbuffer * (*NewRenderbuffer)(GLcontext *ctx, GLuint name);
    void (*BindFramebuffer)(GLcontext *ctx, GLenum target,
-                           struct gl_framebuffer *fb);
+                           struct gl_framebuffer *fb, struct gl_framebuffer *fbread);
    void (*FramebufferRenderbuffer)(GLcontext *ctx, 
                                    struct gl_framebuffer *fb,
                                    GLenum attachment,
index e3bada5ae89088f5b0879dbd588160444d2b144d..6f7effcce70b96086523f538a3bfd06e40ecf298 100644 (file)
@@ -29,6 +29,7 @@
  */
 
 
+#include "buffers.h"
 #include "context.h"
 #include "fbobject.h"
 #include "framebuffer.h"
@@ -924,7 +925,7 @@ check_end_texture_render(GLcontext *ctx, struct gl_framebuffer *fb)
 void GLAPIENTRY
 _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
 {
-   struct gl_framebuffer *newFb;
+   struct gl_framebuffer *newFb, *newFbread;
    GLboolean bindReadBuf, bindDrawBuf;
    GET_CURRENT_CONTEXT(ctx);
 
@@ -984,12 +985,14 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
         }
          _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, newFb);
       }
+      newFbread = newFb;
    }
    else {
       /* Binding the window system framebuffer (which was originally set
        * with MakeCurrent).
        */
       newFb = ctx->WinSysDrawBuffer;
+      newFbread = ctx->WinSysReadBuffer;
    }
 
    ASSERT(newFb);
@@ -999,8 +1002,16 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
     * XXX check if re-binding same buffer and skip some of this code.
     */
 
+   /* for window-framebuffers, re-initialize the fbo values, as they
+      could be wrong (makecurrent with a new drawable while still a fbo
+      was bound will lead to default init fbo values).
+      note that therefore the context ReadBuffer/DrawBuffer values are not
+      valid while fbo's are bound!!! */
    if (bindReadBuf) {
-      _mesa_reference_framebuffer(&ctx->ReadBuffer, newFb);
+      _mesa_reference_framebuffer(&ctx->ReadBuffer, newFbread);
+      if (!newFbread->Name) {
+         _mesa_readbuffer_update_fields(ctx, ctx->Pixel.ReadBuffer);
+      }
    }
 
    if (bindDrawBuf) {
@@ -1008,14 +1019,22 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer)
       check_end_texture_render(ctx, ctx->DrawBuffer);
       /* check if time to delete this framebuffer */
       _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb);
-      if (newFb->Name != 0) {
+      if (!newFb->Name) {
+         GLuint i;
+         GLenum buffers[MAX_DRAW_BUFFERS];
+         for(i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
+            buffers[i] = ctx->Color.DrawBuffer[i];
+         }
+         _mesa_drawbuffers(ctx, ctx->Const.MaxDrawBuffers, buffers, NULL);
+      }
+      else {
          /* check if newly bound framebuffer has any texture attachments */
          check_begin_texture_render(ctx, newFb);
       }
    }
 
    if (ctx->Driver.BindFramebuffer) {
-      ctx->Driver.BindFramebuffer(ctx, target, newFb);
+      ctx->Driver.BindFramebuffer(ctx, target, newFb, newFbread);
    }
 }
 
index dc10d9ffbc8ec851f4d07ea2f4813962942165eb..c9b30d3252829993b796366dcf096f7928f441c3 100644 (file)
@@ -654,6 +654,27 @@ update_color_read_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
 }
 
 
+static void
+update_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
+{
+   /* Completeness only matters for user-created framebuffers */
+   if (fb->Name != 0) {
+      /* XXX: EXT_framebuffer_blit:
+         framebuffer must still be complete wrt read/draw? */
+      _mesa_test_framebuffer_completeness(ctx, fb);
+      _mesa_update_framebuffer_visual(fb);
+   }
+
+   /* update_color_draw/read_buffers not needed for
+      read/draw only fb, but shouldn't hurt ??? */
+   update_color_draw_buffers(ctx, fb);
+   update_color_read_buffer(ctx, fb);
+   _mesa_update_depth_buffer(ctx, fb, BUFFER_DEPTH);
+   _mesa_update_stencil_buffer(ctx, fb, BUFFER_STENCIL);
+
+   compute_depth_max(fb);
+}
+
 /**
  * Update state related to the current draw/read framebuffers.
  * Specifically, update these framebuffer fields:
@@ -671,19 +692,11 @@ void
 _mesa_update_framebuffer(GLcontext *ctx)
 {
    struct gl_framebuffer *fb = ctx->DrawBuffer;
+   struct gl_framebuffer *fbread = ctx->ReadBuffer;
 
-   /* Completeness only matters for user-created framebuffers */
-   if (fb->Name != 0) {
-      _mesa_test_framebuffer_completeness(ctx, fb);
-      _mesa_update_framebuffer_visual(fb);
-   }
-
-   update_color_draw_buffers(ctx, fb);
-   update_color_read_buffer(ctx, fb);
-   _mesa_update_depth_buffer(ctx, fb, BUFFER_DEPTH);
-   _mesa_update_stencil_buffer(ctx, fb, BUFFER_STENCIL);
-
-   compute_depth_max(fb);
+   update_framebuffer(ctx, fb);
+   if (fbread != fb)
+      update_framebuffer(ctx, fbread);
 }
 
 
index 63dd002a41264bbc095b07a73415e7bba08fec9b..fd4127558a839e4d53bd550e971decc0a994798e 100644 (file)
@@ -92,7 +92,7 @@
 #endif
 
 #ifdef WGLAPI
-#undef WGLAPI
+#      undef WGLAPI
 #endif
 
 #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP)
index 8a5dfdb4b80e3ccffd9ad89f49e69aec0a61690f..3ae56c8b0b64ba66c70ec00833945f398228b43f 100644 (file)
@@ -575,7 +575,11 @@ _mesa_ffs(int i)
  *          if no bits set.
  */
 int
+#ifdef __MINGW32__
+_mesa_ffsll(long val)
+#else
 _mesa_ffsll(long long val)
+#endif
 {
 #ifdef ffsll
    return ffsll(val);
index 9be8014a131388aa70f81c8b79f15d8d9dca6b65..ebdfc452a7aa838ef845126c6094584dda7260d5 100644 (file)
@@ -700,7 +700,11 @@ extern int
 _mesa_ffs(int i);
 
 extern int
+#ifdef __MINGW32__
+_mesa_ffsll(long i);
+#else
 _mesa_ffsll(long long i);
+#endif
 
 extern unsigned int
 _mesa_bitcount(unsigned int n);
index dc7195d4ebf7389600c0b54c1cab5bdd8bb892b0..0c2dbf915a1901503bb9a7f8867e902601e0c7ed 100644 (file)
@@ -55,9 +55,6 @@ _mesa_LineWidth( GLfloat width )
 
    FLUSH_VERTICES(ctx, _NEW_LINE);
    ctx->Line.Width = width;
-   ctx->Line._Width = CLAMP(width,
-                           ctx->Const.MinLineWidth,
-                           ctx->Const.MaxLineWidth);
 
    if (ctx->Driver.LineWidth)
       ctx->Driver.LineWidth(ctx, width);
@@ -105,13 +102,12 @@ _mesa_LineStipple( GLint factor, GLushort pattern )
  * Initializes __GLcontextRec::Line and line related constants in
  * __GLcontextRec::Const.
  */
-void GLAPIENTRY _mesa_init_line( GLcontext * ctx )
+void GLAPIENTRY
+_mesa_init_line( GLcontext * ctx )
 {
-   /* Line group */
    ctx->Line.SmoothFlag = GL_FALSE;
    ctx->Line.StippleFlag = GL_FALSE;
    ctx->Line.Width = 1.0;
-   ctx->Line._Width = 1.0;
    ctx->Line.StipplePattern = 0xffff;
    ctx->Line.StippleFactor = 1;
 }
index c150aae4d7f216dce82080f55264fb9e1c2a9bf3..52448ee04eb6b81754cd243c8ad60b6eacb9439b 100644 (file)
@@ -918,7 +918,6 @@ struct gl_line_attrib
    GLushort StipplePattern;    /**< Stipple pattern */
    GLint StippleFactor;                /**< Stipple repeat factor */
    GLfloat Width;              /**< Line width */
-   GLfloat _Width;             /**< Clamped Line width */
 };
 
 
@@ -1064,7 +1063,6 @@ struct gl_point_attrib
 {
    GLboolean SmoothFlag;       /**< True if GL_POINT_SMOOTH is enabled */
    GLfloat Size;               /**< User-specified point size */
-   GLfloat _Size;              /**< Size clamped to Const.Min/MaxPointSize */
    GLfloat Params[3];          /**< GL_EXT_point_parameters */
    GLfloat MinSize, MaxSize;   /**< GL_EXT_point_parameters */
    GLfloat Threshold;          /**< GL_EXT_point_parameters */
@@ -1134,13 +1132,13 @@ struct gl_stencil_attrib
  * An index for each type of texture object
  */
 /*@{*/
-#define TEXTURE_1D_INDEX    0
-#define TEXTURE_2D_INDEX    1
-#define TEXTURE_3D_INDEX    2
-#define TEXTURE_CUBE_INDEX  3
-#define TEXTURE_RECT_INDEX  4
-#define TEXTURE_1D_ARRAY_INDEX    5
-#define TEXTURE_2D_ARRAY_INDEX    6
+#define TEXTURE_1D_INDEX       0
+#define TEXTURE_2D_INDEX       1
+#define TEXTURE_3D_INDEX       2
+#define TEXTURE_CUBE_INDEX     3
+#define TEXTURE_RECT_INDEX     4
+#define TEXTURE_1D_ARRAY_INDEX 5
+#define TEXTURE_2D_ARRAY_INDEX 6
 /*@}*/
 
 /**
@@ -1148,13 +1146,13 @@ struct gl_stencil_attrib
  * Used for Texture.Unit[]._ReallyEnabled flags.
  */
 /*@{*/
-#define TEXTURE_1D_BIT   (1 << TEXTURE_1D_INDEX)
-#define TEXTURE_2D_BIT   (1 << TEXTURE_2D_INDEX)
-#define TEXTURE_3D_BIT   (1 << TEXTURE_3D_INDEX)
-#define TEXTURE_CUBE_BIT (1 << TEXTURE_CUBE_INDEX)
-#define TEXTURE_RECT_BIT (1 << TEXTURE_RECT_INDEX)
-#define TEXTURE_1D_ARRAY_BIT   (1 << TEXTURE_1D_ARRAY_INDEX)
-#define TEXTURE_2D_ARRAY_BIT   (1 << TEXTURE_2D_ARRAY_INDEX)
+#define TEXTURE_1D_BIT       (1 << TEXTURE_1D_INDEX)
+#define TEXTURE_2D_BIT       (1 << TEXTURE_2D_INDEX)
+#define TEXTURE_3D_BIT       (1 << TEXTURE_3D_INDEX)
+#define TEXTURE_CUBE_BIT     (1 << TEXTURE_CUBE_INDEX)
+#define TEXTURE_RECT_BIT     (1 << TEXTURE_RECT_INDEX)
+#define TEXTURE_1D_ARRAY_BIT (1 << TEXTURE_1D_ARRAY_INDEX)
+#define TEXTURE_2D_ARRAY_BIT (1 << TEXTURE_2D_ARRAY_INDEX)
 /*@}*/
 
 
@@ -1328,8 +1326,6 @@ struct gl_texture_format
 };
 
 
-#define MAX_3D_TEXTURE_SIZE (1 << (MAX_3D_TEXTURE_LEVELS - 1))
-
 /**
  * Texture image state.  Describes the dimensions of a texture image,
  * the texel format and pointers to Texel Fetch functions.
@@ -1394,7 +1390,7 @@ struct gl_texture_image
 #define FACE_NEG_Y   3
 #define FACE_POS_Z   4
 #define FACE_NEG_Z   5
-#define MAX_FACES  6
+#define MAX_FACES    6
 /*@}*/
 
 
@@ -2194,12 +2190,11 @@ struct gl_shared_state
     * \todo Improve the granularity of locking.
     */
    /*@{*/
-   _glthread_Mutex TexMutex;              /**< texobj thread safety */
-   GLuint TextureStateStamp;              /**< state notification for shared tex  */
+   _glthread_Mutex TexMutex;           /**< texobj thread safety */
+   GLuint TextureStateStamp;           /**< state notification for shared tex */
    /*@}*/
 
 
-
    /**
     * \name Vertex/fragment programs
     */
index 0f562420b085fa689dfd36ddb68d3da417fa4bf7..e83db5de78d60e64b720637e1aa2eb333207a0ff 100644 (file)
@@ -57,10 +57,6 @@ _mesa_PointSize( GLfloat size )
 
    FLUSH_VERTICES(ctx, _NEW_POINT);
    ctx->Point.Size = size;
-   /* XXX correct clamp limits? */
-   ctx->Point._Size = CLAMP(ctx->Point.Size,
-                           ctx->Point.MinSize,
-                           ctx->Point.MaxSize);
 
    if (ctx->Driver.PointSize)
       ctx->Driver.PointSize(ctx, size);
@@ -253,7 +249,6 @@ _mesa_init_point(GLcontext *ctx)
 
    ctx->Point.SmoothFlag = GL_FALSE;
    ctx->Point.Size = 1.0;
-   ctx->Point._Size = 1.0;
    ctx->Point.Params[0] = 1.0;
    ctx->Point.Params[1] = 0.0;
    ctx->Point.Params[2] = 0.0;
index 58be1f46e570513a23febfce0bb531ce8f31cca2..7bf8808767002b6d40aca00d3a931c2c24b1376d 100644 (file)
@@ -83,7 +83,7 @@ _mesa_CreateShader(GLenum type)
 }
 
 
-GLhandleARB APIENTRY
+GLhandleARB GLAPIENTRY
 _mesa_CreateShaderObjectARB(GLenum type)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -99,7 +99,7 @@ _mesa_CreateProgram(void)
 }
 
 
-GLhandleARB APIENTRY
+GLhandleARB GLAPIENTRY
 _mesa_CreateProgramObjectARB(void)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -319,7 +319,7 @@ _mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint * params)
 
 
 #if 0
-GLint APIENTRY
+GLint GLAPIENTRY
 _mesa_GetUniformLocation(GLuint program, const GLcharARB *name)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -336,7 +336,7 @@ _mesa_GetHandleARB(GLenum pname)
 }
 
 
-GLint APIENTRY
+GLint GLAPIENTRY
 _mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name)
 {
    GET_CURRENT_CONTEXT(ctx);
index 66f8ac64088a33abb1a156307f6d2c04cf9bdec6..444f227760182c102d6e9d40ab8e46457dbac701 100644 (file)
@@ -1068,7 +1068,7 @@ update_tricaps(GLcontext *ctx, GLbitfield new_state)
    if (1/*new_state & _NEW_POINT*/) {
       if (ctx->Point.SmoothFlag)
          ctx->_TriangleCaps |= DD_POINT_SMOOTH;
-      if (ctx->Point._Size != 1.0F)
+      if (ctx->Point.Size != 1.0F)
          ctx->_TriangleCaps |= DD_POINT_SIZE;
       if (ctx->Point._Attenuated)
          ctx->_TriangleCaps |= DD_POINT_ATTEN;
@@ -1082,7 +1082,7 @@ update_tricaps(GLcontext *ctx, GLbitfield new_state)
          ctx->_TriangleCaps |= DD_LINE_SMOOTH;
       if (ctx->Line.StippleFlag)
          ctx->_TriangleCaps |= DD_LINE_STIPPLE;
-      if (ctx->Line._Width != 1.0)
+      if (ctx->Line.Width != 1.0)
          ctx->_TriangleCaps |= DD_LINE_WIDTH;
    }
 
index 411d51cfcc60c066b92b02fdaf9d97b0ff81b96a..b6991f45ed85c416128b2640cd97c059f4767b8d 100644 (file)
@@ -302,7 +302,12 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
 
 #define FX64_NATIVE 1
 
+#ifdef __MINGW32__
+typedef unsigned long Fx64;
+#else
 typedef unsigned long long Fx64;
+#endif
+
 
 #define FX64_MOV32(a, b) a = b
 #define FX64_OR32(a, b)  a |= b
index 35e80e04523ceef13354f8cbc16303b42d06d16a..8b2bdd74b596ee5df0a5e771a79d1424bb116621 100644 (file)
@@ -536,7 +536,7 @@ new_not(slang_ir_node *n)
 static slang_ir_node *
 new_inlined_function_call(slang_ir_node *code, slang_label *name)
 {
-   slang_ir_node *n = new_node1(IR_FUNC, code);
+   slang_ir_node *n = new_node1(IR_CALL, code);
    assert(name);
    if (n)
       n->Label = name;
@@ -1202,17 +1202,29 @@ _slang_gen_function_call(slang_assemble_ctx *A, slang_function *fun,
       /* non-assembly function */
       inlined = slang_inline_function_call(A, fun, oper, dest);
       if (inlined && _slang_find_node_type(inlined, SLANG_OPER_RETURN)) {
-         /* This inlined function has one or more 'return' statements.
+         slang_operation *callOper;
+         /* The function we're calling has one or more 'return' statements.
           * So, we can't truly inline this function because we need to
           * implement 'return' with RET (and CAL).
+          * Nevertheless, we performed "inlining" to make a new instance
+          * of the function body to deal with static register allocation.
+          *
           * XXX check if there's one 'return' and if it's the very last
           * statement in the function - we can optimize that case.
           */
          assert(inlined->type == SLANG_OPER_BLOCK_NEW_SCOPE ||
                 inlined->type == SLANG_OPER_SEQUENCE);
-         inlined->type = SLANG_OPER_INLINED_CALL;
-         inlined->fun = fun;
-         inlined->label = _slang_label_new_unique((char*) fun->header.a_name);
+         if (_slang_function_has_return_value(fun) && !dest) {
+            assert(inlined->children[0].type == SLANG_OPER_VARIABLE_DECL);
+            assert(inlined->children[2].type == SLANG_OPER_IDENTIFIER);
+            callOper = &inlined->children[1];
+         }
+         else {
+            callOper = inlined;
+         }
+         callOper->type = SLANG_OPER_INLINED_CALL;
+         callOper->fun = fun;
+         callOper->label = _slang_label_new_unique((char*) fun->header.a_name);
       }
    }
 
@@ -1949,8 +1961,7 @@ static slang_ir_node *
 _slang_gen_return(slang_assemble_ctx * A, slang_operation *oper)
 {
    const GLboolean haveReturnValue
-      = (oper->num_children == 1 &&
-         oper->children[0].type != SLANG_OPER_VOID);
+      = (oper->num_children == 1 && oper->children[0].type != SLANG_OPER_VOID);
 
    /* error checking */
    assert(A->CurFunction);
@@ -1960,7 +1971,7 @@ _slang_gen_return(slang_assemble_ctx * A, slang_operation *oper)
       return NULL;
    }
    else if (!haveReturnValue &&
-       A->CurFunction->header.type.specifier.type != SLANG_SPEC_VOID) {
+            A->CurFunction->header.type.specifier.type != SLANG_SPEC_VOID) {
       slang_info_log_error(A->log, "return statement requires an expression");
       return NULL;
    }
@@ -2236,7 +2247,9 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
       }
       if (var->type.qualifier == SLANG_QUAL_CONST ||
           var->type.qualifier == SLANG_QUAL_ATTRIBUTE ||
-          var->type.qualifier == SLANG_QUAL_UNIFORM) {
+          var->type.qualifier == SLANG_QUAL_UNIFORM ||
+          (var->type.qualifier == SLANG_QUAL_VARYING &&
+           A->program->Target == GL_FRAGMENT_PROGRAM_ARB)) {
          slang_info_log_error(A->log,
                               "illegal assignment to read-only variable '%s'",
                               (char *) oper->children[0].a_id);
@@ -2264,10 +2277,11 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
       lhs = _slang_gen_operation(A, &oper->children[0]);
 
       if (lhs) {
-         if (lhs->Store->File != PROGRAM_OUTPUT &&
-             lhs->Store->File != PROGRAM_TEMPORARY &&
-             lhs->Store->File != PROGRAM_VARYING &&
-             lhs->Store->File != PROGRAM_UNDEFINED) {
+         if (!(lhs->Store->File == PROGRAM_OUTPUT ||
+               lhs->Store->File == PROGRAM_TEMPORARY ||
+               (lhs->Store->File == PROGRAM_VARYING &&
+                A->program->Target == GL_VERTEX_PROGRAM_ARB) ||
+               lhs->Store->File == PROGRAM_UNDEFINED)) {
             slang_info_log_error(A->log,
                                  "illegal assignment to read-only l-value");
             return NULL;
index 02c74095a9e500b4f003ce7dca4061e32cb2e064..fe13f2865cda606a15c73bb3ad09dead454ad8be 100644 (file)
@@ -780,16 +780,18 @@ emit_label(slang_emit_info *emitInfo, const slang_ir_node *n)
 
 
 /**
- * Emit code for an inlined function call (subroutine).
+ * Emit code for a function call.
+ * Note that for each time a function is called, we emit the function's
+ * body code again because the set of available registers may be different.
  */
 static struct prog_instruction *
-emit_func(slang_emit_info *emitInfo, slang_ir_node *n)
+emit_fcall(slang_emit_info *emitInfo, slang_ir_node *n)
 {
    struct gl_program *progSave;
    struct prog_instruction *inst;
    GLuint subroutineId;
 
-   assert(n->Opcode == IR_FUNC);
+   assert(n->Opcode == IR_CALL);
    assert(n->Label);
 
    /* save/push cur program */
@@ -1687,10 +1689,10 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n)
    case IR_KILL:
       return emit_kill(emitInfo);
 
-   case IR_FUNC:
-      /* new variable scope for subroutines/function calls*/
+   case IR_CALL:
+      /* new variable scope for subroutines/function calls */
       _slang_push_var_table(emitInfo->vt);
-      inst = emit_func(emitInfo, n);
+      inst = emit_fcall(emitInfo, n);
       _slang_pop_var_table(emitInfo->vt);
       return inst;
 
@@ -1782,7 +1784,7 @@ _slang_resolve_subroutines(slang_emit_info *emitInfo)
    emitInfo->NumSubroutines = 0;
 
    /* Examine CAL instructions.
-    * At this point, the BranchTarget field of the CAL instructions is
+    * At this point, the BranchTarget field of the CAL instruction is
     * the number/id of the subroutine to call (an index into the
     * emitInfo->Subroutines list).
     * Translate that into an actual instruction location now.
index a29f3026873573d99c0152aeac80dacc05c4761c..92e8d0345eec0b76bd4c083f978541f19f5dea04 100644 (file)
@@ -311,7 +311,7 @@ _slang_print_ir_tree(const slang_ir_node *n, int indent)
       printf("RETURN\n");
       break;
    case IR_CALL:
-      printf("CALL\n");
+      printf("CALL %s\n", n->Label->Name);
       break;
 
    case IR_LOOP:
index 69db4b5451ec111cfcb643e2dfd90570a1548022..c7c0ddbf9a69cee75449373da6478e39381ddcbf 100644 (file)
@@ -62,8 +62,6 @@ typedef enum
    IR_RETURN,    /* return from subroutine */
    IR_CALL,      /* call subroutine */
 
-   IR_FUNC,      /* inlined function code */
-
    IR_LOOP,      /* high-level loop-begin / loop-end */
                  /* Children[0] = loop body */
                  /* Children[1] = loop tail code, or NULL */
index 69a1f0cd3961fad98816734c68324abc46b2adce..e7911fec3b5536bf98cdb539bff0cdf4aa1a583b 100644 (file)
@@ -132,7 +132,9 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
    line.dx = line.x1 - line.x0;
    line.dy = line.y1 - line.y0;
    line.len = SQRTF(line.dx * line.dx + line.dy * line.dy);
-   line.halfWidth = 0.5F * ctx->Line._Width;
+   line.halfWidth = 0.5F * CLAMP(ctx->Line.Width,
+                                 ctx->Const.MinLineWidthAA,
+                                 ctx->Const.MaxLineWidthAA);
 
    if (line.len == 0.0 || IS_INF_OR_NAN(line.len))
       return;
index 781146e67f93ff4d00be86e38891781f186f4910..3de438760b52cf9f5fb36a404fbee353e77231d1 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.3
+ * Version:  7.1
  *
  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
  *
@@ -63,12 +63,13 @@ compute_stipple_mask( GLcontext *ctx, GLuint len, GLubyte mask[] )
 static void
 draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
 {
-   GLint width, start;
+   const GLint width = (GLint) CLAMP(ctx->Line.Width,
+                                     ctx->Const.MinLineWidth,
+                                     ctx->Const.MaxLineWidth);
+   GLint start;
 
    ASSERT(span->end < MAX_WIDTH);
 
-   width = (GLint) CLAMP( ctx->Line._Width, MIN_LINE_WIDTH, MAX_LINE_WIDTH );
-
    if (width & 1)
       start = width / 2;
    else
@@ -143,7 +144,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
       span.arrayMask |= SPAN_MASK;                             \
       compute_stipple_mask(ctx, span.end, span.array->mask);    \
    }                                                           \
-   if (ctx->Line._Width > 1.0) {                               \
+   if (ctx->Line.Width > 1.0) {                                        \
       draw_wide_line(ctx, &span, (GLboolean)(dx > dy));                \
    }                                                           \
    else {                                                      \
@@ -161,7 +162,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
       span.arrayMask |= SPAN_MASK;                             \
       compute_stipple_mask(ctx, span.end, span.array->mask);   \
    }                                                           \
-   if (ctx->Line._Width > 1.0) {                               \
+   if (ctx->Line.Width > 1.0) {                                        \
       draw_wide_line(ctx, &span, (GLboolean)(dx > dy));                \
    }                                                           \
    else {                                                      \
@@ -180,7 +181,7 @@ draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
       span.arrayMask |= SPAN_MASK;                             \
       compute_stipple_mask(ctx, span.end, span.array->mask);   \
    }                                                           \
-   if (ctx->Line._Width > 1.0) {                               \
+   if (ctx->Line.Width > 1.0) {                                        \
       draw_wide_line(ctx, &span, (GLboolean)(dx > dy));                \
    }                                                           \
    else {                                                      \
@@ -274,16 +275,21 @@ _swrast_choose_line( GLcontext *ctx )
          USE(general_line);
       }
       else if (ctx->Depth.Test
-               || ctx->Line._Width != 1.0
+               || ctx->Line.Width != 1.0
                || ctx->Line.StippleFlag) {
          /* no texture, but Z, fog, width>1, stipple, etc. */
          if (rgbmode)
+#if CHAN_BITS == 32
+            USE(general_line);
+#else
             USE(rgba_line);
+#endif
          else
             USE(ci_line);
       }
       else {
          ASSERT(!ctx->Depth.Test);
+         ASSERT(ctx->Line.Width == 1.0);
          /* simple lines */
          if (rgbmode)
             USE(simple_no_z_rgba_line);
index 8eba53c80766ce64150402b3c62acdbedfae0ea3..4768fbea972bb5a3973f3a9fce026ff3ba0ac246 100644 (file)
@@ -76,7 +76,7 @@ sprite_point(GLcontext *ctx, const SWvertex *vert)
    }
    else {
       /* use constant point size */
-      size = ctx->Point._Size; /* already clamped to user range */
+      size = ctx->Point.Size;
    }
    /* clamp to non-AA implementation limits */
    size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
@@ -227,7 +227,7 @@ smooth_point(GLcontext *ctx, const SWvertex *vert)
    }
    else {
       /* use constant point size */
-      size = ctx->Point._Size; /* this is already clamped */
+      size = ctx->Point.Size;
    }
    /* clamp to AA implementation limits */
    size = CLAMP(size, ctx->Const.MinPointSizeAA, ctx->Const.MaxPointSizeAA);
@@ -361,7 +361,7 @@ large_point(GLcontext *ctx, const SWvertex *vert)
    }
    else {
       /* use constant point size */
-      size = ctx->Point._Size; /* already clamped to user range */
+      size = ctx->Point.Size;
    }
    /* clamp to non-AA implementation limits */
    size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
@@ -550,7 +550,7 @@ _swrast_choose_point(GLcontext *ctx)
       else if (ctx->Point.SmoothFlag) {
          swrast->Point = smooth_point;
       }
-      else if (ctx->Point._Size > 1.0 ||
+      else if (ctx->Point.Size > 1.0 ||
                ctx->Point._Attenuated ||
                ctx->VertexProgram.PointSizeEnabled) {
          swrast->Point = large_point;
index f23272c2beec5271433972883341f1ee0a1382c2..cfc65bee87fe101310a3e3298c8e8cd161f0aaaf 100644 (file)
@@ -1358,7 +1358,7 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
 
 #if CHAN_BITS == 32
    if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) {
-      interpolate_int_colors(ctx, span);
+      interpolate_active_attribs(ctx, span, FRAG_BIT_COL0);
    }
 #else
    if ((span->arrayMask & SPAN_RGBA) == 0) {
index 6aae602037576f2468cf05ebea35d4c1cdbb7524..a6728c318fe3171be817885335216c0fc87a8d5b 100644 (file)
@@ -233,7 +233,7 @@ void _tnl_get_attr( GLcontext *ctx, const void *vin,
       /* If the hardware vertex doesn't have point size then use size from
        * GLcontext.  XXX this will be wrong if drawing attenuated points!
        */
-      dest[0] = ctx->Point._Size;
+      dest[0] = ctx->Point.Size;
    }
    else {
       _mesa_memcpy( dest, ctx->Current.Attrib[attr], 4*sizeof(GLfloat));
index ab3bb37631b42a5cfae8a82a8b91d89492657b56..3cedd9011904f99d6a21d2d4545c21034bc91b61 100644 (file)
@@ -184,7 +184,7 @@ void TAG(translate_vertex)(GLcontext *ctx,
       }
    }
 
-   dst->pointSize = ctx->Point._Size;
+   dst->pointSize = ctx->Point.Size;
 }