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