--- mesa-7.4.1.orig/autogen.sh +++ mesa-7.4.1/autogen.sh @@ -0,0 +1,16 @@ +#! /bin/sh + +srcdir=`dirname "$0"` +test -z "$srcdir" && srcdir=. + +SRCDIR=`(cd "$srcdir" && pwd)` +ORIGDIR=`pwd` + +if test "x$SRCDIR" != "x$ORIGDIR"; then + echo "Mesa cannot be built when srcdir != builddir" 1>&2 + exit 1 +fi + +autoreconf -v --install || exit 1 + +"$srcdir"/configure "$@" --- mesa-7.4.1.orig/foo +++ mesa-7.4.1/foo @@ -0,0 +1,59 @@ +diff --git a/debian/changelog b/debian/changelog +index 3a55f93..62351da 100644 +--- a/debian/changelog ++++ b/debian/changelog +@@ -1,11 +1,10 @@ + mesa (7.4.1-1ubuntu4) karmic; urgency=low + +- * Add 110_null_ptr_during_screen_tear_down.patch and +- 111_fix_mesa_ref_fb_call_syntax.patch to fix crashes caused by errors +- in the previous memory leak fixes in -1u3. ++ * Add 110_null_ptr_during_screen_tear_down.patch to fix crashes caused ++ by errors in the previous memory leak fixes in -1u3. + (LP: #391808) + +- -- Bryce Harrington Wed, 24 Jun 2009 15:32:54 -0700 ++ -- Bryce Harrington Wed, 24 Jun 2009 16:56:36 -0700 + + mesa (7.4.1-1ubuntu3) karmic; urgency=low + +diff --git a/debian/patches/111_fix_mesa_ref_fb_call_syntax.patch b/debian/patches/111_fix_mesa_ref_fb_call_syntax.patch +deleted file mode 100644 +index 95e87c2..0000000 +--- a/debian/patches/111_fix_mesa_ref_fb_call_syntax.patch ++++ /dev/null +@@ -1,25 +0,0 @@ +-From 4b8cd0b0ad48c3b0129451924f7461ffcbbc8597 Mon Sep 17 00:00:00 2001 +-From: Brian Paul +-Date: Mon, 22 Jun 2009 17:23:13 +0000 +-Subject: intel: call _mesa_unreference_framebuffer() in intelDestroyBuffer() +- +-This was a call to _mesa_reference_framebuffer(ptr, NULL) but the NULL +-pointer is incorrect in Mesa 7.4.x. +- +-Fixes a failed assertion during screen tear-down. +---- +-diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c +-index 59fa54f..8d2a3a7 100644 +---- a/src/mesa/drivers/dri/intel/intel_screen.c +-+++ b/src/mesa/drivers/dri/intel/intel_screen.c +-@@ -409,7 +409,7 @@ intelDestroyBuffer(__DRIdrawablePrivate * driDrawPriv) +- } +- } +- +-- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); +-+ _mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate))); +- } +- +- +--- +-cgit v0.8.2 +diff --git a/debian/patches/series b/debian/patches/series +index 676e92d..f183d67 100644 +--- a/debian/patches/series ++++ b/debian/patches/series +@@ -11,4 +11,3 @@ + 108_destroy_intel_fb.patch + 109_release_direct_rendering_resources.patch + 110_null_ptr_during_screen_tear_down.patch +-111_fix_mesa_ref_fb_call_syntax.patch --- mesa-7.4.1.orig/.gitattributes +++ mesa-7.4.1/.gitattributes @@ -0,0 +1,4 @@ +*.dsp -crlf +*.dsw -crlf +*.sln -crlf +*.vcproj -crlf --- mesa-7.4.1.orig/include/GL/miniglx.h +++ mesa-7.4.1/include/GL/miniglx.h @@ -0,0 +1,482 @@ +/* + * Mesa 3-D graphics library + * Version: 6.1 + * + * Copyright (C) 1999-2004 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. + */ + + +/** + * \file miniglx.h + * \brief Mini GLX interface functions. + * \author Brian Paul + * + * See comments miniglx.c for more information. + */ + +#ifndef MINIGLX_H +#define MINIGLX_H + +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * \name Replacement Xlib/GLX types + */ +/*@{*/ +/** + * \brief Boolean type. + * + * It can have the values #True or #False. + */ +#ifndef MINIGLX_NO_XTYPES +typedef int Bool; +#endif +typedef int MINI_Bool; + +/** + * \brief Color map. + * + * Alias for private ::MiniGLXColormapRec structure. + */ +typedef struct MiniGLXColormapRec *MINI_Colormap; +#ifndef MINIGLX_NO_XTYPES +typedef struct MiniGLXColormapRec *Colormap; +#endif + +/** + * \brief Window attributes. + */ +typedef struct MiniGLXSetWindowAttributesRec { + int background_pixel; /**< \brief background pixel */ + int border_pixel; /**< \brief border pixel value */ + MINI_Colormap colormap; /**< \brief color map to be associated with window */ + int event_mask; /**< \brief set of events that should be saved */ +} XSetWindowAttributes; + +/** + * \brief Visual. + * + * Alias for the private ::MiniGLXVisualRec structure. + * + * \sa \ref datatypes. + */ +typedef struct MiniGLXVisualRec Visual; + +/** + * \brief Visual information. + * + * \sa \ref datatypes. + */ +#ifndef MINIGLX_NO_XTYPES +typedef unsigned long VisualID; +#endif +typedef unsigned long MINI_VisualID; +typedef struct MiniGLXXVisualInfoRec { + Visual *visual; /**< \brief pointer to the GLX Visual */ + MINI_VisualID visualid; /**< \brief visual ID */ + int screen; /**< \brief screen number */ + int depth; /**< \brief bit depth */ +#if defined(__cplusplus) || defined(c_plusplus) + int c_class; /**< \brief class */ +#else + int class; /**< \brief class */ +#endif + int bits_per_rgb; /**< \brief total bits per pixel */ +} XVisualInfo; + +/** + * \brief GLX Frame Buffer Configuration (for pbuffers) + * \sa \ref datatypes. + */ +typedef struct MiniGLXFBConfigRec { + XVisualInfo *visInfo; +} GLXFBConfig; + + +/** + * \brief Display handle. + * + * Alias for the private ::MiniGLXDisplayRec structure. + * + * \sa \ref datatypes. + */ +#ifndef MINIGLX_NO_XTYPES +typedef struct MiniGLXDisplayRec Display; +#endif +typedef struct MiniGLXDisplayRec MINI_Display; + +/** + * \brief Window handle. + * + * Alias for the private ::MiniGLXWindowRec structure. + * + * \sa \ref datatypes. + */ +#ifndef MINIGLX_NO_XTYPES +typedef struct MiniGLXWindowRec *Window; +#endif +typedef struct MiniGLXWindowRec *MINI_Window; + +/** + * \brief Drawable. + * + * Alias for the private ::MiniGLXWindowRec structure. + * + * For Mini GLX only the full-screen window can be used as source and + * destination in graphics operations. + * + * \sa \ref datatypes. + */ +#ifndef MINIGLX_NO_XTYPES +typedef struct MiniGLXWindowRec *Drawable; +#endif +typedef struct MiniGLXWindowRec *MINI_Drawable; + +/** + * \brief GLX drawable. + * + * Alias for the private ::MiniGLXWindowRec structure. + * + * Same as #Drawable. + * + * \sa \ref datatypes. + */ +typedef struct MiniGLXWindowRec *GLXDrawable; + +/** + * \brief GLX pbuffer. + * + * Alias for the private ::MiniGLXWindowRec structure. + * + * Same as #Drawable. + * + * \sa \ref datatypes. + */ +typedef struct MiniGLXWindowRec *GLXPbuffer; + +/** + * \brief GLX context. + * + * Alias for the private ::MiniGLXContext structure. + * + * \sa \ref datatypes. + */ +typedef struct MiniGLXContextRec *GLXContext; +/*@}*/ + + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + MINI_Bool send_event; /* true if this came from a SendEvent request */ + MINI_Display *display; /* Display the event was read from */ + MINI_Window window; + int x, y; + int width, height; + int count; /* if non-zero, at least this many more */ +} XExposeEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + MINI_Bool send_event; /* true if this came from a SendEvent request */ + MINI_Display *display; /* Display the event was read from */ + MINI_Window parent; /* parent of the window */ + MINI_Window window; /* window id of window created */ + int x, y; /* window location */ + int width, height; /* size of window */ + int border_width; /* border width */ + MINI_Bool override_redirect; /* creation should be overridden */ +} XCreateWindowEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + MINI_Bool send_event; /* true if this came from a SendEvent request */ + MINI_Display *display; /* Display the event was read from */ + MINI_Window event; + MINI_Window window; +} XDestroyWindowEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + MINI_Bool send_event; /* true if this came from a SendEvent request */ + MINI_Display *display; /* Display the event was read from */ + MINI_Window event; + MINI_Window window; + MINI_Bool from_configure; +} XUnmapEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + MINI_Bool send_event; /* true if this came from a SendEvent request */ + MINI_Display *display; /* Display the event was read from */ + MINI_Window event; + MINI_Window window; + MINI_Bool override_redirect; /* boolean, is override set... */ +} XMapEvent; + + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + MINI_Bool send_event; /* true if this came from a SendEvent request */ + MINI_Display *display; /* Display the event was read from */ + MINI_Window parent; + MINI_Window window; +} XMapRequestEvent; + +typedef union _XEvent { + int type; /* must not be changed; first element */ + XExposeEvent xexpose; + XCreateWindowEvent xcreatewindow; + XDestroyWindowEvent xdestroywindow; + XUnmapEvent xunmap; + XMapEvent xmap; + XMapRequestEvent xmaprequest; + long pad[24]; +} XEvent; + + +/** + * \name Xlib constants + */ +/*@{*/ +#define False 0 +#define True 1 +#define None 0 +#define AllocNone 0 +#define InputOutput 1 +#define ExposureMask (1L<<15) +#define StructureNotifyMask (1L<<17) +#define CWBackPixel (1L<<1) +#define CWBorderPixel (1L<<3) +#define CWEventMask (1L<<11) +#define CWColormap (1L<<13) +#define PseudoColor 3 +#define TrueColor 4 +#define VisualIDMask 0x1 +#define VisualScreenMask 0x2 +#define Expose 12 +#define CreateNotify 16 +#define DestroyNotify 17 +#define UnmapNotify 18 +#define MapNotify 19 +#define MapRequest 20 + +/*@}*/ + +/** + * \name Standard GLX tokens + */ +/*@{*/ +#define GLX_USE_GL 1 +#define GLX_BUFFER_SIZE 2 +#define GLX_LEVEL 3 +#define GLX_RGBA 4 +#define GLX_DOUBLEBUFFER 5 +#define GLX_STEREO 6 +#define GLX_AUX_BUFFERS 7 +#define GLX_RED_SIZE 8 +#define GLX_GREEN_SIZE 9 +#define GLX_BLUE_SIZE 10 +#define GLX_ALPHA_SIZE 11 +#define GLX_DEPTH_SIZE 12 +#define GLX_STENCIL_SIZE 13 +#define GLX_ACCUM_RED_SIZE 14 +#define GLX_ACCUM_GREEN_SIZE 15 +#define GLX_ACCUM_BLUE_SIZE 16 +#define GLX_ACCUM_ALPHA_SIZE 17 +#define GLX_BAD_ATTRIBUTE 1 +#define GLX_BAD_VISUAL 4 +/*@}*/ + + +/** + * \name Unique to Mini GLX + * + * At compile time, the Mini GLX interface version can be tested with the + * MINI_GLX_VERSION_1_x preprocessor tokens. + * + * \sa glXQueryVersion() + */ +/*@{*/ +/** \brief Defined if version 1.0 of Mini GLX is supported. */ +#define MINI_GLX_VERSION_1_0 1 +/** \brief Defined if version 1.1 of Mini GLX is supported. */ +#define MINI_GLX_VERSION_1_1 1 +/*@}*/ + + +/** + * \name Server-specific functions + */ +extern MINI_Display * +__miniglx_StartServer( const char *display_name ); + +extern int +__miniglx_Select( MINI_Display *dpy, int maxfd, + fd_set *rfds, fd_set *wfds, fd_set *xfds, + struct timeval *tv ); + + +/** + * \name Simulated Xlib functions + */ +/*@{*/ +extern MINI_Display * +XOpenDisplay( const char *dpy_name ); + + +extern void +XCloseDisplay( MINI_Display *display ); + +extern MINI_Window +XCreateWindow( MINI_Display *display, MINI_Window parent, int x, int y, + unsigned int width, unsigned int height, + unsigned int border_width, int depth, unsigned int winclass, + Visual *visual, unsigned long valuemask, + XSetWindowAttributes *attributes ); + +extern int +XNextEvent(MINI_Display *display, XEvent *event_return); + +extern MINI_Bool +XCheckMaskEvent( MINI_Display *dpy, long event_mask, XEvent *event_return ); + +/** + * \brief Return the root window. + * + * \param display the display handle. It is ignored by Mini GLX, but should be + * the value returned by XOpenDisplay(). + * \param screen the screen number on the host server. It is ignored by Mini + * GLX but should be zero. + * + * \return the root window. Always zero on Mini GLX. + */ +#define RootWindow(display, screen) 0 +#define DefaultScreen(dpy) 0 + +extern void +XDestroyWindow( MINI_Display *display, MINI_Window w ); + +extern void +XMapWindow( MINI_Display *display, MINI_Window w ); + +/* Should clients have access to this? + */ +extern void +XUnmapWindow( MINI_Display *display, MINI_Window w ); + +extern MINI_Colormap +XCreateColormap( MINI_Display *display, MINI_Window w, Visual *visual, int alloc ); + +extern void +XFreeColormap( MINI_Display *display, MINI_Colormap cmap ); + +extern void +XFree( void *data ); + +extern XVisualInfo * +XGetVisualInfo( MINI_Display *display, long vinfo_mask, + XVisualInfo *vinfo_template, int *nitems_return ); +/*@}*/ + + + +/** + * \name GLX functions + */ +/*@{*/ +extern XVisualInfo* +glXChooseVisual( MINI_Display *dpy, int screen, int *attribList ); + +extern int +glXGetConfig( MINI_Display *dpy, XVisualInfo *vis, int attrib, int *value ); + +extern GLXContext +glXCreateContext( MINI_Display *dpy, XVisualInfo *vis, + GLXContext shareList, MINI_Bool direct ); + +extern void +glXDestroyContext( MINI_Display *dpy, GLXContext ctx ); + +extern MINI_Bool +glXMakeCurrent( MINI_Display *dpy, GLXDrawable drawable, GLXContext ctx); + +extern void +glXSwapBuffers( MINI_Display *dpy, GLXDrawable drawable ); + +extern GLXContext +glXGetCurrentContext( void ); + +extern GLXDrawable +glXGetCurrentDrawable( void ); + +extern void +(*glXGetProcAddress(const GLubyte *procname))( void ); + +extern MINI_Bool +glXQueryVersion( MINI_Display *dpy, int *major, int *minor ); + +/* Added in MiniGLX 1.1 */ +extern GLXPbuffer +glXCreatePbuffer( MINI_Display *dpy, GLXFBConfig config, const int *attribList ); + +extern void +glXDestroyPbuffer( MINI_Display *dpy, GLXPbuffer pbuf ); + +extern GLXFBConfig * +glXChooseFBConfig( MINI_Display *dpy, int screen, const int *attribList, + int *nitems ); + +extern XVisualInfo * +glXGetVisualFromFBConfig( MINI_Display *dpy, GLXFBConfig config ); + +extern void *glXAllocateMemoryMESA(Display *dpy, int scrn, + size_t size, float readFreq, + float writeFreq, float priority); + +extern void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer); + +extern GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn, + const void *pointer ); +/*@}*/ + +extern void +__glXScrEnableExtension( void *, const char * name ); + +/*@}*/ + + +#ifdef __cplusplus +} +#endif + +#endif /* MINIGLX_H */ --- mesa-7.4.1.orig/include/GL/directfbgl.h +++ mesa-7.4.1/include/GL/directfbgl.h @@ -0,0 +1,89 @@ +/* + (c) Copyright 2001 convergence integrated media GmbH. + All rights reserved. + + Written by Denis Oliver Kropp and + Andreas Hundt . + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef __DIRECTFBGL_H__ +#define __DIRECTFBGL_H__ + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + + +typedef struct { + int buffer_size; + int depth_size; + int stencil_size; + int aux_buffers; + + int red_size; + int green_size; + int blue_size; + int alpha_size; + + int accum_red_size; + int accum_green_size; + int accum_blue_size; + int accum_alpha_size; + + DFBBoolean double_buffer; + DFBBoolean stereo; +} DFBGLAttributes; + + +DEFINE_INTERFACE( IDirectFBGL, + + /** Context handling **/ + + /* + * Acquire the hardware lock. + */ + DFBResult (*Lock) ( + IDirectFBGL *thiz + ); + + /* + * Release the lock. + */ + DFBResult (*Unlock) ( + IDirectFBGL *thiz + ); + + /* + * Query the OpenGL attributes. + */ + DFBResult (*GetAttributes) ( + IDirectFBGL *thiz, + DFBGLAttributes *attributes + ); +) + + +#ifdef __cplusplus +} +#endif + +#endif + --- mesa-7.4.1.orig/include/GL/Makefile.am +++ mesa-7.4.1/include/GL/Makefile.am @@ -0,0 +1,38 @@ +## Process this file with automake to produce Makefile.in + +GLincludedir = $(includedir)/GL + +INC_GGI = ggimesa.h +INC_OSMESA = osmesa.h +INC_SVGA = svgamesa.h +INC_X11 = glx.h glxext.h glx_mangle.h +INC_GLUT = glut.h glutf90.h + +if HAVE_GGI +sel_inc_ggi = $(INC_GGI) +endif + +if HAVE_OSMESA +sel_inc_osmesa = $(INC_OSMESA) +endif + +if HAVE_SVGA +sel_inc_svga = $(INC_SVGA) +endif + +if HAVE_X11 +sel_inc_x11 = $(INC_X11) +endif + +if NEED_GLUT +sel_inc_glut = $(INC_GLUT) +endif + +EXTRA_HEADERS = amesa.h dosmesa.h foomesa.h glut_h.dja mesa_wgl.h mglmesa.h \ + vms_x_fix.h wmesa.h \ + $(INC_GGI) $(INC_OSMESA) $(INC_SVGA) $(INC_X11) $(INC_GLUT) + +GLinclude_HEADERS = gl.h glext.h gl_mangle.h glu.h glu_mangle.h \ + $(sel_inc_ggi) $(sel_inc_osmesa) $(sel_inc_svga) \ + $(sel_inc_x11) $(sel_inc_glut) +include $(top_srcdir)/common_rules.make --- mesa-7.4.1.orig/include/GL/glut_h.dja +++ mesa-7.4.1/include/GL/glut_h.dja @@ -0,0 +1,340 @@ + +/* + * Mesa 3-D graphics library + * Version: 3.1 + * Copyright (C) 1995-1998 Brian Paul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* + * This header file is based on the REAL glut.h by Mark J. Kilgard. + * + * The DJGPP/ALLEGRO (DJA) GLUT implementation was written by + * Bernhard Tschirren (bernie-t@geocities.com) for the sole purpose + * of compiling all the sample programs (which use GLUT). Therefore, + * is NOT AT ALL a complete version of GLUT! + */ + + +#ifndef __AGLUT_H__ +#define __AGLUT_H__ + +#include +#include + +#define GLUTCALLBACK +#define APIENTRY +#define GLUTAPI extern + +#define GLUT_RGB 0 +#define GLUT_RGBA GLUT_RGB +#define GLUT_INDEX 1 +#define GLUT_SINGLE 0 +#define GLUT_DOUBLE 2 +#define GLUT_ACCUM 4 +#define GLUT_ALPHA 8 +#define GLUT_DEPTH 16 +#define GLUT_STENCIL 32 + +/* Mouse buttons. */ +#define GLUT_LEFT_BUTTON 0 +#define GLUT_MIDDLE_BUTTON 1 +#define GLUT_RIGHT_BUTTON 2 + +/* Mouse button state. */ +#define GLUT_DOWN 0 +#define GLUT_UP 1 + +/* function keys */ +#define GLUT_KEY_F1 1 +#define GLUT_KEY_F2 2 +#define GLUT_KEY_F3 3 +#define GLUT_KEY_F4 4 +#define GLUT_KEY_F5 5 +#define GLUT_KEY_F6 6 +#define GLUT_KEY_F7 7 +#define GLUT_KEY_F8 8 +#define GLUT_KEY_F9 9 +#define GLUT_KEY_F10 10 +#define GLUT_KEY_F11 11 +#define GLUT_KEY_F12 12 + +/* directional keys */ +#define GLUT_KEY_LEFT 100 +#define GLUT_KEY_UP 101 +#define GLUT_KEY_RIGHT 102 +#define GLUT_KEY_DOWN 103 +#define GLUT_KEY_PAGE_UP 104 +#define GLUT_KEY_PAGE_DOWN 105 +#define GLUT_KEY_HOME 106 +#define GLUT_KEY_END 107 +#define GLUT_KEY_INSERT 108 + +/* Entry/exit state. */ +#define GLUT_LEFT 0 +#define GLUT_ENTERED 1 + +/* Visibility state. */ +#define GLUT_NOT_VISIBLE 0 +#define GLUT_VISIBLE 1 + +/* Color index component selection values. */ +#define GLUT_RED 0 +#define GLUT_GREEN 1 +#define GLUT_BLUE 2 + +/* Layers for use. */ +#define GLUT_NORMAL 0 +#define GLUT_OVERLAY 1 + +/* Stroke font constants (use these in GLUT program). */ +#define GLUT_STROKE_ROMAN ((void*)0) +#define GLUT_STROKE_MONO_ROMAN ((void*)1) + +/* Bitmap font constants (use these in GLUT program). */ +#define GLUT_BITMAP_9_BY_15 ((void*)2) +#define GLUT_BITMAP_8_BY_13 ((void*)3) +#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4) +#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5) +#define GLUT_BITMAP_HELVETICA_10 ((void*)6) +#define GLUT_BITMAP_HELVETICA_12 ((void*)7) +#define GLUT_BITMAP_HELVETICA_18 ((void*)8) + +/* glutGet parameters. */ +#define GLUT_WINDOW_X 100 +#define GLUT_WINDOW_Y 101 +#define GLUT_WINDOW_WIDTH 102 +#define GLUT_WINDOW_HEIGHT 103 +#define GLUT_WINDOW_BUFFER_SIZE 104 +#define GLUT_WINDOW_STENCIL_SIZE 105 +#define GLUT_WINDOW_DEPTH_SIZE 106 +#define GLUT_WINDOW_RED_SIZE 107 +#define GLUT_WINDOW_GREEN_SIZE 108 +#define GLUT_WINDOW_BLUE_SIZE 109 +#define GLUT_WINDOW_ALPHA_SIZE 110 +#define GLUT_WINDOW_ACCUM_RED_SIZE 111 +#define GLUT_WINDOW_ACCUM_GREEN_SIZE 112 +#define GLUT_WINDOW_ACCUM_BLUE_SIZE 113 +#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114 +#define GLUT_WINDOW_DOUBLEBUFFER 115 +#define GLUT_WINDOW_RGBA 116 +#define GLUT_WINDOW_PARENT 117 +#define GLUT_WINDOW_NUM_CHILDREN 118 +#define GLUT_WINDOW_COLORMAP_SIZE 119 +#define GLUT_WINDOW_NUM_SAMPLES 120 +#define GLUT_WINDOW_STEREO 121 +#define GLUT_WINDOW_CURSOR 122 +#define GLUT_SCREEN_WIDTH 200 +#define GLUT_SCREEN_HEIGHT 201 +#define GLUT_SCREEN_WIDTH_MM 202 +#define GLUT_SCREEN_HEIGHT_MM 203 +#define GLUT_MENU_NUM_ITEMS 300 +#define GLUT_DISPLAY_MODE_POSSIBLE 400 +#define GLUT_INIT_WINDOW_X 500 +#define GLUT_INIT_WINDOW_Y 501 +#define GLUT_INIT_WINDOW_WIDTH 502 +#define GLUT_INIT_WINDOW_HEIGHT 503 +#define GLUT_INIT_DISPLAY_MODE 504 +#define GLUT_ELAPSED_TIME 700 +#define GLUT_WINDOW_FORMAT_ID 123 + +/* glutDeviceGet parameters. */ +#define GLUT_HAS_KEYBOARD 600 +#define GLUT_HAS_MOUSE 601 +#define GLUT_HAS_SPACEBALL 602 +#define GLUT_HAS_DIAL_AND_BUTTON_BOX 603 +#define GLUT_HAS_TABLET 604 +#define GLUT_NUM_MOUSE_BUTTONS 605 +#define GLUT_NUM_SPACEBALL_BUTTONS 606 +#define GLUT_NUM_BUTTON_BOX_BUTTONS 607 +#define GLUT_NUM_DIALS 608 +#define GLUT_NUM_TABLET_BUTTONS 609 +#define GLUT_DEVICE_IGNORE_KEY_REPEAT 610 +#define GLUT_DEVICE_KEY_REPEAT 611 +#define GLUT_HAS_JOYSTICK 612 +#define GLUT_OWNS_JOYSTICK 613 +#define GLUT_JOYSTICK_BUTTONS 614 +#define GLUT_JOYSTICK_AXES 615 +#define GLUT_JOYSTICK_POLL_RATE 616 + +/* glutLayerGet parameters. */ +#define GLUT_OVERLAY_POSSIBLE 800 +#define GLUT_LAYER_IN_USE 801 +#define GLUT_HAS_OVERLAY 802 +#define GLUT_TRANSPARENT_INDEX 803 +#define GLUT_NORMAL_DAMAGED 804 +#define GLUT_OVERLAY_DAMAGED 805 + +/* glutVideoResizeGet parameters. */ +#define GLUT_VIDEO_RESIZE_POSSIBLE 900 +#define GLUT_VIDEO_RESIZE_IN_USE 901 +#define GLUT_VIDEO_RESIZE_X_DELTA 902 +#define GLUT_VIDEO_RESIZE_Y_DELTA 903 +#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904 +#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905 +#define GLUT_VIDEO_RESIZE_X 906 +#define GLUT_VIDEO_RESIZE_Y 907 +#define GLUT_VIDEO_RESIZE_WIDTH 908 +#define GLUT_VIDEO_RESIZE_HEIGHT 909 + +/* glutUseLayer parameters. */ +#define GLUT_NORMAL 0 +#define GLUT_OVERLAY 1 + +/* glutGetModifiers return mask. */ +#define GLUT_ACTIVE_SHIFT 1 +#define GLUT_ACTIVE_CTRL 2 +#define GLUT_ACTIVE_ALT 4 + +/* glutSetCursor parameters. */ +/* Basic arrows. */ +#define GLUT_CURSOR_RIGHT_ARROW 0 +#define GLUT_CURSOR_LEFT_ARROW 1 +/* Symbolic cursor shapes. */ +#define GLUT_CURSOR_INFO 2 +#define GLUT_CURSOR_DESTROY 3 +#define GLUT_CURSOR_HELP 4 +#define GLUT_CURSOR_CYCLE 5 +#define GLUT_CURSOR_SPRAY 6 +#define GLUT_CURSOR_WAIT 7 +#define GLUT_CURSOR_TEXT 8 +#define GLUT_CURSOR_CROSSHAIR 9 +/* Directional cursors. */ +#define GLUT_CURSOR_UP_DOWN 10 +#define GLUT_CURSOR_LEFT_RIGHT 11 +/* Sizing cursors. */ +#define GLUT_CURSOR_TOP_SIDE 12 +#define GLUT_CURSOR_BOTTOM_SIDE 13 +#define GLUT_CURSOR_LEFT_SIDE 14 +#define GLUT_CURSOR_RIGHT_SIDE 15 +#define GLUT_CURSOR_TOP_LEFT_CORNER 16 +#define GLUT_CURSOR_TOP_RIGHT_CORNER 17 +#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18 +#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19 +/* Inherit from parent window. */ +#define GLUT_CURSOR_INHERIT 100 +/* Blank cursor. */ +#define GLUT_CURSOR_NONE 101 +/* Fullscreen crosshair (if available). */ +#define GLUT_CURSOR_FULL_CROSSHAIR 102 + +/* GLUT initialization sub-API. */ +GLUTAPI void APIENTRY glutInit(int *argcp, char **argv); +GLUTAPI void APIENTRY glutInitDisplayMode(unsigned int mode); +GLUTAPI void APIENTRY glutInitWindowPosition(int x, int y); +GLUTAPI void APIENTRY glutInitWindowSize(int width, int height); +GLUTAPI void APIENTRY glutMainLoop(void); + +/* GLUT window sub-API. */ +GLUTAPI int APIENTRY glutCreateWindow(const char *title); +GLUTAPI int APIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height); +GLUTAPI void APIENTRY glutDestroyWindow(int win); +GLUTAPI void APIENTRY glutPostRedisplay(void); +GLUTAPI void APIENTRY glutSwapBuffers(void); +GLUTAPI int APIENTRY glutGetWindow(void); +GLUTAPI void APIENTRY glutSetWindow(int win); +GLUTAPI void APIENTRY glutSetWindowTitle(const char *title); +GLUTAPI void APIENTRY glutSetIconTitle(const char *title); +GLUTAPI void APIENTRY glutPositionWindow(int x, int y); +GLUTAPI void APIENTRY glutReshapeWindow(int width, int height); +GLUTAPI void APIENTRY glutPopWindow(void); +GLUTAPI void APIENTRY glutPushWindow(void); +GLUTAPI void APIENTRY glutIconifyWindow(void); +GLUTAPI void APIENTRY glutShowWindow(void); +GLUTAPI void APIENTRY glutHideWindow(void); + +/* GLUT overlay sub-API. */ +GLUTAPI void APIENTRY glutEstablishOverlay(void); +GLUTAPI void APIENTRY glutRemoveOverlay(void); +GLUTAPI void APIENTRY glutUseLayer(GLenum layer); +GLUTAPI void APIENTRY glutPostOverlayRedisplay(void); +GLUTAPI void APIENTRY glutShowOverlay(void); +GLUTAPI void APIENTRY glutHideOverlay(void); + +/* GLUT menu sub-API. */ +GLUTAPI int APIENTRY glutCreateMenu(void (GLUTCALLBACK *)(int)); +GLUTAPI void APIENTRY glutDestroyMenu(int menu); +GLUTAPI int APIENTRY glutGetMenu(void); +GLUTAPI void APIENTRY glutSetMenu(int menu); +GLUTAPI void APIENTRY glutAddMenuEntry(const char *label, int value); +GLUTAPI void APIENTRY glutAddSubMenu(const char *label, int submenu); +GLUTAPI void APIENTRY glutChangeToMenuEntry(int item, const char *label, int value); +GLUTAPI void APIENTRY glutChangeToSubMenu(int item, const char *label, int submenu); +GLUTAPI void APIENTRY glutRemoveMenuItem(int item); +GLUTAPI void APIENTRY glutAttachMenu(int button); +GLUTAPI void APIENTRY glutDetachMenu(int button); + +/* GLUT window callback sub-API. */ +GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK * func)(void)); +GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK * func)(int width, int height)); +GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y)); +GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y)); +GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK * func)(int x, int y)); +GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK * func)(int x, int y)); +GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK * func)(int state)); +GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK * func)(int state)); +GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK * func)(void)); +GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK * func)(int value), int value); +GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK * func)(int state)); +GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK * func)(int key, int x, int y)); +GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK * func)(int x, int y, int z)); +GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK * func)(int x, int y, int z)); +GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK * func)(int button, int state)); +GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK * func)(int button, int state)); +GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK * func)(int dial, int value)); +GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK * func)(int x, int y)); +GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y)); +GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK * func)(int status, int x, int y)); +GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK * func)(void)); +GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK * func)(int state)); + +/* GLUT color index sub-API. */ +GLUTAPI void APIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue); +GLUTAPI GLfloat APIENTRY glutGetColor(int ndx, int component); +GLUTAPI void APIENTRY glutCopyColormap(int win); + +/* GLUT state retrieval sub-API. */ +GLUTAPI int APIENTRY glutGet(GLenum type); +GLUTAPI int APIENTRY glutDeviceGet(GLenum type); + +/* GLUT font sub-API */ +GLUTAPI void APIENTRY glutBitmapCharacter(void *font, int character); +GLUTAPI int APIENTRY glutBitmapWidth(void *font, int character); +GLUTAPI void APIENTRY glutStrokeCharacter(void *font, int character); +GLUTAPI int APIENTRY glutStrokeWidth(void *font, int character); + +/* GLUT pre-built models sub-API */ +GLUTAPI void APIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks); +GLUTAPI void APIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks); +GLUTAPI void APIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); +GLUTAPI void APIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); +GLUTAPI void APIENTRY glutWireCube(GLdouble size); +GLUTAPI void APIENTRY glutSolidCube(GLdouble size); +GLUTAPI void APIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); +GLUTAPI void APIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); +GLUTAPI void APIENTRY glutWireDodecahedron(void); +GLUTAPI void APIENTRY glutSolidDodecahedron(void); +GLUTAPI void APIENTRY glutWireTeapot(GLdouble size); +GLUTAPI void APIENTRY glutSolidTeapot(GLdouble size); +GLUTAPI void APIENTRY glutWireOctahedron(void); +GLUTAPI void APIENTRY glutSolidOctahedron(void); +GLUTAPI void APIENTRY glutWireTetrahedron(void); +GLUTAPI void APIENTRY glutSolidTetrahedron(void); +GLUTAPI void APIENTRY glutWireIcosahedron(void); +GLUTAPI void APIENTRY glutSolidIcosahedron(void); + +#endif /* __AGLUT_H__ */ --- mesa-7.4.1.orig/bin/confdiff.sh +++ mesa-7.4.1/bin/confdiff.sh @@ -0,0 +1,48 @@ +#!/bin/bash -e + +usage() +{ + echo "Usage: $0 " + echo "Highlight differences between Mesa configs" + echo "Example:" + echo " $0 linux linux-x86" +} + +die() +{ + echo "$@" >&2 + return 1 +} + +case "$1" in +-h|--help) usage; exit 0;; +esac + +[ $# -lt 2 ] && die 2 targets needed. See $0 --help +target1=$1 +target2=$2 + +topdir=$(cd "`dirname $0`"/..; pwd) +cd "$topdir" + +[ -f "./configs/$target1" ] || die Missing configs/$target1 +[ -f "./configs/$target2" ] || die Missing configs/$target2 + +trap 'rm -f "$t1" "$t2"' 0 + +t1=$(mktemp) +t2=$(mktemp) + +make -f- -n -p < $t1 +TOP = . +include \$(TOP)/configs/$target1 +default: +EOF + +make -f- -n -p < $t2 +TOP = . +include \$(TOP)/configs/$target2 +default: +EOF + +diff -pu -I'^#' $t1 $t2 --- mesa-7.4.1.orig/bin/installmesa +++ mesa-7.4.1/bin/installmesa @@ -0,0 +1,74 @@ +#!/bin/sh + +# +# Simple shell script for installing Mesa's header and library files. +# If the copy commands below don't work on a particular system (i.e. the +# -f or -d flags), we may need to branch on `uname` to do the right thing. +# + + +TOP=. + +INCLUDE_DIR="/usr/local/include" +LIB_DIR="/usr/local/lib" + +if [ "x$#" = "x0" ] ; then +echo +echo "***** Mesa installation - You may need root privileges to do this *****" +echo +echo "Default directory for header files is:" ${INCLUDE_DIR} +echo "Enter new directory or press to accept this default." + +read INPUT +if [ "x${INPUT}" != "x" ] ; then + INCLUDE_DIR=${INPUT} +fi + +echo +echo "Default directory for library files is:" ${LIB_DIR} +echo "Enter new directory or press to accept this default." + +read INPUT +if [ "x${INPUT}" != "x" ] ; then + LIB_DIR=${INPUT} +fi + +echo +echo "About to install Mesa header files (GL/*.h) in: " ${INCLUDE_DIR}/GL +echo "and Mesa library files (libGL.*, etc) in: " ${LIB_DIR} +echo "Press to continue, or -C to abort." + +read INPUT + +else +INCLUDE_DIR=$1/include +LIB_DIR=$1/lib +fi + +# flags: +# -f = force +# -d = preserve symlinks (does not work on BSD) + +if [ `uname` = "FreeBSD" ] ; then + CP_FLAGS="-f" +elif [ `uname` = "Darwin" ] ; then + CP_FLAGS="-f" +elif [ `uname` = "AIX" ] ; then + CP_FLAGS="-fh" +else + CP_FLAGS="-fd" +fi + + +set -v + +mkdir -p ${INCLUDE_DIR} +mkdir -p ${INCLUDE_DIR}/GL +# NOT YET: mkdir -p ${INCLUDE_DIR}/GLES +mkdir -p ${LIB_DIR} +cp -f ${TOP}/include/GL/*.h ${INCLUDE_DIR}/GL +cp -f ${TOP}/src/glw/*.h ${INCLUDE_DIR}/GL +# NOT YET: cp -f ${TOP}/include/GLES/*.h ${INCLUDE_DIR}/GLES +cp ${CP_FLAGS} ${TOP}/lib*/lib* ${LIB_DIR} + +echo "Done." --- mesa-7.4.1.orig/src/mesa/x86-64/calling_convention.txt +++ mesa-7.4.1/src/mesa/x86-64/calling_convention.txt @@ -0,0 +1,50 @@ +Register Usage +rax temporary register; with variable arguments passes information + about the number of SSE registers used; 1st return register + +rbx* callee-saved register; optionally used as base pointer + +rcx used to pass 4th integer argument to functions + +rdx used to pass 3rd argument to functions 2nd return register + +rsp* stack pointer + +rbp* callee-saved register; optionally used as frame pointer + +rsi used to pass 2nd argument to functions + +rdi used to pass 1st argument to functions + +r8 used to pass 5th argument to functions + +r9 used to pass 6th argument to functions + +r10 temporary register, used for passing a function's static chain pointer + +r11 temporary register + +r12-15* callee-saved registers + +xmm0­1 used to pass and return floating point arguments + +xmm2­7 used to pass floating point arguments + +xmm8­15 temporary registers + +mmx0­7 temporary registers + +st0 temporary register; used to return long double arguments + +st1 temporary registers; used to return long double arguments + +st2­7 temporary registers + +fs Reserved for system use (as thread specific data register) + + + +*) must be preserved across function calls + +Integer arguments from list: rdi,rsi,rdx,rcx,r8,r9,stack +Floating point arguments from list: xmm0-xmm7 \ No newline at end of file --- mesa-7.4.1.orig/src/mesa/drivers/ggi/default/genkgi.h +++ mesa-7.4.1/src/mesa/drivers/ggi/default/genkgi.h @@ -0,0 +1,76 @@ +/* +****************************************************************************** + + GGIMesa - KGIcon specific overrides for fbcon-mesa + API header + + Copyright (C) 1999 Jon Taylor [taylorj@ggi-project.org] + + 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 + THE AUTHOR(S) 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. + +****************************************************************************** +*/ + +#ifndef _GENKGI_MESA_H +#define _GENKGI_MESA_H + +#undef KGI_USE_PPBUFS + +#include +#include + +#include +#include +#include + +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + +/* FIXME: LibGGI needs to export its genkgi.h */ +struct genkgi_priv +{ + ggi_gc *mapped_gc; + unsigned int gc_size; + ggifunc_drawline *drawline; + ggifunc_drawbox *drawbox; + ggifunc_fillscreen *fillscreen; + int fd_gc; + int close_gc; + int fd_kgicommand; + uint8 *mapped_kgicommand; + uint8 *kgicommand_ptr; + unsigned int kgicommand_buffersize; +}; + +#define GENKGI_PRIV(vis) ((struct genkgi_priv *)FBDEV_PRIV(vis)->accelpriv) + +extern ggifunc_getapi GGIMesa_genkgi_getapi; +extern ggifunc_flush GGIMesa_genkgi_flush; + +struct genkgi_priv_mesa +{ + char accel[100]; + int have_accel; + void *accelpriv; /* Private data of subdrivers */ + struct genkgi_priv *oldpriv; /* LibGGI's private data */ +}; + +#define GENKGI_PRIV_MESA(vis) ((struct genkgi_priv_mesa *)FBDEV_PRIV_MESA(vis)->accelpriv) + +#endif /* _GENKHI_MESA_H */ --- mesa-7.4.1.orig/src/mesa/drivers/windows/gdi/InitCritSections.cpp +++ mesa-7.4.1/src/mesa/drivers/windows/gdi/InitCritSections.cpp @@ -0,0 +1,32 @@ +#include "glapi.h" +#include "glThread.h" + +#ifdef WIN32_THREADS +extern "C" _glthread_Mutex OneTimeLock; +extern "C" _glthread_Mutex GenTexturesLock; + +extern "C" void FreeAllTSD(void); + +class _CriticalSectionInit +{ +public: + static _CriticalSectionInit m_inst; + + _CriticalSectionInit() + { + _glthread_INIT_MUTEX(OneTimeLock); + _glthread_INIT_MUTEX(GenTexturesLock); + } + + ~_CriticalSectionInit() + { + _glthread_DESTROY_MUTEX(OneTimeLock); + _glthread_DESTROY_MUTEX(GenTexturesLock); + FreeAllTSD(); + } +}; + +_CriticalSectionInit _CriticalSectionInit::m_inst; + + +#endif --- mesa-7.4.1.orig/src/mesa/drivers/windows/fx/fx.rc +++ mesa-7.4.1/src/mesa/drivers/windows/fx/fx.rc @@ -0,0 +1,39 @@ +#include + +#define PRODNAME "Mesa 6.x" +#define CONTACTSTR "http://www.mesa3d.org" +#define HWSTR "3dfx Voodoo Graphics, Voodoo Rush, Voodoo^2, Voodoo Banshee, Velocity 100/200, Voodoo3, Voodoo4, Voodoo5" +#define COPYRIGHTSTR "Copyright \251 Brian E. Paul" + +#define VERSIONSTR "6.3.0.1" +#define MANVERSION 6 +#define MANREVISION 3 +#define BUILD_NUMBER 1 + +VS_VERSION_INFO VERSIONINFO + FILEVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER + PRODUCTVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER + FILEFLAGSMASK 0x0030003FL + + FILEOS VOS_DOS_WINDOWS32 + FILETYPE VFT_DRV + FILESUBTYPE VFT2_DRV_INSTALLABLE +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "FileDescription", PRODNAME + VALUE "FileVersion", VERSIONSTR + VALUE "LegalCopyright", COPYRIGHTSTR + VALUE "ProductName", PRODNAME + VALUE "Graphics Subsystem", HWSTR + VALUE "Contact", CONTACTSTR + END + END + BLOCK "VarFileInfo" + BEGIN + /* the following line should be extended for localized versions */ + VALUE "Translation", 0x409, 1252 + END +END --- mesa-7.4.1.orig/src/mesa/drivers/windows/gldirect/gldirect.rc +++ mesa-7.4.1/src/mesa/drivers/windows/gldirect/gldirect.rc @@ -0,0 +1,43 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, Inc. 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 +* SCITECH SOFTWARE INC 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. +* +* ====================================================================== +* +* Language: Windows Resource Compiler +* Environment: Windows 95 +* +****************************************************************************/ + +#ifndef WORKSHOP_INVOKED + #include +#endif + +#define FILE_DESCRIPTION "SciTech GLDirect" +#define ORIG_FILENAME "opengl32.dll" +#define FILE_TYPE VFT_DLL + +#include "gldirect/gldver.ver" --- mesa-7.4.1.orig/src/mesa/drivers/windows/gldirect/opengl32.ref +++ mesa-7.4.1/src/mesa/drivers/windows/gldirect/opengl32.ref @@ -0,0 +1,495 @@ +;**************************************************************************** +;* +;* Mesa 3-D graphics library +;* Direct3D Driver Interface +;* +;* ======================================================================== +;* +;* Copyright (C) 1991-2004 SciTech Software, Inc. 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 +;* SCITECH SOFTWARE INC 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. +;* +;* ====================================================================== +;* +;* Language: ANSI C +;* Environment: Windows 9x/2000/XP/XBox (Win32) +;* +;* Description: DLL Module definition file +;* +;****************************************************************************/ + +DESCRIPTION 'GLDirect' + +VERSION 3.0 + +EXPORTS + glAccum + glAlphaFunc + glAreTexturesResident + glArrayElement + glBegin + glBindTexture + glBitmap + glBlendFunc + glCallList + glCallLists + glClear + glClearAccum + glClearIndex + glClearColor + glClearDepth + glClearStencil + glClipPlane + glColor3b + glColor3d + glColor3f + glColor3i + glColor3s + glColor3ub + glColor3ui + glColor3us + glColor4b + glColor4d + glColor4f + glColor4i + glColor4s + glColor4ub + glColor4ui + glColor4us + glColor3bv + glColor3dv + glColor3fv + glColor3iv + glColor3sv + glColor3ubv + glColor3uiv + glColor3usv + glColor4bv + glColor4dv + glColor4fv + glColor4iv + glColor4sv + glColor4ubv + glColor4uiv + glColor4usv + glColorMask + glColorMaterial + glColorPointer + glColorTableEXT + glColorSubTableEXT + glCopyPixels + glCopyTexImage1D + glCopyTexImage2D + glCopyTexSubImage1D + glCopyTexSubImage2D + glCullFace + glDepthFunc + glDepthMask + glDepthRange + glDeleteLists + glDeleteTextures + glDisable + glDisableClientState + glDrawArrays + glDrawBuffer + glDrawElements + glDrawPixels + glEnable + glEnableClientState + glEnd + glEndList + glEvalCoord1d + glEvalCoord1f + glEvalCoord1dv + glEvalCoord1fv + glEvalCoord2d + glEvalCoord2f + glEvalCoord2dv + glEvalCoord2fv + glEvalPoint1 + glEvalPoint2 + glEvalMesh1 + glEdgeFlag + glEdgeFlagv + glEdgeFlagPointer + glEvalMesh2 + glFeedbackBuffer + glFinish + glFlush + glFogf + glFogi + glFogfv + glFogiv + glFrontFace + glFrustum + glGenLists + glGenTextures + glGetBooleanv + glGetClipPlane + glGetColorTableEXT + glGetColorTableParameterivEXT + glGetColorTableParameterfvEXT + glGetDoublev + glGetError + glGetFloatv + glGetIntegerv + glGetLightfv + glGetLightiv + glGetMapdv + glGetMapfv + glGetMapiv + glGetMaterialfv + glGetMaterialiv + glGetPixelMapfv + glGetPixelMapuiv + glGetPixelMapusv + glGetPointerv + glGetPolygonStipple + glGetString + glGetTexEnvfv + glGetTexEnviv + glGetTexGeniv + glGetTexGendv + glGetTexGenfv + glGetTexImage + glGetTexLevelParameterfv + glGetTexLevelParameteriv + glGetTexParameterfv + glGetTexParameteriv + glHint + glIndexd + glIndexf + glIndexi + glIndexs + glIndexub + glIndexdv + glIndexfv + glIndexiv + glIndexsv + glIndexubv + glIndexMask + glIndexPointer + glInterleavedArrays + glInitNames + glIsList + glIsTexture + glLightf + glLighti + glLightfv + glLightiv + glLightModelf + glLightModeli + glLightModelfv + glLightModeliv + glLineWidth + glLineStipple + glListBase + glLoadIdentity + glLoadMatrixd + glLoadMatrixf + glLoadName + glLogicOp + glMap1d + glMap1f + glMap2d + glMap2f + glMapGrid1d + glMapGrid1f + glMapGrid2d + glMapGrid2f + glMaterialf + glMateriali + glMaterialfv + glMaterialiv + glMatrixMode + glMultMatrixd + glMultMatrixf + glNewList + glNormal3b + glNormal3d + glNormal3f + glNormal3i + glNormal3s + glNormal3bv + glNormal3dv + glNormal3fv + glNormal3iv + glNormal3sv + glNormalPointer + glOrtho + glPassThrough + glPixelMapfv + glPixelMapuiv + glPixelMapusv + glPixelStoref + glPixelStorei + glPixelTransferf + glPixelTransferi + glPixelZoom + glPointSize + glPolygonMode + glPolygonOffset + glPolygonOffsetEXT + glPolygonStipple + glPopAttrib + glPopClientAttrib + glPopMatrix + glPopName + glPrioritizeTextures + glPushMatrix + glRasterPos2d + glRasterPos2f + glRasterPos2i + glRasterPos2s + glRasterPos3d + glRasterPos3f + glRasterPos3i + glRasterPos3s + glRasterPos4d + glRasterPos4f + glRasterPos4i + glRasterPos4s + glRasterPos2dv + glRasterPos2fv + glRasterPos2iv + glRasterPos2sv + glRasterPos3dv + glRasterPos3fv + glRasterPos3iv + glRasterPos3sv + glRasterPos4dv + glRasterPos4fv + glRasterPos4iv + glRasterPos4sv + glReadBuffer + glReadPixels + glRectd + glRectf + glRecti + glRects + glRectdv + glRectfv + glRectiv + glRectsv + glScissor + glIsEnabled + glPushAttrib + glPushClientAttrib + glPushName + glRenderMode + glRotated + glRotatef + glSelectBuffer + glScaled + glScalef + glShadeModel + glStencilFunc + glStencilMask + glStencilOp + glTexCoord1d + glTexCoord1f + glTexCoord1i + glTexCoord1s + glTexCoord2d + glTexCoord2f + glTexCoord2i + glTexCoord2s + glTexCoord3d + glTexCoord3f + glTexCoord3i + glTexCoord3s + glTexCoord4d + glTexCoord4f + glTexCoord4i + glTexCoord4s + glTexCoord1dv + glTexCoord1fv + glTexCoord1iv + glTexCoord1sv + glTexCoord2dv + glTexCoord2fv + glTexCoord2iv + glTexCoord2sv + glTexCoord3dv + glTexCoord3fv + glTexCoord3iv + glTexCoord3sv + glTexCoord4dv + glTexCoord4fv + glTexCoord4iv + glTexCoord4sv + glTexCoordPointer + glTexGend + glTexGenf + glTexGeni + glTexGendv + glTexGeniv + glTexGenfv + glTexEnvf + glTexEnvi + glTexEnvfv + glTexEnviv + glTexImage1D + glTexImage2D + glTexParameterf + glTexParameteri + glTexParameterfv + glTexParameteriv + glTexSubImage1D + glTexSubImage2D + glTranslated + glTranslatef + glVertex2d + glVertex2f + glVertex2i + glVertex2s + glVertex3d + glVertex3f + glVertex3i + glVertex3s + glVertex4d + glVertex4f + glVertex4i + glVertex4s + glVertex2dv + glVertex2fv + glVertex2iv + glVertex2sv + glVertex3dv + glVertex3fv + glVertex3iv + glVertex3sv + glVertex4dv + glVertex4fv + glVertex4iv + glVertex4sv + glVertexPointer + glViewport + + glBlendEquationEXT + glBlendColorEXT + glVertexPointerEXT + glNormalPointerEXT + glColorPointerEXT + glIndexPointerEXT + glTexCoordPointerEXT + glEdgeFlagPointerEXT + glGetPointervEXT + glArrayElementEXT + glDrawArraysEXT + glBindTextureEXT + glDeleteTexturesEXT + glGenTexturesEXT + glPrioritizeTexturesEXT + glCopyTexSubImage3DEXT + glTexImage3DEXT + glTexSubImage3DEXT + + glWindowPos4fMESA + glWindowPos2iMESA + glWindowPos2sMESA + glWindowPos2fMESA + glWindowPos2dMESA + glWindowPos2ivMESA + glWindowPos2svMESA + glWindowPos2fvMESA + glWindowPos2dvMESA + glWindowPos3iMESA + glWindowPos3sMESA + glWindowPos3fMESA + glWindowPos3dMESA + glWindowPos3ivMESA + glWindowPos3svMESA + glWindowPos3fvMESA + glWindowPos3dvMESA + glWindowPos4iMESA + glWindowPos4sMESA + glWindowPos4dMESA + glWindowPos4ivMESA + glWindowPos4svMESA + glWindowPos4fvMESA + glWindowPos4dvMESA + glResizeBuffersMESA + + wglCopyContext + wglCreateContext + wglCreateLayerContext + wglDeleteContext + wglDescribeLayerPlane + wglGetCurrentContext + wglGetCurrentDC + wglGetLayerPaletteEntries + wglGetProcAddress + wglMakeCurrent + wglRealizeLayerPalette + wglSetLayerPaletteEntries + wglShareLists + wglSwapLayerBuffers + wglUseFontBitmapsA + wglUseFontBitmapsW + wglUseFontOutlinesA + wglUseFontOutlinesW + +;These functions are identical and therefore share the same addresses + ChoosePixelFormat = wglChoosePixelFormat + DescribePixelFormat = wglDescribePixelFormat + GetPixelFormat = wglGetPixelFormat + SetPixelFormat = wglSetPixelFormat + SwapBuffers = wglSwapBuffers + + wglChoosePixelFormat + wglDescribePixelFormat + wglGetPixelFormat + wglSetPixelFormat + wglSwapBuffers + + glActiveTextureARB + glClientActiveTextureARB + glMultiTexCoord1dARB + glMultiTexCoord1dvARB + glMultiTexCoord1fARB + glMultiTexCoord1fvARB + glMultiTexCoord1iARB + glMultiTexCoord1ivARB + glMultiTexCoord1sARB + glMultiTexCoord1svARB + glMultiTexCoord2dARB + glMultiTexCoord2dvARB + glMultiTexCoord2fARB + glMultiTexCoord2fvARB + glMultiTexCoord2iARB + glMultiTexCoord2ivARB + glMultiTexCoord2sARB + glMultiTexCoord2svARB + glMultiTexCoord3dARB + glMultiTexCoord3dvARB + glMultiTexCoord3fARB + glMultiTexCoord3fvARB + glMultiTexCoord3iARB + glMultiTexCoord3ivARB + glMultiTexCoord3sARB + glMultiTexCoord3svARB + glMultiTexCoord4dARB + glMultiTexCoord4dvARB + glMultiTexCoord4fARB + glMultiTexCoord4fvARB + glMultiTexCoord4iARB + glMultiTexCoord4ivARB + glMultiTexCoord4sARB + glMultiTexCoord4svARB --- mesa-7.4.1.orig/src/mesa/drivers/windows/gldirect/mesasw/colors.h +++ mesa-7.4.1/src/mesa/drivers/windows/gldirect/mesasw/colors.h @@ -0,0 +1,520 @@ +/* File name : colors.h + * Version : 2.3 + * + * Header file for display driver for Mesa 2.3 under + * Windows95 and WindowsNT + * This file defines macros and global variables needed + * for converting color format + * + * Copyright (C) 1996- Li Wei + * Address : Institute of Artificial Intelligence + * : & Robotics + * : Xi'an Jiaotong University + * Email : liwei@aiar.xjtu.edu.cn + * Web page : http://sun.aiar.xjtu.edu.cn + * + * This file and its associations are partially based on the + * Windows NT driver for Mesa, written by Mark Leaming + * (mark@rsinc.com). + */ + +/* + * Macros for pixel format defined + */ + +/* + * Revision 1.1 2004/04/20 11:13:11 alanh + * add SciTech's GLDirect driver for Windows. + * + * This code is donated to Mesa which allows the usage of + * a Direct3D layer (DX7, DX8, DX9 or complete software fallback). + * + * No build system exists for this code yet, that will come..... + * + * Revision 1.1.1.1 1999/08/19 00:55:42 jtg + * Imported sources + * + * Revision 1.2 1999/01/03 03:08:57 brianp + * Ted Jump's changes + * + * Revision 1.1 1999/01/03 03:08:12 brianp + * Initial revision + * + * Revision 2.0.2 1997/4/30 15:58:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn) + * Add LUTs need for dithering + */ + +/* + * Revision 1.1 2004/04/20 11:13:11 alanh + * add SciTech's GLDirect driver for Windows. + * + * This code is donated to Mesa which allows the usage of + * a Direct3D layer (DX7, DX8, DX9 or complete software fallback). + * + * No build system exists for this code yet, that will come..... + * + * Revision 1.1.1.1 1999/08/19 00:55:42 jtg + * Imported sources + * + * Revision 1.2 1999/01/03 03:08:57 brianp + * Ted Jump's changes + * + * Revision 1.1 1999/01/03 03:08:12 brianp + * Initial revision + * + * Revision 2.0.1 1997/4/29 15:52:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn) + * Add BGR8 Macro + */ + +/* + * Revision 1.1 2004/04/20 11:13:11 alanh + * add SciTech's GLDirect driver for Windows. + * + * This code is donated to Mesa which allows the usage of + * a Direct3D layer (DX7, DX8, DX9 or complete software fallback). + * + * No build system exists for this code yet, that will come..... + * + * Revision 1.1.1.1 1999/08/19 00:55:42 jtg + * Imported sources + * + * Revision 1.2 1999/01/03 03:08:57 brianp + * Ted Jump's changes + * + * Revision 1.1 1999/01/03 03:08:12 brianp + * Initial revision + * + * Revision 2.0 1996/11/15 10:55:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn) + * Initial revision + */ +/* Values for wmesa->pixelformat: */ + +#define PF_8A8B8G8R 3 /* 32-bit TrueColor: 8-A, 8-B, 8-G, 8-R */ +#define PF_8R8G8B 4 /* 32-bit TrueColor: 8-R, 8-G, 8-B */ +#define PF_5R6G5B 5 /* 16-bit TrueColor: 5-R, 6-G, 5-B bits */ +#define PF_DITHER8 6 /* Dithered RGB using a lookup table */ +#define PF_LOOKUP 7 /* Undithered RGB using a lookup table */ +#define PF_GRAYSCALE 10 /* Grayscale or StaticGray */ +#define PF_BADFORMAT 11 +#define PF_INDEX8 12 + +char ColorMap16[] = { +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, +0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, +0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, +0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, +0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05, +0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06, +0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07, +0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08, +0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09, +0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A, +0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B, +0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C, +0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D, +0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E, +0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, +0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, +0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, +0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, +0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, +0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14, +0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, +0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, +0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17, +0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19, +0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, +0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B, +0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C, +0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D, +0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E, +0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F}; + +#define BGR8(r,g,b) (unsigned)(((BYTE)(b & 0xc0 | (g & 0xe0)>>2 | (r & 0xe0)>>5))) +#ifdef DDRAW +#define BGR16(r,g,b) ((WORD)(((BYTE)(ColorMap16[b]) | ((BYTE)(g&0xfc) << 3)) | (((WORD)(BYTE)(ColorMap16[r])) << 11))) +#else +#define BGR16(r,g,b) ((WORD)(((BYTE)(ColorMap16[b]) | ((BYTE)(ColorMap16[g]) << 5)) | (((WORD)(BYTE)(ColorMap16[r])) << 10))) +#endif +#define BGR24(r,g,b) (unsigned long)(((DWORD)(((BYTE)(b)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(r))<<16))) << 8) +#define BGR32(r,g,b) (unsigned long)((DWORD)(((BYTE)(b)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(r))<<16))) + + + +/* + * If pixelformat==PF_8A8B8G8R: + */ +#define PACK_8A8B8G8R( R, G, B, A ) \ + ( ((A) << 24) | ((B) << 16) | ((G) << 8) | (R) ) + + +/* + * If pixelformat==PF_8R8G8B: + */ +#define PACK_8R8G8B( R, G, B) ( ((R) << 16) | ((G) << 8) | (B) ) + + +/* + * If pixelformat==PF_5R6G5B: + */ + + +#ifdef DDRAW +#define PACK_5R6G5B( R, G, B) ((WORD)(((BYTE)(ColorMap16[B]) | ((BYTE)(G&0xfc) << 3)) | (((WORD)(BYTE)(ColorMap16[R])) << 11))) +#else +#define PACK_5R6G5B( R, G, B) ((WORD)(((BYTE)(ColorMap16[B]) | ((BYTE)(ColorMap16[G]) << 5)) | (((WORD)(BYTE)(ColorMap16[R])) << 10))) +#endif +/*---------------------------------------------------------------------------- + +Division lookup tables. These tables compute 0-255 divided by 51 and +modulo 51. These tables could approximate gamma correction. + +*/ + +char unsigned const aDividedBy51Rounded[256] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, +}; + +char unsigned const aDividedBy51[256] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, +}; + +char unsigned const aModulo51[256] = +{ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 0, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 0, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 0, +}; + +/*---------------------------------------------------------------------------- + +Multiplication LUTs. These compute 0-5 times 6 and 36. + +*/ + +char unsigned const aTimes6[6] = +{ + 0, 6, 12, 18, 24, 30 +}; + +char unsigned const aTimes36[6] = +{ + 0, 36, 72, 108, 144, 180 +}; + + +/*---------------------------------------------------------------------------- + +Dither matrices for 8 bit to 2.6 bit halftones. + +*/ + +char unsigned const aHalftone16x16[256] = +{ + 0, 44, 9, 41, 3, 46, 12, 43, 1, 44, 10, 41, 3, 46, 12, 43, + 34, 16, 25, 19, 37, 18, 28, 21, 35, 16, 26, 19, 37, 18, 28, 21, + 38, 6, 47, 3, 40, 9, 50, 6, 38, 7, 47, 4, 40, 9, 49, 6, + 22, 28, 13, 31, 25, 31, 15, 34, 22, 29, 13, 32, 24, 31, 15, 34, + 2, 46, 12, 43, 1, 45, 10, 42, 2, 45, 11, 42, 1, 45, 11, 42, + 37, 18, 27, 21, 35, 17, 26, 20, 36, 17, 27, 20, 36, 17, 26, 20, + 40, 8, 49, 5, 38, 7, 48, 4, 39, 8, 48, 5, 39, 7, 48, 4, + 24, 30, 15, 33, 23, 29, 13, 32, 23, 30, 14, 33, 23, 29, 14, 32, + 2, 46, 12, 43, 0, 44, 10, 41, 3, 47, 12, 44, 0, 44, 10, 41, + 37, 18, 27, 21, 35, 16, 25, 19, 37, 19, 28, 22, 35, 16, 25, 19, + 40, 9, 49, 5, 38, 7, 47, 4, 40, 9, 50, 6, 38, 6, 47, 3, + 24, 30, 15, 34, 22, 29, 13, 32, 25, 31, 15, 34, 22, 28, 13, 31, + 1, 45, 11, 42, 2, 46, 11, 42, 1, 45, 10, 41, 2, 46, 11, 43, + 36, 17, 26, 20, 36, 17, 27, 21, 35, 16, 26, 20, 36, 18, 27, 21, + 39, 8, 48, 4, 39, 8, 49, 5, 38, 7, 48, 4, 39, 8, 49, 5, + 23, 29, 14, 33, 24, 30, 14, 33, 23, 29, 13, 32, 24, 30, 14, 33, +}; + +char unsigned const aHalftone8x8[64] = +{ + 0, 38, 9, 47, 2, 40, 11, 50, + 25, 12, 35, 22, 27, 15, 37, 24, + 6, 44, 3, 41, 8, 47, 5, 43, + 31, 19, 28, 15, 34, 21, 31, 18, + 1, 39, 11, 49, 0, 39, 10, 48, + 27, 14, 36, 23, 26, 13, 35, 23, + 7, 46, 4, 43, 7, 45, 3, 42, + 33, 20, 30, 17, 32, 19, 29, 16, +}; + +char unsigned const aHalftone4x4_1[16] = +{ + 0, 25, 6, 31, + 38, 12, 44, 19, + 9, 35, 3, 28, + 47, 22, 41, 15 +}; + +char unsigned const aHalftone4x4_2[16] = +{ + 41, 3, 9, 28, + 35, 15, 22, 47, + 6, 25, 38, 0, + 19, 44, 31, 12 +}; + +/*************************************************************************** + aWinGHalftoneTranslation + + Translates a 2.6 bit-per-pixel halftoned representation into the + slightly rearranged WinG Halftone Palette. +*/ + +char unsigned const aWinGHalftoneTranslation[216] = +{ + 0, + 29, + 30, + 31, + 32, + 249, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 250, + 250, + 57, + 58, + 59, + 251, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 250, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 227, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 151, + 120, + 121, + 122, + 123, + 124, + 228, + 125, + 126, + 229, + 133, + 162, + 135, + 131, + 132, + 137, + 166, + 134, + 140, + 130, + 136, + 143, + 138, + 139, + 174, + 141, + 142, + 177, + 129, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 157, + 152, + 153, + 154, + 155, + 156, + 192, + 158, + 159, + 160, + 161, + 196, + 163, + 164, + 165, + 127, + 199, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 207, + 175, + 176, + 210, + 178, + 179, + 180, + 181, + 182, + 183, + 184, + 185, + 186, + 187, + 188, + 189, + 190, + 191, + 224, + 193, + 194, + 195, + 252, + 252, + 197, + 198, + 128, + 253, + 252, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 230, + 208, + 209, + 231, + 211, + 212, + 213, + 214, + 215, + 216, + 217, + 218, + 219, + 220, + 221, + 222, + 254, + 223, + 232, + 225, + 226, + 255, +}; --- mesa-7.4.1.orig/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c +++ mesa-7.4.1/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c @@ -0,0 +1,1719 @@ +/**************************************************************************** +* +* Mesa 3-D graphics library +* Direct3D Driver Interface +* +* ======================================================================== +* +* Copyright (C) 1991-2004 SciTech Software, Inc. 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 +* SCITECH SOFTWARE INC 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. +* +* ====================================================================== +* +* Language: ANSI C +* Environment: Windows 9x/2000/XP/XBox (Win32) +* +* Description: Mesa Software WGL (WindowsGL) +* +****************************************************************************/ + +#include +#define GL_GLEXT_PROTOTYPES +#include +#include + +#include "glheader.h" +#include "colors.h" +#include "context.h" +#include "colormac.h" +#include "dd.h" +#include "depth.h" +#include "extensions.h" +#include "macros.h" +#include "matrix.h" +// #include "mem.h" +//#include "mmath.h" +#include "mtypes.h" +#include "texformat.h" +#include "texstore.h" +#include "teximage.h" +#include "vbo/vbo.h" +#include "swrast/swrast.h" +#include "swrast_setup/swrast_setup.h" +#include "swrast/s_context.h" +#include "swrast/s_depth.h" +#include "swrast/s_lines.h" +#include "swrast/s_triangle.h" +#include "swrast/s_trispan.h" +#include "tnl/tnl.h" +#include "tnl/t_context.h" +#include "tnl/t_pipeline.h" + +#include "dglcontext.h" +#include "gld_driver.h" + +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- + +DGL_pixelFormat pfTemplateMesaSW = +{ + { + sizeof(PIXELFORMATDESCRIPTOR), // Size of the data structure + 1, // Structure version - should be 1 + // Flags: + PFD_DRAW_TO_WINDOW | // The buffer can draw to a window or device surface. + PFD_DRAW_TO_BITMAP | // The buffer can draw to a bitmap. (DaveM) + PFD_SUPPORT_GDI | // The buffer supports GDI drawing. (DaveM) + PFD_SUPPORT_OPENGL | // The buffer supports OpenGL drawing. + PFD_DOUBLEBUFFER | // The buffer is double-buffered. + 0, // Placeholder for easy commenting of above flags + PFD_TYPE_RGBA, // Pixel type RGBA. + 32, // Total colour bitplanes (excluding alpha bitplanes) + 8, 0, // Red bits, shift + 8, 8, // Green bits, shift + 8, 16, // Blue bits, shift + 8, 24, // Alpha bits, shift (destination alpha) + 64, // Accumulator bits (total) + 16, 16, 16, 16, // Accumulator bits: Red, Green, Blue, Alpha + 16, // Depth bits + 8, // Stencil bits + 0, // Number of auxiliary buffers + 0, // Layer type + 0, // Specifies the number of overlay and underlay planes. + 0, // Layer mask + 0, // Specifies the transparent color or index of an underlay plane. + 0 // Damage mask + }, + 0, // Unused +}; + +//--------------------------------------------------------------------------- +// Extensions +//--------------------------------------------------------------------------- + +typedef struct { + PROC proc; + char *name; +} GLD_extension; + +static GLD_extension GLD_extList[] = { +#ifdef GL_EXT_polygon_offset + { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" }, +#endif + { (PROC)glBlendEquationEXT, "glBlendEquationEXT" }, + { (PROC)glBlendColorEXT, "glBlendColorExt" }, + { (PROC)glVertexPointerEXT, "glVertexPointerEXT" }, + { (PROC)glNormalPointerEXT, "glNormalPointerEXT" }, + { (PROC)glColorPointerEXT, "glColorPointerEXT" }, + { (PROC)glIndexPointerEXT, "glIndexPointerEXT" }, + { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" }, + { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" }, + { (PROC)glGetPointervEXT, "glGetPointervEXT" }, + { (PROC)glArrayElementEXT, "glArrayElementEXT" }, + { (PROC)glDrawArraysEXT, "glDrawArrayEXT" }, + { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" }, + { (PROC)glBindTextureEXT, "glBindTextureEXT" }, + { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" }, + { (PROC)glGenTexturesEXT, "glGenTexturesEXT" }, + { (PROC)glIsTextureEXT, "glIsTextureEXT" }, + { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" }, + { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" }, + { (PROC)glTexImage3DEXT, "glTexImage3DEXT" }, + { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" }, + { (PROC)glPointParameterfEXT, "glPointParameterfEXT" }, + { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" }, + { (PROC)glLockArraysEXT, "glLockArraysEXT" }, + { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" }, + { NULL, "\0" } +}; + +//--------------------------------------------------------------------------- +// WMesa Internal Functions +//--------------------------------------------------------------------------- + +#define PAGE_FILE 0xffffffff + +#define REDBITS 0x03 +#define REDSHIFT 0x00 +#define GREENBITS 0x03 +#define GREENSHIFT 0x03 +#define BLUEBITS 0x02 +#define BLUESHIFT 0x06 + +typedef struct _dibSection { + HDC hDC; + HANDLE hFileMap; + BOOL fFlushed; + LPVOID base; +} WMDIBSECTION, *PWMDIBSECTION; + +typedef struct wmesa_context { + HWND Window; + HDC hDC; + HPALETTE hPalette; + HPALETTE hOldPalette; + HPEN hPen; + HPEN hOldPen; + HCURSOR hOldCursor; + COLORREF crColor; + // 3D projection stuff + RECT drawRect; + UINT uiDIBoffset; + // OpenGL stuff + HPALETTE hGLPalette; + GLuint width; + GLuint height; + GLuint ScanWidth; + GLboolean db_flag; //* double buffered? + GLboolean rgb_flag; //* RGB mode? + GLboolean dither_flag; //* use dither when 256 color mode for RGB? + GLuint depth; //* bits per pixel (1, 8, 24, etc) + ULONG pixel; // current color index or RGBA pixel value + ULONG clearpixel; //* pixel for clearing the color buffers + PBYTE ScreenMem; // WinG memory + BITMAPINFO *IndexFormat; + HPALETTE hPal; // Current Palette + HPALETTE hPalHalfTone; + + + WMDIBSECTION dib; + BITMAPINFO bmi; + HBITMAP hbmDIB; + HBITMAP hOldBitmap; + HBITMAP Old_Compat_BM; + HBITMAP Compat_BM; // Bitmap for double buffering + PBYTE pbPixels; + int nColors; + BYTE cColorBits; + int pixelformat; + + RECT rectOffScreen; + RECT rectSurface; +// HWND hwnd; + DWORD pitch; + PBYTE addrOffScreen; + + // We always double-buffer, for performance reasons, but + // we need to know which of SwapBuffers() or glFlush() to + // handle. If we're emulating, then we update on Flush(), + // otherwise we update on SwapBufers(). KeithH + BOOL bEmulateSingleBuffer; +} WMesaContext, *PWMC; + +#define GLD_GET_WMESA_DRIVER(c) (WMesaContext*)(c)->glPriv + +// TODO: +GLint stereo_flag = 0 ; + +/* If we are double-buffering, we want to get the DC for the + * off-screen DIB, otherwise the DC for the window. + */ +#define DD_GETDC ((Current->db_flag) ? Current->dib.hDC : Current->hDC ) +#define DD_RELEASEDC + +#define FLIP(Y) (Current->height-(Y)-1) + +struct DISPLAY_OPTIONS { + int stereo; + int fullScreen; + int mode; + int bpp; +}; + +struct DISPLAY_OPTIONS displayOptions; + +//--------------------------------------------------------------------------- + +static unsigned char threeto8[8] = { + 0, 0111>>1, 0222>>1, 0333>>1, 0444>>1, 0555>>1, 0666>>1, 0377 +}; + +static unsigned char twoto8[4] = { + 0, 0x55, 0xaa, 0xff +}; + +static unsigned char oneto8[2] = { + 0, 255 +}; + +//--------------------------------------------------------------------------- + +BYTE DITHER_RGB_2_8BIT( int red, int green, int blue, int pixel, int scanline) +{ + char unsigned redtemp, greentemp, bluetemp, paletteindex; + + //*** now, look up each value in the halftone matrix + //*** using an 8x8 ordered dither. + redtemp = aDividedBy51[red] + + (aModulo51[red] > aHalftone8x8[(pixel%8)*8 + + scanline%8]); + greentemp = aDividedBy51[(char unsigned)green] + + (aModulo51[green] > aHalftone8x8[ + (pixel%8)*8 + scanline%8]); + bluetemp = aDividedBy51[(char unsigned)blue] + + (aModulo51[blue] > aHalftone8x8[ + (pixel%8)*8 +scanline%8]); + + //*** recombine the halftoned rgb values into a palette index + paletteindex = + redtemp + aTimes6[greentemp] + aTimes36[bluetemp]; + + //*** and translate through the wing halftone palette + //*** translation vector to give the correct value. + return aWinGHalftoneTranslation[paletteindex]; +} + +//--------------------------------------------------------------------------- + +static unsigned char componentFromIndex(UCHAR i, UINT nbits, UINT shift) +{ + unsigned char val; + + val = i >> shift; + switch (nbits) { + + case 1: + val &= 0x1; + return oneto8[val]; + + case 2: + val &= 0x3; + return twoto8[val]; + + case 3: + val &= 0x7; + return threeto8[val]; + + default: + return 0; + } +} + +//--------------------------------------------------------------------------- + + +void wmSetPixel(PWMC pwc, int iScanLine, int iPixel, BYTE r, BYTE g, BYTE b) +{ + WMesaContext *Current = pwc; + + // Test for invalid scanline parameter. KeithH + if ((iScanLine < 0) || (iScanLine >= pwc->height)) + return; + + if (Current->db_flag) { + LPBYTE lpb = pwc->pbPixels; + UINT nBypp = pwc->cColorBits >> 3; + UINT nOffset = iPixel % nBypp; + + lpb += pwc->ScanWidth * iScanLine; + lpb += iPixel * nBypp; + + if(nBypp == 1){ + if(pwc->dither_flag) + *lpb = DITHER_RGB_2_8BIT(r,g,b,iScanLine,iPixel); + else + *lpb = BGR8(r,g,b); + } + else if(nBypp == 2) + *((LPWORD)lpb) = BGR16(r,g,b); + else if (nBypp == 3) + *((LPDWORD)lpb) = BGR24(r,g,b); + else if (nBypp == 4) + *((LPDWORD)lpb) = BGR32(r,g,b); + } + else{ + SetPixel(Current->hDC, iPixel, iScanLine, RGB(r,g,b)); + } +} + +//--------------------------------------------------------------------------- + +void wmCreateDIBSection( + HDC hDC, + PWMC pwc, // handle of device context + CONST BITMAPINFO *pbmi, // bitmap size, format, and color data + UINT iUsage // color data type indicator: RGB values or palette indices + ) +{ + DWORD dwSize = 0; + DWORD dwScanWidth; + UINT nBypp = pwc->cColorBits / 8; + HDC hic; + + dwScanWidth = (((pwc->ScanWidth * nBypp)+ 3) & ~3); + + pwc->ScanWidth =pwc->pitch = dwScanWidth; + + if (stereo_flag) + pwc->ScanWidth = 2* pwc->pitch; + + dwSize = sizeof(BITMAPINFO) + (dwScanWidth * pwc->height); + + pwc->dib.hFileMap = CreateFileMapping((HANDLE)PAGE_FILE, + NULL, + PAGE_READWRITE | SEC_COMMIT, + 0, + dwSize, + NULL); + + if (!pwc->dib.hFileMap) + return; + + pwc->dib.base = MapViewOfFile(pwc->dib.hFileMap, + FILE_MAP_ALL_ACCESS, + 0, + 0, + 0); + + if(!pwc->dib.base){ + CloseHandle(pwc->dib.hFileMap); + return; + } + + + CopyMemory(pwc->dib.base, pbmi, sizeof(BITMAPINFO)); + + hic = CreateIC("display", NULL, NULL, NULL); + pwc->dib.hDC = CreateCompatibleDC(hic); + + + pwc->hbmDIB = CreateDIBSection(hic, + &(pwc->bmi), + (iUsage ? DIB_PAL_COLORS : DIB_RGB_COLORS), + &(pwc->pbPixels), + pwc->dib.hFileMap, + 0); + pwc->ScreenMem = pwc->addrOffScreen = pwc->pbPixels; + pwc->hOldBitmap = SelectObject(pwc->dib.hDC, pwc->hbmDIB); + + DeleteDC(hic); + + return; + +} + +//--------------------------------------------------------------------------- + +void wmCreatePalette( PWMC pwdc ) +{ + /* Create a compressed and re-expanded 3:3:2 palette */ + int i; + LOGPALETTE *pPal; + BYTE rb, rs, gb, gs, bb, bs; + + pwdc->nColors = 0x100; + + pPal = (PLOGPALETTE)malloc(sizeof(LOGPALETTE) + + pwdc->nColors * sizeof(PALETTEENTRY)); + memset( pPal, 0, sizeof(LOGPALETTE) + pwdc->nColors * sizeof(PALETTEENTRY) ); + + pPal->palVersion = 0x300; + + rb = REDBITS; + rs = REDSHIFT; + gb = GREENBITS; + gs = GREENSHIFT; + bb = BLUEBITS; + bs = BLUESHIFT; + + if (pwdc->db_flag) { + + /* Need to make two palettes: one for the screen DC and one for the DIB. */ + pPal->palNumEntries = pwdc->nColors; + for (i = 0; i < pwdc->nColors; i++) { + pPal->palPalEntry[i].peRed = componentFromIndex( i, rb, rs ); + pPal->palPalEntry[i].peGreen = componentFromIndex( i, gb, gs ); + pPal->palPalEntry[i].peBlue = componentFromIndex( i, bb, bs ); + pPal->palPalEntry[i].peFlags = 0; + } + pwdc->hGLPalette = CreatePalette( pPal ); + pwdc->hPalette = CreatePalette( pPal ); + } + + else { + pPal->palNumEntries = pwdc->nColors; + for (i = 0; i < pwdc->nColors; i++) { + pPal->palPalEntry[i].peRed = componentFromIndex( i, rb, rs ); + pPal->palPalEntry[i].peGreen = componentFromIndex( i, gb, gs ); + pPal->palPalEntry[i].peBlue = componentFromIndex( i, bb, bs ); + pPal->palPalEntry[i].peFlags = 0; + } + pwdc->hGLPalette = CreatePalette( pPal ); + } + + free(pPal); + +} + +//--------------------------------------------------------------------------- + +/* This function sets the color table of a DIB section + * to match that of the destination DC + */ +BOOL wmSetDibColors(PWMC pwc) +{ + RGBQUAD *pColTab, *pRGB; + PALETTEENTRY *pPal, *pPE; + int i, nColors; + BOOL bRet=TRUE; + DWORD dwErr=0; + + /* Build a color table in the DIB that maps to the + * selected palette in the DC. + */ + nColors = 1 << pwc->cColorBits; + pPal = (PALETTEENTRY *)malloc( nColors * sizeof(PALETTEENTRY)); + memset( pPal, 0, nColors * sizeof(PALETTEENTRY) ); + GetPaletteEntries( pwc->hGLPalette, 0, nColors, pPal ); + pColTab = (RGBQUAD *)malloc( nColors * sizeof(RGBQUAD)); + for (i = 0, pRGB = pColTab, pPE = pPal; i < nColors; i++, pRGB++, pPE++) { + pRGB->rgbRed = pPE->peRed; + pRGB->rgbGreen = pPE->peGreen; + pRGB->rgbBlue = pPE->peBlue; + } + if(pwc->db_flag) + bRet = SetDIBColorTable(pwc->dib.hDC, 0, nColors, pColTab ); + + if(!bRet) + dwErr = GetLastError(); + + free( pColTab ); + free( pPal ); + + return bRet; +} + +//--------------------------------------------------------------------------- + +static void wmSetPixelFormat( PWMC wc, HDC hDC) +{ + if(wc->rgb_flag) + wc->cColorBits = GetDeviceCaps(hDC, BITSPIXEL); + else + wc->cColorBits = 8; + switch(wc->cColorBits){ + case 8: + if(wc->dither_flag != GL_TRUE) + wc->pixelformat = PF_INDEX8; + else + wc->pixelformat = PF_DITHER8; + break; + case 16: + wc->pixelformat = PF_5R6G5B; + break; + case 32: + wc->pixelformat = PF_8R8G8B; + break; + default: + wc->pixelformat = PF_BADFORMAT; + } +} + +//--------------------------------------------------------------------------- + +/* + * This function creates the DIB section that is used for combined + * GL and GDI calls + */ +BOOL wmCreateBackingStore(PWMC pwc, long lxSize, long lySize) +{ + HDC hdc = pwc->hDC; + LPBITMAPINFO pbmi = &(pwc->bmi); + int iUsage; + + pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + pbmi->bmiHeader.biWidth = lxSize; + pbmi->bmiHeader.biHeight= -lySize; + pbmi->bmiHeader.biPlanes = 1; + if(pwc->rgb_flag) + pbmi->bmiHeader.biBitCount = GetDeviceCaps(pwc->hDC, BITSPIXEL); + else + pbmi->bmiHeader.biBitCount = 8; + pbmi->bmiHeader.biCompression = BI_RGB; + pbmi->bmiHeader.biSizeImage = 0; + pbmi->bmiHeader.biXPelsPerMeter = 0; + pbmi->bmiHeader.biYPelsPerMeter = 0; + pbmi->bmiHeader.biClrUsed = 0; + pbmi->bmiHeader.biClrImportant = 0; + + iUsage = (pbmi->bmiHeader.biBitCount <= 8) ? DIB_PAL_COLORS : DIB_RGB_COLORS; + + pwc->cColorBits = pbmi->bmiHeader.biBitCount; + pwc->ScanWidth = pwc->pitch = lxSize; + pwc->width = lxSize; + pwc->height = lySize; + + wmCreateDIBSection(hdc, pwc, pbmi, iUsage); + + if ((iUsage == DIB_PAL_COLORS) && !(pwc->hGLPalette)) { + wmCreatePalette( pwc ); + wmSetDibColors( pwc ); + } + wmSetPixelFormat(pwc, pwc->hDC); + return TRUE; +} + +//--------------------------------------------------------------------------- + +/* + * Free up the dib section that was created + */ +BOOL wmDeleteBackingStore(PWMC pwc) +{ + SelectObject(pwc->dib.hDC, pwc->hOldBitmap); + DeleteDC(pwc->dib.hDC); + DeleteObject(pwc->hbmDIB); + UnmapViewOfFile(pwc->dib.base); + CloseHandle(pwc->dib.hFileMap); + return TRUE; +} + +//--------------------------------------------------------------------------- + +/* + * Blit memory DC to screen DC + */ +BOOL wmFlush(PWMC pwc, HDC hDC) +{ + BOOL bRet = 0; + DWORD dwErr = 0; + +// Now using bEmulateSingleBuffer in the calling function. KeithH + +// if(pwc->db_flag){ + bRet = BitBlt(hDC, 0, 0, pwc->width, pwc->height, + pwc->dib.hDC, 0, 0, SRCCOPY); +// } + + return bRet; + +} + +//--------------------------------------------------------------------------- +// Support Functions +//--------------------------------------------------------------------------- + +static void flush(GLcontext* ctx) +{ + GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); + WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); +/* + if((Current->rgb_flag &&!(Current->db_flag)) + ||(!Current->rgb_flag)) + { + wmFlush(Current, Current->hDC); + } +*/ + // Only flush if we're not in double-buffer mode. KeithH + // The demo fractal.c calls glutSwapBuffers() then glFlush()! + if (Current->bEmulateSingleBuffer) { + wmFlush(Current, Current->hDC); + } +} + + +//--------------------------------------------------------------------------- + + +/* + * Set the color index used to clear the color buffer. + */ +static void clear_index(GLcontext* ctx, GLuint index) +{ + GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); + WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); + Current->clearpixel = index; +} + + + +//--------------------------------------------------------------------------- + +/* + * Set the color used to clear the color buffer. + */ +//static void clear_color( GLcontext* ctx, const GLchan color[4] ) +// Changed for Mesa 5.x. KeithH +static void clear_color( + GLcontext* ctx, + const GLfloat color[4]) +{ + GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); + WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); + GLubyte col[4]; + CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]); + Current->clearpixel = RGB(col[0], col[1], col[2]); +} + + +//--------------------------------------------------------------------------- + + +/* + * Clear the specified region of the color buffer using the clear color + * or index as specified by one of the two functions above. + * + * This procedure clears either the front and/or the back COLOR buffers. + * Only the "left" buffer is cleared since we are not stereo. + * Clearing of the other non-color buffers is left to the swrast. + * We also only clear the color buffers if the color masks are all 1's. + * Otherwise, we let swrast do it. + */ + +static clear(GLcontext* ctx, GLbitfield mask, + GLboolean all, GLint x, GLint y, GLint width, GLint height) +{ + GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); + WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); + DWORD dwColor; + WORD wColor; + BYTE bColor; + LPDWORD lpdw = (LPDWORD)Current->pbPixels; + LPWORD lpw = (LPWORD)Current->pbPixels; + LPBYTE lpb = Current->pbPixels; + int lines; + const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask; + + if (all){ + x=y=0; + width=Current->width; + height=Current->height; + } + + + /* sanity check - can't have right(stereo) buffers */ + assert((mask & (DD_FRONT_RIGHT_BIT | DD_BACK_RIGHT_BIT)) == 0); + + /* clear alpha */ + if ((mask & (DD_FRONT_LEFT_BIT | DD_BACK_RIGHT_BIT)) && + ctx->DrawBuffer->UseSoftwareAlphaBuffers && + ctx->Color.ColorMask[ACOMP]) { + _swrast_clear_alpha_buffers( ctx ); + } + + if (*colorMask == 0xffffffff && ctx->Color.IndexMask == 0xffffffff) { + if (mask & DD_BACK_LEFT_BIT) { + /* Double-buffering - clear back buffer */ + UINT nBypp = Current->cColorBits / 8; + int i = 0; + int iSize = 0; + + assert(Current->db_flag==GL_TRUE); /* we'd better be double buffer */ + if(nBypp ==1 ){ + iSize = Current->width/4; + bColor = BGR8(GetRValue(Current->clearpixel), + GetGValue(Current->clearpixel), + GetBValue(Current->clearpixel)); + wColor = MAKEWORD(bColor,bColor); + dwColor = MAKELONG(wColor, wColor); + } + if(nBypp == 2){ + iSize = Current->width / 2; + wColor = BGR16(GetRValue(Current->clearpixel), + GetGValue(Current->clearpixel), + GetBValue(Current->clearpixel)); + dwColor = MAKELONG(wColor, wColor); + } + else if(nBypp == 4){ + iSize = Current->width; + dwColor = BGR32(GetRValue(Current->clearpixel), + GetGValue(Current->clearpixel), + GetBValue(Current->clearpixel)); + } + + /* clear a line */ + while(i < iSize){ + *lpdw = dwColor; + lpdw++; + i++; + } + + /* This is the 24bit case */ + if (nBypp == 3) { + iSize = Current->width *3/4; + dwColor = BGR24(GetRValue(Current->clearpixel), + GetGValue(Current->clearpixel), + GetBValue(Current->clearpixel)); + while(i < iSize){ + *lpdw = dwColor; + lpb += nBypp; + lpdw = (LPDWORD)lpb; + i++; + } + } + + i = 0; + if (stereo_flag) + lines = height /2; + else + lines = height; + /* copy cleared line to other lines in buffer */ + do { + memcpy(lpb, Current->pbPixels, iSize*4); + lpb += Current->ScanWidth; + i++; + } + while (iclearpixel); + HBRUSH Brush=CreateSolidBrush(Current->clearpixel); + HPEN Old_Pen=SelectObject(DC,Pen); + HBRUSH Old_Brush=SelectObject(DC,Brush); + Rectangle(DC,x,y,x+width,y+height); + SelectObject(DC,Old_Pen); + SelectObject(DC,Old_Brush); + DeleteObject(Pen); + DeleteObject(Brush); + DD_RELEASEDC; + mask &= ~DD_FRONT_LEFT_BIT; + } /* single-buffer */ + } /* if masks are all 1's */ + + /* Call swrast if there is anything left to clear (like DEPTH) */ + if (mask) + _swrast_Clear( ctx, mask, all, x, y, width, height ); +} + + +//--------------------------------------------------------------------------- + + +static void enable( GLcontext* ctx, GLenum pname, GLboolean enable ) +{ + GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); + WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); + + if (!Current) + return; + + if (pname == GL_DITHER) { + if(enable == GL_FALSE){ + Current->dither_flag = GL_FALSE; + if(Current->cColorBits == 8) + Current->pixelformat = PF_INDEX8; + } + else{ + if (Current->rgb_flag && Current->cColorBits == 8){ + Current->pixelformat = PF_DITHER8; + Current->dither_flag = GL_TRUE; + } + else + Current->dither_flag = GL_FALSE; + } + } +} + +//--------------------------------------------------------------------------- + +static GLboolean set_draw_buffer( GLcontext* ctx, GLenum mode ) +{ + /* TODO: this could be better */ + if (mode==GL_FRONT_LEFT || mode==GL_BACK_LEFT) { + return GL_TRUE; + } + else { + return GL_FALSE; + } +} + +//--------------------------------------------------------------------------- + + +static void set_read_buffer(GLcontext *ctx, GLframebuffer *colorBuffer, + GLenum buffer ) +{ + /* XXX todo */ + return; +} + + +//--------------------------------------------------------------------------- + + +/* Return characteristics of the output buffer. */ +//static void buffer_size( GLcontext* ctx, GLuint *width, GLuint *height ) +// Altered for Mesa 5.x. KeithH +static void buffer_size( + GLframebuffer *buffer, + GLuint *width, + GLuint *height) +{ + // For some reason the context is not passed into this function. + // Therefore we have to explicitly retrieve it. + GET_CURRENT_CONTEXT(ctx); + + GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); + WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); + int New_Size; + RECT CR; + + GetClientRect(Current->Window,&CR); + + *width=CR.right; + *height=CR.bottom; + + New_Size=((*width)!=Current->width) || ((*height)!=Current->height); + + if (New_Size){ + Current->width=*width; + Current->height=*height; + Current->ScanWidth=Current->width; + if ((Current->ScanWidth%sizeof(long))!=0) + Current->ScanWidth+=(sizeof(long)-(Current->ScanWidth%sizeof(long))); + + if (Current->db_flag){ + if (Current->rgb_flag==GL_TRUE && Current->dither_flag!=GL_TRUE){ + wmDeleteBackingStore(Current); + wmCreateBackingStore(Current, Current->width, Current->height); + } + } + + } +} + + + +/**********************************************************************/ +/***** Accelerated point, line, polygon rendering *****/ +/**********************************************************************/ + +/* Accelerated routines are not implemented in 4.0. See OSMesa for ideas. */ + +static void fast_rgb_points( GLcontext* ctx, GLuint first, GLuint last ) +{ +} + +//--------------------------------------------------------------------------- + +/* Return pointer to accelerated points function */ +extern tnl_points_func choose_points_function( GLcontext* ctx ) +{ + return NULL; +} + +//--------------------------------------------------------------------------- + +static void fast_flat_rgb_line( GLcontext* ctx, GLuint v0, + GLuint v1, GLuint pv ) +{ +} + +//--------------------------------------------------------------------------- + +static tnl_line_func choose_line_function( GLcontext* ctx ) +{ +} + + +/**********************************************************************/ +/***** Span-based pixel drawing *****/ +/**********************************************************************/ + + +/* Write a horizontal span of 32-bit color-index pixels with a boolean mask. */ +static void write_ci32_span( const GLcontext* ctx, + GLuint n, GLint x, GLint y, + const GLuint index[], + const GLubyte mask[] ) +{ + GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); + WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); + GLuint i; + PBYTE Mem=Current->ScreenMem+FLIP(y)*Current->ScanWidth+x; + assert(Current->rgb_flag==GL_FALSE); + for (i=0; iScreenMem+FLIP(y)*Current->ScanWidth+x; + assert(Current->rgb_flag==GL_FALSE); + for (i=0; iScreenMem+FLIP(y)*Current->ScanWidth+x; + assert(Current->rgb_flag==GL_FALSE); + for (i=0; irgb_flag==GL_TRUE) + { + GLuint i; + HDC DC=DD_GETDC; + y=FLIP(y); + if (mask) { + for (i=0; iScreenMem+y*Current->ScanWidth+x; + y = FLIP(y); + if (mask) { + for (i=0; ihPal, + RGB(rgba[i][RCOMP], + rgba[i][GCOMP], + rgba[i][BCOMP])); + } + else { + for (i=0; ihPal, + RGB(rgba[i][RCOMP], + rgba[i][GCOMP], + rgba[i][BCOMP])); + } + } +} + +//--------------------------------------------------------------------------- + +/* Write a horizontal span of RGB color pixels with a boolean mask. */ +static void write_rgb_span( const GLcontext* ctx, + GLuint n, GLint x, GLint y, + const GLubyte rgb[][3], const GLubyte mask[] ) +{ + GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); + WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); + PWMC pwc = Current; + + if (pwc->rgb_flag==GL_TRUE) + { + GLuint i; + HDC DC=DD_GETDC; + y=FLIP(y); + if (mask) { + for (i=0; iScreenMem+y*Current->ScanWidth+x; + y = FLIP(y); + if (mask) { + for (i=0; ihPal, + RGB(rgb[i][RCOMP], + rgb[i][GCOMP], + rgb[i][BCOMP])); + } + else { + for (i=0; ihPal, + RGB(rgb[i][RCOMP], + rgb[i][GCOMP], + rgb[i][BCOMP])); + } + } +} + +//--------------------------------------------------------------------------- + +/* + * Write a horizontal span of pixels with a boolean mask. The current color + * is used for all pixels. + */ +static void write_mono_rgba_span( const GLcontext* ctx, + GLuint n, GLint x, GLint y, + const GLchan color[4], const GLubyte mask[]) +{ + GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); + WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); + ULONG pixel = RGB( color[RCOMP], color[GCOMP], color[BCOMP] ); + GLuint i; + HDC DC=DD_GETDC; + PWMC pwc = Current; + assert(Current->rgb_flag==GL_TRUE); + y=FLIP(y); + if(Current->rgb_flag==GL_TRUE){ + for (i=0; irgb_flag==GL_FALSE); + for (i=0; iScreenMem+FLIP(y[i])*Current->ScanWidth+x[i]; + *Mem = index[i]; + } + } +} + + +//--------------------------------------------------------------------------- + + +/* + * Write an array of pixels with a boolean mask. The current color + * index is used for all pixels. + */ +static void write_mono_ci_pixels( const GLcontext* ctx, + GLuint n, + const GLint x[], const GLint y[], + GLuint colorIndex, const GLubyte mask[] ) +{ + GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); + WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); + GLuint i; + assert(Current->rgb_flag==GL_FALSE); + for (i=0; iScreenMem+FLIP(y[i])*Current->ScanWidth+x[i]; + *Mem = colorIndex; + } + } +} + + +//--------------------------------------------------------------------------- + + +/* Write an array of RGBA pixels with a boolean mask. */ +static void write_rgba_pixels( const GLcontext* ctx, + GLuint n, const GLint x[], const GLint y[], + const GLubyte rgba[][4], const GLubyte mask[] ) +{ + GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); + WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); + GLuint i; + PWMC pwc = Current; + HDC DC=DD_GETDC; + assert(Current->rgb_flag==GL_TRUE); + for (i=0; irgb_flag==GL_TRUE); + for (i=0; iScreenMem+FLIP(y)*Current->ScanWidth+x; + assert(Current->rgb_flag==GL_FALSE); + for (i=0; irgb_flag==GL_FALSE); + for (i=0; iScreenMem+FLIP(y[i])*Current->ScanWidth+x[i]); + } + } +} + +//--------------------------------------------------------------------------- + +/* Read a horizontal span of color pixels. */ +static void read_rgba_span( const GLcontext* ctx, + GLuint n, GLint x, GLint y, + GLubyte rgba[][4] ) +{ + GLD_context *gldCtx = GLD_GET_CONTEXT(ctx); + WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx); + UINT i; + COLORREF Color; + HDC DC=DD_GETDC; + assert(Current->rgb_flag==GL_TRUE); + y = Current->height - y - 1; + for (i=0; irgb_flag==GL_TRUE); + for (i=0; iheight - y[i] - 1; + Color=GetPixel(DC,x[i],y2); + rgba[i][RCOMP] = GetRValue(Color); + rgba[i][GCOMP] = GetGValue(Color); + rgba[i][BCOMP] = GetBValue(Color); + rgba[i][ACOMP] = 255; + } + } + DD_RELEASEDC; +} + +//--------------------------------------------------------------------------- + +static void wmesa_update_state( + GLcontext *ctx, + GLuint new_state) +{ + _swrast_InvalidateState( ctx, new_state ); + _swsetup_InvalidateState( ctx, new_state ); + _vbo_InvalidateState( ctx, new_state ); + _tnl_InvalidateState( ctx, new_state ); +} + +//--------------------------------------------------------------------------- + +static void wmesa_viewport( + GLcontext *ctx, + GLint x, + GLint y, + GLsizei w, + GLsizei h) +{ +// ctx->Driver.ResizeBuffersMESA(ctx); +} + +//--------------------------------------------------------------------------- + +static void wmesa_update_state_first_time( + GLcontext *ctx, + GLuint new_state) +{ + struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx ); + TNLcontext *tnl = TNL_CONTEXT(ctx); + + /* + * XXX these function pointers could be initialized just once during + * context creation since they don't depend on any state changes. + * kws - This is true - this function gets called a lot and it + * would be good to minimize setting all this when not needed. + */ + // Good idea, so I'll do it. KeithH. :-) + + ctx->Driver.GetString = _gldGetStringGeneric; + ctx->Driver.UpdateState = wmesa_update_state; + ctx->Driver.DrawBuffer = set_draw_buffer; + ctx->Driver.ResizeBuffers = _swrast_alloc_buffers; + ctx->Driver.GetBufferSize = buffer_size; + + ctx->Driver.Viewport = wmesa_viewport; + + ctx->Driver.Accum = _swrast_Accum; + ctx->Driver.Bitmap = _swrast_Bitmap; + ctx->Driver.Clear = clear; + + ctx->Driver.Flush = flush; + ctx->Driver.ClearIndex = clear_index; + ctx->Driver.ClearColor = clear_color; + ctx->Driver.Enable = enable; + + ctx->Driver.CopyPixels = _swrast_CopyPixels; + ctx->Driver.DrawPixels = _swrast_DrawPixels; + ctx->Driver.ReadPixels = _swrast_ReadPixels; + + ctx->Driver.ChooseTextureFormat = _mesa_choose_tex_format; + ctx->Driver.TexImage1D = _mesa_store_teximage1d; + ctx->Driver.TexImage2D = _mesa_store_teximage2d; + ctx->Driver.TexImage3D = _mesa_store_teximage3d; + ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d; + ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d; + ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; + ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; + + ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d; + ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d; + ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d; + ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d; + ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d; + ctx->Driver.CopyColorTable = _swrast_CopyColorTable; + ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable; + ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; + ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; + + // Does not apply for Mesa 5.x + //ctx->Driver.BaseCompressedTexFormat = _mesa_base_compressed_texformat; + //ctx->Driver.CompressedTextureSize = _mesa_compressed_texture_size; + //ctx->Driver.GetCompressedTexImage = _mesa_get_compressed_teximage; + + swdd->SetBuffer = set_read_buffer; + + + /* Pixel/span writing functions: */ + swdd->WriteRGBASpan = write_rgba_span; + swdd->WriteRGBSpan = write_rgb_span; + swdd->WriteMonoRGBASpan = write_mono_rgba_span; + swdd->WriteRGBAPixels = write_rgba_pixels; + swdd->WriteMonoRGBAPixels = write_mono_rgba_pixels; + swdd->WriteCI32Span = write_ci32_span; + swdd->WriteCI8Span = write_ci8_span; + swdd->WriteMonoCISpan = write_mono_ci_span; + swdd->WriteCI32Pixels = write_ci32_pixels; + swdd->WriteMonoCIPixels = write_mono_ci_pixels; + + swdd->ReadCI32Span = read_ci32_span; + swdd->ReadRGBASpan = read_rgba_span; + swdd->ReadCI32Pixels = read_ci32_pixels; + swdd->ReadRGBAPixels = read_rgba_pixels; + + + tnl->Driver.RunPipeline = _tnl_run_pipeline; + + wmesa_update_state(ctx, new_state); +} + +//--------------------------------------------------------------------------- +// Driver interface functions +//--------------------------------------------------------------------------- + +BOOL gldCreateDrawable_MesaSW( + DGL_ctx *pCtx, + BOOL bPersistantInterface, + BOOL bPersistantBuffers) +{ + WMesaContext *c; + GLboolean true_color_flag; + GLboolean rgb_flag = GL_TRUE; + GLboolean db_flag = GL_TRUE; + + if (pCtx == NULL) + return FALSE; + + c = (struct wmesa_context * ) calloc(1,sizeof(struct wmesa_context)); + if (!c) + return FALSE; + + pCtx->glPriv = c; + + c->hDC = pCtx->hDC; + c->Window = pCtx->hWnd; + + true_color_flag = GetDeviceCaps(pCtx->hDC, BITSPIXEL) > 8; + + +#ifdef DITHER + if ((true_color_flag==GL_FALSE) && (rgb_flag == GL_TRUE)){ + c->dither_flag = GL_TRUE; + c->hPalHalfTone = WinGCreateHalftonePalette(); + } + else + c->dither_flag = GL_FALSE; +#else + c->dither_flag = GL_FALSE; +#endif + + + if (rgb_flag==GL_FALSE) + { + c->rgb_flag = GL_FALSE; +#if 0 + /* Old WinG stuff???? */ + c->db_flag = db_flag =GL_TRUE; /* WinG requires double buffering */ + printf("Single buffer is not supported in color index mode, ", + "setting to double buffer.\n"); +#endif + } + else + { + c->rgb_flag = GL_TRUE; + } + +// db_flag = pCtx->lpPF->pfd.dwFlags & PFD_DOUBLEBUFFER ? GL_TRUE : GL_FALSE; + db_flag = GL_TRUE; // Force double-buffer + if (db_flag) { + c->db_flag = 1; + /* Double buffered */ + { + wmCreateBackingStore(c, pCtx->dwWidth, pCtx->dwHeight); + + } + } else { + /* Single Buffered */ + if (c->rgb_flag) + c->db_flag = 0; + } + + c->bEmulateSingleBuffer = (pCtx->lpPF->pfd.dwFlags & PFD_DOUBLEBUFFER) + ? FALSE : TRUE; + + return TRUE; +} + +//--------------------------------------------------------------------------- + +BOOL gldResizeDrawable_MesaSW( + DGL_ctx *ctx, + BOOL bDefaultDriver, + BOOL bPersistantInterface, + BOOL bPersistantBuffers) +{ + WMesaContext *c; + + if (ctx == NULL) + return FALSE; + + c = ctx->glPriv; + if (c == NULL) + return FALSE; + + c->hDC = ctx->hDC; + c->Window = ctx->hWnd; +// c->width = ctx->dwWidth; +// c->height = ctx->dwHeight; + + if (c->db_flag) { + wmDeleteBackingStore(c); + wmCreateBackingStore(c, ctx->dwWidth, ctx->dwHeight); + } + + return TRUE; +} + +//--------------------------------------------------------------------------- + +BOOL gldDestroyDrawable_MesaSW( + DGL_ctx *ctx) +{ + WMesaContext *c; + + if (ctx == NULL) + return FALSE; + + c = ctx->glPriv; + if (c == NULL) + return FALSE; + + if (c->hPalHalfTone != NULL) + DeleteObject(c->hPalHalfTone); + + if (c->db_flag) + wmDeleteBackingStore(c); + + free(c); + + ctx->glPriv = NULL; + + return TRUE; +} + +//--------------------------------------------------------------------------- + +BOOL gldCreatePrivateGlobals_MesaSW(void) +{ + // Mesa Software driver needs no private globals + return TRUE; +} + +//--------------------------------------------------------------------------- + +BOOL gldDestroyPrivateGlobals_MesaSW(void) +{ + // Mesa Software driver needs no private globals + return TRUE; +} + +//--------------------------------------------------------------------------- + +BOOL gldBuildPixelformatList_MesaSW(void) +{ + // Release any existing pixelformat list + if (glb.lpPF) { + free(glb.lpPF); + } + + glb.nPixelFormatCount = 0; + glb.lpPF = NULL; + + glb.lpPF = (DGL_pixelFormat *)calloc(2, sizeof(DGL_pixelFormat)); + if (glb.lpPF == NULL) + return FALSE; + // Single-buffered + memcpy(&glb.lpPF[0], &pfTemplateMesaSW, sizeof(DGL_pixelFormat)); + glb.lpPF[0].pfd.dwFlags &= ~PFD_DOUBLEBUFFER; // Remove doublebuffer flag + // Double-buffered + memcpy(&glb.lpPF[1], &pfTemplateMesaSW, sizeof(DGL_pixelFormat)); + glb.nPixelFormatCount = 2; + + // Mark list as 'current' + glb.bPixelformatsDirty = FALSE; + + return TRUE; +} + +//--------------------------------------------------------------------------- + +BOOL gldInitialiseMesa_MesaSW( + DGL_ctx *gld) +{ + GLcontext *ctx; + + if (gld == NULL) + return FALSE; + + ctx = gld->glCtx; + + // Set max texture size to 256 + ctx->Const.MaxTextureLevels = 8; + + // Multitexture enable/disable + ctx->Const.MaxTextureUnits = (glb.bMultitexture) ? MAX_TEXTURE_UNITS : 1; + + /* Initialize the software rasterizer and helper modules.*/ + + // Added this to force max texture diminsion to 256. KeithH + ctx->Const.MaxTextureLevels = 8; + + _mesa_enable_sw_extensions(ctx); + _mesa_enable_imaging_extensions(ctx); + _mesa_enable_1_3_extensions(ctx); + +// _swrast_CreateContext( ctx ); +// _vbo_CreateContext( ctx ); +// _tnl_CreateContext( ctx ); +// _swsetup_CreateContext( ctx ); + + _swsetup_Wakeup( ctx ); + + wmesa_update_state_first_time(ctx, ~0); + + return TRUE; +} + +//--------------------------------------------------------------------------- + +BOOL gldSwapBuffers_MesaSW( + DGL_ctx *ctx, + HDC hDC, + HWND hWnd) +{ + WMesaContext *c; + + if (ctx == NULL) + return FALSE; + + c = ctx->glPriv; + if (c == NULL) + return FALSE; + + /* If we're swapping the buffer associated with the current context + * we have to flush any pending rendering commands first. + */ + + // Altered to respect bEmulateSingleBuffer. KeithH +// if (c->db_flag) + if (!c->bEmulateSingleBuffer) + wmFlush(c, hDC); + + return TRUE; +} + +//--------------------------------------------------------------------------- + +PROC gldGetProcAddress_MesaSW( + LPCSTR a) +{ + int i; + PROC proc = NULL; + + for (i=0; GLD_extList[i].proc; i++) { + if (!strcmp(a, GLD_extList[i].name)) { + proc = GLD_extList[i].proc; + break; + } + } + + gldLogPrintf(GLDLOG_INFO, "GetProcAddress: %s (%s)", a, proc ? "OK" : "Failed"); + + return proc; +} + +//--------------------------------------------------------------------------- + +BOOL gldGetDisplayMode_MesaSW( + DGL_ctx *ctx, + GLD_displayMode *glddm) +{ + HDC hdcDesktop; + + if (glddm == NULL) + return FALSE; + + // + // A bit hacky... KeithH + // + + hdcDesktop = GetDC(NULL); + glddm->Width = GetDeviceCaps(hdcDesktop, HORZRES); + glddm->Height = GetDeviceCaps(hdcDesktop, VERTRES); + glddm->BPP = GetDeviceCaps(hdcDesktop, BITSPIXEL); + glddm->Refresh = 0; + ReleaseDC(0, hdcDesktop); + + return TRUE; +} + +//--------------------------------------------------------------------------- + --- mesa-7.4.1.orig/src/mesa/drivers/dri/mga/README +++ mesa-7.4.1/src/mesa/drivers/dri/mga/README @@ -0,0 +1,26 @@ +MGA DRI driver ported from XF86DRI to FBDRI +by Denis Oliver Kropp + + +INFO + +This driver has been ported from the head branch of XFree86 to +the embedded-1-branch of Mesa. + + +STATUS + +Already working very well as far as I've tested it (16/32 bit). +glxgears runs at 935 fps (G550 32MB AGP 4x, Athlon 1.33) vs 744 fps with XFree. +Other demos (terrain, fire, etc.) have been successfully tested as well. + + +TODO + +- mgaEngineShutdown +- mgaEngineRestore +- SGRAM detection +- remove some unused bits from server/* +- subset driver support +- mgaWaitForVBlank +- deinitialization (from MGADRICloseScreen) a la radeonDestroyScreen --- mesa-7.4.1.orig/src/mesa/drivers/dri/tdfx/BUGS +++ mesa-7.4.1/src/mesa/drivers/dri/tdfx/BUGS @@ -0,0 +1,64 @@ +REMOVE THIS FILE BEFORE MERGING WITH TRUNK +------------------------------------------ + +OUTSTANDING BUGS + +demos/reflect - reading back Z on Voodoo3, image offset to right + Fixed in latest Glide. + +Q3 - some polygons drawn as vertical strips, similar to bug that was + seen in demos/fire. Voodoo3 only. May be related to glDepthMask + or glColorMask. + +book/fog - not fogging + Fog in orthograph mode still not implemented. Checking with + 3dfx engineers for ideas. + +Q3 demo crashes after changing display settings + but the full Q3 game version seems OK. + + + +MORE OUTSTANDING BUGS + +private context was NULL! causing immediate failure of any glx prog. cant +reproduce after restarting the X server. putting it down as halluc. + +texture object image was NULL, causing segmentation failure. happens with +prboom. ive put a check in tdfx_texstate.c but this isn't a fix. + +prboom, wall textures near first chainsaw aren't bound properly. sideways +movements causes the wall textures to move with you. prboom busted? + +16bpp mode, quake3, windowed, q3dm1, floor under rocketlauncher bands. it +looks like multitexturing gone wrong. i'll disable a tmu and test. + +sof, polygons appear at wrong x,y,z positions, intermittent, have not yet +found reliable way of reproducing. culling? sometimes polys disappear. + +descent3 is all black in 16bpp mode - FIXED (palette problems) + +smeared pixels in quake3 - FIXED (texture memory overlapped FB) + + + +PERFORMANCE COMPARISON (Brian / Alan) + + V3/16 is Voodoo3 in 16bpp on a P3/500 + V5/16 is Voodoo5 in 16bpp on a P3/600 + V5/32 is Voodoo5 in 32bpp on a P3/600 + V5A/16 is Voodoo5 in 16bpp on an Alpha AXP/600 + V5A/32 is Voodoo5 in 32bpp on an Alpha AXP/600 + + tdfx-2-1-branch tdfx-3-0-0-branch +demo V3/16 V5/16 V5/32 V3/16 V5/16 V5/32 V5A/16 V5A/32 +------------------------------------------------------------------------ +gloss 257 183 174 320 308 177 313 167 +fire 42 39 52 41 +fire (no help) 98 80 50 106 113 73 124 80 +tunnel 61 50 70 58 +tunnel (no help) 167 142 57 138 152 113 171 122 +gears 663 554 540 881 1232 776 1484 830 +teapot 20 21 37 36 +teapot (no help) 22 14 14 24 30 30 43 42 + --- mesa-7.4.1.orig/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fasttmp.h +++ mesa-7.4.1/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fasttmp.h @@ -0,0 +1,313 @@ + +#if !defined(NASM_ASSEMBLER) && !defined(MASM_ASSEMBLER) +#define TAGLLBL(a) TAG(.L##a) +#else +#define TAGLLBL(a) TAG(a) +#endif + +#if !GLIDE3 + +#define GR_VERTEX_X_OFFSET 0 +#define GR_VERTEX_Y_OFFSET 4 +#define GR_VERTEX_Z_OFFSET 8 +#define GR_VERTEX_R_OFFSET 12 +#define GR_VERTEX_G_OFFSET 16 +#define GR_VERTEX_B_OFFSET 20 +#define GR_VERTEX_OOZ_OFFSET 24 +#define GR_VERTEX_A_OFFSET 28 +#define GR_VERTEX_OOW_OFFSET 32 + +#else /* GLIDE3 */ + +#define GR_VERTEX_X_OFFSET 0 +#define GR_VERTEX_Y_OFFSET 4 +#define GR_VERTEX_OOZ_OFFSET 8 +#define GR_VERTEX_OOW_OFFSET 12 +#define GR_VERTEX_R_OFFSET 16 +#define GR_VERTEX_G_OFFSET 20 +#define GR_VERTEX_B_OFFSET 24 +#define GR_VERTEX_A_OFFSET 28 +#define GR_VERTEX_Z_OFFSET 32 + +#endif /* GLIDE3 */ + +#define GR_VERTEX_SOW_TMU0_OFFSET 36 +#define GR_VERTEX_TOW_TMU0_OFFSET 40 +#define GR_VERTEX_OOW_TMU0_OFFSET 44 +#define GR_VERTEX_SOW_TMU1_OFFSET 48 +#define GR_VERTEX_TOW_TMU1_OFFSET 52 +#define GR_VERTEX_OOW_TMU1_OFFSET 56 + + + + +/*#define MAT_SX 0 /* accessed by REGIND !! */ +#define MAT_SY 20 +#define MAT_SZ 40 +#define MAT_TX 48 +#define MAT_TY 52 +#define MAT_TZ 56 + + + + +/* Do viewport map, device scale and perspective projection. + * + * void project_verts( GLfloat *first, + * GLfloat *last, + * const GLfloat *m, + * GLuint stride ) + * + * + * Rearrange fxVertices to look like grVertices. + */ + +GLOBL GLNAME( TAG(fx_3dnow_project_vertices) ) +GLNAME( TAG(fx_3dnow_project_vertices) ): + + PUSH_L ( EBP ) + + MOV_L ( REGOFF(8, ESP), ECX ) /* first_vert */ + MOV_L ( REGOFF(12, ESP), EDX ) /* last_vert */ + + CMP_L ( ECX, EDX ) + JE ( TAGLLBL(FXPV_end) ) + + FEMMS + + PREFETCH ( REGIND(ECX) ) /* fetch the first vertex */ + + MOV_L ( REGOFF(16, ESP), EBP ) /* matrix */ + MOV_L ( REGOFF(20, ESP), EAX ) /* stride */ + + MOVD ( REGOFF(MAT_TX, EBP), MM6 ) /* | tx */ + PUNPCKLDQ ( REGOFF(MAT_TY, EBP), MM6 ) /* ty | tx */ + +#if !defined(FX_V2) + MOV_L ( CONST(0x49400000), REGOFF(-8, ESP) ) /* snapper */ + MOV_L ( CONST(0x49400000), REGOFF(-4, ESP) ) /* snapper */ +#endif + + MOVQ ( REGOFF(-8, ESP), MM4 ) /* snapper | snapper */ + PFADD ( MM4, MM6 ) /* ty+snapper | tx+snapper */ + + MOVD ( REGIND(EBP), MM5 ) + PUNPCKLDQ ( REGOFF(MAT_SY, EBP), MM5 ) /* vsy | vsx */ + + MOVD ( REGOFF(MAT_SZ, EBP), MM1 ) /* | vsz */ + + +ALIGNTEXT32 +TAGLLBL(FXPV_loop_start): + + PREFETCH ( REGOFF(64, ECX) ) /* fetch the next-ish vertex */ + + + MOVD ( REGOFF(12, ECX), MM0 ) /* | f[3] */ + PFRCP ( MM0, MM0 ) /* oow = 1/f[3] */ + + MOVD ( REGOFF(12, ECX), MM7 ) /* | f[3] */ + PFRCPIT1 ( MM0, MM7 ) + PFRCPIT2 ( MM0, MM7 ) /* oow | oow */ + + PUNPCKLDQ ( MM7, MM7 ) + + +#if (TYPE & SETUP_RGBA) + MOVD ( REGOFF(CLIP_R, ECX ), MM0 ) /* f[RCOORD] = f[CLIP_R]; */ + MOVD ( MM0, REGOFF(GR_VERTEX_R_OFFSET, ECX) ) +#endif + +#if (TYPE & SETUP_TMU1) + MOVQ ( REGOFF(CLIP_S1, ECX), MM0 ) /* f[S1COORD] = f[CLIP_S1] * oow */ + PFMUL ( MM7, MM0 ) /* f[T1COORD] = f[CLIP_T1] * oow */ + MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU1_OFFSET, ECX) ) +#endif + + +#if (TYPE & SETUP_TMU0) + MOVQ ( REGOFF(CLIP_S0, ECX), MM0 ) /* f[S0COORD] = f[CLIP_S0] * oow */ + PFMUL ( MM7, MM0 ) /* f[T0COORD] = f[CLIP_T0] * oow */ + MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU0_OFFSET, ECX) ) +#endif + + + + + +/* DO_SETUP_XYZ */ + + MOVQ ( REGIND(ECX), MM2 ) /* f[1] | f[0] */ + PFMUL ( MM7, MM2 ) /* f[1] * oow | f[0] * oow */ + + MOVD ( REGOFF(8, ECX), MM3 ) /* | f[2] */ + PFMUL ( MM7, MM3 ) /* | f[2] * oow */ + + MOVD ( REGOFF(MAT_TZ, EBP), MM0 ) /* | vtz */ + PFMUL ( MM1, MM3 ) /* | f[2] *= vsz */ + + PFADD ( MM0, MM3 ) /* | f[2] += vtz */ + PFMUL ( MM5, MM2 ) /* f[1] *= vsy | f[0] *= vsx */ + + PFADD ( MM6, MM2 ) /* f[1] += vty | f[0] += vtx */ + +#if !defined(FX_V2) + PFSUB ( MM4, MM2 ) /* f[0,1] -= snapper */ +#endif + + MOVQ ( MM2, REGOFF(GR_VERTEX_X_OFFSET, ECX) ) + MOVD ( MM3, REGOFF(GR_VERTEX_OOZ_OFFSET, ECX) ) + + +/* end of DO_SETUP_XYZ */ + + MOVD ( MM7, REGOFF(GR_VERTEX_OOW_OFFSET, ECX) ) /* f[OOWCOORD] = oow */ + ADD_L ( EAX, ECX ) /* f += stride */ + + CMP_L ( ECX, EDX ) /* stall??? */ + JA ( TAGLLBL(FXPV_loop_start) ) + +TAGLLBL(FXPV_end): + FEMMS + POP_L ( EBP ) + RET + + + + + + + +/* void project_verts( GLfloat *first, + * GLfloat *last, + * const GLfloat *m, + * GLuint stride, + * const GLubyte *mask ) + * + */ + +GLOBL GLNAME( TAG(fx_3dnow_project_clipped_vertices) ) +GLNAME( TAG(fx_3dnow_project_clipped_vertices) ): + + PUSH_L ( EBP ) + + MOV_L ( REGOFF(8, ESP), ECX ) /* first FXDRIVER(VB)->verts*/ + MOV_L ( REGOFF(12, ESP), EDX ) /* last FXDRIVER(VB)->last_vert */ + + FEMMS + + PUSH_L ( EDI ) + PUSH_L ( ESI ) + + PREFETCH ( REGIND(ECX) ) /* fetch the first vertex */ + + MOV_L ( REGOFF(24, ESP), EBP ) /* mat ctx->Viewport.WindowMap.M */ + MOV_L ( REGOFF(28, ESP), EAX ) /* stride */ + MOV_L ( REGOFF(32, ESP), ESI ) /* VB->ClipMask */ + + MOVD ( REGOFF(MAT_TX, EBP), MM6 ) /* | tx */ + PUNPCKLDQ ( REGOFF(MAT_TY, EBP), MM6 ) /* ty | tx */ + +#if !defined(FX_V2) + MOV_L ( CONST(0x49400000), REGOFF(-8, ESP) ) /* snapper */ + MOV_L ( CONST(0x49400000), REGOFF(-4, ESP) ) /* snapper */ +#endif + + MOVQ ( REGOFF(-8, ESP), MM4 ) /* snapper | snapper */ + PFADD ( MM4, MM6 ) /* ty+snapper | tx+snapper */ + + MOVD ( REGIND(EBP), MM5 ) + PUNPCKLDQ ( REGOFF(MAT_SY, EBP), MM5 ) /* vsy | vsx */ + + MOVD ( REGOFF(MAT_SZ, EBP), MM1 ) /* | vsz */ + + + +ALIGNTEXT32 +TAGLLBL(FXPCV_loop_start): + + PREFETCH ( REGOFF(64, ECX) ) /* fetch the next-ish vertex */ + + CMP_B ( CONST(0), REGIND(ESI) ) + JNE ( TAGLLBL(FXPCV_skip) ) + + MOVD ( REGOFF(12, ECX), MM0) /* | f[3] */ + PFRCP ( MM0, MM0 ) /* oow = 1/f[3] */ + + MOVD ( REGOFF(12, ECX), MM7) /* | f[3] */ + PFRCPIT1 ( MM0, MM7 ) + PFRCPIT2 ( MM0, MM7 ) /* oow | oow */ + + PUNPCKLDQ ( MM7, MM7 ) + + +#if (TYPE & SETUP_RGBA) + MOVD ( REGOFF(CLIP_R, ECX ), MM0 ) /* f[RCOORD] = f[CLIP_R]; */ + MOVD ( MM0, REGOFF(GR_VERTEX_R_OFFSET, ECX) ) +#endif + +#if (TYPE & SETUP_TMU1) + MOVQ ( REGOFF(CLIP_S1, ECX), MM0 ) /* f[S1COORD] = f[CLIP_S1] * oow */ + PFMUL ( MM7, MM0 ) /* f[T1COORD] = f[CLIP_T1] * oow */ + MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU1_OFFSET, ECX) ) +#endif + + +#if (TYPE & SETUP_TMU0) + MOVQ ( REGOFF(CLIP_S0, ECX), MM0 ) /* f[S0COORD] = f[CLIP_S0] * oow */ + PFMUL ( MM7, MM0 ) /* f[T0COORD] = f[CLIP_T0] * oow */ + MOVQ ( MM0, REGOFF(GR_VERTEX_SOW_TMU0_OFFSET, ECX) ) +#endif + + + + +/* DO_SETUP_XYZ */ + + MOVQ ( REGIND(ECX), MM2 ) /* f[1] | f[0] */ + PFMUL ( MM7, MM2 ) /* f[1] * oow | f[0] * oow */ + + MOVD ( REGOFF(8, ECX), MM3 ) /* | f[2] */ + PFMUL ( MM7, MM3 ) /* | f[2] * oow */ + + MOVD ( REGOFF(MAT_TZ, EBP), MM0 ) /* | vtz */ + PFMUL ( MM1, MM3 ) /* | f[2] *= vsz */ + + PFADD ( MM0, MM3 ) /* | f[2] += vtz */ + PFMUL ( MM5, MM2 ) /* f[1] *= vsy | f[0] *= vsx */ + + PFADD ( MM6, MM2 ) /* f[1] += vty | f[0] += vtx */ + +#if !defined(FX_V2) + PFSUB ( MM4, MM2 ) /* f[0,1] -= snapper */ +#endif + + MOVQ ( MM2, REGOFF(GR_VERTEX_X_OFFSET, ECX) ) + MOVD ( MM3, REGOFF(GR_VERTEX_OOZ_OFFSET, ECX) ) + + +/* end of DO_SETUP_XYZ */ + + MOVD ( MM7, REGOFF(GR_VERTEX_OOW_OFFSET, ECX) ) /* f[OOWCOORD] = oow */ + +TAGLLBL(FXPCV_skip): + ADD_L ( EAX, ECX ) /* f += stride */ + + INC_L ( ESI ) /* next ClipMask */ + CMP_L ( ECX, EDX ) + JA ( TAGLLBL(FXPCV_loop_start) ) + + POP_L ( ESI ) + POP_L ( EDI ) + +TAGLLBL(FXPCV_end): + FEMMS + POP_L ( EBP ) + RET + + + +#undef TYPE +#undef TAG +#undef SIZE + --- mesa-7.4.1.orig/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fastpath.S +++ mesa-7.4.1/src/mesa/drivers/dri/tdfx/X86/fx_3dnow_fastpath.S @@ -0,0 +1,83 @@ + +#include "../../X86/assyntax.h" + +#define SETUP_RGBA 0x1 +#define SETUP_TMU0 0x2 +#define SETUP_TMU1 0x4 + + +/* Pack either rgba or texture into the remaining half of a 32 byte vertex. + */ +#define CLIP_R 24 +#define CLIP_G 16 +#define CLIP_B 20 +#define CLIP_A 28 /* defined inf fxdrv.h */ + +#define CLIP_S0 16 +#define CLIP_T0 20 +#define CLIP_S1 24 +#define CLIP_T1 28 + +#define SIZE 4 +#define TYPE (0) +#define TAG(x) x +#include "fx_3dnow_fasttmp.h" + +#define SIZE 8 +#define TYPE (SETUP_RGBA) +#define TAG(x) x##_RGBA +#include "fx_3dnow_fasttmp.h" + +#define SIZE 6 +#define TYPE (SETUP_TMU0) +#define TAG(x) x##_TMU0 +#include "fx_3dnow_fasttmp.h" + +#define SIZE 8 +#define TYPE (SETUP_TMU0|SETUP_TMU1) +#define TAG(x) x##_TMU0_TMU1 +#include "fx_3dnow_fasttmp.h" + +#undef CLIP_S1 +#undef CLIP_T1 +#define CLIP_S1 16 +#define CLIP_T1 20 + +#define SIZE 6 +#define TYPE (SETUP_TMU1) +#define TAG(x) x##_TMU1 +#include "fx_3dnow_fasttmp.h" + +/* These three need to use a full 64 byte clip-space vertex. + */ +#undef CLIP_S0 +#undef CLIP_T0 +#undef CLIP_S1 +#undef CLIP_T1 + +#define CLIP_S0 32 +#define CLIP_T0 36 +#define CLIP_S1 40 +#define CLIP_T1 44 + +#define SIZE 10 +#define TYPE (SETUP_RGBA|SETUP_TMU0) +#define TAG(x) x##_RGBA_TMU0 +#include "fx_3dnow_fasttmp.h" + +#define SIZE 12 +#define TYPE (SETUP_RGBA|SETUP_TMU0|SETUP_TMU1) +#define TAG(x) x##_RGBA_TMU0_TMU1 +#include "fx_3dnow_fasttmp.h" + +#undef CLIP_S1 +#undef CLIP_T1 +#define CLIP_S1 32 +#define CLIP_T1 36 + +#define SIZE 10 +#define TYPE (SETUP_RGBA|SETUP_TMU1) +#define TAG(x) x##_RGBA_TMU1 +#include "fx_3dnow_fasttmp.h" + + --- mesa-7.4.1.orig/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ mesa-7.4.1/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -310,6 +310,7 @@ GLubyte color_mask[4]; GLboolean color_blend; uint32_t tiling; + uint32_t draw_offset; } key; memset(&key, 0, sizeof(key)); @@ -326,6 +327,7 @@ key.width = region->pitch; /* XXX: not really! */ key.height = region->height; key.cpp = region->cpp; + key.draw_offset = region->draw_offset; /* cur 3d or cube face offset */ } else { key.surface_type = BRW_SURFACE_NULL; key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; @@ -333,6 +335,7 @@ key.width = 1; key.height = 1; key.cpp = 4; + key.draw_offset = 0; } memcpy(key.color_mask, ctx->Color.ColorMask, sizeof(key.color_mask)); @@ -354,8 +357,9 @@ surf.ss0.surface_format = key.surface_format; surf.ss0.surface_type = key.surface_type; + surf.ss1.base_addr = key.draw_offset; if (region_bo != NULL) - surf.ss1.base_addr = region_bo->offset; /* reloc */ + surf.ss1.base_addr += region_bo->offset; /* reloc */ surf.ss2.width = key.width - 1; surf.ss2.height = key.height - 1; @@ -380,12 +384,12 @@ * them both. We might be able to figure out from other state * a more restrictive relocation to emit. */ - dri_bo_emit_reloc(brw->wm.surf_bo[unit], - I915_GEM_DOMAIN_RENDER, - I915_GEM_DOMAIN_RENDER, - 0, - offsetof(struct brw_surface_state, ss1), - region_bo); + drm_intel_bo_emit_reloc(brw->wm.surf_bo[unit], + offsetof(struct brw_surface_state, ss1), + region_bo, + key.draw_offset, + I915_GEM_DOMAIN_RENDER, + I915_GEM_DOMAIN_RENDER); } } } --- mesa-7.4.1.orig/src/mesa/drivers/dri/intel/intel_context.c +++ mesa-7.4.1/src/mesa/drivers/dri/intel/intel_context.c @@ -534,7 +534,8 @@ if ((ctx->DrawBuffer->Name == 0) && intel->front_buffer_dirty) { __DRIscreen *const screen = intel->intelScreen->driScrnPriv; - if ((screen->dri2.loader->base.version >= 2) + if (screen->dri2.loader + && (screen->dri2.loader->base.version >= 2) && (screen->dri2.loader->flushFrontBuffer != NULL)) { (*screen->dri2.loader->flushFrontBuffer)(intel->driDrawable, intel->driDrawable->loaderPrivate); --- mesa-7.4.1.orig/src/mesa/drivers/dri/intel/intel_pixel.c +++ mesa-7.4.1/src/mesa/drivers/dri/intel/intel_pixel.c @@ -183,7 +183,7 @@ intel->meta.saved_vp_height = ctx->Viewport.Height; intel->meta.saved_matrix_mode = ctx->Transform.MatrixMode; - /* _mesa_Viewport(0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height);*/ + _mesa_Viewport(0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height); _mesa_MatrixMode(GL_PROJECTION); _mesa_PushMatrix(); @@ -205,8 +205,8 @@ _mesa_MatrixMode(intel->meta.saved_matrix_mode); - /* _mesa_Viewport(intel->meta.saved_vp_x, intel->meta.saved_vp_y, - intel->meta.saved_vp_width, intel->meta.saved_vp_height);*/ + _mesa_Viewport(intel->meta.saved_vp_x, intel->meta.saved_vp_y, + intel->meta.saved_vp_width, intel->meta.saved_vp_height); } /** --- mesa-7.4.1.orig/src/mesa/drivers/dri/common/xmlpool/Makefile +++ mesa-7.4.1/src/mesa/drivers/dri/common/xmlpool/Makefile @@ -0,0 +1,96 @@ +# Convenient makefile for managing translations. + +# Prerequisites: +# - GNU gettext +# - Python + +# Adding new translations +# ----------------------- + +# To start working on a new translation edit the POS=... line +# below. If you want to add for example a french translation, add +# fr.po. + +# Then run "make po" to generate a fresh .po file from translatable +# strings in t_options.h. Now you can edit the new .po file (fr.po in +# the example above) to translate the strings. Please make sure that +# your editor encodes the file in UTF-8. + +# Updating existing translations +# ------------------------------ + +# Run "make po" to update .po files with new translatable strings from +# t_options.h. Now you can edit the .po files you're interested +# in. Please make sure that your editor encodes the file in UTF-8. + +# Updating options.h +# ------------------ + +# Finally run "make" to generate options.h from t_options.h with all +# translations. Now you can rebuild the drivers. Any common options +# used by the drivers will have option descriptions with the latest +# translations. + +# Publishing translations +# ----------------------- + +# To get your translation(s) into Mesa CVS, please send me your +# .po file. + +# More information: +# - info gettext + +# The set of supported languages. Add languages as needed. +POS=de.po es.po nl.po fr.po sv.po + +# +# Don't change anything below, unless you know what you're doing. +# +LANGS=$(POS:%.po=%) +MOS=$(POS:%.po=%/LC_MESSAGES/options.mo) +POT=xmlpool.pot + +.PHONY: all clean pot po mo + +all: options.h + +# Only intermediate files are cleaned up. options.h is not deleted because +# it's in CVS. +clean: + -rm -f $(POT) *~ + -rm -rf $(LANGS) + +# Default target options.h +options.h: t_options.h mo + python gen_xmlpool.py $(LANGS) > options.h + +# Update .mo files from the corresponding .po files. +mo: + @for mo in $(MOS); do \ + lang=$${mo%%/*}; \ + echo "Updating $$mo from $$lang.po."; \ + mkdir -p $${mo%/*}; \ + msgfmt -o $$mo $$lang.po; \ + done + +# Use this target to create or update .po files with new messages in +# driconf.py. +po: $(POS) + +pot: $(POT) + +# Extract message catalog from driconf.py. +$(POT): t_options.h + xgettext -L C --from-code utf-8 -o $(POT) t_options.h + +# Create or update a .po file for a specific language. +%.po: $(POT) + @if [ -f $@ ]; then \ + echo "Merging new strings from $(POT) into $@."; \ + mv $@ $@~; \ + msgmerge -o $@ $@~ $(POT); \ + else \ + echo "Initializing $@ from $(POT)."; \ + msginit -i $(POT) -o $@~ --locale=$*; \ + sed -e 's/charset=.*\\n/charset=UTF-8\\n/' $@~ > $@; \ + fi --- mesa-7.4.1.orig/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py +++ mesa-7.4.1/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py @@ -0,0 +1,191 @@ +#!/usr/bin/python + +import sys +import gettext +import re + +# List of supported languages +languages = sys.argv[1:] + +# Escape special characters in C strings +def escapeCString (s): + escapeSeqs = {'\a' : '\\a', '\b' : '\\b', '\f' : '\\f', '\n' : '\\n', + '\r' : '\\r', '\t' : '\\t', '\v' : '\\v', '\\' : '\\\\'} + # " -> '' is a hack. Quotes (") aren't possible in XML attributes. + # Better use Unicode characters for typographic quotes in option + # descriptions and translations. + i = 0 + r = '' + while i < len(s): + # Special case: escape double quote with \u201c or \u201d, depending + # on whether it's an open or close quote. This is needed because plain + # double quotes are not possible in XML attributes. + if s[i] == '"': + if i == len(s)-1 or s[i+1].isspace(): + # close quote + q = u'\u201c' + else: + # open quote + q = u'\u201d' + r = r + q + elif escapeSeqs.has_key(s[i]): + r = r + escapeSeqs[s[i]] + else: + r = r + s[i] + i = i + 1 + return r + +# Expand escape sequences in C strings (needed for gettext lookup) +def expandCString (s): + escapeSeqs = {'a' : '\a', 'b' : '\b', 'f' : '\f', 'n' : '\n', + 'r' : '\r', 't' : '\t', 'v' : '\v', + '"' : '"', '\\' : '\\'} + i = 0 + escape = False + hexa = False + octa = False + num = 0 + digits = 0 + r = '' + while i < len(s): + if not escape: + if s[i] == '\\': + escape = True + else: + r = r + s[i] + elif hexa: + if (s[i] >= '0' and s[i] <= '9') or \ + (s[i] >= 'a' and s[i] <= 'f') or \ + (s[i] >= 'A' and s[i] <= 'F'): + num = num * 16 + int(s[i],16) + digits = digits + 1 + else: + digits = 2 + if digits >= 2: + hexa = False + escape = False + r = r + chr(num) + elif octa: + if s[i] >= '0' and s[i] <= '7': + num = num * 8 + int(s[i],8) + digits = digits + 1 + else: + digits = 3 + if digits >= 3: + octa = False + escape = False + r = r + chr(num) + else: + if escapeSeqs.has_key(s[i]): + r = r + escapeSeqs[s[i]] + escape = False + elif s[i] >= '0' and s[i] <= '7': + octa = True + num = int(s[i],8) + if num <= 3: + digits = 1 + else: + digits = 2 + elif s[i] == 'x' or s[i] == 'X': + hexa = True + num = 0 + digits = 0 + else: + r = r + s[i] + escape = False + i = i + 1 + return r + +# Expand matches. The first match is always a DESC or DESC_BEGIN match. +# Subsequent matches are ENUM matches. +# +# DESC, DESC_BEGIN format: \1 \2= \3 \4=gettext(" \5= \6=") \7 +# ENUM format: \1 \2=gettext(" \3= \4=") \5 +def expandMatches (matches, translations, end=None): + assert len(matches) > 0 + nTranslations = len(translations) + i = 0 + # Expand the description+enums for all translations + for lang,trans in translations: + i = i + 1 + # Make sure that all but the last line of a simple description + # are extended with a backslash. + suffix = '' + if len(matches) == 1 and i < len(translations) and \ + not matches[0].expand (r'\7').endswith('\\'): + suffix = ' \\' + # Expand the description line. Need to use ugettext in order to allow + # non-ascii unicode chars in the original English descriptions. + text = escapeCString (trans.ugettext (unicode (expandCString ( + matches[0].expand (r'\5')), "utf-8"))).encode("utf-8") + print matches[0].expand (r'\1' + lang + r'\3"' + text + r'"\7') + suffix + # Expand any subsequent enum lines + for match in matches[1:]: + text = escapeCString (trans.ugettext (unicode (expandCString ( + match.expand (r'\3')), "utf-8"))).encode("utf-8") + print match.expand (r'\1"' + text + r'"\5') + + # Expand description end + if end: + print end, + +# Compile a list of translation classes to all supported languages. +# The first translation is always a NullTranslations. +translations = [("en", gettext.NullTranslations())] +for lang in languages: + try: + trans = gettext.translation ("options", ".", [lang]) + except IOError: + sys.stderr.write ("Warning: language '%s' not found.\n" % lang) + continue + translations.append ((lang, trans)) + +# Regular expressions: +reLibintl_h = re.compile (r'#\s*include\s*') +reDESC = re.compile (r'(\s*DRI_CONF_DESC\s*\(\s*)([a-z]+)(\s*,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$') +reDESC_BEGIN = re.compile (r'(\s*DRI_CONF_DESC_BEGIN\s*\(\s*)([a-z]+)(\s*,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$') +reENUM = re.compile (r'(\s*DRI_CONF_ENUM\s*\([^,]+,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$') +reDESC_END = re.compile (r'\s*DRI_CONF_DESC_END') + +# Print a header +print \ +"/***********************************************************************\n" \ +" *** THIS FILE IS GENERATED AUTOMATICALLY. DON'T EDIT! ***\n" \ +" ***********************************************************************/" + +# Process the options template and generate options.h with all +# translations. +template = file ("t_options.h", "r") +descMatches = [] +for line in template: + if len(descMatches) > 0: + matchENUM = reENUM .match (line) + matchDESC_END = reDESC_END.match (line) + if matchENUM: + descMatches.append (matchENUM) + elif matchDESC_END: + expandMatches (descMatches, translations, line) + descMatches = [] + else: + sys.stderr.write ( + "Warning: unexpected line inside description dropped:\n%s\n" \ + % line) + continue + if reLibintl_h.search (line): + # Ignore (comment out) #include + print "/* %s * commented out by gen_xmlpool.py */" % line + continue + matchDESC = reDESC .match (line) + matchDESC_BEGIN = reDESC_BEGIN.match (line) + if matchDESC: + assert len(descMatches) == 0 + expandMatches ([matchDESC], translations) + elif matchDESC_BEGIN: + assert len(descMatches) == 0 + descMatches = [matchDESC_BEGIN] + else: + print line, + +if len(descMatches) > 0: + sys.stderr.write ("Warning: unterminated description at end of file.\n") + expandMatches (descMatches, translations) --- mesa-7.4.1.orig/src/mesa/drivers/dri/r300/r300_texmem.c +++ mesa-7.4.1/src/mesa/drivers/dri/r300/r300_texmem.c @@ -44,6 +44,7 @@ #include "main/colormac.h" #include "main/macros.h" #include "main/simple_list.h" +#include "main/texobj.h" #include "radeon_reg.h" /* gets definition for usleep */ #include "r300_context.h" #include "r300_state.h" @@ -71,8 +72,8 @@ } for (i = 0; i < rmesa->radeon.glCtx->Const.MaxTextureUnits; i++) { - if (rmesa->state.texture.unit[i].texobj == t) { - rmesa->state.texture.unit[i].texobj = NULL; + if (rmesa->state.texture.unit[i].texobj == t->base.tObj) { + _mesa_reference_texobj(&rmesa->state.texture.unit[i].texobj, NULL); } } } --- mesa-7.4.1.orig/src/mesa/drivers/dri/r300/r300_state.c +++ mesa-7.4.1/src/mesa/drivers/dri/r300/r300_state.c @@ -1487,7 +1487,7 @@ #endif tmu_mappings[i] = hw_tmu; - t = r300->state.texture.unit[i].texobj; + t = (r300TexObjPtr) r300->state.texture.unit[i].texobj->DriverData; /* XXX questionable fix for bug 9170: */ if (!t) continue; --- mesa-7.4.1.orig/src/mesa/drivers/dri/r300/r300_texstate.c +++ mesa-7.4.1/src/mesa/drivers/dri/r300/r300_texstate.c @@ -567,19 +567,20 @@ /* Update state if this is a different texture object to last * time. */ - if (rmesa->state.texture.unit[unit].texobj != t) { + if (rmesa->state.texture.unit[unit].texobj != tObj) { if (rmesa->state.texture.unit[unit].texobj != NULL) { + r300TexObjPtr t_old = (r300TexObjPtr) rmesa->state.texture.unit[unit].texobj->DriverData; + /* The old texture is no longer bound to this texture unit. * Mark it as such. */ - rmesa->state.texture.unit[unit].texobj->base.bound &= - ~(1 << unit); + t_old->base.bound &= ~(1 << unit); } - rmesa->state.texture.unit[unit].texobj = t; + _mesa_reference_texobj(&rmesa->state.texture.unit[unit].texobj, tObj); t->base.bound |= (1 << unit); - driUpdateTextureLRU((driTextureObject *) t); /* XXX: should be locked! */ + driUpdateTextureLRU(&t->base); /* XXX: should be locked! */ } return !t->border_fallback; --- mesa-7.4.1.orig/src/mesa/drivers/dri/r300/r300_context.h +++ mesa-7.4.1/src/mesa/drivers/dri/r300/r300_context.h @@ -211,7 +211,7 @@ }; struct r300_texture_env_state { - r300TexObjPtr texobj; + struct gl_texture_object *texobj; GLenum format; GLenum envMode; }; --- mesa-7.4.1.orig/src/mesa/drivers/dri/r300/Lindent +++ mesa-7.4.1/src/mesa/drivers/dri/r300/Lindent @@ -0,0 +1,2 @@ +#!/bin/sh +indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs "$@" --- mesa-7.4.1.orig/src/mesa/drivers/dri/radeon/radeon_screen.c +++ mesa-7.4.1/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -554,11 +554,8 @@ screen->chip_family = CHIP_FAMILY_RS300; break; - /* 9500 with 1 pipe verified by: Reid Linnemann */ + case PCI_CHIP_R300_AD: - screen->chip_family = CHIP_FAMILY_RV350; - screen->chip_flags = RADEON_CHIPSET_TCL; - break; case PCI_CHIP_R300_AE: case PCI_CHIP_R300_AF: case PCI_CHIP_R300_AG: @@ -886,6 +883,18 @@ } else { screen->num_gb_pipes = temp; } + + /* pipe overrides */ + switch (dri_priv->deviceID) { + case PCI_CHIP_R300_AD: /* 9500 with 1 quadpipe verified by: Reid Linnemann */ + case PCI_CHIP_RV410_5E4C: /* RV410 SE only have 1 quadpipe */ + case PCI_CHIP_RV410_5E4F: /* RV410 SE only have 1 quadpipe */ + screen->num_gb_pipes = 1; + break; + default: + break; + } + } if ( sPriv->drm_version.minor >= 10 ) { --- mesa-7.4.1.orig/src/mesa/shader/arbprogparse.c +++ mesa-7.4.1/src/mesa/shader/arbprogparse.c @@ -1496,10 +1496,16 @@ curr = vc_head; while (curr) { if (curr->type == vt_attrib) { - if (curr->attrib_is_generic) - genericAttrib[ curr->attrib_binding ] = GL_TRUE; - else + if (curr->attrib_is_generic) { + GLuint attr = (curr->attrib_binding == 0) + ? 0 : (curr->attrib_binding - VERT_ATTRIB_GENERIC0); + assert(attr < MAX_VERTEX_PROGRAM_ATTRIBS); + genericAttrib[attr] = GL_TRUE; + } + else { + assert(curr->attrib_binding < MAX_VERTEX_PROGRAM_ATTRIBS); explicitAttrib[ curr->attrib_binding ] = GL_TRUE; + } } curr = curr->next; --- mesa-7.4.1.orig/src/mesa/shader/arbprogram.syn +++ mesa-7.4.1/src/mesa/shader/arbprogram.syn @@ -0,0 +1,2824 @@ +/* + * Mesa 3-D graphics library + * Version: 6.2 + * + * Copyright (C) 1999-2004 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. + */ + + /** + * \file arbprogram.syn + * ARB_fragment/vertex_program syntax + * \author Michal Krol + */ + +.syntax program; + +/* + This value must be incremented every time emit code values or structure of the production + array changes. This value is placed at the beginning of the production array. The loader + compares the value with its REVISION value. If they do not match, the loader is not up + to date. +*/ +.emtcode REVISION 0x0a + +/* program type */ +.emtcode FRAGMENT_PROGRAM 0x01 +.emtcode VERTEX_PROGRAM 0x02 + +/* program section */ +.emtcode OPTION 0x01 +.emtcode INSTRUCTION 0x02 +.emtcode DECLARATION 0x03 +.emtcode END 0x04 + +/* GL_ARB_fragment_program option */ +.emtcode ARB_PRECISION_HINT_FASTEST 0x00 +.emtcode ARB_PRECISION_HINT_NICEST 0x01 +.emtcode ARB_FOG_EXP 0x02 +.emtcode ARB_FOG_EXP2 0x03 +.emtcode ARB_FOG_LINEAR 0x04 + +/* GL_ARB_vertex_program option */ +.emtcode ARB_POSITION_INVARIANT 0x05 + +/* GL_ARB_fragment_program_shadow option */ +.emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x06 + +/* GL_ARB_draw_buffers option */ +.emtcode ARB_DRAW_BUFFERS 0x07 + +/* GL_MESA_texture_array option */ +.emtcode MESA_TEXTURE_ARRAY 0x08 + +/* GL_ARB_fragment_program instruction class */ +.emtcode OP_ALU_INST 0x00 +.emtcode OP_TEX_INST 0x01 + +/* GL_ARB_vertex_program instruction class */ +/* OP_ALU_INST */ + +/* GL_ARB_fragment_program instruction type */ +.emtcode OP_ALU_VECTOR 0x00 +.emtcode OP_ALU_SCALAR 0x01 +.emtcode OP_ALU_BINSC 0x02 +.emtcode OP_ALU_BIN 0x03 +.emtcode OP_ALU_TRI 0x04 +.emtcode OP_ALU_SWZ 0x05 +.emtcode OP_TEX_SAMPLE 0x06 +.emtcode OP_TEX_KIL 0x07 + +/* GL_ARB_vertex_program instruction type */ +.emtcode OP_ALU_ARL 0x08 +/* OP_ALU_VECTOR */ +/* OP_ALU_SCALAR */ +/* OP_ALU_BINSC */ +/* OP_ALU_BIN */ +/* OP_ALU_TRI */ +/* OP_ALU_SWZ */ + +/* GL_ARB_fragment_program instruction code */ +.emtcode OP_ABS 0x00 +.emtcode OP_ABS_SAT 0x1B +.emtcode OP_FLR 0x09 +.emtcode OP_FLR_SAT 0x26 +.emtcode OP_FRC 0x0A +.emtcode OP_FRC_SAT 0x27 +.emtcode OP_LIT 0x0C +.emtcode OP_LIT_SAT 0x2A +.emtcode OP_MOV 0x11 +.emtcode OP_MOV_SAT 0x30 +.emtcode OP_COS 0x1F +.emtcode OP_COS_SAT 0x20 +.emtcode OP_EX2 0x07 +.emtcode OP_EX2_SAT 0x25 +.emtcode OP_LG2 0x0B +.emtcode OP_LG2_SAT 0x29 +.emtcode OP_RCP 0x14 +.emtcode OP_RCP_SAT 0x33 +.emtcode OP_RSQ 0x15 +.emtcode OP_RSQ_SAT 0x34 +.emtcode OP_SIN 0x38 +.emtcode OP_SIN_SAT 0x39 +.emtcode OP_SCS 0x35 +.emtcode OP_SCS_SAT 0x36 +.emtcode OP_POW 0x13 +.emtcode OP_POW_SAT 0x32 +.emtcode OP_ADD 0x01 +.emtcode OP_ADD_SAT 0x1C +.emtcode OP_DP3 0x03 +.emtcode OP_DP3_SAT 0x21 +.emtcode OP_DP4 0x04 +.emtcode OP_DP4_SAT 0x22 +.emtcode OP_DPH 0x05 +.emtcode OP_DPH_SAT 0x23 +.emtcode OP_DST 0x06 +.emtcode OP_DST_SAT 0x24 +.emtcode OP_MAX 0x0F +.emtcode OP_MAX_SAT 0x2E +.emtcode OP_MIN 0x10 +.emtcode OP_MIN_SAT 0x2F +.emtcode OP_MUL 0x12 +.emtcode OP_MUL_SAT 0x31 +.emtcode OP_SGE 0x16 +.emtcode OP_SGE_SAT 0x37 +.emtcode OP_SLT 0x17 +.emtcode OP_SLT_SAT 0x3A +.emtcode OP_SUB 0x18 +.emtcode OP_SUB_SAT 0x3B +.emtcode OP_XPD 0x1A +.emtcode OP_XPD_SAT 0x43 +.emtcode OP_CMP 0x1D +.emtcode OP_CMP_SAT 0x1E +.emtcode OP_LRP 0x2B +.emtcode OP_LRP_SAT 0x2C +.emtcode OP_MAD 0x0E +.emtcode OP_MAD_SAT 0x2D +.emtcode OP_SWZ 0x19 +.emtcode OP_SWZ_SAT 0x3C +.emtcode OP_TEX 0x3D +.emtcode OP_TEX_SAT 0x3E +.emtcode OP_TXB 0x3F +.emtcode OP_TXB_SAT 0x40 +.emtcode OP_TXP 0x41 +.emtcode OP_TXP_SAT 0x42 +.emtcode OP_KIL 0x28 + +/* GL_ARB_vertex_program instruction code */ +.emtcode OP_ARL 0x02 +/* OP_ABS */ +/* OP_FLR */ +/* OP_FRC */ +/* OP_LIT */ +/* OP_MOV */ +/* OP_EX2 */ +.emtcode OP_EXP 0x08 +/* OP_LG2 */ +.emtcode OP_LOG 0x0D +/* OP_RCP */ +/* OP_RSQ */ +/* OP_POW */ +/* OP_ADD */ +/* OP_DP3 */ +/* OP_DP4 */ +/* OP_DPH */ +/* OP_DST */ +/* OP_MAX */ +/* OP_MIN */ +/* OP_MUL */ +/* OP_SGE */ +/* OP_SLT */ +/* OP_SUB */ +/* OP_XPD */ +/* OP_MAD */ +/* OP_SWZ */ + +/* fragment attribute binding */ +.emtcode FRAGMENT_ATTRIB_COLOR 0x01 +.emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02 +.emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03 +.emtcode FRAGMENT_ATTRIB_POSITION 0x04 + +/* vertex attribute binding */ +.emtcode VERTEX_ATTRIB_POSITION 0x01 +.emtcode VERTEX_ATTRIB_WEIGHT 0x02 +.emtcode VERTEX_ATTRIB_NORMAL 0x03 +.emtcode VERTEX_ATTRIB_COLOR 0x04 +.emtcode VERTEX_ATTRIB_FOGCOORD 0x05 +.emtcode VERTEX_ATTRIB_TEXCOORD 0x06 +.emtcode VERTEX_ATTRIB_MATRIXINDEX 0x07 +.emtcode VERTEX_ATTRIB_GENERIC 0x08 + +/* fragment result binding */ +.emtcode FRAGMENT_RESULT_COLOR 0x01 +.emtcode FRAGMENT_RESULT_DEPTH 0x02 + +/* vertex result binding */ +.emtcode VERTEX_RESULT_POSITION 0x01 +.emtcode VERTEX_RESULT_COLOR 0x02 +.emtcode VERTEX_RESULT_FOGCOORD 0x03 +.emtcode VERTEX_RESULT_POINTSIZE 0x04 +.emtcode VERTEX_RESULT_TEXCOORD 0x05 + +/* texture target */ +.emtcode TEXTARGET_1D 0x01 +.emtcode TEXTARGET_2D 0x02 +.emtcode TEXTARGET_3D 0x03 +.emtcode TEXTARGET_RECT 0x04 +.emtcode TEXTARGET_CUBE 0x05 +/* GL_ARB_fragment_program_shadow */ +.emtcode TEXTARGET_SHADOW1D 0x06 +.emtcode TEXTARGET_SHADOW2D 0x07 +.emtcode TEXTARGET_SHADOWRECT 0x08 +/* GL_MESA_texture_array */ +.emtcode TEXTARGET_1D_ARRAY 0x09 +.emtcode TEXTARGET_2D_ARRAY 0x0a +.emtcode TEXTARGET_SHADOW1D_ARRAY 0x0b +.emtcode TEXTARGET_SHADOW2D_ARRAY 0x0c + +/* face type */ +.emtcode FACE_FRONT 0x00 +.emtcode FACE_BACK 0x01 + +/* color type */ +.emtcode COLOR_PRIMARY 0x00 +.emtcode COLOR_SECONDARY 0x01 + +/* component */ +.emtcode COMPONENT_X 0x00 +.emtcode COMPONENT_Y 0x01 +.emtcode COMPONENT_Z 0x02 +.emtcode COMPONENT_W 0x03 +.emtcode COMPONENT_0 0x04 +.emtcode COMPONENT_1 0x05 + +/* array index type */ +.emtcode ARRAY_INDEX_ABSOLUTE 0x00 +.emtcode ARRAY_INDEX_RELATIVE 0x01 + +/* matrix name */ +.emtcode MATRIX_MODELVIEW 0x01 +.emtcode MATRIX_PROJECTION 0x02 +.emtcode MATRIX_MVP 0x03 +.emtcode MATRIX_TEXTURE 0x04 +.emtcode MATRIX_PALETTE 0x05 +.emtcode MATRIX_PROGRAM 0x06 + +/* matrix modifier */ +.emtcode MATRIX_MODIFIER_IDENTITY 0x00 +.emtcode MATRIX_MODIFIER_INVERSE 0x01 +.emtcode MATRIX_MODIFIER_TRANSPOSE 0x02 +.emtcode MATRIX_MODIFIER_INVTRANS 0x03 + +/* constant type */ +.emtcode CONSTANT_SCALAR 0x01 +.emtcode CONSTANT_VECTOR 0x02 + +/* program param type */ +.emtcode PROGRAM_PARAM_ENV 0x01 +.emtcode PROGRAM_PARAM_LOCAL 0x02 + +/* register type */ +.emtcode REGISTER_ATTRIB 0x01 +.emtcode REGISTER_PARAM 0x02 +.emtcode REGISTER_RESULT 0x03 +.emtcode REGISTER_ESTABLISHED_NAME 0x04 + +/* param binding */ +.emtcode PARAM_NULL 0x00 +.emtcode PARAM_ARRAY_ELEMENT 0x01 +.emtcode PARAM_STATE_ELEMENT 0x02 +.emtcode PARAM_PROGRAM_ELEMENT 0x03 +.emtcode PARAM_PROGRAM_ELEMENTS 0x04 +.emtcode PARAM_CONSTANT 0x05 + +/* param state property */ +.emtcode STATE_MATERIAL 0x01 +.emtcode STATE_LIGHT 0x02 +.emtcode STATE_LIGHT_MODEL 0x03 +.emtcode STATE_LIGHT_PROD 0x04 +.emtcode STATE_FOG 0x05 +.emtcode STATE_MATRIX_ROWS 0x06 +/* GL_ARB_fragment_program */ +.emtcode STATE_TEX_ENV 0x07 +.emtcode STATE_DEPTH 0x08 +/* GL_ARB_vertex_program */ +.emtcode STATE_TEX_GEN 0x09 +.emtcode STATE_CLIP_PLANE 0x0A +.emtcode STATE_POINT 0x0B + +/* state material property */ +.emtcode MATERIAL_AMBIENT 0x01 +.emtcode MATERIAL_DIFFUSE 0x02 +.emtcode MATERIAL_SPECULAR 0x03 +.emtcode MATERIAL_EMISSION 0x04 +.emtcode MATERIAL_SHININESS 0x05 + +/* state light property */ +.emtcode LIGHT_AMBIENT 0x01 +.emtcode LIGHT_DIFFUSE 0x02 +.emtcode LIGHT_SPECULAR 0x03 +.emtcode LIGHT_POSITION 0x04 +.emtcode LIGHT_ATTENUATION 0x05 +.emtcode LIGHT_HALF 0x06 +.emtcode LIGHT_SPOT_DIRECTION 0x07 + +/* state light model property */ +.emtcode LIGHT_MODEL_AMBIENT 0x01 +.emtcode LIGHT_MODEL_SCENECOLOR 0x02 + +/* state light product property */ +.emtcode LIGHT_PROD_AMBIENT 0x01 +.emtcode LIGHT_PROD_DIFFUSE 0x02 +.emtcode LIGHT_PROD_SPECULAR 0x03 + +/* state texture environment property */ +.emtcode TEX_ENV_COLOR 0x01 + +/* state texture generation coord property */ +.emtcode TEX_GEN_EYE 0x01 +.emtcode TEX_GEN_OBJECT 0x02 + +/* state fog property */ +.emtcode FOG_COLOR 0x01 +.emtcode FOG_PARAMS 0x02 + +/* state depth property */ +.emtcode DEPTH_RANGE 0x01 + +/* state point parameters property */ +.emtcode POINT_SIZE 0x01 +.emtcode POINT_ATTENUATION 0x02 + +/* declaration */ +.emtcode ATTRIB 0x01 +.emtcode PARAM 0x02 +.emtcode TEMP 0x03 +.emtcode OUTPUT 0x04 +.emtcode ALIAS 0x05 +/* GL_ARB_vertex_program */ +.emtcode ADDRESS 0x06 + +/* error messages */ +.errtext UNKNOWN_PROGRAM_SIGNATURE "1001: '$e_signature$': unknown program signature" +.errtext MISSING_END_OR_INVALID_STATEMENT "1002: '$e_statement$': invalid statement" +.errtext CODE_AFTER_END "1003: '$e_statement$': code after 'END' keyword" +.errtext INVALID_PROGRAM_OPTION "1004: '$e_identifier$': invalid program option" +.errtext EXT_SWIZ_COMP_EXPECTED "1005: extended swizzle component expected but '$e_token$' found" +.errtext TEX_TARGET_EXPECTED "1006: texture target expected but '$e_token$' found" +.errtext TEXTURE_EXPECTED "1007: 'texture' expected but '$e_identifier$' found" +.errtext SOURCE_REGISTER_EXPECTED "1008: source register expected but '$e_token$' found" +.errtext DESTINATION_REGISTER_EXPECTED "1009: destination register expected but '$e_token$' found" +.errtext INVALID_ADDRESS_COMPONENT "1010: '$e_identifier$': invalid address component" +.errtext INVALID_ADDRESS_WRITEMASK "1011: '$e_identifier$': invalid address writemask" +.errtext INVALID_COMPONENT "1012: '$e_charordigit$': invalid component" +.errtext INVALID_SUFFIX "1013: '$e_identifier$': invalid suffix" +.errtext INVALID_WRITEMASK "1014: '$e_identifier$': invalid writemask" +.errtext FRAGMENT_EXPECTED "1015: 'fragment' expected but '$e_identifier$' found" +.errtext VERTEX_EXPECTED "1016: 'vertex' expected but '$e_identifier$' found" +.errtext INVALID_FRAGMENT_PROPERTY "1017: '$e_identifier$': invalid fragment property" +.errtext INVALID_VERTEX_PROPERTY "1018: '$e_identifier$': invalid vertex property" +.errtext INVALID_STATE_PROPERTY "1019: '$e_identifier$': invalid state property" +.errtext INVALID_MATERIAL_PROPERTY "1020: '$e_identifier$': invalid material property" +.errtext INVALID_LIGHT_PROPERTY "1021: '$e_identifier$': invalid light property" +.errtext INVALID_SPOT_PROPERTY "1022: '$e_identifier$': invalid spot property" +.errtext INVALID_LIGHTMODEL_PROPERTY "1023: '$e_identifier$': invalid light model property" +.errtext INVALID_LIGHTPROD_PROPERTY "1024: '$e_identifier$': invalid light product property" +.errtext INVALID_TEXENV_PROPERTY "1025: '$e_identifier$': invalid texture environment property" +.errtext INVALID_TEXGEN_PROPERTY "1026: '$e_identifier$': invalid texture generating property" +.errtext INVALID_TEXGEN_COORD "1027: '$e_identifier$': invalid texture generating coord" +.errtext INVALID_FOG_PROPERTY "1028: '$e_identifier$': invalid fog property" +.errtext INVALID_DEPTH_PROPERTY "1029: '$e_identifier$': invalid depth property" +.errtext INVALID_CLIPPLANE_PROPERTY "1030: '$e_identifier$': invalid clip plane property" +.errtext INVALID_POINT_PROPERTY "1031: '$e_identifier$': invalid point property" +.errtext MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED "1032: matrix row selector or modifier expected but '$e_token$' found" +.errtext INVALID_MATRIX_NAME "1033: '$e_identifier$': invalid matrix name" +.errtext INVALID_PROGRAM_PROPERTY "1034: '$e_identifier$': invalid program property" +.errtext RESULT_EXPECTED "1035: 'result' expected but '$e_token$' found" +.errtext INVALID_RESULT_PROPERTY "1036: '$e_identifier$': invalid result property" +.errtext INVALID_FACE_PROPERTY "1037: '$e_identifier$': invalid face property" +.errtext INVALID_COLOR_PROPERTY "1038: '$e_identifier$': invalid color property" +.errtext IDENTIFIER_EXPECTED "1039: identifier expected but '$e_token$' found" +.errtext RESERVED_KEYWORD "1040: use of reserved keyword as an identifier" +.errtext INTEGER_EXPECTED "1041: integer value expected but '$e_token$' found" +.errtext MISSING_SEMICOLON "1042: ';' expected but '$e_token$' found" +.errtext MISSING_COMMA "1043: ',' expected but '$e_token$' found" +.errtext MISSING_LBRACKET "1044: '[' expected but '$e_token$' found" +.errtext MISSING_RBRACKET "1045: ']' expected but '$e_token$' found" +.errtext MISSING_DOT "1046: '.' expected but '$e_token$' found" +.errtext MISSING_EQUAL "1047: '=' expected but '$e_token$' found" +.errtext MISSING_LBRACE "1048: '{' expected but '$e_token$' found" +.errtext MISSING_RBRACE "1049: '}' expected but '$e_token$' found" +.errtext MISSING_DOTDOT "1050: '..' expected but '$e_token$' found" +.errtext MISSING_FRACTION_OR_EXPONENT "1051: missing fraction part or exponent" +.errtext MISSING_DOT_OR_EXPONENT "1052: missing '.' or exponent" +.errtext EXPONENT_VALUE_EXPECTED "1053: exponent value expected" +.errtext INTEGER_OUT_OF_RANGE "1054: integer value out of range" +.errtext OPERATION_NEEDS_DESTINATION_VARIABLE "1055: operation needs destination variable" +.errtext OPERATION_NEEDS_SOURCE_VARIABLE "1056: operation needs source variable" +.errtext ADDRESS_REGISTER_EXPECTED "1057: address register expected but '$e_token$' found" +.errtext ADDRESS_REGISTER_OR_INTEGER_EXPECTED "1058: address register or integer literal expected but '$e_token$' found" + +/* extension presence condition registers */ + +/* GL_ARB_vertex_blend */ +/* GL_EXT_vertex_weighting */ +.regbyte vertex_blend 0x00 + +/* GL_ARB_matrix_palette */ +.regbyte matrix_palette 0x00 + +/* GL_ARB_point_parameters */ +/* GL_EXT_point_parameters */ +.regbyte point_parameters 0x00 + +/* GL_EXT_secondary_color */ +.regbyte secondary_color 0x00 + +/* GL_EXT_fog_coord */ +.regbyte fog_coord 0x00 + +/* GL_EXT_texture_rectangle */ +/* GL_NV_texture_rectangle */ +.regbyte texture_rectangle 0x00 + +/* GL_ARB_fragment_program_shadow */ +.regbyte fragment_program_shadow 0x00 + +/* GL_ARB_draw_buffers */ +.regbyte draw_buffers 0x00 + +/* GL_MESA_texture_array */ +.regbyte texture_array 0x00 + +/* option presence condition registers */ +/* they are all initially set to zero - when a particular OPTION is encountered, the appropriate */ +/* register is set to 1 to indicate that the OPTION was specified. */ + +/* GL_ARB_fragment_program */ +.regbyte ARB_precision_hint_fastest 0x00 +.regbyte ARB_precision_hint_nicest 0x00 +.regbyte ARB_fog_exp 0x00 +.regbyte ARB_fog_exp2 0x00 +.regbyte ARB_fog_linear 0x00 + +/* GL_ARB_vertex_program */ +.regbyte ARB_position_invariant 0x00 + +/* GL_ARB_fragment_program_shadow */ +.regbyte ARB_fragment_program_shadow 0x00 + +/* GL_ARB_draw_buffers */ +.regbyte ARB_draw_buffers 0x00 + +/* GL_MESA_texture_array */ +.regbyte MESA_texture_array 0x00 + +/* program target condition register */ +/* this syntax script deals with two program targets - VERTEX_PROGRAM and FRAGMENT_PROGRAM. */ +/* to distinguish between them we need a register that will store for us the current target. */ +/* the client will typically set the register to apropriate value before parsing a particular */ +/* program. the mapping between program targets and their values is listed below. */ +/* */ +/* program target register value */ +/* ---------------------------------------------- */ +/* FRAGMENT_PROGRAM 0x10 */ +/* VERTEX_PROGRAM 0x20 */ +/* */ +/* the initial value of the register is 0 to catch potential errors with not setting the register */ +/* with the proper value. */ +.regbyte program_target 0x00 + +/* + ::= "END" +*/ +program + programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION; +programs + .if (program_target == 0x10) frag_program_1_0 .emit FRAGMENT_PROGRAM .emit 0x01 .emit 0x00 .or + .if (program_target == 0x20) vert_program_1_0 .emit VERTEX_PROGRAM .emit 0x01 .emit 0x00; +frag_program_1_0 + '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'f' .and 'p' .and '1' .and '.' .and '0' .and + optional_space .and fp_optionSequence .and fp_statementSequence .and + "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and + '\0' .error CODE_AFTER_END; +vert_program_1_0 + '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'v' .and 'p' .and '1' .and '.' .and '0' .and + optional_space .and vp_optionSequence .and vp_statementSequence .and + "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and + '\0' .error CODE_AFTER_END; + +/* + ::=