- Mesa 4.1 DOS/DJGPP Port v1.2\r
+ Mesa 5.0 DOS/DJGPP Port v1.3\r
~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
\r
\r
Description:\r
~~~~~~~~~~~~\r
\r
-Well, guess what... this is the DOS port of Mesa 4.1, for DJGPP fans... Whoa!\r
+Well, guess what... this is the DOS port of Mesa 5.0, for DJGPP fans... Whoa!\r
The driver has its origins in ddsample.c, written by Brian Paul and found by me\r
in Mesa 3.4.2.\r
\r
default = k6\r
BIG_OPT=1 crazy optimizations; not very useful, though...\r
default = no\r
+ SGI_GLU=1 build SGI's GLU instead of Mesa's.\r
+ default = no\r
GLIDE absolute path to Glide library; used with FX.\r
default = $(TOP)/include/glide3\r
FX=1 build for 3dfx Glide3; use it if you have the Glide\r
Tested on:\r
CPU: K6-2 (CXT) @500(412.5) MHz\r
Mainboard: ViA Apollo VP2/97 w/ 128 MB SDRAM\r
- Video card: PowerColor Evil King3 (Voodoo3 3000) w/ 16384 kB SDRAM\r
+ Video card: PowerColor EvilKing3 (Voodoo3 3000 PCI) w/ 16 MB SDRAM\r
DJGPP: djdev 2.04 + gcc v3.2 + make v3.79.1\r
+ OS: DOS and Win9x\r
\r
\r
\r
2. Dynamic modules\r
\r
Q) What are you mumbling about dynamic modules?\r
- A) You must have the DXE2 package (available on SimTel.Net, courtesy of\r
- Andrew Zabolotny) installed in order to build the dynamic modules.\r
-\r
- Q) I have DXE2, but I couldn't build the `dxe2gen.exe'.\r
- Q) I built `dxe2gen.exe', but it doesn't do the job right.\r
- A) There is a patched version on my web page.\r
+ A) You must have the DXE3 package (available on my site) installed in order\r
+ to build the dynamic modules.\r
\r
- Q) DXE2 modules give me headaches...\r
- A) The DXE2 modules are not compulsory. The static libraries are still built\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 ~2MB executable size. For example:\r
+ live with your huge executable size. For example:\r
gcc -o OUT.exe IN.c -lglut -lglu -lgl\r
\r
- Q) Okay, DXE2 modules are built. How can I use them?\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
- dxe2res -o dmesadxe.c gl.dxe glu.dxe glut.dxe\r
- gcc -o dmesadxe.o dmesadxe.c\r
+ dxe3res -o dmesadxe.c gl.dxe glu.dxe glut.dxe\r
+ gcc -o dmesadxe.o -c -fno-builtin dmesadxe.c\r
gcc -o OUT.exe dmesadxe.o IN.c -liglut -liglu -ligl -ldl\r
\r
- Q) What is that `dxe2res.exe' thing?\r
- A) That is an utility that generates the export file for a given set of\r
- modules. If you can't find it in the DXE2 package, you must be looking at\r
- the wrong archive :)\r
-\r
3. Using Mesa for DJGPP\r
\r
- Q) Does this build work in Win9x?\r
- A) Yes.\r
-\r
- Q) Does it work under NT (W2k, XP) core?\r
- A) Uh... probably not!\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
+ Glide port is on my web page. If you haven't, sorry; everything is done\r
+ in software. Suggestions?\r
\r
Q) I made a simple application and it does nothing. It exits right away. Not\r
even a blank screen.\r
- A) The current version supports only RGB[A] modes, for it made no sense to\r
- me to endorse color-index (aka palette) modes.\r
A) Single-buffered is not allowed at all. Until I can find a way to use\r
*REAL* hardware acceleration, it won't get implemented.\r
- A) Another weird "feature" is that buffer width must be multiple of 4 (I'm a\r
+ A) Another weird "feature" is that buffer width must be multiple of 8 (I'm a\r
lazy programmer and I found that the easiest way to keep buffer handling\r
at peak performance ;-).\r
\r
GLUT took this into account for _WIN32 DLL's only; I don't want to modify\r
his headers. The only workaround is to link GLUT the old way :-(\r
\r
- Q) DMesa is so SLOOOW! The Win32 OpenGL performs so much\r
- better...\r
- A) Is that a question? If you have a Voodoo3/Banshee card, you're lucky. The\r
- Glide port is on my web page. If you haven't, sorry; everything is done\r
- in software. Suggestions?\r
+ Q) I tried to set refresh rate w/ DMesa, but without success.\r
+ A) Refresh rate control works only for VESA 3.0. If you were compiling for\r
+ Glide, see Glide info. If not, sorry!\r
\r
- Q) I have a super/mega/ultra monitor and all you can do is 60Hz? My eyes are\r
- leaking from the orbits...\r
- A) If you were compiling for Glide, see Glide info. If not, be aware that\r
- refresh rate control works only for VESA 3.0. The environment variable\r
- DMESA_REFRESH sets the default screen refresh. For example:\r
- set DMESA_REFRESH=75\r
+ Q) The GLUT is incomplete.\r
+ A) See below.\r
\r
\r
\r
\r
Well, this "skeletal" GLUT implementation is not mine. Thanks should go to\r
Bernhard Tschirren, Mark Kilgard, Brian Paul and probably others (or probably\r
-not ;-). I only changed it to be self-standing (Allegro-free). The keyboard,\r
-mouse and timer drivers were inspired from an old project of mine (D3Xl) and\r
-fixed with many Allegro "infusions"; I deeply thank to Shawn Hargreaves et co.\r
-\r
-My keyboard driver used only scancodes, but since GLUT requires ASCII values\r
-for keys, I borrowed the translation tables (and maybe more) from Allegro.\r
-Ctrl-Alt-Del (plus Ctrl-Alt-End, for Windows users) will shut down the GLUT\r
-engine unconditionally: it will raise SIGINT, which in turn will call the\r
-destructors (let's hope), thus cleaning up your/my mess ;-) NB: since the\r
-DJGPP guys ensured signal handlers won't go beyond program's space (and since\r
-dynamic modules shall) the SIGINT can't be hooked (well, it can, but it is\r
-useless), therefore you must live with the 'Exiting due to signal SIGINT'\r
-message...\r
-\r
-The mouse driver is far from complete (lack of positioning, drawing, etc),\r
-but is enough to make almost all the demos work.\r
+not ;-). GLUT functionality will be extended only on an "as needed" basis.\r
+\r
+My keyboard driver used only scancodes; as GLUT requires ASCII values for keys,\r
+I borrowed the translation tables (and maybe more) from Allegro -- many thanks\r
+to Shawn Hargreaves et co. Ctrl-Alt-Del (plus Ctrl-Alt-End, for Windows users)\r
+will shut down the GLUT engine unconditionally: it will raise SIGINT, which in\r
+turn will (hopefully) call the destructors, thus cleaning up your/my mess ;-)\r
+NB: since the DJGPP guys ensured signal handlers won't go beyond program's\r
+space (and since dynamic modules shall) the SIGINT can't be hooked (well, it\r
+can, but it is useless), therefore you must live with the 'Exiting due to\r
+signal SIGINT' message...\r
+\r
+The mouse driver is far from complete (lack of positioning, drawing, etc), but\r
+is enough to make almost all the demos work.\r
\r
The timer is pretty versatile for it supports multiple timers with different\r
-frequencies. It may not be the most accurate timer in the known universe, but\r
-I think it's OK. Take this example: you have timer A with a very high rate,\r
-and then you have timer B with very low rate compared to A; now, A ticks OK,\r
-but timer B will probably loose precision!\r
+frequencies. While not being the most accurate timer in the known universe, I\r
+think it's OK. Take this example: you have timer A with a very high rate, and\r
+then you have timer B with very low rate compared to A; now, A ticks OK, but\r
+timer B will probably loose precision!\r
\r
As an addition, stdout and stderr are redirected and dumped upon exit. This\r
-means that printf can be safely called during graphics, but all messages come\r
-in bulk! A bit of a hack, I know, but I think it's better than to miss them\r
-at all. "Borrowed" from RHIDE (Robert Hoehne) or SETEDIT (Salvador Eduardo\r
-Tropea)... I'm not sure.\r
+means that `printf' can be safely called during graphics. A bit of a hack, I\r
+know, because all messages come in bulk, but I think it's better than nothing.\r
+"Borrowed" from LIBRHUTI (Robert Hoehne).\r
\r
Window creating defaults: 640x480x16 at (0,0), 8-bit stencil, 16-bit accum.\r
-However, the video mode is chosen in such a way that first window will fit.\r
+However, the video mode is chosen in such a way that first window will fit. If\r
+you need high resolution with small windows, try to place them far to the right\r
+(or way down).\r
+\r
+The following environment variables can customize GLUT behaviour:\r
+ DMESA_GLUT_REFRESH - set vertical screen refresh rate\r
+ DMESA_GLUT_BPP - set default bits per pixel\r
\r
\r
\r
History:\r
~~~~~~~~\r
\r
-v1.0 mar-2002 initial release\r
-\r
-v1.1 sep-2002 + added 3dfx Glide3 support\r
- + added refresh rate control\r
- + added fonts in glut\r
- * lots of minor changes\r
-\r
-v1.2 nov-2002 * synced w/ Mesa-4.1\r
- - removed dmesadxe.h\r
+v1.0 (mar-2002)\r
+ initial release\r
+\r
+v1.1 (sep-2002)\r
+ + added 3dfx Glide3 support\r
+ + added refresh rate control\r
+ + added fonts in GLUT\r
+ * lots of minor changes\r
+\r
+v1.2 (nov-2002)\r
+ * synced w/ Mesa-4.1\r
+ - removed dmesadxe.h\r
+\r
+v1.3 (dec-2002)\r
+ + enabled OpenGL 1.4 support\r
+ + added MMX clear/blit routines\r
+ + enabled SGI's GLU compilation\r
+ + added color-index modes\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
+ * overhauled virtual buffer and internal video drivers\r
+ * better fxMesa integration\r
+ * extended GLUT functionality\r
+ * switched to DXE3\r
\r
\r
\r
*/\r
\r
/*\r
- * DOS/DJGPP device driver v1.2 for Mesa 4.1\r
+ * DOS/DJGPP device driver v1.3 for Mesa 5.0\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
#define DMESA_MAJOR_VERSION 5\r
#define DMESA_MINOR_VERSION 0\r
\r
+/* Sample Usage:\r
+ *\r
+ * 1. Call DMesaCreateVisual() to initialize graphics.\r
+ * 2. Call DMesaCreateContext() to create a DMesa rendering context.\r
+ * 3. Call DMesaCreateBuffer() to define the window.\r
+ * 4. Call DMesaMakeCurrent() to bind the DMesaBuffer to a DMesaContext.\r
+ * 5. Make gl* calls to render your graphics.\r
+ * 6. Use DMesaSwapBuffers() when double buffering to swap front/back buffers.\r
+ * 7. Before exiting, destroy DMesaBuffer, DMesaContext and DMesaVisual.\r
+ */\r
+\r
typedef struct dmesa_context *DMesaContext;\r
typedef struct dmesa_visual *DMesaVisual;\r
typedef struct dmesa_buffer *DMesaBuffer;\r
extern "C" {\r
#endif\r
\r
-DMesaVisual DMesaCreateVisual (GLint width, GLint height,\r
- GLint colDepth,\r
- GLboolean dbFlag,\r
- GLint depthSize,\r
- GLint stencilSize,\r
- GLint accumSize);\r
+/*\r
+ * Create a new Visual and set graphics mode.\r
+ */\r
+DMesaVisual DMesaCreateVisual (GLint width, /* X res */\r
+ GLint height, /* Y res */\r
+ GLint colDepth, /* BPP */\r
+ GLint refresh, /* refresh rate: 0=default */\r
+ GLboolean dbFlag, /* double-buffered */\r
+ GLboolean rgbFlag, /* RGB mode */\r
+ GLboolean alphaFlag,/* alpha buffer requested */\r
+ GLint depthSize, /* requested bits/depth */\r
+ GLint stencilSize, /* requested bits/stencil */\r
+ GLint accumSize); /* requested bits/accum */\r
\r
+/*\r
+ * Destroy Visual and restore screen.\r
+ */\r
void DMesaDestroyVisual (DMesaVisual v);\r
\r
+\r
+\r
+/*\r
+ * Create a new Context for rendering.\r
+ */\r
+DMesaContext DMesaCreateContext (DMesaVisual visual, DMesaContext share);\r
+\r
+/*\r
+ * Destroy Context.\r
+ */\r
+void DMesaDestroyContext (DMesaContext c);\r
+\r
+\r
+\r
+/*\r
+ * Create a new Buffer (window).\r
+ */\r
DMesaBuffer DMesaCreateBuffer (DMesaVisual visual,\r
GLint xpos, GLint ypos,\r
GLint width, GLint height);\r
\r
+/*\r
+ * Destroy Buffer.\r
+ */\r
void DMesaDestroyBuffer (DMesaBuffer b);\r
\r
-DMesaContext DMesaCreateContext (DMesaVisual visual, DMesaContext share);\r
\r
-void DMesaDestroyContext (DMesaContext c);\r
\r
+/*\r
+ * Bind Buffer to Context and make the Context the current one.\r
+ */\r
+GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b);\r
+\r
+\r
+\r
+/*\r
+ * Swap the front and back buffers for the given Buffer.\r
+ * No action is taken if the buffer is not double buffered.\r
+ */\r
+void DMesaSwapBuffers (DMesaBuffer b);\r
+\r
+\r
+\r
+/*\r
+ * Move/Resize Buffer.\r
+ */\r
GLboolean DMesaViewport (DMesaBuffer b,\r
GLint xpos, GLint ypos,\r
GLint width, GLint height);\r
\r
-GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b);\r
-\r
-void DMesaSwapBuffers (DMesaBuffer b);\r
+/*\r
+ * Set CI color using normalized values.\r
+ */\r
+void DMesaSetCI (int ndx, GLfloat red, GLfloat green, GLfloat blue);\r
\r
#ifdef __cplusplus\r
}\r
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
\r
-# DOS/DJGPP glu makefile v1.1 for Mesa 4.0\r
+# DOS/DJGPP glu makefile v1.3 for Mesa 5.0\r
#\r
# Copyright (C) 2002 - Borca Daniel\r
# Email : dborca@yahoo.com\r
CFLAGS += -I$(TOP)/include\r
\r
AR = ar\r
-ARFLAGS = ru\r
+ARFLAGS = rus\r
\r
-ifneq ($(wildcard $(DJDIR)/lib/dxe2.ld),)\r
-DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))\r
+ifneq ($(wildcard $(DJDIR)/lib/dxe3.ld),)\r
+DXE3GEN = $(wildcard $(addsuffix /dxe3gen.exe,$(subst ;, ,$(PATH))))\r
endif\r
\r
RM = del\r
OBJECTS = $(SOURCES:.c=.o)\r
\r
.c.o:\r
- $(CC) -o $@ -c $(CFLAGS) $<\r
+ $(CC) -o $@ $(CFLAGS) -c $<\r
\r
all: $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP)\r
\r
$(AR) $(ARFLAGS) $(LIBDIR)/$(GLU_LIB) $(OBJECTS)\r
\r
$(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP): $(OBJECTS)\r
-ifeq ($(DXE2GEN),)\r
- $(warning Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN)\r
- $(warning somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.)\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
else\r
- -dxe2gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) $(OBJECTS) -E djgpp_ -E glu -D "Mesa DJGPP GLU" -U\r
+ -dxe3gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) -D "MesaGLU DJGPP" -E glu -X -P gl.dxe -U $(OBJECTS)\r
endif\r
\r
clean:\r
--- /dev/null
+# Mesa 3-D graphics library\r
+# Version: 4.0\r
+# \r
+# Copyright (C) 1999 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
+# to deal in the Software without restriction, including without limitation\r
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+# and/or sell copies of the Software, and to permit persons to whom the\r
+# Software is furnished to do so, subject to the following conditions:\r
+# \r
+# The above copyright notice and this permission notice shall be included\r
+# in all copies or substantial portions of the Software.\r
+# \r
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+\r
+# DOS/DJGPP glu makefile v1.3 for Mesa 5.0\r
+#\r
+# Copyright (C) 2002 - Borca Daniel\r
+# Email : dborca@yahoo.com\r
+# Web : http://www.geocities.com/dborca\r
+\r
+\r
+#\r
+# Available options:\r
+#\r
+# Environment variables:\r
+# CFLAGS\r
+#\r
+# Targets:\r
+# all: build GLU\r
+# clean: remove object files\r
+#\r
+\r
+\r
+\r
+.PHONY: all clean\r
+\r
+TOP = ..\r
+LIBDIR = $(TOP)/lib\r
+GLU_LIB = libglu.a\r
+GLU_DXE = glu.dxe\r
+GLU_IMP = libiglu.a\r
+\r
+CC = gcc\r
+CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include -Iinclude\r
+CXX = gxx\r
+CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess\r
+\r
+AR = ar\r
+ARFLAGS = rus\r
+\r
+ifneq ($(wildcard $(DJDIR)/lib/dxe3.ld),)\r
+DXE3GEN = $(wildcard $(addsuffix /dxe3gen.exe,$(subst ;, ,$(PATH))))\r
+endif\r
+\r
+RM = del\r
+\r
+C_SOURCES = \\r
+ libutil/error.c \\r
+ libutil/glue.c \\r
+ libutil/mipmap.c \\r
+ libutil/project.c \\r
+ libutil/quad.c \\r
+ libutil/registry.c \\r
+ libtess/dict.c \\r
+ libtess/geom.c \\r
+ libtess/memalloc.c \\r
+ libtess/mesh.c \\r
+ libtess/normal.c \\r
+ libtess/priorityq.c \\r
+ libtess/render.c \\r
+ libtess/sweep.c \\r
+ libtess/tess.c \\r
+ libtess/tessmono.c\r
+\r
+CC_SOURCES = \\r
+ libnurbs/interface/bezierEval.cc \\r
+ libnurbs/interface/bezierPatch.cc \\r
+ libnurbs/interface/bezierPatchMesh.cc \\r
+ libnurbs/interface/glcurveval.cc \\r
+ libnurbs/interface/glinterface.cc \\r
+ libnurbs/interface/glrenderer.cc \\r
+ libnurbs/interface/glsurfeval.cc \\r
+ libnurbs/interface/incurveeval.cc \\r
+ libnurbs/interface/insurfeval.cc \\r
+ libnurbs/internals/arc.cc \\r
+ libnurbs/internals/arcsorter.cc \\r
+ libnurbs/internals/arctess.cc \\r
+ libnurbs/internals/backend.cc \\r
+ libnurbs/internals/basiccrveval.cc \\r
+ libnurbs/internals/basicsurfeval.cc \\r
+ libnurbs/internals/bin.cc \\r
+ libnurbs/internals/bufpool.cc \\r
+ libnurbs/internals/cachingeval.cc \\r
+ libnurbs/internals/ccw.cc \\r
+ libnurbs/internals/coveandtiler.cc \\r
+ libnurbs/internals/curve.cc \\r
+ libnurbs/internals/curvelist.cc \\r
+ libnurbs/internals/curvesub.cc \\r
+ libnurbs/internals/dataTransform.cc \\r
+ libnurbs/internals/displaylist.cc \\r
+ libnurbs/internals/flist.cc \\r
+ libnurbs/internals/flistsorter.cc \\r
+ libnurbs/internals/hull.cc \\r
+ libnurbs/internals/intersect.cc \\r
+ libnurbs/internals/knotvector.cc \\r
+ libnurbs/internals/mapdesc.cc \\r
+ libnurbs/internals/mapdescv.cc \\r
+ libnurbs/internals/maplist.cc \\r
+ libnurbs/internals/mesher.cc \\r
+ libnurbs/internals/monoTriangulationBackend.cc \\r
+ libnurbs/internals/monotonizer.cc \\r
+ libnurbs/internals/mycode.cc \\r
+ libnurbs/internals/nurbsinterfac.cc \\r
+ libnurbs/internals/nurbstess.cc \\r
+ libnurbs/internals/patch.cc \\r
+ libnurbs/internals/patchlist.cc \\r
+ libnurbs/internals/quilt.cc \\r
+ libnurbs/internals/reader.cc \\r
+ libnurbs/internals/renderhints.cc \\r
+ libnurbs/internals/slicer.cc \\r
+ libnurbs/internals/sorter.cc \\r
+ libnurbs/internals/splitarcs.cc \\r
+ libnurbs/internals/subdivider.cc \\r
+ libnurbs/internals/tobezier.cc \\r
+ libnurbs/internals/trimline.cc \\r
+ libnurbs/internals/trimregion.cc \\r
+ libnurbs/internals/trimvertpool.cc \\r
+ libnurbs/internals/uarray.cc \\r
+ libnurbs/internals/varray.cc \\r
+ libnurbs/nurbtess/directedLine.cc \\r
+ libnurbs/nurbtess/gridWrap.cc \\r
+ libnurbs/nurbtess/monoChain.cc \\r
+ libnurbs/nurbtess/monoPolyPart.cc \\r
+ libnurbs/nurbtess/monoTriangulation.cc \\r
+ libnurbs/nurbtess/partitionX.cc \\r
+ libnurbs/nurbtess/partitionY.cc \\r
+ libnurbs/nurbtess/polyDBG.cc \\r
+ libnurbs/nurbtess/polyUtil.cc \\r
+ libnurbs/nurbtess/primitiveStream.cc \\r
+ libnurbs/nurbtess/quicksort.cc \\r
+ libnurbs/nurbtess/rectBlock.cc \\r
+ libnurbs/nurbtess/sampleComp.cc \\r
+ libnurbs/nurbtess/sampleCompBot.cc \\r
+ libnurbs/nurbtess/sampleCompRight.cc \\r
+ libnurbs/nurbtess/sampleCompTop.cc \\r
+ libnurbs/nurbtess/sampleMonoPoly.cc \\r
+ libnurbs/nurbtess/sampledLine.cc \\r
+ libnurbs/nurbtess/searchTree.cc\r
+\r
+SOURCES = $(C_SOURCES) $(CC_SOURCES)\r
+\r
+OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))\r
+\r
+.c.o:\r
+ $(CC) -o $@ $(CFLAGS) -c $<\r
+.cc.o:\r
+ $(CXX) -o $@ $(CXXFLAGS) -c $<\r
+\r
+all: $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP)\r
+\r
+$(LIBDIR)/$(GLU_LIB): $(OBJECTS)\r
+ $(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
+else\r
+ -dxe3gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) -D "MesaGLU/SGI DJGPP" -E glu -X -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
+\r
+-include depend\r
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
\r
-# DOS/DJGPP glut makefile v1.1 for Mesa 4.0\r
+# DOS/DJGPP glut makefile v1.3 for Mesa 5.0\r
#\r
# Copyright (C) 2002 - Borca Daniel\r
# Email : dborca@yahoo.com\r
# Environment variables:\r
# CFLAGS\r
#\r
-# GLIDE absolute path to Glide SDK; used with FX.\r
-# default = $(TOP)/include/glide3\r
-# FX=1 build for 3dfx Glide3; use it if you have the glide\r
-# SDK (designed for your platform), and, of course, a\r
-# 3dfx card... Note that this disables compilation of\r
-# actual DMesa code, as Glide does all the stuff!\r
-# default = no\r
-# MARK absolute path to original GLUT.\r
+# MKGLUT absolute path to original GLUT.\r
# default = $(TOP)/src-glut\r
#\r
# Targets:\r
\r
TOP = ..\r
GLIDE ?= $(TOP)/include/glide3\r
-MARK ?= $(TOP)/src-glut\r
+MKGLUT ?= $(TOP)/src-glut\r
LIBDIR = $(TOP)/lib\r
GLUT_LIB = libglut.a\r
GLUT_DXE = glut.dxe\r
GLUT_IMP = libiglut.a\r
\r
CC = gcc\r
-CFLAGS += -I$(TOP)/include -I$(MARK)\r
-ifdef FX\r
-CFLAGS += -D__DOS__ -I$(GLIDE) -DFX -DFX_GLIDE3 -DFXMESA_USE_ARGB\r
-endif\r
+CFLAGS += -I$(TOP)/include -I$(MKGLUT)\r
\r
AR = ar\r
ARFLAGS = ru\r
\r
-ifneq ($(wildcard $(DJDIR)/lib/dxe2.ld),)\r
-DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))\r
+ifneq ($(wildcard $(DJDIR)/lib/dxe3.ld),)\r
+DXE3GEN = $(wildcard $(addsuffix /dxe3gen.exe,$(subst ;, ,$(PATH))))\r
endif\r
\r
RM = del\r
PC_HW/pc_timer.c \\r
PC_HW/pc_irq.S\r
\r
-MARK_SOURCES = \\r
- $(MARK)/glut_8x13.c \\r
- $(MARK)/glut_9x15.c \\r
- $(MARK)/glut_hel10.c \\r
- $(MARK)/glut_hel12.c \\r
- $(MARK)/glut_hel18.c \\r
- $(MARK)/glut_tr10.c \\r
- $(MARK)/glut_tr24.c\r
+MKGLUT_SOURCES = \\r
+ $(MKGLUT)/glut_8x13.c \\r
+ $(MKGLUT)/glut_9x15.c \\r
+ $(MKGLUT)/glut_hel10.c \\r
+ $(MKGLUT)/glut_hel12.c \\r
+ $(MKGLUT)/glut_hel18.c \\r
+ $(MKGLUT)/glut_tr10.c \\r
+ $(MKGLUT)/glut_tr24.c\r
\r
-SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES) $(MARK_SOURCES)\r
+SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES) $(MKGLUT_SOURCES)\r
\r
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))\r
\r
.c.o:\r
- $(CC) -o $@ -c $(CFLAGS) $<\r
+ $(CC) -o $@ $(CFLAGS) -c $<\r
.S.o:\r
- $(CC) -o $@ -c $(CFLAGS) $<\r
+ $(CC) -o $@ $(CFLAGS) -c $<\r
.s.o:\r
- $(CC) -o $@ -c $(CFLAGS) -x assembler-with-cpp $<\r
+ $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<\r
\r
all: $(LIBDIR)/$(GLUT_LIB) $(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP)\r
\r
$(AR) $(ARFLAGS) $(LIBDIR)/$(GLUT_LIB) $(OBJECTS)\r
\r
$(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)\r
-ifeq ($(DXE2GEN),)\r
- $(warning Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN)\r
- $(warning somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.)\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
else\r
- -dxe2gen -o $(LIBDIR)/$(GLUT_DXE) -I $(LIBDIR)/$(GLUT_IMP) $(OBJECTS) -E djgpp_ -E glut -D "Mesa DJGPP GLUT" -U\r
+ -dxe3gen -o $(LIBDIR)/$(GLUT_DXE) -I $(LIBDIR)/$(GLUT_IMP) -D "MesaGLUT DJGPP" -E glut -X -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 /,\,$(MARK)/*.o)\r
+ -$(RM) $(subst /,\,$(MKGLUT)/*.o)\r
\r
-include depend\r
/*\r
- * PC/HW routine collection v1.2 for DOS/DJGPP\r
+ * PC/HW routine collection v1.3 for DOS/DJGPP\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
/*\r
* standard redirection\r
*/\r
-static int h_out, h_outbak, h_err, h_errbak;\r
+#define STDOUT 1\r
+#define STDERR 2\r
+\r
+static char outname[L_tmpnam];\r
+static int h_out, h_outbak;\r
+static char errname[L_tmpnam];\r
+static int h_err, h_errbak;\r
\r
int pc_open_stdout (void)\r
{\r
- if ((h_out=open(tmpnam(NULL), O_WRONLY | O_CREAT | O_TRUNC | O_TEXT | O_TEMPORARY, S_IRUSR | S_IWUSR)) >= 0) {\r
- if ((h_outbak=dup(1)) != -1) {\r
- fflush(stdout);\r
- if (dup2(h_out, 1) != -1) {\r
- return 0;\r
- }\r
- close(h_outbak);\r
- }\r
- close(h_out);\r
+ tmpnam(outname);\r
+\r
+ if ((h_out=open(outname, O_WRONLY | O_CREAT | O_TEXT | O_TRUNC, S_IREAD | S_IWRITE)) > 0) {\r
+ h_outbak = dup(STDOUT);\r
+ fflush(stdout);\r
+ dup2(h_out, STDOUT);\r
}\r
- return (h_out = -1);\r
+\r
+ return h_out;\r
}\r
\r
void pc_close_stdout (void)\r
FILE *f;\r
char *line = alloca(512);\r
\r
- if (h_out >= 0) {\r
- dup2(h_outbak, 1);\r
+ if (h_out > 0) {\r
+ dup2(h_outbak, STDOUT);\r
+ close(h_out);\r
close(h_outbak);\r
\r
- if ((f=fdopen(h_out, "r")) != NULL) {\r
- fseek(f, 0, SEEK_SET);\r
- while (fgets(line, 512, f)) {\r
- fputs(line, stdout);\r
- }\r
- fclose(f);\r
- } else {\r
- close(h_out);\r
+ f = fopen(outname, "rt");\r
+ while (fgets(line, 512, f)) {\r
+ fputs(line, stdout);\r
}\r
+ fclose(f);\r
+\r
+ remove(outname);\r
}\r
}\r
\r
int pc_open_stderr (void)\r
{\r
- if ((h_err=open(tmpnam(NULL), O_WRONLY | O_CREAT | O_TRUNC | O_TEXT | O_TEMPORARY, S_IRUSR | S_IWUSR)) >= 0) {\r
- if ((h_errbak=dup(2)) != -1) {\r
- fflush(stderr);\r
- if (dup2(h_err, 2) != -1) {\r
- return 0;\r
- }\r
- close(h_errbak);\r
- }\r
- close(h_err);\r
+ tmpnam(errname);\r
+\r
+ if ((h_err=open(errname, O_WRONLY | O_CREAT | O_TEXT | O_TRUNC, S_IREAD | S_IWRITE)) > 0) {\r
+ h_errbak = dup(STDERR);\r
+ fflush(stderr);\r
+ dup2(h_err, STDERR);\r
}\r
- return (h_err = -1);\r
+\r
+ return h_err;\r
}\r
\r
void pc_close_stderr (void)\r
FILE *f;\r
char *line = alloca(512);\r
\r
- if (h_err >= 0) {\r
- dup2(h_errbak, 2);\r
+ if (h_err > 0) {\r
+ dup2(h_errbak, STDERR);\r
+ close(h_err);\r
close(h_errbak);\r
\r
- if ((f=fdopen(h_err, "r")) != NULL) {\r
- fseek(f, 0, SEEK_SET);\r
- while (fgets(line, 512, f)) {\r
- fputs(line, stderr);\r
- }\r
- fclose(f);\r
- } else {\r
- close(h_err);\r
+ f = fopen(errname, "rt");\r
+ while (fgets(line, 512, f)) {\r
+ fputs(line, stderr);\r
}\r
+ fclose(f);\r
+\r
+ remove(errname);\r
}\r
}\r
*/\r
\r
/*\r
- * DOS/DJGPP glut driver v1.0 for Mesa 4.0\r
+ * DOS/DJGPP glut driver v1.3 for Mesa 5.0\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
\r
\r
#include "GL/glut.h"\r
+#include "GL/dmesa.h"\r
+#include "internal.h"\r
+\r
+\r
+\r
+#define CLAMP(i) ((i) > 1.0 ? 1.0 : ((i) < 0.0 ? 0.0 : (i)))\r
+\r
\r
\r
void APIENTRY glutSetColor (int ndx, GLfloat red, GLfloat green, GLfloat blue)\r
{\r
+ if (g_display_mode & GLUT_INDEX) {\r
+ DMesaSetCI(ndx, CLAMP(red), CLAMP(green), CLAMP(blue));\r
+ }\r
}\r
\r
\r
+\r
GLfloat APIENTRY glutGetColor (int ndx, int component)\r
{\r
return 0.0;\r
}\r
\r
\r
+\r
void APIENTRY glutCopyColormap (int win)\r
{\r
}\r
*/\r
\r
/*\r
- * DOS/DJGPP glut driver v1.0 for Mesa 4.0\r
+ * DOS/DJGPP glut driver v1.3 for Mesa 5.0\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
#include "GL/glut.h"\r
#include "internal.h"\r
\r
-GLenum g_display_mode = 0;\r
+GLuint g_display_mode = 0;\r
GLuint g_width = DEFAULT_WIDTH;\r
GLuint g_height = DEFAULT_HEIGHT;\r
-GLint g_mouse = GL_FALSE;\r
+GLuint g_bpp = DEFAULT_BPP;\r
+GLuint g_refresh = 0;\r
+GLuint g_mouse = 0;\r
GLboolean g_redisplay = GL_FALSE;\r
GLint g_xpos = 0;\r
GLint g_ypos = 0;\r
*/\r
\r
/*\r
- * DOS/DJGPP glut driver v1.0 for Mesa 4.0\r
+ * DOS/DJGPP glut driver v1.3 for Mesa 5.0\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
\r
void APIENTRY glutInit (int *argcp, char **argv)\r
{\r
+ const char *env;\r
+\r
+ if ((env = getenv("DMESA_GLUT_BPP")) != NULL) {\r
+ g_bpp = atoi(env);\r
+ }\r
+ if ((env = getenv("DMESA_GLUT_REFRESH")) != NULL) {\r
+ g_refresh = atoi(env);\r
+ }\r
+\r
glutGet(GLUT_ELAPSED_TIME);\r
}\r
\r
#define STENCIL_SIZE 8\r
#define ACCUM_SIZE 16\r
\r
-extern GLenum g_display_mode;\r
+extern GLuint g_display_mode;\r
extern GLuint g_width;\r
extern GLuint g_height;\r
-extern GLint g_mouse;\r
+extern GLuint g_bpp;\r
+extern GLuint g_refresh;\r
+extern GLuint g_mouse;\r
extern GLboolean g_redisplay;\r
extern GLint g_xpos;\r
extern GLint g_ypos;\r
*/\r
\r
/*\r
- * DOS/DJGPP glut driver v1.0 for Mesa 4.0\r
+ * DOS/DJGPP glut driver v1.3 for Mesa 5.0\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
int APIENTRY glutGet (GLenum type)\r
{\r
switch (type) {\r
+ case GLUT_WINDOW_COLORMAP_SIZE:\r
+ return (g_display_mode & GLUT_INDEX) ? 256 : 0;\r
case GLUT_WINDOW_RGBA:\r
- return 1;\r
+ return !(g_display_mode & GLUT_INDEX);\r
case GLUT_ELAPSED_TIME:\r
if (!timer_installed) {\r
timer_installed = !timer_installed;\r
*/\r
\r
/*\r
- * DOS/DJGPP glut driver v1.2 for Mesa 4.1\r
+ * DOS/DJGPP glut driver v1.3 for Mesa 5.0\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
\r
\r
#include "GL/glut.h"\r
-#ifndef FX\r
#include "GL/dmesa.h"\r
-#else\r
-#include "GL/fxmesa.h"\r
-#endif\r
#include "internal.h"\r
\r
\r
\r
static int window;\r
\r
-#ifndef FX\r
static DMesaVisual visual = NULL;\r
static DMesaContext context = NULL;\r
static DMesaBuffer buffer[MAX_WINDOWS];\r
-#else\r
-static void *visual = NULL;\r
-static fxMesaContext context = NULL;\r
-static int fx_attrib[32];\r
-#endif\r
\r
\r
\r
for (i=0; i<MAX_WINDOWS; i++) {\r
glutDestroyWindow(i+1);\r
}\r
-#ifndef FX\r
if (context) DMesaDestroyContext(context);\r
if (visual) DMesaDestroyVisual(visual);\r
-#else\r
- if (context) fxMesaDestroyContext(context);\r
-#endif\r
\r
pc_close_stdout();\r
pc_close_stderr();\r
int i;\r
\r
if (!visual) {\r
- int screen_w = DEFAULT_WIDTH;\r
- int screen_h = DEFAULT_HEIGHT;\r
-\r
- if ((g_width<=640) && (g_height<=480)) {\r
- screen_w = 640;\r
- screen_h = 480;\r
- } else if ((g_width<=800) && (g_height<=600)) {\r
- screen_w = 800;\r
- screen_h = 600;\r
- } else if ((g_width<=1024) && (g_height<=768)) {\r
- screen_w = 1024;\r
- screen_h = 768;\r
- }\r
-\r
-#ifndef FX\r
- if ((visual=DMesaCreateVisual(screen_w, screen_h, DEFAULT_BPP,\r
+ if ((visual=DMesaCreateVisual(g_xpos + g_width, g_ypos + g_height, g_bpp, g_refresh,\r
g_display_mode & GLUT_DOUBLE,\r
+ !(g_display_mode & GLUT_INDEX),\r
+ g_display_mode & GLUT_ALPHA,\r
g_display_mode & GLUT_DEPTH ?DEPTH_SIZE :0,\r
g_display_mode & GLUT_STENCIL?STENCIL_SIZE:0,\r
g_display_mode & GLUT_ACCUM ?ACCUM_SIZE :0))==NULL) {\r
DMesaDestroyVisual(visual);\r
return 0;\r
}\r
-#else\r
- i = 0;\r
- if (g_display_mode & GLUT_DOUBLE) fx_attrib[i++] = FXMESA_DOUBLEBUFFER;\r
- if (g_display_mode & GLUT_DEPTH) { fx_attrib[i++] = FXMESA_DEPTH_SIZE; fx_attrib[i++] = DEPTH_SIZE; }\r
- if (g_display_mode & GLUT_STENCIL) { fx_attrib[i++] = FXMESA_STENCIL_SIZE; fx_attrib[i++] = STENCIL_SIZE; }\r
- if (g_display_mode & GLUT_ACCUM) { fx_attrib[i++] = FXMESA_ACCUM_SIZE; fx_attrib[i++] = ACCUM_SIZE; }\r
- fx_attrib[i] = FXMESA_NONE;\r
- if ((context=fxMesaCreateBestContext(-1, screen_w, screen_h, fx_attrib))==NULL) {\r
- return 0;\r
- }\r
- visual = context;\r
-#endif\r
\r
pc_open_stdout();\r
pc_open_stderr();\r
pc_atexit(clean);\r
}\r
\r
-#ifndef FX\r
for (i=0; i<MAX_WINDOWS; i++) {\r
if (!buffer[i]) {\r
DMesaBuffer b;\r
}\r
\r
return 0;\r
-#else\r
- fxMesaMakeCurrent(context);\r
-\r
- return 1;\r
-#endif\r
}\r
\r
\r
\r
void APIENTRY glutDestroyWindow (int win)\r
{\r
-#ifndef FX\r
if (buffer[win-1]) {\r
DMesaDestroyBuffer(buffer[win-1]);\r
buffer[win-1] = NULL;\r
}\r
-#endif\r
}\r
\r
\r
void APIENTRY glutSwapBuffers (void)\r
{\r
if (g_mouse) pc_scare_mouse();\r
-#ifndef FX\r
DMesaSwapBuffers(buffer[window]);\r
-#else\r
- fxMesaSwapBuffers();\r
-#endif\r
if (g_mouse) pc_unscare_mouse();\r
}\r
\r
\r
void APIENTRY glutPositionWindow (int x, int y)\r
{\r
-#ifndef FX\r
if (DMesaViewport(buffer[window], x, y, g_width, g_height)) {\r
g_xpos = x;\r
g_ypos = y;\r
}\r
-#endif\r
}\r
\r
\r
void APIENTRY glutReshapeWindow (int width, int height)\r
{\r
-#ifndef FX\r
if (DMesaViewport(buffer[window], g_xpos, g_ypos, width, height)) {\r
g_width = width;\r
g_height = height;\r
glViewport(0, 0, width, height);\r
}\r
}\r
-#endif\r
}\r
\r
\r
/*\r
* Mesa 3-D graphics library\r
- * Version: 4.1\r
+ * Version: 5.0\r
* \r
* Copyright (C) 1999 Brian Paul All Rights Reserved.\r
* \r
*/\r
\r
/*\r
- * DOS/DJGPP device driver v1.2 for Mesa 4.1\r
+ * DOS/DJGPP device driver v1.3 for Mesa 5.0\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
*/\r
\r
\r
+#ifndef FX\r
+\r
#include "glheader.h"\r
#include "context.h"\r
#include "GL/dmesa.h"\r
\r
#include "video.h"\r
\r
+#else\r
+\r
+#include "../FX/fxdrv.h"\r
+#include "GL/dmesa.h"\r
+\r
+#endif\r
+\r
\r
\r
/*\r
\r
int xpos, ypos; /* position */\r
int width, height; /* size in pixels */\r
- int bypp, stride, bytes; /* bytes per pixel, in a line, then total */\r
};\r
\r
/*\r
DMesaVisual visual;\r
DMesaBuffer Buffer;\r
GLuint ClearColor;\r
+ GLuint ClearIndex;\r
/* etc... */\r
};\r
\r
\r
\r
+#ifndef FX\r
/****************************************************************************\r
* Read/Write pixels\r
***************************************************************************/\r
#define FLIP(y) (c->Buffer->height - (y) - 1)\r
-#define FLIP2(y) (h - (y) - 1)\r
+#define FLIP2(y) (b - (y))\r
\r
+/****************************************************************************\r
+ * RGB[A]\r
+ ***************************************************************************/\r
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 c = (DMesaContext)ctx->DriverCtx;\r
- void *b = c->Buffer->the_window;\r
GLuint i, offset;\r
\r
offset = c->Buffer->width * FLIP(y) + x;\r
/* draw some pixels */\r
for (i=0; i<n; i++, offset++) {\r
if (mask[i]) {\r
- vl_putpixel(b, offset, vl_mixrgba(rgba[i]));\r
+ vl_putpixel(offset, vl_mixrgba(rgba[i]));\r
}\r
}\r
} else {\r
/* draw all pixels */\r
for (i=0; i<n; i++, offset++) {\r
- vl_putpixel(b, offset, vl_mixrgba(rgba[i]));\r
+ vl_putpixel(offset, vl_mixrgba(rgba[i]));\r
}\r
}\r
}\r
const GLubyte rgb[][3], const GLubyte mask[])\r
{\r
const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
- void *b = c->Buffer->the_window;\r
GLuint i, offset;\r
\r
offset = c->Buffer->width * FLIP(y) + x;\r
/* draw some pixels */\r
for (i=0; i<n; i++, offset++) {\r
if (mask[i]) {\r
- vl_putpixel(b, offset, vl_mixrgb(rgb[i]));\r
+ vl_putpixel(offset, vl_mixrgb(rgb[i]));\r
}\r
}\r
} else {\r
/* draw all pixels */\r
for (i=0; i<n; i++, offset++) {\r
- vl_putpixel(b, offset, vl_mixrgb(rgb[i]));\r
+ vl_putpixel(offset, vl_mixrgb(rgb[i]));\r
}\r
}\r
}\r
const GLchan color[4], const GLubyte mask[])\r
{\r
const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
- void *b = c->Buffer->the_window;\r
GLuint i, offset, rgba = vl_mixrgba(color);\r
\r
offset = c->Buffer->width * FLIP(y) + x;\r
/* draw some pixels */\r
for (i=0; i<n; i++, offset++) {\r
if (mask[i]) {\r
- vl_putpixel(b, offset, rgba);\r
+ vl_putpixel(offset, rgba);\r
}\r
}\r
} else {\r
/* draw all pixels */\r
for (i=0; i<n; i++, offset++) {\r
- vl_putpixel(b, offset, rgba);\r
+ vl_putpixel(offset, rgba);\r
}\r
}\r
}\r
GLubyte rgba[][4])\r
{\r
const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
- void *b = c->Buffer->the_window;\r
GLuint i, offset;\r
\r
offset = c->Buffer->width * FLIP(y) + x;\r
/* read all pixels */\r
for (i=0; i<n; i++, offset++) {\r
- vl_getrgba(b, offset, rgba[i]);\r
+ vl_getrgba(offset, rgba[i]);\r
}\r
}\r
\r
const GLubyte rgba[][4], const GLubyte mask[])\r
{\r
const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
- void *b = c->Buffer->the_window;\r
- GLuint i, w = c->Buffer->width, h = c->Buffer->height;\r
+ GLuint i, w = c->Buffer->width, b = c->Buffer->height - 1;\r
\r
if (mask) {\r
/* draw some pixels */\r
for (i=0; i<n; i++) {\r
if (mask[i]) {\r
- vl_putpixel(b, FLIP2(y[i])*w + x[i], vl_mixrgba(rgba[i]));\r
+ vl_putpixel(FLIP2(y[i])*w + x[i], vl_mixrgba(rgba[i]));\r
}\r
}\r
} else {\r
/* draw all pixels */\r
for (i=0; i<n; i++) {\r
- vl_putpixel(b, FLIP2(y[i])*w + x[i], vl_mixrgba(rgba[i]));\r
+ vl_putpixel(FLIP2(y[i])*w + x[i], vl_mixrgba(rgba[i]));\r
}\r
}\r
}\r
const GLchan color[4], const GLubyte mask[])\r
{\r
const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
- void *b = c->Buffer->the_window;\r
- GLuint i, w = c->Buffer->width, h = c->Buffer->height, rgba = vl_mixrgba(color);\r
+ GLuint i, w = c->Buffer->width, b = c->Buffer->height - 1, rgba = vl_mixrgba(color);\r
\r
if (mask) {\r
/* draw some pixels */\r
for (i=0; i<n; i++) {\r
if (mask[i]) {\r
- vl_putpixel(b, FLIP2(y[i])*w + x[i], rgba);\r
+ vl_putpixel(FLIP2(y[i])*w + x[i], rgba);\r
}\r
}\r
} else {\r
/* draw all pixels */\r
for (i=0; i<n; i++) {\r
- vl_putpixel(b, FLIP2(y[i])*w + x[i], rgba);\r
+ vl_putpixel(FLIP2(y[i])*w + x[i], rgba);\r
}\r
}\r
}\r
GLubyte rgba[][4], const GLubyte mask[])\r
{\r
const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
- void *b = c->Buffer->the_window;\r
- GLuint i, w = c->Buffer->width, h = c->Buffer->height;\r
+ GLuint i, w = c->Buffer->width, b = c->Buffer->height - 1;\r
\r
if (mask) {\r
/* read some pixels */\r
for (i=0; i<n; i++) {\r
if (mask[i]) {\r
- vl_getrgba(b, FLIP2(y[i])*w + x[i], rgba[i]);\r
+ vl_getrgba(FLIP2(y[i])*w + x[i], rgba[i]);\r
}\r
}\r
} else {\r
/* read all pixels */\r
for (i=0; i<n; i++) {\r
- vl_getrgba(b, FLIP2(y[i])*w + x[i], rgba[i]);\r
+ vl_getrgba(FLIP2(y[i])*w + x[i], rgba[i]);\r
+ }\r
+ }\r
+}\r
+\r
+/****************************************************************************\r
+ * Index\r
+ ***************************************************************************/\r
+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 c = (DMesaContext)ctx->DriverCtx;\r
+ GLuint i, offset;\r
+\r
+ offset = c->Buffer->width * FLIP(y) + x;\r
+ if (mask) {\r
+ /* draw some pixels */\r
+ for (i=0; i<n; i++, offset++) {\r
+ if (mask[i]) {\r
+ vl_putpixel(offset, index[i]);\r
+ }\r
+ }\r
+ } else {\r
+ /* draw all pixels */\r
+ for (i=0; i<n; i++, offset++) {\r
+ vl_putpixel(offset, index[i]);\r
+ }\r
+ }\r
+}\r
+\r
+\r
+\r
+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 c = (DMesaContext)ctx->DriverCtx;\r
+ GLuint i, offset;\r
+\r
+ offset = c->Buffer->width * FLIP(y) + x;\r
+ if (mask) {\r
+ /* draw some pixels */\r
+ for (i=0; i<n; i++, offset++) {\r
+ if (mask[i]) {\r
+ vl_putpixel(offset, index[i]);\r
+ }\r
+ }\r
+ } else {\r
+ /* draw all pixels */\r
+ for (i=0; i<n; i++, offset++) {\r
+ vl_putpixel(offset, index[i]);\r
+ }\r
+ }\r
+}\r
+\r
+\r
+\r
+static void write_mono_index_span (const GLcontext *ctx,\r
+ GLuint n, GLint x, GLint y,\r
+ GLuint colorIndex, const GLubyte mask[])\r
+{\r
+ const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
+ GLuint i, offset;\r
+\r
+ offset = c->Buffer->width * FLIP(y) + x;\r
+ if (mask) {\r
+ /* draw some pixels */\r
+ for (i=0; i<n; i++, offset++) {\r
+ if (mask[i]) {\r
+ vl_putpixel(offset, colorIndex);\r
+ }\r
+ }\r
+ } else {\r
+ /* draw all pixels */\r
+ for (i=0; i<n; i++, offset++) {\r
+ vl_putpixel(offset, colorIndex);\r
+ }\r
+ }\r
+}\r
+\r
+\r
+\r
+static void read_index_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,\r
+ GLuint index[])\r
+{\r
+ const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
+ GLuint i, offset;\r
+\r
+ offset = c->Buffer->width * FLIP(y) + x;\r
+ /* read all pixels */\r
+ for (i=0; i<n; i++, offset++) {\r
+ index[i] = vl_getCIpixel(offset);\r
+ }\r
+}\r
+\r
+\r
+\r
+static void write_index_pixels (const GLcontext *ctx,\r
+ GLuint n, const GLint x[], const GLint y[],\r
+ const GLuint index[], const GLubyte mask[])\r
+{\r
+ const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
+ GLuint i, w = c->Buffer->width, b = c->Buffer->height - 1;\r
+\r
+ if (mask) {\r
+ /* draw some pixels */\r
+ for (i=0; i<n; i++) {\r
+ if (mask[i]) {\r
+ vl_putpixel(FLIP2(y[i])*w + x[i], index[i]);\r
+ }\r
+ }\r
+ } else {\r
+ /* draw all pixels */\r
+ for (i=0; i<n; i++) {\r
+ vl_putpixel(FLIP2(y[i])*w + x[i], index[i]);\r
+ }\r
+ }\r
+}\r
+\r
+\r
+\r
+static void write_mono_index_pixels (const GLcontext *ctx,\r
+ GLuint n, const GLint x[], const GLint y[],\r
+ GLuint colorIndex, const GLubyte mask[])\r
+{\r
+ const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
+ GLuint i, w = c->Buffer->width, b = c->Buffer->height - 1;\r
+\r
+ if (mask) {\r
+ /* draw some pixels */\r
+ for (i=0; i<n; i++) {\r
+ if (mask[i]) {\r
+ vl_putpixel(FLIP2(y[i])*w + x[i], colorIndex);\r
+ }\r
+ }\r
+ } else {\r
+ /* draw all pixels */\r
+ for (i=0; i<n; i++) {\r
+ vl_putpixel(FLIP2(y[i])*w + x[i], colorIndex);\r
+ }\r
+ }\r
+}\r
+\r
+\r
+\r
+static void read_index_pixels (const GLcontext *ctx,\r
+ GLuint n, const GLint x[], const GLint y[],\r
+ GLuint index[], const GLubyte mask[])\r
+{\r
+ const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
+ GLuint i, w = c->Buffer->width, b = c->Buffer->height - 1;\r
+\r
+ if (mask) {\r
+ /* read some pixels */\r
+ for (i=0; i<n; i++) {\r
+ if (mask[i]) {\r
+ index[i] = vl_getCIpixel(FLIP2(y[i])*w + x[i]);\r
+ }\r
+ }\r
+ } else {\r
+ /* read all pixels */\r
+ for (i=0; i<n; i++) {\r
+ index[i] = vl_getCIpixel(FLIP2(y[i])*w + x[i]);\r
}\r
}\r
}\r
/*\r
* flat, NON-depth-buffered, triangle.\r
*/\r
-#define NAME tri_rgb_flat\r
-#define SETUP_CODE \\r
- GLuint rgb = vl_mixrgb(v2->color); \\r
- const DMesaContext c = (DMesaContext)ctx->DriverCtx; \\r
- void *b = c->Buffer->the_window; \\r
- GLuint w = c->Buffer->width, h = c->Buffer->height;\r
+static void tri_rgb_flat (GLcontext *ctx,\r
+ const SWvertex *v0,\r
+ const SWvertex *v1,\r
+ const SWvertex *v2)\r
+{\r
+ const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
+ GLuint w = c->Buffer->width, b = c->Buffer->height - 1;\r
+\r
+#define SETUP_CODE GLuint rgb = vl_mixrgb(v2->color);\r
\r
#define RENDER_SPAN(span) \\r
GLuint i, offset = FLIP2(span.y)*w + span.x; \\r
for (i = 0; i < span.end; i++, offset++) { \\r
- vl_putpixel(b, offset, rgb); \\r
+ vl_putpixel(offset, rgb); \\r
}\r
-#include "swrast/s_tritemp.h"\r
\r
+#include "swrast/s_tritemp.h"\r
+}\r
\r
\r
\r
/*\r
* flat, depth-buffered, triangle.\r
*/\r
-#define NAME tri_rgb_flat_z\r
+static void tri_rgb_flat_z (GLcontext *ctx,\r
+ const SWvertex *v0,\r
+ const SWvertex *v1,\r
+ const SWvertex *v2)\r
+{\r
+ const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
+ GLuint w = c->Buffer->width, b = c->Buffer->height - 1;\r
+\r
#define INTERP_Z 1\r
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE\r
-#define SETUP_CODE \\r
- const DMesaContext c = (DMesaContext)ctx->DriverCtx; \\r
- void *b = c->Buffer->the_window; \\r
- GLuint w = c->Buffer->width, h = c->Buffer->height; \\r
- GLuint rgb = vl_mixrgb(v2->color);\r
+#define SETUP_CODE GLuint rgb = vl_mixrgb(v2->color);\r
\r
#define RENDER_SPAN(span) \\r
GLuint i, offset = FLIP2(span.y)*w + span.x; \\r
for (i = 0; i < span.end; i++, offset++) { \\r
const DEPTH_TYPE z = FixedToDepth(span.z); \\r
if (z < zRow[i]) { \\r
- vl_putpixel(b, offset, rgb); \\r
+ vl_putpixel(offset, rgb); \\r
zRow[i] = z; \\r
} \\r
span.z += span.zStep; \\r
}\r
-#include "swrast/s_tritemp.h"\r
\r
+#include "swrast/s_tritemp.h"\r
+}\r
\r
\r
\r
/*\r
* smooth, NON-depth-buffered, triangle.\r
*/\r
-#define NAME tri_rgb_smooth\r
+static void tri_rgb_smooth (GLcontext *ctx,\r
+ const SWvertex *v0,\r
+ const SWvertex *v1,\r
+ const SWvertex *v2)\r
+{\r
+ const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
+ GLuint w = c->Buffer->width, b = c->Buffer->height - 1;\r
+\r
#define INTERP_RGB 1\r
-#define SETUP_CODE \\r
- const DMesaContext c = (DMesaContext)ctx->DriverCtx; \\r
- void *b = c->Buffer->the_window; \\r
- GLuint w = c->Buffer->width, h = c->Buffer->height;\r
-#define RENDER_SPAN(span) \\r
- GLuint i, offset = FLIP2(span.y)*w + span.x; \\r
- for (i = 0; i < span.end; i++, offset++) { \\r
- unsigned char rgb[3]; \\r
- rgb[0] = FixedToInt(span.red); \\r
- rgb[1] = FixedToInt(span.green); \\r
- rgb[2] = FixedToInt(span.blue); \\r
- vl_putpixel(b, offset, vl_mixrgb(rgb)); \\r
- span.red += span.redStep; \\r
- span.green += span.greenStep; \\r
- span.blue += span.blueStep; \\r
+#define RENDER_SPAN(span) \\r
+ GLuint i, offset = FLIP2(span.y)*w + span.x; \\r
+ for (i = 0; i < span.end; i++, offset++) { \\r
+ vl_putpixel(offset, vl_mixfix(span.red, span.green, span.blue)); \\r
+ span.red += span.redStep; \\r
+ span.green += span.greenStep; \\r
+ span.blue += span.blueStep; \\r
}\r
+\r
#include "swrast/s_tritemp.h"\r
+}\r
\r
\r
\r
/*\r
* smooth, depth-buffered, triangle.\r
*/\r
-#define NAME tri_rgb_smooth_z\r
+static void tri_rgb_smooth_z (GLcontext *ctx,\r
+ const SWvertex *v0,\r
+ const SWvertex *v1,\r
+ const SWvertex *v2)\r
+{\r
+ const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
+ GLuint w = c->Buffer->width, b = c->Buffer->height - 1;\r
+\r
#define INTERP_Z 1\r
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE\r
#define INTERP_RGB 1\r
-#define SETUP_CODE \\r
- const DMesaContext c = (DMesaContext)ctx->DriverCtx; \\r
- void *b = c->Buffer->the_window; \\r
- GLuint w = c->Buffer->width, h = c->Buffer->height;\r
-#define RENDER_SPAN(span) \\r
- GLuint i, offset = FLIP2(span.y)*w + span.x; \\r
- for (i = 0; i < span.end; i++, offset++) { \\r
- const DEPTH_TYPE z = FixedToDepth(span.z); \\r
- if (z < zRow[i]) { \\r
- unsigned char rgb[3]; \\r
- rgb[0] = FixedToInt(span.red); \\r
- rgb[1] = FixedToInt(span.green); \\r
- rgb[2] = FixedToInt(span.blue); \\r
- vl_putpixel(b, offset, vl_mixrgb(rgb)); \\r
- zRow[i] = z; \\r
- } \\r
- span.red += span.redStep; \\r
- span.green += span.greenStep; \\r
- span.blue += span.blueStep; \\r
- span.z += span.zStep; \\r
+\r
+#define RENDER_SPAN(span) \\r
+ GLuint i, offset = FLIP2(span.y)*w + span.x; \\r
+ for (i = 0; i < span.end; i++, offset++) { \\r
+ const DEPTH_TYPE z = FixedToDepth(span.z); \\r
+ if (z < zRow[i]) { \\r
+ vl_putpixel(offset, vl_mixfix(span.red, span.green, span.blue));\\r
+ zRow[i] = z; \\r
+ } \\r
+ span.red += span.redStep; \\r
+ span.green += span.greenStep; \\r
+ span.blue += span.blueStep; \\r
+ span.z += span.zStep; \\r
}\r
-#include "swrast/s_tritemp.h"\r
\r
+#include "swrast/s_tritemp.h"\r
+}\r
\r
\r
\r
{\r
const SWcontext *swrast = SWRAST_CONTEXT(ctx);\r
\r
- if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL;\r
- if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL;\r
- if (ctx->Texture._EnabledUnits) return (swrast_tri_func) NULL;\r
-\r
- if (ctx->Light.ShadeModel==GL_SMOOTH\r
- && swrast->_RasterMask==DEPTH_BIT\r
- && ctx->Depth.Func==GL_LESS\r
- && ctx->Depth.Mask==GL_TRUE\r
- && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS\r
- && ctx->Polygon.StippleFlag==GL_FALSE) {\r
- return tri_rgb_smooth_z;\r
+ if ((ctx->RenderMode != GL_RENDER)\r
+ || (ctx->Polygon.SmoothFlag)\r
+ || (ctx->Polygon.StippleFlag)\r
+ || (ctx->Texture._EnabledUnits)\r
+ || (swrast->_RasterMask & MULTI_DRAW_BIT)\r
+ || ((ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK))) {\r
+ return (swrast_tri_func)NULL;\r
}\r
- if (ctx->Light.ShadeModel==GL_FLAT\r
- && swrast->_RasterMask==DEPTH_BIT\r
+\r
+ if (swrast->_RasterMask==DEPTH_BIT\r
&& ctx->Depth.Func==GL_LESS\r
&& ctx->Depth.Mask==GL_TRUE\r
- && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS\r
- && ctx->Polygon.StippleFlag==GL_FALSE) {\r
- return tri_rgb_flat_z;\r
+ && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS) {\r
+ return (ctx->Light.ShadeModel==GL_SMOOTH) ? tri_rgb_smooth_z : tri_rgb_flat_z;\r
}\r
- if (swrast->_RasterMask==0 /* no depth test */\r
- && ctx->Light.ShadeModel==GL_SMOOTH\r
- && ctx->Polygon.StippleFlag==GL_FALSE) {\r
- return tri_rgb_smooth;\r
- }\r
- if (swrast->_RasterMask==0 /* no depth test */\r
- && ctx->Light.ShadeModel==GL_FLAT\r
- && ctx->Polygon.StippleFlag==GL_FALSE) {\r
- return tri_rgb_flat;\r
+\r
+ if (swrast->_RasterMask==0) { /* no depth test */\r
+ return (ctx->Light.ShadeModel==GL_SMOOTH) ? tri_rgb_smooth : tri_rgb_flat;\r
}\r
\r
return (swrast_tri_func)NULL;\r
\r
\r
/* Override for the swrast triangle-selection function. Try to use one\r
- * of our internal line functions, otherwise fall back to the\r
+ * of our internal triangle functions, otherwise fall back to the\r
* standard swrast functions.\r
*/\r
static void dmesa_choose_tri (GLcontext *ctx)\r
* Miscellaneous device driver funcs\r
***************************************************************************/\r
\r
+static void clear_index (GLcontext *ctx, GLuint index)\r
+{\r
+ DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
+\r
+ c->ClearIndex = index;\r
+}\r
+\r
static void clear_color (GLcontext *ctx, const GLfloat color[4])\r
{\r
GLubyte col[4];\r
{\r
const DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
const GLuint *colorMask = (GLuint *)&ctx->Color.ColorMask;\r
- DMesaBuffer b = c->Buffer;\r
\r
/*\r
* Clear the specified region of the buffers indicated by 'mask'\r
*/\r
\r
/* we can't handle color or index masking */\r
- if (*colorMask==0xffffffff) {\r
+ if ((*colorMask == 0xffffffff) && (ctx->Color.IndexMask == 0xffffffff)) {\r
if (mask & DD_BACK_LEFT_BIT) {\r
+ int color = c->visual->rgb_flag ? c->ClearColor : c->ClearIndex;\r
+\r
if (all) {\r
- vl_clear(b->the_window, b->bytes, c->ClearColor);\r
+ vl_clear(color);\r
} else {\r
- vl_rect(b->the_window, x, y, width, height, c->ClearColor);\r
+ vl_rect(x, y, width, height, color);\r
}\r
+\r
mask &= ~DD_BACK_LEFT_BIT;\r
}\r
}\r
\r
\r
\r
-static void color_mask (GLcontext *ctx, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask)\r
-{\r
- /*\r
- * XXX todo - Implements glColorMask()\r
- */\r
-}\r
-\r
-\r
-\r
static void set_buffer (GLcontext *ctx, GLframebuffer *colorBuffer, GLuint bufferBit)\r
{\r
/*\r
\r
\r
\r
-static void enable (GLcontext *ctx, GLenum pname, GLboolean state)\r
-{\r
- /*\r
- * XXX todo -\r
- */\r
-}\r
-\r
-\r
-\r
/*\r
* Return the width and height of the current buffer.\r
* If anything special has to been done when the buffer/window is\r
{\r
switch (name) {\r
case GL_RENDERER:\r
- return (const GLubyte *)"Mesa DJGPP\0port (c) Borca Daniel nov-2002";\r
+ return (const GLubyte *)"Mesa DJGPP\0port (c) Borca Daniel dec-2002";\r
default:\r
return NULL;\r
}\r
/* Statechange callbacks:\r
*/\r
ctx->Driver.ClearColor = clear_color;\r
- ctx->Driver.ColorMask = color_mask;\r
- ctx->Driver.Enable = enable;\r
+ ctx->Driver.ClearIndex = clear_index;\r
\r
/* Initialize the TNL driver interface:\r
*/\r
_tnl_InvalidateState( ctx, new_state );\r
_swsetup_InvalidateState( ctx, new_state );\r
\r
+ /* Index span/pixel functions */\r
+ dd->WriteCI32Span = write_index_span;\r
+ dd->WriteCI8Span = write_index8_span;\r
+ dd->WriteMonoCISpan = write_mono_index_span;\r
+ dd->WriteCI32Pixels = write_index_pixels;\r
+ dd->WriteMonoCIPixels = write_mono_index_pixels;\r
+ dd->ReadCI32Span = read_index_span;\r
+ dd->ReadCI32Pixels = read_index_pixels;\r
+\r
/* RGB(A) span/pixel functions */\r
dd->WriteRGBASpan = write_rgba_span;\r
dd->WriteRGBSpan = write_rgb_span;\r
dd->ReadRGBASpan = read_rgba_span;\r
dd->ReadRGBAPixels = read_rgba_pixels;\r
}\r
+#endif\r
\r
\r
\r
/*\r
* The exact arguments to this function will depend on your window system\r
*/\r
-DMesaVisual DMesaCreateVisual (GLint width, GLint height, GLint colDepth,\r
- GLboolean dbFlag, GLint depthSize,\r
+DMesaVisual DMesaCreateVisual (GLint width,\r
+ GLint height,\r
+ GLint colDepth,\r
+ GLint refresh,\r
+ GLboolean dbFlag,\r
+ GLboolean rgbFlag,\r
+ GLboolean alphaFlag,\r
+ GLint depthSize,\r
GLint stencilSize,\r
GLint accumSize)\r
{\r
+#ifndef FX\r
DMesaVisual v;\r
- GLint redBits, greenBits, blueBits, alphaBits;\r
-\r
- char *var = getenv("DMESA_REFRESH");\r
- int refresh = (var != NULL) ? atoi(var) : 0;\r
+ GLint redBits, greenBits, blueBits, alphaBits, indexBits;\r
\r
if (!dbFlag) {\r
return NULL;\r
}\r
\r
alphaBits = 0;\r
- switch (colDepth) {\r
- case 15:\r
- redBits = 5;\r
- greenBits = 5;\r
- blueBits = 5;\r
- break;\r
- case 16:\r
- redBits = 5;\r
- greenBits = 6;\r
- blueBits = 5;\r
- break;\r
- case 32:\r
- alphaBits = 8;\r
- case 24:\r
- redBits = 8;\r
- greenBits = 8;\r
- blueBits = 8;\r
- break;\r
- default:\r
- return NULL;\r
+\r
+ if (!rgbFlag) {\r
+ indexBits = 8;\r
+ redBits = 0;\r
+ greenBits = 0;\r
+ blueBits = 0;\r
+ } else {\r
+ indexBits = 0;\r
+ switch (colDepth) {\r
+ case 8:\r
+ redBits = 8;\r
+ greenBits = 8;\r
+ blueBits = 8;\r
+ break;\r
+ case 15:\r
+ redBits = 5;\r
+ greenBits = 5;\r
+ blueBits = 5;\r
+ break;\r
+ case 16:\r
+ redBits = 5;\r
+ greenBits = 6;\r
+ blueBits = 5;\r
+ break;\r
+ case 32:\r
+ alphaBits = 8;\r
+ case 24:\r
+ redBits = 8;\r
+ greenBits = 8;\r
+ blueBits = 8;\r
+ break;\r
+ default:\r
+ return NULL;\r
+ }\r
}\r
\r
- if (vl_video_init(width, height, colDepth, refresh) != 0) {\r
+ if ((colDepth=vl_video_init(width, height, colDepth, rgbFlag, refresh)) <= 0) {\r
return NULL;\r
}\r
\r
+ if (alphaFlag && (alphaBits==0)) {\r
+ alphaBits = 8;\r
+ }\r
+\r
if ((v=(DMesaVisual)calloc(1, sizeof(struct dmesa_visual))) != NULL) {\r
/* Create core visual */\r
- v->gl_visual = _mesa_create_visual(colDepth>8, /* rgb */\r
+ v->gl_visual = _mesa_create_visual(rgbFlag, /* rgb */\r
dbFlag,\r
GL_FALSE, /* stereo */\r
redBits,\r
greenBits,\r
blueBits,\r
alphaBits,\r
- 0, /* indexBits */\r
+ indexBits, /* indexBits */\r
depthSize,\r
stencilSize,\r
accumSize, /* accumRed */\r
accumSize, /* accumGreen */\r
accumSize, /* accumBlue */\r
- alphaBits?accumSize:0, /* accumAlpha */\r
+ alphaFlag?accumSize:0, /* accumAlpha */\r
1); /* numSamples */\r
\r
v->depth = colDepth;\r
v->db_flag = dbFlag;\r
+ v->rgb_flag = rgbFlag;\r
}\r
\r
return v;\r
+\r
+#else\r
+\r
+ int i = 0, fx_attrib[32];\r
+\r
+ if (!rgbFlag) {\r
+ return NULL;\r
+ }\r
+\r
+ if (dbFlag) fx_attrib[i++] = FXMESA_DOUBLEBUFFER;\r
+ if (depthSize > 0) { fx_attrib[i++] = FXMESA_DEPTH_SIZE; fx_attrib[i++] = depthSize; }\r
+ if (stencilSize > 0) { fx_attrib[i++] = FXMESA_STENCIL_SIZE; fx_attrib[i++] = stencilSize; }\r
+ if (accumSize > 0) { fx_attrib[i++] = FXMESA_ACCUM_SIZE; fx_attrib[i++] = accumSize; }\r
+ if (alphaFlag) { fx_attrib[i++] = FXMESA_ALPHA_SIZE; fx_attrib[i++] = 1; }\r
+ fx_attrib[i] = FXMESA_NONE;\r
+\r
+ return (DMesaVisual)fxMesaCreateBestContext(-1, width, height, fx_attrib);\r
+#endif\r
}\r
\r
\r
\r
void DMesaDestroyVisual (DMesaVisual v)\r
{\r
- vl_video_exit();\r
+#ifndef FX\r
_mesa_destroy_visual(v->gl_visual);\r
free(v);\r
+\r
+ vl_video_exit();\r
+#else\r
+ fxMesaDestroyContext((fxMesaContext)v);\r
+#endif\r
}\r
\r
\r
GLint xpos, GLint ypos,\r
GLint width, GLint height)\r
{\r
+#ifndef FX\r
DMesaBuffer b;\r
\r
if ((b=(DMesaBuffer)calloc(1, sizeof(struct dmesa_buffer))) != NULL) {\r
b->ypos = ypos;\r
b->width = width;\r
b->height = height;\r
- b->bypp = (visual->depth+7)/8;\r
}\r
\r
return b;\r
+#else\r
+ return (DMesaBuffer)visual;\r
+#endif\r
}\r
\r
\r
\r
void DMesaDestroyBuffer (DMesaBuffer b)\r
{\r
+#ifndef FX\r
free(b->the_window);\r
_mesa_free_framebuffer_data(&b->gl_buffer);\r
free(b);\r
+#endif\r
}\r
\r
\r
DMesaContext DMesaCreateContext (DMesaVisual visual,\r
DMesaContext share)\r
{\r
+#ifndef FX\r
DMesaContext c;\r
GLboolean direct = GL_FALSE;\r
\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
\r
/* you probably have to do a bunch of other initializations here. */\r
_ac_CreateContext(c->gl_ctx);\r
_tnl_CreateContext(c->gl_ctx);\r
_swsetup_CreateContext(c->gl_ctx);\r
- dmesa_register_swrast_functions(c->gl_ctx);\r
+ if (visual->rgb_flag) dmesa_register_swrast_functions(c->gl_ctx);\r
dmesa_init_pointers(c->gl_ctx);\r
}\r
\r
return c;\r
+\r
+#else\r
+\r
+ return (DMesaContext)visual;\r
+#endif\r
}\r
\r
\r
\r
void DMesaDestroyContext (DMesaContext c)\r
{\r
- _mesa_destroy_context(c->gl_ctx);\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
+ }\r
free(c);\r
+#endif\r
}\r
\r
\r
GLint xpos, GLint ypos,\r
GLint width, GLint height)\r
{\r
+#ifndef FX\r
void *new_window;\r
\r
if ((new_window=vl_sync_buffer(b->the_window, xpos, ypos, width, height)) == NULL) {\r
b->ypos = ypos;\r
b->width = width;\r
b->height = height;\r
- b->stride = width * b->bypp;\r
- b->bytes = b->stride * height;\r
return GL_TRUE;\r
}\r
+\r
+#else\r
+\r
+ return GL_FALSE;\r
+#endif\r
}\r
\r
\r
*/\r
GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b)\r
{\r
+#ifndef FX\r
if ((c != NULL) && (b != NULL)) {\r
if (!DMesaViewport(b, b->xpos, b->ypos, b->width, b->height)) {\r
return GL_FALSE;\r
_mesa_make_current(NULL, NULL);\r
}\r
\r
+#else\r
+\r
+ fxMesaMakeCurrent((fxMesaContext)c);\r
+#endif\r
+\r
return GL_TRUE;\r
}\r
\r
void DMesaSwapBuffers (DMesaBuffer b)\r
{\r
/* copy/swap back buffer to front if applicable */\r
+#ifndef FX\r
GET_CURRENT_CONTEXT(ctx);\r
_mesa_notifySwapBuffers(ctx);\r
- vl_flip(b->the_window, b->stride, b->height);\r
+ vl_flip();\r
+#else\r
+ fxMesaSwapBuffers();\r
+#endif\r
+}\r
+\r
+\r
+\r
+void DMesaSetCI (int ndx, GLfloat red, GLfloat green, GLfloat blue)\r
+{\r
+#ifndef FX\r
+ vl_setCI(ndx, red, green, blue);\r
+#endif\r
}\r
*/\r
\r
/*\r
- * DOS/DJGPP device driver v1.1 for Mesa 4.0\r
+ * DOS/DJGPP device driver v1.3 for Mesa 5.0\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
\r
#include <dpmi.h>\r
\r
-#include "dpmiint.h"\r
+#include "internal.h"\r
\r
\r
\r
--- /dev/null
+/*\r
+ * Mesa 3-D graphics library\r
+ * Version: 4.0\r
+ * \r
+ * Copyright (C) 1999 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
+ * to deal in the Software without restriction, including without limitation\r
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+ * and/or sell copies of the Software, and to permit persons to whom the\r
+ * Software is furnished to do so, subject to the following conditions:\r
+ * \r
+ * The above copyright notice and this permission notice shall be included\r
+ * in all copies or substantial portions of the Software.\r
+ * \r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ */\r
+\r
+/*\r
+ * DOS/DJGPP device driver v1.3 for Mesa 5.0\r
+ *\r
+ * Copyright (C) 2002 - Borca Daniel\r
+ * Email : dborca@yahoo.com\r
+ * Web : http://www.geocities.com/dborca\r
+ */\r
+\r
+\r
+#ifndef INTERNAL_H_included\r
+#define INTERNAL_H_included\r
+\r
+#include "../mmath.h"\r
+\r
+/*\r
+ * general purpose defines, etc.\r
+ */\r
+#ifndef FALSE\r
+#define FALSE 0\r
+#define TRUE !FALSE\r
+#endif\r
+\r
+#define __PACKED__ __attribute__((packed))\r
+\r
+typedef unsigned char word8;\r
+typedef unsigned short word16;\r
+typedef unsigned long word32;\r
+\r
+#define _16_ *(word16 *)&\r
+#define _32_ *(word32 *)&\r
+\r
+\r
+\r
+/*\r
+ * video mode structure\r
+ */\r
+typedef struct vl_mode {\r
+ int mode;\r
+ int xres, yres;\r
+ int scanlen;\r
+ int bpp;\r
+\r
+ int sel;\r
+ int gran;\r
+} vl_mode;\r
+\r
+\r
+\r
+/*\r
+ * video driver structure\r
+ */\r
+typedef struct {\r
+ vl_mode *(*init) (void);\r
+ int (*entermode) (vl_mode *p, int refresh);\r
+ void (*blit) (void);\r
+ void (*setCI_f) (int index, float red, float green, float blue);\r
+ void (*setCI_i) (int index, int red, int green, int blue);\r
+ int (*getCIprec) (void);\r
+ void (*restore) (void);\r
+ void (*finit) (void);\r
+} vl_driver;\r
+\r
+\r
+\r
+/*\r
+ * memory mapping\r
+ */\r
+int _create_selector (int *segment, unsigned long base, int size);\r
+void _remove_selector (int *segment);\r
+\r
+/*\r
+ * system routines\r
+ */\r
+int vl_can_mmx (void);\r
+\r
+/*\r
+ * asm routines to deal with virtual buffering\r
+ */\r
+extern void v_clear8 (int color);\r
+#define v_clear15 v_clear16\r
+extern void v_clear16 (int color);\r
+extern void v_clear24 (int color);\r
+extern void v_clear32 (int color);\r
+\r
+extern void v_clear8_mmx (int color);\r
+#define v_clear15_mmx v_clear16_mmx\r
+extern void v_clear16_mmx (int color);\r
+extern void v_clear24_mmx (int color);\r
+extern void v_clear32_mmx (int color);\r
+\r
+extern void v_rect8 (int x, int y, int width, int height, int color);\r
+#define v_rect15 v_rect16\r
+extern void v_rect16 (int x, int y, int width, int height, int color);\r
+extern void v_rect24 (int x, int y, int width, int height, int color);\r
+extern void v_rect32 (int x, int y, int width, int height, int color);\r
+\r
+extern void v_putpixel8 (unsigned int offset, int color);\r
+#define v_putpixel15 v_putpixel16\r
+extern void v_putpixel16 (unsigned int offset, int color);\r
+extern void v_putpixel24 (unsigned int offset, int color);\r
+extern void v_putpixel32 (unsigned int offset, int color);\r
+\r
+#endif\r
*/\r
\r
/*\r
- * DOS/DJGPP device driver v1.2 for Mesa 4.1\r
+ * DOS/DJGPP device driver v1.3 for Mesa 5.0\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
\r
\r
#include <dpmi.h>\r
-#include <string.h>\r
+#include <stdlib.h>\r
#include <stubinfo.h>\r
#include <sys/exceptn.h>\r
#include <sys/segments.h>\r
#include <sys/movedata.h>\r
\r
#include "vesa.h"\r
-#include "../dpmiint.h"\r
\r
\r
\r
static int banked_selector, linear_selector;\r
static int oldmode = -1;\r
\r
+static int vesa_color_precision = 6;\r
+\r
+static void *vesa_pmcode;\r
+unsigned int vesa_gran_mask, vesa_gran_shift;\r
+\r
\r
\r
/*\r
\r
\r
\r
-/* vesa_init:\r
- * Attempts to detect VESA, check video modes and create selectors.\r
- * Returns 0 if error.\r
+/* Desc: Attempts to detect VESA, check video modes and create selectors.\r
+ *\r
+ * In : -\r
+ * Out : mode array\r
+ *\r
+ * Note: -\r
*/\r
-static word16 vesa_init (void)\r
+static vl_mode *vesa_init (void)\r
{\r
__dpmi_regs r;\r
word16 *p;\r
word32 linearfb = 0;\r
\r
if (vesa_ver) {\r
- return vesa_ver;\r
+ return modes;\r
}\r
\r
_farpokel(_stubinfo->ds_selector, 0, 0x32454256);\r
__dpmi_int(0x10, &r);\r
movedata(_stubinfo->ds_selector, 0, _my_ds(), (unsigned)vesa_info, 512);\r
if ((r.x.ax!=0x004f) || ((_32_ vesa_info[V_SIGN])!=0x41534556)) {\r
- return 0;\r
+ return NULL;\r
}\r
\r
p = (word16 *)(((_16_ vesa_info[V_MODE_SEG])<<4) + (_16_ vesa_info[V_MODE_OFS]));\r
case 16:\r
q->bpp = tmp[M_RED] + tmp[M_GREEN] + tmp[M_BLUE];\r
break;\r
+ case 8:\r
case 15:\r
case 24:\r
case 32:\r
} while (TRUE);\r
\r
if (q==modes) {\r
- return 0;\r
+ return NULL;\r
}\r
if (linearfb) {\r
maxsize = ((maxsize+0xfffUL)&~0xfffUL);\r
if (_create_selector(&linear_selector, linearfb, maxsize)) {\r
- return 0;\r
+ return NULL;\r
}\r
}\r
if (_create_selector(&banked_selector, 0xa0000, modes[0].gran)) {\r
_remove_selector(&linear_selector);\r
- return 0;\r
+ return NULL;\r
}\r
\r
for (q=modes; q->mode!=0xffff; q++) {\r
q->sel = (q->mode&0x4000) ? linear_selector : banked_selector;\r
}\r
\r
- return (vesa_ver = _16_ vesa_info[V_MINOR]);\r
+ if (vesa_info[V_MAJOR] >= 2) {\r
+ r.x.ax = 0x4f0a;\r
+ r.h.bl = 0;\r
+ __dpmi_int(0x10, &r);\r
+ if (r.x.ax == 0x004f) {\r
+ vesa_pmcode = malloc(r.x.cx);\r
+ movedata(__djgpp_dos_sel, (r.x.es << 4) + r.x.di, _my_ds(), (unsigned)vesa_pmcode, r.x.cx);\r
+ p = (word16 *)((long)vesa_pmcode + ((word16 *)vesa_pmcode)[3]);\r
+ while (*p++ != 0xffff) ;\r
+ if (*p != 0xffff) {\r
+ free(vesa_pmcode);\r
+ vesa_pmcode = NULL;\r
+ } else {\r
+ vesa_swbank = (char *)vesa_pmcode + ((word16 *)vesa_pmcode)[0];\r
+ }\r
+ }\r
+ }\r
+\r
+ vesa_ver = _16_ vesa_info[V_MINOR];\r
+ return modes;\r
}\r
\r
\r
\r
-/* vesa_finit:\r
- * Frees all resources allocated by VESA init code.\r
+/* Desc: Frees all resources allocated by VESA init code.\r
+ *\r
+ * In : -\r
+ * Out : -\r
+ *\r
+ * Note: -\r
*/\r
static void vesa_finit (void)\r
{\r
if (vesa_ver) {\r
_remove_selector(&linear_selector);\r
_remove_selector(&banked_selector);\r
+ if (vesa_pmcode != NULL) {\r
+ free(vesa_pmcode);\r
+ vesa_pmcode = NULL;\r
+ }\r
}\r
}\r
\r
\r
\r
-/* vesa_getmodes:\r
- * Returns ptr to mode array.\r
- */\r
-static vl_mode *vesa_getmodes (void)\r
-{\r
- return (vesa_init() == 0) ? NULL : modes;\r
-}\r
-\r
-\r
-\r
-/* _closest_pixclk:\r
- * Uses VESA 3.0 function 0x4F0B to find the closest pixel clock to the\r
- * requested value.\r
+/* Desc: Uses VESA 3.0 function 0x4F0B to find the closest pixel clock to the requested value.\r
+ *\r
+ * In : mode, clock\r
+ * Out : desired clock\r
+ *\r
+ * Note: -\r
*/\r
static unsigned long _closest_pixclk (int mode_no, unsigned long vclk)\r
{\r
\r
\r
\r
-/* _crtc_timing:\r
- * Calculates CRTC mode timings.\r
+/* Desc: Calculates CRTC mode timings.\r
+ *\r
+ * In : crtc block, geometry, adjust\r
+ * Out :\r
+ *\r
+ * Note:\r
*/\r
static void _crtc_timing (CRTCInfoBlock *crtc, int xres, int yres, int xadjust, int yadjust)\r
{\r
\r
\r
\r
-/* vesa_entermode:\r
- * Attempts to enter specified video mode.\r
+/* Desc: Attempts to enter specified video mode.\r
+ *\r
+ * In : ptr to mode structure, refresh rate\r
+ * Out : 0 if success\r
*\r
- * success: 0\r
- * failure: !0\r
+ * Note: -\r
*/\r
static int vesa_entermode (vl_mode *p, int refresh)\r
{\r
__dpmi_regs r;\r
\r
+ if (p->mode & 0x4000) {\r
+ VESA.blit = vl_can_mmx() ? vesa_l_dump_virtual_mmx : vesa_l_dump_virtual;\r
+ } else {\r
+ VESA.blit = vesa_b_dump_virtual;\r
+ { int n; for (vesa_gran_shift=0, n=p->gran; n; vesa_gran_shift++, n>>=1) ; }\r
+ vesa_gran_mask = (1<<(--vesa_gran_shift)) - 1;\r
+ if ((unsigned)p->gran != (vesa_gran_mask+1)) {\r
+ return !0;\r
+ }\r
+ }\r
+\r
if (oldmode == -1) {\r
r.x.ax = 0x4f03;\r
__dpmi_int(0x10, &r);\r
}\r
\r
__dpmi_int(0x10, &r);\r
+ if (r.x.ax != 0x004f) {\r
+ return !0;\r
+ }\r
\r
- return (r.x.ax != 0x004f);\r
+ if (p->bpp == 8) {\r
+ r.x.ax = 0x4f08;\r
+ r.x.bx = 0x0800;\r
+ __dpmi_int(0x10, &r);\r
+ if (r.x.ax == 0x004f) {\r
+ r.x.ax = 0x4f08;\r
+ r.h.bl = 0x01;\r
+ __dpmi_int(0x10, &r);\r
+ vesa_color_precision = r.h.bh;\r
+ }\r
+ }\r
+\r
+ return 0;\r
}\r
\r
\r
\r
-/* vesa_restore:\r
- * Restores to the mode prior to first call to vesa_entermode.\r
+/* Desc: Restores to the mode prior to first call to vesa_entermode.\r
+ *\r
+ * In : -\r
+ * Out : -\r
+ *\r
+ * Note: -\r
*/\r
static void vesa_restore (void)\r
{\r
\r
\r
\r
+/* Desc: set one palette entry\r
+ *\r
+ * In : color index, R, G, B\r
+ * Out : -\r
+ *\r
+ * Note: uses normalized values\r
+ */\r
+static void vesa_setCI_f (int index, float red, float green, float blue)\r
+{\r
+ float max = (1 << vesa_color_precision) - 1;\r
+\r
+ int _red = red * max;\r
+ int _green = green * max;\r
+ int _blue = blue * max;\r
+\r
+ __asm("\n\\r
+ movw $0x1010, %%ax \n\\r
+ movb %1, %%dh \n\\r
+ movb %2, %%ch \n\\r
+ int $0x10 \n\\r
+"::"b"(index), "m"(_red), "m"(_green), "c"(_blue):"%eax", "%edx");\r
+}\r
+\r
+\r
+\r
+/* Desc: set one palette entry\r
+ *\r
+ * In : color index, R, G, B\r
+ * Out : -\r
+ *\r
+ * Note: uses integer values\r
+ */\r
+static void vesa_setCI_i (int index, int red, int green, int blue)\r
+{\r
+ __asm("\n\\r
+ movw $0x1010, %%ax \n\\r
+ movb %1, %%dh \n\\r
+ movb %2, %%ch \n\\r
+ int $0x10 \n\\r
+"::"b"(index), "m"(red), "m"(green), "c"(blue):"%eax", "%edx");\r
+}\r
+\r
+\r
+\r
+/* Desc: retrieve CI precision\r
+ *\r
+ * In : -\r
+ * Out : precision in bits\r
+ *\r
+ * Note: -\r
+ */\r
+static int vesa_getCIprec (void)\r
+{\r
+ return vesa_color_precision;\r
+}\r
+\r
+\r
+\r
/*\r
* the driver\r
*/\r
vl_driver VESA = {\r
- vesa_getmodes,\r
+ vesa_init,\r
vesa_entermode,\r
+ NULL,\r
+ vesa_setCI_f,\r
+ vesa_setCI_i,\r
+ vesa_getCIprec,\r
vesa_restore,\r
vesa_finit\r
};\r
*/\r
\r
/*\r
- * DOS/DJGPP device driver v1.1 for Mesa 4.0\r
+ * DOS/DJGPP device driver v1.3 for Mesa 5.0\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
#ifndef VESA_H_included\r
#define VESA_H_included\r
\r
-#include "../videoint.h"\r
+#include "../internal.h"\r
\r
+extern void *vesa_swbank;\r
\r
+extern void vesa_b_dump_virtual (void);\r
+extern void vesa_l_dump_virtual (void);\r
+extern void vesa_l_dump_virtual_mmx (void);\r
\r
extern vl_driver VESA;\r
\r
*/\r
\r
/*\r
- * DOS/DJGPP device driver v1.1 for Mesa 4.0\r
+ * DOS/DJGPP device driver v1.3 for Mesa 5.0\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
* Web : http://www.geocities.com/dborca\r
+ *\r
+ * Thanks to CrazyPyro (Neil Funk) for FakeColor\r
*/\r
\r
\r
#include <stdlib.h>\r
\r
#include "video.h"\r
-#include "videoint.h"\r
+#include "internal.h"\r
#include "vesa/vesa.h"\r
+#include "vga/vga.h"\r
\r
\r
\r
-static vl_driver *drv = &VESA;\r
-/* card specific: valid forever */\r
-word32 vl_hw_granularity;\r
-static unsigned int gran_shift, gran_mask;\r
+static vl_driver *drv;\r
/* based upon mode specific data: valid entire session */\r
int vl_video_selector;\r
static int video_scanlen, video_bypp;\r
/* valid until next buffer */\r
+void *vl_current_draw_buffer, *vl_current_read_buffer;\r
+int vl_current_stride, vl_current_width, vl_current_height, vl_current_bytes;\r
int vl_current_offset, vl_current_delta;\r
-static int current_width;\r
\r
\r
\r
226, 230, 234, 238, 242, 246, 250, 255\r
};\r
\r
+/* FakeColor data */\r
+#define R_CNT 6\r
+#define G_CNT 6\r
+#define B_CNT 6\r
\r
+#define R_BIAS 7\r
+#define G_BIAS 7\r
+#define B_BIAS 7\r
\r
-void (*vl_clear) (void *buffer, int bytes, int color);\r
-void (*vl_flip) (void *buffer, int stride, int height);\r
-int (*vl_mixrgba) (const unsigned char rgba[]);\r
+static word32 VGAPalette[256];\r
+static word8 array_r[256];\r
+static word8 array_g[256];\r
+static word8 array_b[256];\r
+\r
+\r
+\r
+int (*vl_mixfix) (fixed r, fixed g, fixed b);\r
int (*vl_mixrgb) (const unsigned char rgb[]);\r
-void (*vl_putpixel) (void *buffer, int offset, int color);\r
-void (*vl_getrgba) (void *buffer, int offset, unsigned char rgba[4]);\r
+int (*vl_mixrgba) (const unsigned char rgba[]);\r
+void (*vl_getrgba) (unsigned int offset, unsigned char rgba[4]);\r
+void (*vl_clear) (int color);\r
+void (*vl_rect) (int x, int y, int width, int height, int color);\r
+void (*vl_flip) (void);\r
+void (*vl_putpixel) (unsigned int offset, int color);\r
\r
\r
\r
-/* vl_rect:\r
- * Clears a rectange with specified color.\r
+/* Desc: color composition (w/o ALPHA)\r
+ *\r
+ * In : R, G, B\r
+ * Out : color\r
+ *\r
+ * Note: -\r
*/\r
-void vl_rect (void *buffer, int x, int y, int width, int height, int color)\r
+static int vl_mixfix8fake (fixed r, fixed g, fixed b)\r
{\r
- int offset = y*current_width + x;\r
- int delta = current_width - width;\r
-\r
- for (y=0; y<height; y++) {\r
- for (x=0; x<width; x++, offset++) {\r
- vl_putpixel(buffer, offset, color);\r
- }\r
- offset += delta;\r
- }\r
+ return array_b[b>>FIXED_SHIFT]*G_CNT*R_CNT\r
+ + array_g[g>>FIXED_SHIFT]*R_CNT\r
+ + array_r[r>>FIXED_SHIFT];\r
+}\r
+#define vl_mixfix8 vl_mixfix8fake\r
+static int vl_mixfix15 (fixed r, fixed g, fixed b)\r
+{\r
+ return ((r>>(3+FIXED_SHIFT))<<10)\r
+ |((g>>(3+FIXED_SHIFT))<<5)\r
+ |(b>>(3+FIXED_SHIFT));\r
+}\r
+static int vl_mixfix16 (fixed r, fixed g, fixed b)\r
+{\r
+ return ((r>>(3+FIXED_SHIFT))<<11)\r
+ |((g>>(2+FIXED_SHIFT))<<5)\r
+ |(b>>(3+FIXED_SHIFT));\r
+}\r
+#define vl_mixfix24 vl_mixfix32\r
+static int vl_mixfix32 (fixed r, fixed g, fixed b)\r
+{\r
+ return ((r>>FIXED_SHIFT)<<16)\r
+ |((g>>FIXED_SHIFT)<<8)\r
+ |(b>>FIXED_SHIFT);\r
}\r
\r
\r
\r
-/* vl_mixrgba*:\r
- * Color composition (w/ ALPHA).\r
+/* Desc: color composition (w/ ALPHA)\r
+ *\r
+ * In : array of integers (R, G, B, A)\r
+ * Out : color\r
+ *\r
+ * Note: -\r
*/\r
+#define vl_mixrgba8 vl_mixrgb8fake\r
#define vl_mixrgba15 vl_mixrgb15\r
#define vl_mixrgba16 vl_mixrgb16\r
#define vl_mixrgba24 vl_mixrgb24\r
\r
\r
\r
-/* vl_mixrgb*:\r
- * Color composition (w/o ALPHA).\r
+/* Desc: color composition (w/o ALPHA)\r
+ *\r
+ * In : array of integers (R, G, B)\r
+ * Out : color\r
+ *\r
+ * Note: -\r
*/\r
+static int vl_mixrgb8fake (const unsigned char rgba[])\r
+{\r
+ return array_b[rgba[2]]*G_CNT*R_CNT\r
+ + array_g[rgba[1]]*R_CNT\r
+ + array_r[rgba[0]];\r
+}\r
+#define vl_mixrgb8 vl_mixrgb8fake\r
static int vl_mixrgb15 (const unsigned char rgb[])\r
{\r
return ((rgb[0]>>3)<<10)|((rgb[1]>>3)<<5)|(rgb[2]>>3);\r
\r
\r
\r
-/* v_getrgba*:\r
- * Color decomposition.\r
+/* Desc: color decomposition\r
+ *\r
+ * In : pixel offset, array of integers to hold color components (R, G, B, A)\r
+ * Out : -\r
+ *\r
+ * Note: uses current read buffer\r
*/\r
-static void v_getrgba15 (void *buffer, int offset, unsigned char rgba[4])\r
+static void v_getrgba8fake6 (unsigned int offset, unsigned char rgba[])\r
{\r
- int c = ((word16 *)buffer)[offset];\r
+ word32 c = VGAPalette[((word8 *)vl_current_read_buffer)[offset]];\r
+ rgba[0] = _rgb_scale_6[(c >> 16) & 0x3F];\r
+ rgba[1] = _rgb_scale_6[(c >> 8) & 0x3F];\r
+ rgba[2] = _rgb_scale_6[c & 0x3F];\r
+ rgba[3] = c >> 24;\r
+}\r
+static void v_getrgba8fake8 (unsigned int offset, unsigned char rgba[])\r
+{\r
+ word32 c = VGAPalette[((word8 *)vl_current_read_buffer)[offset]];\r
+ rgba[0] = c >> 16;\r
+ rgba[1] = c >> 8;\r
+ rgba[2] = c;\r
+ rgba[3] = c >> 24;\r
+}\r
+#define v_getrgba8 v_getrgba8fake6\r
+static void v_getrgba15 (unsigned int offset, unsigned char rgba[4])\r
+{\r
+ word32 c = ((word16 *)vl_current_read_buffer)[offset];\r
rgba[0] = _rgb_scale_5[(c >> 10) & 0x1F];\r
rgba[1] = _rgb_scale_5[(c >> 5) & 0x1F];\r
rgba[2] = _rgb_scale_5[c & 0x1F];\r
rgba[3] = 255;\r
}\r
-static void v_getrgba16 (void *buffer, int offset, unsigned char rgba[4])\r
+static void v_getrgba16 (unsigned int offset, unsigned char rgba[4])\r
{\r
- int c = ((word16 *)buffer)[offset];\r
+ word32 c = ((word16 *)vl_current_read_buffer)[offset];\r
rgba[0] = _rgb_scale_5[(c >> 11) & 0x1F];\r
rgba[1] = _rgb_scale_6[(c >> 5) & 0x3F];\r
rgba[2] = _rgb_scale_5[c & 0x1F];\r
rgba[3] = 255;\r
}\r
-static void v_getrgba24 (void *buffer, int offset, unsigned char rgba[4])\r
+static void v_getrgba24 (unsigned int offset, unsigned char rgba[4])\r
{\r
- int c = *(word32 *)((long)buffer+offset*3);\r
+ word32 c = *(word32 *)((long)vl_current_read_buffer+offset*3);\r
rgba[0] = c >> 16;\r
rgba[1] = c >> 8;\r
rgba[2] = c;\r
rgba[3] = 255;\r
}\r
-static void v_getrgba32 (void *buffer, int offset, unsigned char rgba[4])\r
+static void v_getrgba32 (unsigned int offset, unsigned char rgba[4])\r
{\r
- int c = ((word32 *)buffer)[offset];\r
+ word32 c = ((word32 *)vl_current_read_buffer)[offset];\r
rgba[0] = c >> 16;\r
rgba[1] = c >> 8;\r
rgba[2] = c; \r
\r
\r
\r
-/* vl_sync_buffer:\r
- * Syncs buffer with video hardware. Returns NULL in case of failure.\r
+/* Desc: set one palette entry\r
+ *\r
+ * In : index, R, G, B\r
+ * Out : -\r
+ *\r
+ * Note: color components are in range [0.0 .. 1.0]\r
+ */\r
+void vl_setCI (int index, float red, float green, float blue)\r
+{\r
+ drv->setCI_f(index, red, green, blue);\r
+}\r
+\r
+\r
+\r
+/* Desc: read pixel from 8bit buffer\r
+ *\r
+ * In : pixel offset\r
+ * Out : pixel read\r
+ *\r
+ * Note: used only for CI modes\r
+ */\r
+int vl_getCIpixel (unsigned int offset)\r
+{\r
+ return ((word8 *)vl_current_read_buffer)[offset];\r
+}\r
+\r
+\r
+\r
+/* Desc: set one palette entry\r
+ *\r
+ * In : color, R, G, B\r
+ * Out : -\r
+ *\r
+ * Note: color components are in range [0 .. 63]\r
+ */\r
+static void fake_setcolor (int c, int r, int g, int b)\r
+{\r
+ VGAPalette[c] = 0xff000000 | (r<<16) | (g<<8) | b;\r
+\r
+ drv->setCI_i(c, r, g, b);\r
+}\r
+\r
+\r
+\r
+/* Desc: build FakeColor palette\r
+ *\r
+ * In : CI precision in bits\r
+ * Out : -\r
+ *\r
+ * Note: -\r
+ */\r
+static void fake_buildpalette (int bits)\r
+{\r
+ double c_r, c_g, c_b;\r
+ int r, g, b, color = 0;\r
+\r
+ double max = (1 << bits) - 1;\r
+\r
+ for (b=0; b<B_CNT; ++b) {\r
+ for (g=0; g<G_CNT; ++g) {\r
+ for (r=0; r<R_CNT; ++r) {\r
+ c_r = 0.5 + (double)r*(max-R_BIAS)/(R_CNT-1.) + R_BIAS;\r
+ c_g = 0.5 + (double)g*(max-G_BIAS)/(G_CNT-1.) + G_BIAS;\r
+ c_b = 0.5 + (double)b*(max-B_BIAS)/(B_CNT-1.) + B_BIAS;\r
+ fake_setcolor(color++, (int)c_r, (int)c_g, (int)c_b);\r
+ }\r
+ }\r
+ }\r
+\r
+ for (color=0; color<256; color++) {\r
+ c_r = (double)color*R_CNT/256.;\r
+ c_g = (double)color*G_CNT/256.;\r
+ c_b = (double)color*B_CNT/256.;\r
+ array_r[color] = (int)c_r;\r
+ array_g[color] = (int)c_g;\r
+ array_b[color] = (int)c_b;\r
+ }\r
+}\r
+\r
+\r
+\r
+/* Desc: sync buffer with video hardware\r
+ *\r
+ * In : old buffer, position, size\r
+ * Out : new buffer\r
+ *\r
+ * Note: -\r
*/\r
void *vl_sync_buffer (void *buffer, int x, int y, int width, int height)\r
{\r
void *newbuf;\r
\r
- if (width&3) {\r
+ if (width&7) {\r
return NULL;\r
} else {\r
- if ((newbuf=realloc(buffer, width*height*video_bypp))!=NULL) {\r
+ if ((newbuf=realloc(buffer, width * height * video_bypp)) != NULL) {\r
+ vl_current_width = width;\r
+ vl_current_height = height;\r
+ vl_current_stride = vl_current_width * video_bypp;\r
+ vl_current_bytes = vl_current_stride * height;\r
+\r
vl_current_offset = video_scanlen * y + video_bypp * x;\r
- current_width = width;\r
- vl_current_delta = video_scanlen - video_bypp * width;\r
+ vl_current_delta = video_scanlen - vl_current_stride;\r
}\r
- return newbuf;\r
+ return vl_current_draw_buffer = vl_current_read_buffer = newbuf;\r
}\r
}\r
\r
\r
\r
-/* vl_setup_mode:\r
+/* Desc: retrieve CPU MMX capability\r
*\r
- * success: 0\r
- * failure: -1\r
+ * In : -\r
+ * Out : FALSE if CPU cannot do MMX\r
+ *\r
+ * Note: -\r
*/\r
-static int vl_setup_mode (vl_mode *p)\r
+int vl_can_mmx (void)\r
{\r
- if (p->mode&0x4000) {\r
- vl_flip = l_dump_virtual;\r
- } else {\r
- { int n; for (gran_shift=0, n=p->gran; n; gran_shift++, n>>=1) ; }\r
- gran_mask = (1<<(--gran_shift)) - 1;\r
- if ((unsigned)p->gran != (gran_mask+1)) {\r
- return -1;\r
- }\r
- vl_hw_granularity = p->gran;\r
- vl_flip = b_dump_virtual;\r
- }\r
+#ifdef USE_MMX_ASM\r
+ extern int _mesa_identify_x86_cpu_features (void);\r
+ int _mesa_x86_cpu_features = _mesa_identify_x86_cpu_features();\r
+ return (_mesa_x86_cpu_features & 0x00800000);\r
+#else\r
+ return 0;\r
+#endif\r
+}\r
+\r
+\r
\r
+/* Desc: setup mode\r
+ *\r
+ * In : ptr to mode definition\r
+ * Out : 0 if success\r
+ *\r
+ * Note: -\r
+ */\r
+static int vl_setup_mode (vl_mode *p)\r
+{\r
#define INITPTR(bpp) \\r
vl_putpixel = v_putpixel##bpp; \\r
vl_getrgba = v_getrgba##bpp; \\r
- vl_clear = v_clear##bpp; \\r
+ vl_rect = v_rect##bpp; \\r
+ vl_mixfix = vl_mixfix##bpp; \\r
vl_mixrgb = vl_mixrgb##bpp; \\r
- vl_mixrgba = vl_mixrgba##bpp;\r
-\r
+ vl_mixrgba = vl_mixrgba##bpp; \\r
+ vl_clear = vl_can_mmx() ? v_clear##bpp##_mmx : v_clear##bpp\r
+ \r
switch (p->bpp) {\r
+ case 8:\r
+ INITPTR(8);\r
+ break;\r
case 15:\r
INITPTR(15);\r
break;\r
\r
\r
\r
-/* vl_video_exit:\r
- * Shutdown the video engine.\r
- * Restores to the mode prior to first call to `vl_video_init'.\r
+/* Desc: restore to the mode prior to first call to `vl_video_init'.\r
+ *\r
+ * In : -\r
+ * Out : -\r
+ *\r
+ * Note: -\r
*/\r
void vl_video_exit (void)\r
{\r
\r
\r
\r
-/* vl_video_init:\r
- * Enter mode.\r
+/* Desc: enter mode\r
*\r
- * success: 0\r
- * failure: -1\r
+ * In : xres, yres, bits/pixel, RGB, refresh rate\r
+ * Out : pixel width in bits if success\r
+ *\r
+ * Note: -\r
*/\r
-int vl_video_init (int width, int height, int bpp, int refresh)\r
+int vl_video_init (int width, int height, int bpp, int rgb, int refresh)\r
{\r
+ int fake;\r
vl_mode *p, *q;\r
unsigned int min;\r
\r
+ fake = 0;\r
+ if (!rgb) {\r
+ bpp = 8;\r
+ } else if (bpp == 8) {\r
+ fake = 1;\r
+ }\r
+\r
/* initialize hardware */\r
- if ((q=drv->getmodes()) == NULL) {\r
- return -1;\r
+ drv = &VESA;\r
+ if ((q=drv->init()) == NULL) {\r
+ drv = &VGA;\r
+ if ((q=drv->init()) == NULL) {\r
+ return 0;\r
+ }\r
}\r
\r
/* search for a mode that fits our request */\r
\r
/* check, setup and enter mode */\r
if ((p!=NULL) && (vl_setup_mode(p) == 0) && (drv->entermode(p, refresh) == 0)) {\r
- return 0;\r
+ vl_flip = drv->blit;\r
+ if (fake) {\r
+ min = drv->getCIprec();\r
+ fake_buildpalette(min);\r
+ if (min == 8) {\r
+ vl_getrgba = v_getrgba8fake8;\r
+ }\r
+ }\r
+ return bpp;\r
}\r
\r
/* abort */\r
- return -1;\r
+ return 0;\r
}\r
*/\r
\r
/*\r
- * DOS/DJGPP device driver v1.1 for Mesa 4.0\r
+ * DOS/DJGPP device driver v1.3 for Mesa 5.0\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
#ifndef VIDEO_H_included\r
#define VIDEO_H_included\r
\r
-int vl_video_init (int width, int height, int bpp, int refresh);\r
-void vl_video_exit (void);\r
+typedef int fixed;\r
\r
-void *vl_sync_buffer (void *buffer, int x, int y, int width, int height);\r
+extern int (*vl_mixfix) (fixed r, fixed g, fixed b);\r
+extern int (*vl_mixrgb) (const unsigned char rgb[]);\r
+extern int (*vl_mixrgba) (const unsigned char rgba[]);\r
+extern void (*vl_getrgba) (unsigned int offset, unsigned char rgba[4]);\r
\r
-extern void (*vl_clear) (void *buffer, int bytes, int color);\r
-void vl_rect (void *buffer, int x, int y, int width, int height, int color);\r
+extern void (*vl_clear) (int color);\r
+extern void (*vl_rect) (int x, int y, int width, int height, int color);\r
+extern void (*vl_flip) (void);\r
+extern void (*vl_putpixel) (unsigned int offset, int color);\r
\r
-void (*vl_flip) (void *buffer, int stride, int height);\r
+void vl_setCI (int index, float red, float green, float blue);\r
+int vl_getCIpixel (unsigned int offset);\r
\r
-extern int (*vl_mixrgba) (const unsigned char rgba[]);\r
-extern int (*vl_mixrgb) (const unsigned char rgb[]);\r
-extern void (*vl_putpixel) (void *buffer, int offset, int color);\r
-extern void (*vl_getrgba) (void *buffer, int offset, unsigned char rgba[4]);\r
+void *vl_sync_buffer (void *buffer, int x, int y, int width, int height);\r
+\r
+void vl_video_exit (void);\r
+int vl_video_init (int width, int height, int bpp, int rgb, int refresh);\r
\r
#endif\r
*/\r
\r
/*\r
- * DOS/DJGPP device driver v1.1 for Mesa 4.0\r
+ * DOS/DJGPP device driver v1.3 for Mesa 5.0\r
*\r
* Copyright (C) 2002 - Borca Daniel\r
* Email : dborca@yahoo.com\r
.file "virtual.S"\r
\r
/*\r
- * extern word32 vl_hw_granularity;\r
- * extern int vl_video_selector;\r
- * extern int vl_current_offset, vl_current_delta;\r
+ * extern void *vl_current_draw_buffer;\r
+ * extern int vl_current_width, vl_current_bytes;\r
*/\r
\r
.text\r
\r
-/*\r
- * void v_clear16 (void *buffer, int bytes, int color);\r
+/* Desc: void v_clear8 (int color);\r
+ *\r
+ * In : color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
*/\r
- .balign 4\r
+ .p2align 5,,31\r
+ .global _v_clear8\r
+_v_clear8:\r
+ movl 4(%esp), %eax\r
+ movb %al, %ah\r
+ pushw %ax\r
+ pushw %ax\r
+ popl %eax\r
+ jmp _v_clear_common\r
+\r
+/* Desc: void v_clear16 (int color);\r
+ *\r
+ * In : color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
+ */\r
+ .p2align 5,,31\r
.global _v_clear16\r
_v_clear16:\r
- movl 12(%esp), %eax\r
+ movl 4(%esp), %eax\r
pushw %ax\r
pushw %ax\r
popl %eax\r
jmp _v_clear_common\r
\r
-/*\r
- * void v_clear32 (void *buffer, int bytes, int color);\r
+/* Desc: void v_clear32 (int color);\r
+ *\r
+ * In : color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
*/\r
- .balign 4\r
+ .p2align 5,,31\r
.global _v_clear32\r
_v_clear32:\r
- movl 12(%esp), %eax\r
+ movl 4(%esp), %eax\r
.balign 4\r
_v_clear_common:\r
- movl 8(%esp), %ecx\r
- movl 4(%esp), %edx\r
+ movl _vl_current_bytes, %ecx\r
+ movl _vl_current_draw_buffer, %edx\r
shrl $2, %ecx\r
- 0:\r
.balign 4\r
+ 0:\r
movl %eax, (%edx)\r
addl $4, %edx\r
decl %ecx\r
jnz 0b\r
ret\r
\r
-/*\r
- * void v_clear24 (void *buffer, int bytes, int color);\r
+/* Desc: void v_clear8_mmx (int color);\r
+ *\r
+ * In : color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
+ */\r
+ .p2align 5,,31\r
+ .global _v_clear8_mmx\r
+_v_clear8_mmx:\r
+ movl 4(%esp), %eax\r
+ movb %al, %ah\r
+ pushw %ax\r
+ pushw %ax\r
+ pushw %ax\r
+ pushw %ax\r
+ jmp _v_clear_common_mmx\r
+\r
+/* Desc: void v_clear16_mmx (int color);\r
+ *\r
+ * In : color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
*/\r
+ .p2align 5,,31\r
+ .global _v_clear16_mmx\r
+_v_clear16_mmx:\r
+ movl 4(%esp), %eax\r
+ pushw %ax\r
+ pushw %ax\r
+ pushw %ax\r
+ pushw %ax\r
+ jmp _v_clear_common_mmx\r
+\r
+/* Desc: void v_clear32_mmx (int color);\r
+ *\r
+ * In : color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
+ */\r
+ .p2align 5,,31\r
+ .global _v_clear32_mmx\r
+_v_clear32_mmx:\r
+ movl 4(%esp), %eax\r
+ pushl %eax\r
+ pushl %eax\r
.balign 4\r
+_v_clear_common_mmx:\r
+#ifdef USE_MMX_ASM\r
+ movl _vl_current_bytes, %ecx\r
+ movl _vl_current_draw_buffer, %edx\r
+ movq (%esp), %mm0\r
+ shrl $3, %ecx\r
+ .balign 4\r
+ 0:\r
+ movq %mm0, (%edx)\r
+ addl $8, %edx\r
+ decl %ecx\r
+ jnz 0b\r
+ emms\r
+#endif\r
+ addl $8, %esp\r
+ ret\r
+\r
+/* Desc: void v_clear24 (int color);\r
+ *\r
+ * In : color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
+ */\r
+ .p2align 5,,31\r
.global _v_clear24\r
_v_clear24:\r
- movl 8(%esp), %edx\r
movl $0xaaaaaaab, %eax\r
- mull %edx\r
- movl 12(%esp), %eax\r
+ mull _vl_current_bytes\r
+ movl 4(%esp), %eax\r
movl %edx, %ecx\r
- movl 4(%esp), %edx\r
pushl %ebx\r
+ movl _vl_current_draw_buffer, %edx\r
shrl %ecx\r
- movb 18(%esp), %bl\r
+ movb 10(%esp), %bl\r
.balign 4\r
0:\r
movw %ax, (%edx)\r
popl %ebx\r
ret\r
\r
-/*\r
- * void b_dump_virtual (void *buffer, int stride, int height);\r
+/* Desc: void v_clear24_mmx (int color);\r
+ *\r
+ * In : color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
*/\r
+ .p2align 5,,31\r
+ .global _v_clear24_mmx\r
+_v_clear24_mmx:\r
+#ifdef USE_MMX_ASM\r
+ movl 4(%esp), %eax\r
+ movl %eax, %edx\r
+ movl %eax, %ecx\r
+ shll $16, %edx\r
+ rorl $8, %ecx\r
+ movw %cx, %dx\r
+ rorl $16, %ecx\r
+ movb %dh, %cl\r
+ shll $8, %eax\r
+ movb %ch, %al\r
+ rorl $8, %eax\r
+\r
+ pushl %edx\r
+ pushl %eax\r
+ movq (%esp), %mm0\r
+ pushl %ecx\r
+ movq (%esp), %mm1\r
+ pushl %edx\r
+ movq (%esp), %mm2\r
+\r
+ movl $0xaaaaaaab, %eax\r
+ mull _vl_current_bytes\r
+ movl %edx, %ecx\r
+ movl _vl_current_draw_buffer, %edx\r
+ shrl $4, %ecx\r
.balign 4\r
- .global _b_dump_virtual\r
-_b_dump_virtual:\r
- pushl %ebx\r
+ 0:\r
+ movq %mm0, (%edx)\r
+ movq %mm1, 8(%edx)\r
+ movq %mm2, 16(%edx)\r
+ addl $24, %edx\r
+ decl %ecx\r
+ jnz 0b\r
+ emms\r
+ addl $16, %esp\r
+#endif\r
+ ret\r
+\r
+/* Desc: void v_rect8 (int color);\r
+ *\r
+ * In : color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
+ */\r
+ .p2align 5,,31\r
+ .global _v_rect8\r
+_v_rect8:\r
+ cld\r
pushl %esi\r
pushl %edi\r
- pushl %ebp\r
- movl _vl_video_selector, %fs\r
- movl 4*4+4+0(%esp), %esi\r
- movl _vl_hw_granularity, %ebp\r
- xorl %edx, %edx\r
- movl _vl_current_offset, %eax\r
- divl %ebp\r
- movl %edx, %edi\r
- pushl %eax\r
- movl %eax, %edx\r
- xorl %ebx, %ebx\r
- movw $0x4f05, %ax\r
- int $0x10\r
- movl _vl_current_delta, %ebx\r
- movl 5*4+4+4(%esp), %ecx\r
- movl 5*4+4+8(%esp), %edx\r
- shrl $2, %ecx\r
+ movl 28(%esp), %eax\r
+ movl _vl_current_width, %esi\r
+ movl 16(%esp), %edi\r
+ movb %al, %ah\r
+ movl 20(%esp), %ecx\r
+ imull %esi, %edi\r
+ movl 24(%esp), %edx\r
+ subl %ecx, %esi\r
+ addl 12(%esp), %edi\r
+ pushw %ax\r
+ pushw %ax\r
+ pushl %ds\r
+ popl %es\r
+ addl _vl_current_draw_buffer, %edi\r
+ popl %eax\r
+ pushl %ebx\r
+ movl %ecx, %ebx\r
+ andl $3, %ebx\r
.balign 4\r
0:\r
pushl %ecx\r
.balign 4\r
1:\r
- cmpl %ebp, %edi\r
- jb 2f\r
- pushl %ebx\r
- pushl %edx\r
- incl 12(%esp)\r
- movw $0x4f05, %ax\r
- movl 12(%esp), %edx\r
- xorl %ebx, %ebx\r
- int $0x10\r
- popl %edx\r
+ shrl $2, %ecx\r
+ rep; stosl\r
+ testl %ebx, %ebx\r
+ jz 2f\r
+ movl %ebx, %ecx\r
+ rep; stosb\r
+ .balign 4\r
+ 2:\r
+ popl %ecx\r
+ addl %esi, %edi\r
+ decl %edx\r
+ jnz 0b\r
popl %ebx\r
- subl %ebp, %edi\r
+ popl %edi\r
+ popl %esi\r
+ ret\r
+\r
+/* Desc: void v_rect16 (int color);\r
+ *\r
+ * In : color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
+ */\r
+ .p2align 5,,31\r
+ .global _v_rect16\r
+_v_rect16:\r
+ cld\r
+ pushl %esi\r
+ pushl %edi\r
+ movl 28(%esp), %eax\r
+ movl _vl_current_width, %esi\r
+ movl 16(%esp), %edi\r
+ movl 20(%esp), %ecx\r
+ imull %esi, %edi\r
+ movl 24(%esp), %edx\r
+ subl %ecx, %esi\r
+ addl 12(%esp), %edi\r
+ pushw %ax\r
+ shll %esi\r
+ pushw %ax\r
+ shll %edi\r
+ pushl %ds\r
+ popl %es\r
+ addl _vl_current_draw_buffer, %edi\r
+ popl %eax\r
+ .balign 4\r
+ 0:\r
+ pushl %ecx\r
+ .balign 4\r
+ 1:\r
+ shrl %ecx\r
+ rep; stosl\r
+ jnc 2f\r
+ stosw\r
+ .balign 4\r
2:\r
- movl (%esi), %eax\r
- addl $4, %esi\r
- movl %eax, %fs:(%edi)\r
- addl $4, %edi\r
+ popl %ecx\r
+ addl %esi, %edi\r
+ decl %edx\r
+ jnz 0b\r
+ popl %edi\r
+ popl %esi\r
+ ret\r
+\r
+/* Desc: void v_rect24 (int color);\r
+ *\r
+ * In : color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
+ */\r
+ .p2align 5,,31\r
+ .global _v_rect24\r
+_v_rect24:\r
+ pushl %esi\r
+ pushl %edi\r
+ movl 28(%esp), %eax\r
+ movl _vl_current_width, %esi\r
+ movl 16(%esp), %edi\r
+ movl 20(%esp), %ecx\r
+ imull %esi, %edi\r
+ movl 24(%esp), %edx\r
+ subl %ecx, %esi\r
+ addl 12(%esp), %edi\r
+ leal (%esi, %esi, 2), %esi\r
+ pushl %ebx\r
+ leal (%edi, %edi, 2), %edi\r
+ movl %eax, %ebx\r
+ addl _vl_current_draw_buffer, %edi\r
+ shrl $16, %ebx\r
+ .balign 4\r
+ 0:\r
+ pushl %ecx\r
+ .balign 4\r
+ 1:\r
+ movw %ax, (%edi)\r
+ movb %bl, 2(%edi)\r
+ addl $3, %edi\r
decl %ecx\r
jnz 1b\r
popl %ecx\r
- addl %ebx, %edi\r
+ addl %esi, %edi\r
decl %edx\r
jnz 0b\r
- popl %eax\r
- popl %ebp\r
+ popl %ebx\r
popl %edi\r
popl %esi\r
- popl %ebx\r
ret\r
\r
-/*\r
- * void l_dump_virtual (void *buffer, int stride, int height);\r
+/* Desc: void v_rect32 (int color);\r
+ *\r
+ * In : color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
*/\r
- .balign 4\r
- .global _l_dump_virtual\r
-_l_dump_virtual:\r
- pushl %ebx\r
+ .p2align 5,,31\r
+ .global _v_rect32\r
+_v_rect32:\r
pushl %esi\r
pushl %edi\r
- movl _vl_video_selector, %fs\r
- movl 3*4+4+0(%esp), %esi\r
- movl _vl_current_offset, %edi\r
- movl 3*4+4+4(%esp), %ecx\r
- movl 3*4+4+8(%esp), %edx\r
- movl _vl_current_delta, %ebx\r
- shrl $2, %ecx\r
+ movl _vl_current_width, %esi\r
+ movl 16(%esp), %edi\r
+ movl 20(%esp), %ecx\r
+ imull %esi, %edi\r
+ movl 24(%esp), %edx\r
+ subl %ecx, %esi\r
+ addl 12(%esp), %edi\r
+ shll $2, %esi\r
+ shll $2, %edi\r
+ movl 28(%esp), %eax\r
+ addl _vl_current_draw_buffer, %edi\r
.balign 4\r
0:\r
pushl %ecx\r
.balign 4\r
1:\r
- movl (%esi), %eax\r
- addl $4, %esi\r
- movl %eax, %fs:(%edi)\r
+ movl %eax, (%edi)\r
addl $4, %edi\r
decl %ecx\r
jnz 1b\r
popl %ecx\r
- addl %ebx, %edi\r
+ addl %esi, %edi\r
decl %edx\r
jnz 0b\r
popl %edi\r
popl %esi\r
- popl %ebx\r
ret\r
\r
-/*\r
- * void v_putpixel16 (void *buffer, int offset, int color);\r
+/* Desc: void v_putpixel8 (unsigned int offset, int color);\r
+ *\r
+ * In : offset within buffer, color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
*/\r
- .balign 4\r
+ .p2align 5,,31\r
+ .global _v_putpixel8\r
+_v_putpixel8:\r
+ movl 8(%esp), %ecx\r
+ movl 4(%esp), %edx\r
+ movl _vl_current_draw_buffer, %eax\r
+ movb %cl, (%eax,%edx)\r
+ ret\r
+\r
+/* Desc: void v_putpixel16 (unsigned int offset, int color);\r
+ *\r
+ * In : offset within buffer, color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
+ */\r
+ .p2align 5,,31\r
.global _v_putpixel16\r
_v_putpixel16:\r
- movl 8(%esp), %edx\r
- shll %edx\r
- movl 12(%esp), %eax\r
- addl 4(%esp), %edx\r
- movw %ax, (%edx)\r
+ movl 8(%esp), %ecx\r
+ movl 4(%esp), %edx\r
+ movl _vl_current_draw_buffer, %eax\r
+ movw %cx, (%eax,%edx,2)\r
ret\r
\r
-/*\r
- * void v_putpixel24 (void *buffer, int offset, int color);\r
+/* Desc: void v_putpixel24 (unsigned int offset, int color);\r
+ *\r
+ * In : offset within buffer, color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
*/\r
- .balign 4\r
+ .p2align 5,,31\r
.global _v_putpixel24\r
_v_putpixel24:\r
+ movl 4(%esp), %eax\r
movl 8(%esp), %edx\r
- leal (%edx, %edx, 2), %edx\r
- movl 12(%esp), %eax\r
- addl 4(%esp), %edx\r
- movw %ax, (%edx)\r
- shrl $16, %eax\r
- movb %al, 2(%edx)\r
+ movl _vl_current_draw_buffer, %ecx\r
+ leal (%eax,%eax,2), %eax\r
+ movw %dx, (%ecx,%eax)\r
+ shrl $16, %edx\r
+ movb %dl, 2(%ecx,%eax)\r
ret\r
\r
-/*\r
- * void v_putpixel32 (void *buffer, int offset, int color);\r
+/* Desc: void v_putpixel32 (unsigned int offset, int color);\r
+ *\r
+ * In : offset within buffer, color\r
+ * Out : -\r
+ *\r
+ * Note: uses current draw buffer\r
*/\r
- .balign 4\r
+ .p2align 5,,31\r
.global _v_putpixel32\r
_v_putpixel32:\r
- movl 8(%esp), %edx\r
- shll $2, %edx\r
- movl 12(%esp), %eax\r
- addl 4(%esp), %edx\r
- movl %eax, (%edx)\r
+ movl 8(%esp), %ecx\r
+ movl 4(%esp), %edx\r
+ movl _vl_current_draw_buffer, %eax\r
+ movl %ecx, (%eax,%edx,4)\r
ret\r
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
\r
-# DOS/DJGPP core makefile v1.2 for Mesa 4.1\r
+# DOS/DJGPP core makefile v1.3 for Mesa 5.0\r
#\r
# Copyright (C) 2002 - Borca Daniel\r
# Email : dborca@yahoo.com\r
endif\r
\r
AR = ar\r
-ARFLAGS = ru\r
+ARFLAGS = rus\r
\r
-ifneq ($(wildcard $(DJDIR)/lib/dxe2.ld),)\r
-DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))\r
+ifneq ($(wildcard $(DJDIR)/lib/dxe3.ld),)\r
+DXE3GEN = $(wildcard $(addsuffix /dxe3gen.exe,$(subst ;, ,$(PATH))))\r
endif\r
\r
RM = del\r
X86_SOURCES =\r
endif\r
\r
-ifndef FX\r
DRIVER_SOURCES = \\r
- DOS/dmesa.c \\r
+ DOS/dmesa.c\r
+ifndef FX\r
+DRIVER_SOURCES += \\r
DOS/video.c \\r
DOS/virtual.S \\r
DOS/vesa/vesa.c \\r
+ DOS/vesa/blit.S \\r
+ DOS/vga/vga.c \\r
DOS/dpmi.c\r
else\r
-DRIVER_SOURCES = \\r
+DRIVER_SOURCES += \\r
FX/fxapi.c \\r
FX/fxdd.c \\r
FX/fxddspan.c \\r
X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES)))\r
\r
.c.o:\r
- $(CC) -o $@ -c $(CFLAGS) $<\r
+ $(CC) -o $@ $(CFLAGS) -c $<\r
.S.o:\r
- $(CC) -o $@ -c $(CFLAGS) $<\r
+ $(CC) -o $@ $(CFLAGS) -c $<\r
.s.o:\r
- $(CC) -o $@ -c $(CFLAGS) -x assembler-with-cpp $<\r
+ $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<\r
\r
all: $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_IMP)\r
\r
$(AR) $(ARFLAGS) $(LIBDIR)/$(GL_LIB) $(OBJECTS)\r
\r
$(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_IMP): $(OBJECTS)\r
-ifeq ($(DXE2GEN),)\r
- $(warning Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN)\r
- $(warning somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.)\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
else\r
- -dxe2gen -o $(LIBDIR)/$(GL_DXE) -I $(LIBDIR)/$(GL_IMP) $(OBJECTS) -E djgpp_ -E gl -E DMesa -E fxMesa -D "Mesa DJGPP GL" -U\r
+ifdef FX\r
+ -dxe3gen -o $(LIBDIR)/$(GL_DXE) -I $(LIBDIR)/$(GL_IMP) -D "MesaGL/FX DJGPP" -E gl -E DMesa -X -P glid3.dxe -U $(OBJECTS)\r
+else\r
+ -dxe3gen -o $(LIBDIR)/$(GL_DXE) -I $(LIBDIR)/$(GL_IMP) -D "MesaGL DJGPP" -E gl -E DMesa -X -U $(OBJECTS)\r
+endif\r
endif\r
\r
$(X86_OBJECTS): X86/matypes.h\r
-$(RM) $(subst /,\,X86/*.o)\r
-$(RM) $(subst /,\,DOS/*.o)\r
-$(RM) $(subst /,\,DOS/vesa/*.o)\r
+ -$(RM) $(subst /,\,DOS/vga/*.o)\r
-$(RM) $(subst /,\,FX/*.o)\r
\r
-include depend\r