OSDN Git Service

DOS updates from Daniel Borca
authorBrian Paul <brian.paul@tungstengraphics.com>
Sat, 29 Mar 2003 16:14:01 +0000 (16:14 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sat, 29 Mar 2003 16:14:01 +0000 (16:14 +0000)
docs/README.DJ
progs/samples/Makefile.DJ
src/glu/mesa/Makefile.DJ
src/glu/sgi/Makefile.DJ
src/glut/dos/Makefile.DJ
src/glut/dos/PC_HW/pc_keyb.c
src/glut/dos/PC_HW/pc_mouse.c
src/mesa/drivers/dos/dmesa.c
src/mesa/main/Makefile.DJ

index a800d6e..0ddcea8 100644 (file)
@@ -70,7 +70,7 @@ Tested on:
        CPU:            K6-2 (CXT) @500(412.5) MHz\r
        Mainboard:      ViA Apollo VP2/97 w/ 128 MB SDRAM\r
        Video card:     PowerColor EvilKing3 (Voodoo3 3000 PCI) w/ 16 MB SDRAM\r
-       DJGPP:          djdev 2.04 + gcc v3.2.1 + make v3.79.1\r
+       DJGPP:          djdev 2.04 + gcc v3.2.2 + make v3.79.1\r
        OS:             DOS and Win9x\r
 \r
 \r
@@ -94,26 +94,16 @@ FAQ:
       with the following line:\r
        #define vsnprintf(buf, max, fmt, arg) vsprintf(buf, fmt, arg)\r
 \r
-2. Dynamic modules\r
+   Q) `make' complains about DXE3 or something, yet it builds the libraries.\r
+   A) DXE3 refers to the DJGPP dynamic modules. You'll need either the latest\r
+      DJGPP distro, or download the separate package from my web page. Read the\r
+      DXE3 documentation on how to use them. Hint: build your export object\r
+      file; then link it with your application. For example:\r
+       dxe3res -o dxe3tbl.c gl.dxe glu.dxe glut.dxe\r
+       gcc -o dxe3tbl.o -c dxe3tbl.c\r
+       gcc -o OUT.exe dxe3tbl.o IN.c -liglut -liglu -ligl -ldl\r
 \r
-   Q) What are you mumbling about dynamic modules?\r
-   A) You must have the DXE3 package (available on my site) installed in order\r
-      to build the dynamic modules.\r
-\r
-   Q) DXE3 modules give me headaches...\r
-   A) The DXE3 modules are not compulsory. The static libraries are still built\r
-      and you can use them in the old-fashioned, classic way... and learn to\r
-      live with your huge executable size. For example:\r
-       gcc -o OUT.exe IN.c -lglut -lglu -lgl\r
-\r
-   Q) Okay, DXE3 modules are built. How can I use them?\r
-   A) Build your export object file; then link it with your application.\r
-      For example:\r
-       dxe3res -o dmesadxe.c gl.dxe glu.dxe glut.dxe\r
-       gcc -o dmesadxe.o -c dmesadxe.c\r
-       gcc -o OUT.exe dmesadxe.o IN.c -liglut -liglu -ligl -ldl\r
-\r
-3. Using Mesa for DJGPP\r
+2. Using Mesa for DJGPP\r
 \r
    Q) DMesa is so SLOOOW! The Win32 OpenGL performs so much better...\r
    A) Is that a question? If you have a Voodoo3/Banshee card, you're lucky (the\r
@@ -188,6 +178,7 @@ position right before the main loop.
 The following environment variables can customize GLUT behaviour:\r
        DMESA_GLUT_REFRESH      - set vertical screen refresh rate (VESA3)\r
        DMESA_GLUT_BPP          - set default bits per pixel (VGA needs 8)\r
+       GLUT_FPS                - print frames/second statistics to stderr\r
 \r
 \r
 \r
@@ -217,7 +208,8 @@ v1.3 (mar-2003)
        + added Matrox Millennium MGA2064W driver\r
        + added 8bit FakeColor (thanks to Neil Funk)\r
        + added VGA support (to keep Ben Decker happy)\r
-       ! fixed GLUT compilation error (reported by Chan Kar Heng)\r
+       ! fixed some compilation errors (reported by Chan Kar Heng)\r
+       * optimized driver for faster callback access... yeah, right :)\r
        * overhauled virtual buffer and internal video drivers\r
        * better fxMesa integration\r
        * revamped GLUT\r
index 81db825..e29e0e5 100644 (file)
@@ -67,7 +67,7 @@ LD = gxx
 LDFLAGS = -s -L$(TOP)/lib\r
 \r
 ifeq ($(DXE),1)\r
-DMESADXE = $(TOP)/lib/dmesadxe.o\r
+DXE3TABLE = $(TOP)/lib/dxe3tbl.o\r
 LDLIBS += -liglut -liglu -ligl -ldl\r
 else\r
 LDLIBS = -lglut -lglu -lgl\r
@@ -80,7 +80,7 @@ endif
 .c.o:\r
        $(CC) -o $@ $(CFLAGS) -c $<\r
 .o.exe:\r
-       $(LD) -o $@ $(LDFLAGS) $(DMESADXE) $< $(LDLIBS)\r
+       $(LD) -o $@ $(LDFLAGS) $(DXE3TABLE) $< $(LDLIBS)\r
 \r
 all:\r
        $(error Must specify <filename.exe> to build)\r
index e4423cc..b11b233 100644 (file)
@@ -54,11 +54,13 @@ CFLAGS += -I$(TOP)/include
 AR = ar\r
 ARFLAGS = rus\r
 \r
-ifneq ($(wildcard $(DJDIR)/lib/dxe3.ld),)\r
-DXE3GEN = $(wildcard $(addsuffix /dxe3gen.exe,$(subst ;, ,$(PATH))))\r
-endif\r
+HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe)\r
 \r
-RM = del\r
+ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)\r
+UNLINK = del $(subst /,\,$(1))\r
+else\r
+UNLINK = $(RM) $(1)\r
+endif\r
 \r
 CORE_SOURCES = \\r
        glu.c \\r
@@ -86,14 +88,13 @@ $(LIBDIR)/$(GLU_LIB): $(OBJECTS)
        $(AR) $(ARFLAGS) $(LIBDIR)/$(GLU_LIB) $(OBJECTS)\r
 \r
 $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP): $(OBJECTS)\r
-ifeq ($(DXE3GEN),)\r
-       $(warning Missing DXE3GEN and/or DXE3.LD! You must have DXE3GEN)\r
-       $(warning somewhere in PATH, and DXE3.LD in DJGPP/LIB directory.)\r
+ifeq ($(HAVEDXE3),)\r
+       $(warning Missing DXE3 package... Skipping $(GLU_DXE))\r
 else\r
        -dxe3gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) -D "MesaGLU DJGPP" -E _glu -P gl.dxe -U $(OBJECTS)\r
 endif\r
 \r
 clean:\r
-       -$(RM) $(subst /,\,*.o)\r
+       -$(call UNLINK,*.o)\r
 \r
 -include depend\r
index 0f0984f..d81da0f 100644 (file)
@@ -56,11 +56,13 @@ CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbte
 AR = ar\r
 ARFLAGS = rus\r
 \r
-ifneq ($(wildcard $(DJDIR)/lib/dxe3.ld),)\r
-DXE3GEN = $(wildcard $(addsuffix /dxe3gen.exe,$(subst ;, ,$(PATH))))\r
-endif\r
+HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe)\r
 \r
-RM = del\r
+ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)\r
+UNLINK = del $(subst /,\,$(1))\r
+else\r
+UNLINK = $(RM) $(1)\r
+endif\r
 \r
 C_SOURCES = \\r
        libutil/error.c \\r
@@ -170,18 +172,17 @@ $(LIBDIR)/$(GLU_LIB): $(OBJECTS)
        $(AR) $(ARFLAGS) $(LIBDIR)/$(GLU_LIB) $(OBJECTS)\r
 \r
 $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP): $(OBJECTS)\r
-ifeq ($(DXE3GEN),)\r
-       $(warning Missing DXE3GEN and/or DXE3.LD! You must have DXE3GEN)\r
-       $(warning somewhere in PATH, and DXE3.LD in DJGPP/LIB directory.)\r
+ifeq ($(HAVEDXE3),)\r
+       $(warning Missing DXE3 package... Skipping $(GLU_DXE))\r
 else\r
        -dxe3gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) -D "MesaGLU/SGI DJGPP" -E _glu -P gl.dxe -U $(OBJECTS)\r
 endif\r
 \r
 clean:\r
-       -$(RM) $(subst /,\,libutil/*.o)\r
-       -$(RM) $(subst /,\,libtess/*.o)\r
-       -$(RM) $(subst /,\,libnurbs/interface/*.o)\r
-       -$(RM) $(subst /,\,libnurbs/internals/*.o)\r
-       -$(RM) $(subst /,\,libnurbs/nurbtess/*.o)\r
+       -$(call UNLINK,libutil/*.o)\r
+       -$(call UNLINK,libtess/*.o)\r
+       -$(call UNLINK,libnurbs/interface/*.o)\r
+       -$(call UNLINK,libnurbs/internals/*.o)\r
+       -$(call UNLINK,libnurbs/nurbtess/*.o)\r
 \r
 -include depend\r
index 2ae8852..52c347c 100644 (file)
@@ -59,11 +59,13 @@ CFLAGS += -I- -I$(TOP)/include -I. -I$(MKGLUT) -IPC_HW
 AR = ar\r
 ARFLAGS = rus\r
 \r
-ifneq ($(wildcard $(DJDIR)/lib/dxe3.ld),)\r
-DXE3GEN = $(wildcard $(addsuffix /dxe3gen.exe,$(subst ;, ,$(PATH))))\r
-endif\r
+HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe)\r
 \r
-RM = del\r
+ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)\r
+UNLINK = del $(subst /,\,$(1))\r
+else\r
+UNLINK = $(RM) $(1)\r
+endif\r
 \r
 CORE_SOURCES = \\r
        callback.c \\r
@@ -118,16 +120,15 @@ $(LIBDIR)/$(GLUT_LIB): $(OBJECTS)
        $(AR) $(ARFLAGS) $(LIBDIR)/$(GLUT_LIB) $(OBJECTS)\r
 \r
 $(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)\r
-ifeq ($(DXE3GEN),)\r
-       $(warning Missing DXE3GEN and/or DXE3.LD! You must have DXE3GEN)\r
-       $(warning somewhere in PATH, and DXE3.LD in DJGPP/LIB directory.)\r
+ifeq ($(HAVEDXE3),)\r
+       $(warning Missing DXE3 package... Skipping $(GLUT_DXE))\r
 else\r
        -dxe3gen -o $(LIBDIR)/$(GLUT_DXE) -I $(LIBDIR)/$(GLUT_IMP) -D "MesaGLUT DJGPP" -E _glut -P gl.dxe -P glu.dxe -U $(OBJECTS)\r
 endif\r
 \r
 clean:\r
-       -$(RM) $(subst /,\,*.o)\r
-       -$(RM) $(subst /,\,PC_HW/*.o)\r
-       -$(RM) $(subst /,\,$(MKGLUT)/*.o)\r
+       -$(call UNLINK,*.o)\r
+       -$(call UNLINK,PC_HW/*.o)\r
+       -$(call UNLINK,$(MKGLUT)/*.o)\r
 \r
 -include depend\r
index 6475be3..ec509c2 100644 (file)
@@ -420,8 +420,9 @@ int pc_readkey (void)
  if (keyboard_installed) {\r
     int key;\r
 \r
-    do {\r
-    } while (key_buffer.start==key_buffer.end);\r
+    while (key_buffer.start==key_buffer.end) {\r
+          __dpmi_yield();\r
+    }\r
 \r
     DISABLE();\r
     key = key_buffer.key[key_buffer.start++];\r
index 1740bfb..cf8fb66 100644 (file)
@@ -274,6 +274,5 @@ _mouse_wrap:                                        \n\
                movl    %esi, %esp              \n\\r
                popl    %es                     \n\\r
                iret                            \n\\r
-               .balign 4                       \n\\r
                .global _mouse_wrap_end         \n\\r
 _mouse_wrap_end:.long  0, 0");\r
index d3d3d4a..a389e3d 100644 (file)
@@ -1,8 +1,8 @@
 /*\r
  * Mesa 3-D graphics library\r
- * Version:  5.0\r
+ * Version:  5.0.1\r
  * \r
- * Copyright (C) 1999  Brian Paul   All Rights Reserved.\r
+ * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.\r
  * \r
  * Permission is hereby granted, free of charge, to any person obtaining a\r
  * copy of this software and associated documentation files (the "Software"),\r
 /*\r
  * DOS/DJGPP device driver v1.3 for Mesa\r
  *\r
- *  Copyright (C) 2002 - Borca Daniel\r
+ *  Copyright (c) 2003 - Borca Daniel\r
  *  Email : dborca@yahoo.com\r
  *  Web   : http://www.geocities.com/dborca\r
  */\r
 \r
 \r
 #ifndef FX\r
-\r
 #include "glheader.h"\r
 #include "context.h"\r
-#include "GL/dmesa.h"\r
 #include "extensions.h"\r
 #include "macros.h"\r
 #include "matrix.h"\r
 #include "tnl/tnl.h"\r
 #include "tnl/t_context.h"\r
 #include "tnl/t_pipeline.h"\r
-\r
 #ifndef MATROX\r
-\r
 #include "video.h"\r
-\r
 #else  /* MATROX */\r
-\r
 #include "mga/mga.h"\r
-\r
 #endif /* MATROX */\r
-\r
 #else  /* FX */\r
-\r
 #include "../FX/fxdrv.h"\r
-#include "GL/dmesa.h"\r
-\r
 #endif /* FX */\r
 \r
+#include "GL/dmesa.h"\r
+\r
 \r
 \r
 /*\r
@@ -78,7 +69,7 @@
  * Add system-specific fields to it.\r
  */\r
 struct dmesa_visual {\r
-   GLvisual *gl_visual;\r
+   GLvisual gl_visual;\r
    GLboolean db_flag;           /* double buffered? */\r
    GLboolean rgb_flag;          /* RGB mode? */\r
    GLuint depth;                /* bits per pixel (1, 8, 24, etc) */\r
@@ -105,7 +96,7 @@ struct dmesa_buffer {
  * Add system-specific fields to it.\r
  */\r
 struct dmesa_context {\r
-   GLcontext *gl_ctx;           /* the core library context */\r
+   GLcontext gl_ctx;            /* the core library context */\r
    DMesaVisual visual;\r
    DMesaBuffer Buffer;\r
    GLuint ClearColor;\r
@@ -141,7 +132,7 @@ struct dmesa_context {
 static void write_rgba_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,\r
                              const GLubyte rgba[][4], const GLubyte mask[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, offset;\r
 \r
 #ifndef MATROX\r
@@ -189,7 +180,7 @@ static void write_rgba_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
 static void write_rgb_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,\r
                             const GLubyte rgb[][3], const GLubyte mask[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, offset;\r
 \r
  offset = DSTRIDE * FLIP(y) + x;\r
@@ -214,7 +205,7 @@ static void write_mono_rgba_span (const GLcontext *ctx,
                                   GLuint n, GLint x, GLint y,\r
                                   const GLchan color[4], const GLubyte mask[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, offset, rgba = vl_mixrgba(color);\r
 \r
  offset = DSTRIDE * FLIP(y) + x;\r
@@ -238,7 +229,7 @@ static void write_mono_rgba_span (const GLcontext *ctx,
 static void read_rgba_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,\r
                             GLubyte rgba[][4])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, offset;\r
 \r
  offset = DSTRIDE * FLIP(y) + x;\r
@@ -254,7 +245,7 @@ static void write_rgba_pixels (const GLcontext *ctx,
                                GLuint n, const GLint x[], const GLint y[],\r
                                const GLubyte rgba[][4], const GLubyte mask[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;\r
 \r
  if (mask) {\r
@@ -278,7 +269,7 @@ static void write_mono_rgba_pixels (const GLcontext *ctx,
                                     GLuint n, const GLint x[], const GLint y[],\r
                                     const GLchan color[4], const GLubyte mask[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1, rgba = vl_mixrgba(color);\r
 \r
  if (mask) {\r
@@ -302,7 +293,7 @@ static void read_rgba_pixels (const GLcontext *ctx,
                               GLuint n, const GLint x[], const GLint y[],\r
                               GLubyte rgba[][4], const GLubyte mask[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;\r
 \r
  if (mask) {\r
@@ -329,7 +320,7 @@ static void read_rgba_pixels (const GLcontext *ctx,
 static void write_index_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,\r
                               const GLuint index[], const GLubyte mask[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, offset;\r
 \r
  offset = DSTRIDE * FLIP(y) + x;\r
@@ -353,7 +344,7 @@ static void write_index_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
 static void write_index8_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,\r
                                const GLubyte index[], const GLubyte mask[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, offset;\r
 \r
  offset = DSTRIDE * FLIP(y) + x;\r
@@ -378,7 +369,7 @@ static void write_mono_index_span (const GLcontext *ctx,
                                    GLuint n, GLint x, GLint y,\r
                                    GLuint colorIndex, const GLubyte mask[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, offset;\r
 \r
  offset = DSTRIDE * FLIP(y) + x;\r
@@ -402,7 +393,7 @@ static void write_mono_index_span (const GLcontext *ctx,
 static void read_index_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,\r
                              GLuint index[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, offset;\r
 \r
  offset = DSTRIDE * FLIP(y) + x;\r
@@ -418,7 +409,7 @@ static void write_index_pixels (const GLcontext *ctx,
                                 GLuint n, const GLint x[], const GLint y[],\r
                                 const GLuint index[], const GLubyte mask[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;\r
 \r
  if (mask) {\r
@@ -442,7 +433,7 @@ static void write_mono_index_pixels (const GLcontext *ctx,
                                      GLuint n, const GLint x[], const GLint y[],\r
                                      GLuint colorIndex, const GLubyte mask[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;\r
 \r
  if (mask) {\r
@@ -466,7 +457,7 @@ static void read_index_pixels (const GLcontext *ctx,
                                GLuint n, const GLint x[], const GLint y[],\r
                                GLuint index[], const GLubyte mask[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;\r
 \r
  if (mask) {\r
@@ -494,7 +485,7 @@ static void read_index_pixels (const GLcontext *ctx,
 static void write_depth_span (GLcontext *ctx, GLuint n, GLint x, GLint y,\r
                               const GLdepth depth[], const GLubyte mask[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, offset;\r
 \r
  offset = DSTRIDE * FLIP(y) + x;\r
@@ -518,7 +509,7 @@ static void write_depth_span (GLcontext *ctx, GLuint n, GLint x, GLint y,
 static void read_depth_span (GLcontext *ctx, GLuint n, GLint x, GLint y,\r
                              GLdepth depth[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, offset;\r
 \r
  offset = DSTRIDE * FLIP(y) + x;\r
@@ -534,7 +525,7 @@ static void write_depth_pixels (GLcontext *ctx, GLuint n,
                                 const GLint x[], const GLint y[],\r
                                 const GLdepth depth[], const GLubyte mask[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;\r
 \r
  if (mask) {\r
@@ -558,7 +549,7 @@ static void read_depth_pixels (GLcontext *ctx, GLuint n,
                                const GLint x[], const GLint y[],\r
                                GLdepth depth[])\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;\r
 \r
  /* read all values */\r
@@ -582,7 +573,7 @@ static void tri_rgb_flat (GLcontext *ctx,
                           const SWvertex *v1,\r
                           const SWvertex *v2)\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint _b_ = dmesa->Buffer->height - 1;\r
 #ifndef MATROX\r
  GLuint _w_ = dmesa->Buffer->width;\r
@@ -619,7 +610,7 @@ static void tri_rgb_flat_zless (GLcontext *ctx,
                                 const SWvertex *v1,\r
                                 const SWvertex *v2)\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint _b_ = dmesa->Buffer->height - 1;\r
 #ifndef MATROX\r
  GLuint _w_ = dmesa->Buffer->width;\r
@@ -666,7 +657,7 @@ static void tri_rgb_iter (GLcontext *ctx,
                           const SWvertex *v1,\r
                           const SWvertex *v2)\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint _b_ = dmesa->Buffer->height - 1;\r
 #ifndef MATROX\r
  GLuint _w_ = dmesa->Buffer->width;\r
@@ -707,7 +698,7 @@ static void tri_rgb_iter_zless (GLcontext *ctx,
                                 const SWvertex *v1,\r
                                 const SWvertex *v2)\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint _b_ = dmesa->Buffer->height - 1;\r
 #ifndef MATROX\r
  GLuint _w_ = dmesa->Buffer->width;\r
@@ -839,7 +830,7 @@ static void line_rgb_flat (GLcontext *ctx,
                            const SWvertex *vert0,\r
                            const SWvertex *vert1)\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint _b_ = dmesa->Buffer->height - 1;\r
 #ifndef MATROX\r
  GLuint _w_ = dmesa->Buffer->width;\r
@@ -867,7 +858,7 @@ static void line_rgb_flat_zless (GLcontext *ctx,
                                  const SWvertex *vert0,\r
                                  const SWvertex *vert1)\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint _b_ = dmesa->Buffer->height - 1;\r
 #ifndef MATROX\r
  GLuint _w_ = dmesa->Buffer->width;\r
@@ -907,7 +898,7 @@ static void line_rgb_iter (GLcontext *ctx,
                            const SWvertex *vert0,\r
                            const SWvertex *vert1)\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint _b_ = dmesa->Buffer->height - 1;\r
  MGAvertex m0, m1;\r
  matrox_line_clip_hack(ctx, _b_, &m0, vert0, &m1, vert1);\r
@@ -925,7 +916,7 @@ static void line_rgb_iter_zless (GLcontext *ctx,
                                  const SWvertex *vert0,\r
                                  const SWvertex *vert1)\r
 {\r
- const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext dmesa = (DMesaContext)ctx;\r
  GLuint _b_ = dmesa->Buffer->height - 1;\r
  MGAvertex m0, m1;\r
  matrox_line_clip_hack(ctx, _b_, &m0, vert0, &m1, vert1);\r
@@ -992,7 +983,7 @@ static void dmesa_choose_line (GLcontext *ctx)
 \r
 static void clear_index (GLcontext *ctx, GLuint index)\r
 {\r
- ((DMesaContext)ctx->DriverCtx)->ClearIndex = index;\r
+ ((DMesaContext)ctx)->ClearIndex = index;\r
 }\r
 \r
 static void clear_color (GLcontext *ctx, const GLfloat color[4])\r
@@ -1002,7 +993,7 @@ static void clear_color (GLcontext *ctx, const GLfloat color[4])
  CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);\r
  CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]);\r
  CLAMPED_FLOAT_TO_UBYTE(col[3], color[3]);\r
- ((DMesaContext)ctx->DriverCtx)->ClearColor = vl_mixrgba(col);\r
+ ((DMesaContext)ctx)->ClearColor = vl_mixrgba(col);\r
 }\r
 \r
 \r
@@ -1010,7 +1001,7 @@ static void clear_color (GLcontext *ctx, const GLfloat color[4])
 static void clear (GLcontext *ctx, GLbitfield mask, GLboolean all,\r
                    GLint x, GLint y, GLint width, GLint height)\r
 {\r
- const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext c = (DMesaContext)ctx;\r
  const GLuint *colorMask = (GLuint *)&ctx->Color.ColorMask;\r
 \r
 /*\r
@@ -1234,7 +1225,7 @@ static void dmesa_init_pointers (GLcontext *ctx)
   * pretty sure they will never change during the life of the Visual\r
   */\r
 #ifdef MATROX\r
- if (((DMesaContext)ctx->DriverCtx)->visual->zbuffer == -1) {\r
+ if (((DMesaContext)ctx)->visual->zbuffer == -1) {\r
     /* Depth span/pixel functions */\r
     dd->WriteDepthSpan = write_depth_span;\r
     dd->WriteDepthPixels = write_depth_pixels;\r
@@ -1363,23 +1354,24 @@ DMesaVisual DMesaCreateVisual (GLint width,
     alphaBits = 8;\r
  }\r
 \r
- if ((v=(DMesaVisual)calloc(1, sizeof(struct dmesa_visual))) != NULL) {\r
+ if ((v=(DMesaVisual)CALLOC_STRUCT(dmesa_visual)) != NULL) {\r
     /* Create core visual */\r
-    v->gl_visual = _mesa_create_visual(rgbFlag,                        /* rgb */\r
-                                       dbFlag,\r
-                                       GL_FALSE,               /* stereo */\r
-                                       redBits,\r
-                                       greenBits,\r
-                                       blueBits,\r
-                                       alphaBits,\r
-                                       indexBits,              /* indexBits */\r
-                                       depthSize,\r
-                                       stencilSize,\r
-                                       accumSize,              /* accumRed */\r
-                                       accumSize,              /* accumGreen */\r
-                                       accumSize,              /* accumBlue */\r
-                                       alphaFlag?accumSize:0,  /* accumAlpha */\r
-                                       1);                     /* numSamples */\r
+    _mesa_initialize_visual((GLvisual *)v,\r
+                            rgbFlag,           /* rgb */\r
+                            dbFlag,\r
+                            GL_FALSE,          /* stereo */\r
+                            redBits,\r
+                            greenBits,\r
+                            blueBits,\r
+                            alphaBits,\r
+                            indexBits,         /* indexBits */\r
+                            depthSize,\r
+                            stencilSize,\r
+                            accumSize,         /* accumRed */\r
+                            accumSize,         /* accumGreen */\r
+                            accumSize,         /* accumBlue */\r
+                            alphaFlag?accumSize:0,     /* accumAlpha */\r
+                            1);                        /* numSamples */\r
 \r
     v->depth = colDepth;\r
     v->db_flag = dbFlag;\r
@@ -1420,8 +1412,7 @@ DMesaVisual DMesaCreateVisual (GLint width,
 void DMesaDestroyVisual (DMesaVisual v)\r
 {\r
 #ifndef FX\r
- _mesa_destroy_visual(v->gl_visual);\r
- free(v);\r
+ _mesa_destroy_visual((GLvisual *)v);\r
 \r
 #ifndef MATROX\r
  vl_video_exit();\r
@@ -1443,14 +1434,13 @@ DMesaBuffer DMesaCreateBuffer (DMesaVisual visual,
 #ifndef FX\r
  DMesaBuffer b;\r
 \r
- if ((b=(DMesaBuffer)calloc(1, sizeof(struct dmesa_buffer))) != NULL) {\r
-\r
-    _mesa_initialize_framebuffer(&b->gl_buffer,\r
-                                 visual->gl_visual,\r
+ if ((b=(DMesaBuffer)CALLOC_STRUCT(dmesa_buffer)) != NULL) {\r
+    _mesa_initialize_framebuffer((GLframebuffer *)b,\r
+                                 (GLvisual *)visual,\r
                                  visual->zbuffer == 1,\r
-                                 visual->gl_visual->stencilBits > 0,\r
-                                 visual->gl_visual->accumRedBits > 0,\r
-                                 visual->gl_visual->alphaBits > 0);\r
+                                 ((GLvisual *)visual)->stencilBits > 0,\r
+                                 ((GLvisual *)visual)->accumRedBits > 0,\r
+                                 ((GLvisual *)visual)->alphaBits > 0);\r
     b->xpos = xpos;\r
     b->ypos = ypos;\r
     b->width = width;\r
@@ -1471,8 +1461,7 @@ void DMesaDestroyBuffer (DMesaBuffer b)
 #ifndef MATROX\r
  free(b->the_window);\r
 #endif\r
- _mesa_free_framebuffer_data(&b->gl_buffer);\r
- free(b);\r
+ _mesa_destroy_framebuffer((GLframebuffer *)b);\r
 #endif\r
 }\r
 \r
@@ -1485,28 +1474,29 @@ DMesaContext DMesaCreateContext (DMesaVisual visual,
  DMesaContext c;\r
  GLboolean direct = GL_FALSE;\r
 \r
- if ((c=(DMesaContext)calloc(1, sizeof(struct dmesa_context))) != NULL) {\r
-    c->gl_ctx = _mesa_create_context(visual->gl_visual,\r
-                                     share ? share->gl_ctx : NULL,\r
-                                     (void *)c, direct);\r
+ if ((c=(DMesaContext)CALLOC_STRUCT(dmesa_context)) != NULL) {\r
+    _mesa_initialize_context((GLcontext *)c,\r
+                             (GLvisual *)visual,\r
+                             (GLcontext *)share,\r
+                             (void *)c, direct);\r
 \r
-    _mesa_enable_sw_extensions(c->gl_ctx);\r
-    _mesa_enable_1_3_extensions(c->gl_ctx);\r
-    _mesa_enable_1_4_extensions(c->gl_ctx);\r
+    _mesa_enable_sw_extensions((GLcontext *)c);\r
+    _mesa_enable_1_3_extensions((GLcontext *)c);\r
+    _mesa_enable_1_4_extensions((GLcontext *)c);\r
 \r
     /* you probably have to do a bunch of other initializations here. */\r
     c->visual = visual;\r
 \r
-    c->gl_ctx->Driver.UpdateState = dmesa_update_state;\r
+    ((GLcontext *)c)->Driver.UpdateState = dmesa_update_state;\r
 \r
     /* Initialize the software rasterizer and helper modules.\r
      */\r
-    _swrast_CreateContext(c->gl_ctx);\r
-    _ac_CreateContext(c->gl_ctx);\r
-    _tnl_CreateContext(c->gl_ctx);\r
-    _swsetup_CreateContext(c->gl_ctx);\r
-    if (visual->rgb_flag) dmesa_register_swrast_functions(c->gl_ctx);\r
-    dmesa_init_pointers(c->gl_ctx);\r
+    _swrast_CreateContext((GLcontext *)c);\r
+    _ac_CreateContext((GLcontext *)c);\r
+    _tnl_CreateContext((GLcontext *)c);\r
+    _swsetup_CreateContext((GLcontext *)c);\r
+    if (visual->rgb_flag) dmesa_register_swrast_functions((GLcontext *)c);\r
+    dmesa_init_pointers((GLcontext *)c);\r
  }\r
 \r
  return c;\r
@@ -1521,14 +1511,13 @@ DMesaContext DMesaCreateContext (DMesaVisual visual,
 void DMesaDestroyContext (DMesaContext c)\r
 {\r
 #ifndef FX\r
- if (c->gl_ctx) {\r
-    _swsetup_DestroyContext(c->gl_ctx);\r
-    _swrast_DestroyContext(c->gl_ctx);\r
-    _tnl_DestroyContext(c->gl_ctx);\r
-    _ac_DestroyContext(c->gl_ctx);\r
-    _mesa_destroy_context(c->gl_ctx);\r
+ if (c) {\r
+    _swsetup_DestroyContext((GLcontext *)c);\r
+    _swrast_DestroyContext((GLcontext *)c);\r
+    _tnl_DestroyContext((GLcontext *)c);\r
+    _ac_DestroyContext((GLcontext *)c);\r
+    _mesa_destroy_context((GLcontext *)c);\r
  }\r
- free(c);\r
 #endif\r
 }\r
 \r
@@ -1538,7 +1527,7 @@ GLboolean DMesaMoveBuffer (GLint xpos, GLint ypos)
 {\r
 #if !defined(FX) && !defined(MATROX)\r
  GET_CURRENT_CONTEXT(ctx);\r
- DMesaBuffer b = ((DMesaContext)ctx->DriverCtx)->Buffer;\r
+ DMesaBuffer b = ((DMesaContext)ctx)->Buffer;\r
 \r
  if (vl_sync_buffer(&b->the_window, xpos, ypos, b->width, b->height) != 0) {\r
     return GL_FALSE;\r
@@ -1559,7 +1548,7 @@ GLboolean DMesaResizeBuffer (GLint width, GLint height)
 {\r
 #if !defined(FX) && !defined(MATROX)\r
  GET_CURRENT_CONTEXT(ctx);\r
- DMesaBuffer b = ((DMesaContext)ctx->DriverCtx)->Buffer;\r
+ DMesaBuffer b = ((DMesaContext)ctx)->Buffer;\r
 \r
  if (vl_sync_buffer(&b->the_window, b->xpos, b->ypos, width, height) != 0) {\r
     return GL_FALSE;\r
@@ -1591,8 +1580,8 @@ GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b)
 \r
     c->Buffer = b;\r
 \r
-    _mesa_make_current(c->gl_ctx, &b->gl_buffer);\r
-    if (c->gl_ctx->Viewport.Width == 0) {\r
+    _mesa_make_current((GLcontext *)c, (GLframebuffer *)b);\r
+    if (((GLcontext *)c)->Viewport.Width == 0) {\r
        /* initialize viewport to window size */\r
        _mesa_Viewport(0, 0, b->width, b->height);\r
     }\r
@@ -1619,7 +1608,7 @@ void DMesaSwapBuffers (DMesaBuffer b)
 #ifndef MATROX\r
  vl_flip();\r
 #else\r
- if (((DMesaContext)ctx->DriverCtx)->visual->db_flag) {\r
+ if (((DMesaContext)ctx)->visual->db_flag) {\r
     mga_swapbuffers(1);\r
  }\r
 #endif\r
@@ -1643,7 +1632,7 @@ DMesaContext DMesaGetCurrentContext (void)
 {\r
 #ifndef FX\r
  GET_CURRENT_CONTEXT(ctx);\r
- return (ctx == NULL) ? NULL : (DMesaContext)ctx->DriverCtx;\r
+ return (DMesaContext)ctx;\r
 #else\r
  return (DMesaContext)fxMesaGetCurrentContext();\r
 #endif\r
@@ -1655,7 +1644,7 @@ int DMesaGetIntegerv (GLenum pname, GLint *params)
 {\r
 #ifndef FX\r
  GET_CURRENT_CONTEXT(ctx);\r
- const DMesaContext c = (ctx == NULL) ? NULL : (DMesaContext)ctx->DriverCtx;\r
+ const DMesaContext c = (DMesaContext)ctx;\r
 #else\r
  const fxMesaContext c = fxMesaGetCurrentContext();\r
 #endif\r
index 971769d..16012c8 100644 (file)
@@ -89,11 +89,13 @@ endif
 AR = ar\r
 ARFLAGS = rus\r
 \r
-ifneq ($(wildcard $(DJDIR)/lib/dxe3.ld),)\r
-DXE3GEN = $(wildcard $(addsuffix /dxe3gen.exe,$(subst ;, ,$(PATH))))\r
-endif\r
+HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe)\r
 \r
-RM = del\r
+ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)\r
+UNLINK = del $(subst /,\,$(1))\r
+else\r
+UNLINK = $(RM) $(1)\r
+endif\r
 \r
 CORE_SOURCES = \\r
        api_arrayelt.c \\r
@@ -173,6 +175,7 @@ CORE_SOURCES = \
        swrast/s_drawpix.c \\r
        swrast/s_feedback.c \\r
        swrast/s_fog.c \\r
+       swrast/s_histogram.c \\r
        swrast/s_imaging.c \\r
        swrast/s_lines.c \\r
        swrast/s_logic.c \\r
@@ -310,9 +313,8 @@ $(LIBDIR)/$(GL_LIB): $(OBJECTS)
        $(AR) $(ARFLAGS) $(LIBDIR)/$(GL_LIB) $(OBJECTS)\r
 \r
 $(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_IMP): $(OBJECTS)\r
-ifeq ($(DXE3GEN),)\r
-       $(warning Missing DXE3GEN and/or DXE3.LD! You must have DXE3GEN)\r
-       $(warning somewhere in PATH, and DXE3.LD in DJGPP/LIB directory.)\r
+ifeq ($(HAVEDXE3),)\r
+       $(warning Missing DXE3 package... Skipping $(GL_DXE))\r
 else\r
 ifeq ($(FX),1)\r
        -dxe3gen -o $(LIBDIR)/$(GL_DXE) -I $(LIBDIR)/$(GL_IMP) -D $(LIBNAME) -E _gl -E _DMesa -P glid3.dxe -U $(OBJECTS)\r
@@ -330,15 +332,15 @@ X86/gen_matypes.exe: X86/gen_matypes.c
        $(CC) -o $@ $(CFLAGS) -s $<\r
 \r
 clean:\r
-       -$(RM) $(subst /,\,*.o)\r
-       -$(RM) $(subst /,\,array_cache/*.o)\r
-       -$(RM) $(subst /,\,math/*.o)\r
-       -$(RM) $(subst /,\,swrast/*.o)\r
-       -$(RM) $(subst /,\,swrast_setup/*.o)\r
-       -$(RM) $(subst /,\,tnl/*.o)\r
-       -$(RM) $(subst /,\,X86/*.o)\r
-       -$(RM) $(subst /,\,DOS/*.o)\r
-       -$(RM) $(subst /,\,DOS/mga/*.o)\r
-       -$(RM) $(subst /,\,FX/*.o)\r
+       -$(call UNLINK,*.o)\r
+       -$(call UNLINK,array_cache/*.o)\r
+       -$(call UNLINK,math/*.o)\r
+       -$(call UNLINK,swrast/*.o)\r
+       -$(call UNLINK,swrast_setup/*.o)\r
+       -$(call UNLINK,tnl/*.o)\r
+       -$(call UNLINK,X86/*.o)\r
+       -$(call UNLINK,DOS/*.o)\r
+       -$(call UNLINK,DOS/mga/*.o)\r
+       -$(call UNLINK,FX/*.o)\r
 \r
 -include depend\r