DOS updates from Daniel Borca

This commit is contained in:
Brian Paul
2003-03-29 16:14:01 +00:00
parent a8d4963fbc
commit 183aea64d3
9 changed files with 160 additions and 174 deletions

View File

@@ -70,7 +70,7 @@ Tested on:
CPU: K6-2 (CXT) @500(412.5) MHz
Mainboard: ViA Apollo VP2/97 w/ 128 MB SDRAM
Video card: PowerColor EvilKing3 (Voodoo3 3000 PCI) w/ 16 MB SDRAM
DJGPP: djdev 2.04 + gcc v3.2.1 + make v3.79.1
DJGPP: djdev 2.04 + gcc v3.2.2 + make v3.79.1
OS: DOS and Win9x
@@ -94,26 +94,16 @@ FAQ:
with the following line:
#define vsnprintf(buf, max, fmt, arg) vsprintf(buf, fmt, arg)
2. Dynamic modules
Q) `make' complains about DXE3 or something, yet it builds the libraries.
A) DXE3 refers to the DJGPP dynamic modules. You'll need either the latest
DJGPP distro, or download the separate package from my web page. Read the
DXE3 documentation on how to use them. Hint: build your export object
file; then link it with your application. For example:
dxe3res -o dxe3tbl.c gl.dxe glu.dxe glut.dxe
gcc -o dxe3tbl.o -c dxe3tbl.c
gcc -o OUT.exe dxe3tbl.o IN.c -liglut -liglu -ligl -ldl
Q) What are you mumbling about dynamic modules?
A) You must have the DXE3 package (available on my site) installed in order
to build the dynamic modules.
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 huge executable size. For example:
gcc -o OUT.exe IN.c -lglut -lglu -lgl
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:
dxe3res -o dmesadxe.c gl.dxe glu.dxe glut.dxe
gcc -o dmesadxe.o -c dmesadxe.c
gcc -o OUT.exe dmesadxe.o IN.c -liglut -liglu -ligl -ldl
3. Using Mesa for DJGPP
2. Using Mesa for DJGPP
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
@@ -188,6 +178,7 @@ position right before the main loop.
The following environment variables can customize GLUT behaviour:
DMESA_GLUT_REFRESH - set vertical screen refresh rate (VESA3)
DMESA_GLUT_BPP - set default bits per pixel (VGA needs 8)
GLUT_FPS - print frames/second statistics to stderr
@@ -217,7 +208,8 @@ v1.3 (mar-2003)
+ added Matrox Millennium MGA2064W driver
+ added 8bit FakeColor (thanks to Neil Funk)
+ added VGA support (to keep Ben Decker happy)
! fixed GLUT compilation error (reported by Chan Kar Heng)
! fixed some compilation errors (reported by Chan Kar Heng)
* optimized driver for faster callback access... yeah, right :)
* overhauled virtual buffer and internal video drivers
* better fxMesa integration
* revamped GLUT

View File

@@ -67,7 +67,7 @@ LD = gxx
LDFLAGS = -s -L$(TOP)/lib
ifeq ($(DXE),1)
DMESADXE = $(TOP)/lib/dmesadxe.o
DXE3TABLE = $(TOP)/lib/dxe3tbl.o
LDLIBS += -liglut -liglu -ligl -ldl
else
LDLIBS = -lglut -lglu -lgl
@@ -80,7 +80,7 @@ endif
.c.o:
$(CC) -o $@ $(CFLAGS) -c $<
.o.exe:
$(LD) -o $@ $(LDFLAGS) $(DMESADXE) $< $(LDLIBS)
$(LD) -o $@ $(LDFLAGS) $(DXE3TABLE) $< $(LDLIBS)
all:
$(error Must specify <filename.exe> to build)

View File

@@ -54,11 +54,13 @@ CFLAGS += -I$(TOP)/include
AR = ar
ARFLAGS = rus
ifneq ($(wildcard $(DJDIR)/lib/dxe3.ld),)
DXE3GEN = $(wildcard $(addsuffix /dxe3gen.exe,$(subst ;, ,$(PATH))))
endif
HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe)
RM = del
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = del $(subst /,\,$(1))
else
UNLINK = $(RM) $(1)
endif
CORE_SOURCES = \
glu.c \
@@ -86,14 +88,13 @@ $(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.)
ifeq ($(HAVEDXE3),)
$(warning Missing DXE3 package... Skipping $(GLU_DXE))
else
-dxe3gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) -D "MesaGLU DJGPP" -E _glu -P gl.dxe -U $(OBJECTS)
endif
clean:
-$(RM) $(subst /,\,*.o)
-$(call UNLINK,*.o)
-include depend

View File

@@ -56,11 +56,13 @@ CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbte
AR = ar
ARFLAGS = rus
ifneq ($(wildcard $(DJDIR)/lib/dxe3.ld),)
DXE3GEN = $(wildcard $(addsuffix /dxe3gen.exe,$(subst ;, ,$(PATH))))
endif
HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe)
RM = del
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = del $(subst /,\,$(1))
else
UNLINK = $(RM) $(1)
endif
C_SOURCES = \
libutil/error.c \
@@ -170,18 +172,17 @@ $(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.)
ifeq ($(HAVEDXE3),)
$(warning Missing DXE3 package... Skipping $(GLU_DXE))
else
-dxe3gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) -D "MesaGLU/SGI DJGPP" -E _glu -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)
-$(call UNLINK,libutil/*.o)
-$(call UNLINK,libtess/*.o)
-$(call UNLINK,libnurbs/interface/*.o)
-$(call UNLINK,libnurbs/internals/*.o)
-$(call UNLINK,libnurbs/nurbtess/*.o)
-include depend

View File

@@ -59,11 +59,13 @@ CFLAGS += -I- -I$(TOP)/include -I. -I$(MKGLUT) -IPC_HW
AR = ar
ARFLAGS = rus
ifneq ($(wildcard $(DJDIR)/lib/dxe3.ld),)
DXE3GEN = $(wildcard $(addsuffix /dxe3gen.exe,$(subst ;, ,$(PATH))))
endif
HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe)
RM = del
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = del $(subst /,\,$(1))
else
UNLINK = $(RM) $(1)
endif
CORE_SOURCES = \
callback.c \
@@ -118,16 +120,15 @@ $(LIBDIR)/$(GLUT_LIB): $(OBJECTS)
$(AR) $(ARFLAGS) $(LIBDIR)/$(GLUT_LIB) $(OBJECTS)
$(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_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.)
ifeq ($(HAVEDXE3),)
$(warning Missing DXE3 package... Skipping $(GLUT_DXE))
else
-dxe3gen -o $(LIBDIR)/$(GLUT_DXE) -I $(LIBDIR)/$(GLUT_IMP) -D "MesaGLUT DJGPP" -E _glut -P gl.dxe -P glu.dxe -U $(OBJECTS)
endif
clean:
-$(RM) $(subst /,\,*.o)
-$(RM) $(subst /,\,PC_HW/*.o)
-$(RM) $(subst /,\,$(MKGLUT)/*.o)
-$(call UNLINK,*.o)
-$(call UNLINK,PC_HW/*.o)
-$(call UNLINK,$(MKGLUT)/*.o)
-include depend

View File

@@ -420,8 +420,9 @@ int pc_readkey (void)
if (keyboard_installed) {
int key;
do {
} while (key_buffer.start==key_buffer.end);
while (key_buffer.start==key_buffer.end) {
__dpmi_yield();
}
DISABLE();
key = key_buffer.key[key_buffer.start++];

View File

@@ -274,6 +274,5 @@ _mouse_wrap: \n\
movl %esi, %esp \n\
popl %es \n\
iret \n\
.balign 4 \n\
.global _mouse_wrap_end \n\
_mouse_wrap_end:.long 0, 0");

View File

@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 5.0
* Version: 5.0.1
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -25,17 +25,15 @@
/*
* DOS/DJGPP device driver v1.3 for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Copyright (c) 2003 - Borca Daniel
* Email : dborca@yahoo.com
* Web : http://www.geocities.com/dborca
*/
#ifndef FX
#include "glheader.h"
#include "context.h"
#include "GL/dmesa.h"
#include "extensions.h"
#include "macros.h"
#include "matrix.h"
@@ -53,24 +51,17 @@
#include "tnl/tnl.h"
#include "tnl/t_context.h"
#include "tnl/t_pipeline.h"
#ifndef MATROX
#include "video.h"
#else /* MATROX */
#include "mga/mga.h"
#endif /* MATROX */
#else /* FX */
#include "../FX/fxdrv.h"
#include "GL/dmesa.h"
#endif /* FX */
#include "GL/dmesa.h"
/*
@@ -78,7 +69,7 @@
* Add system-specific fields to it.
*/
struct dmesa_visual {
GLvisual *gl_visual;
GLvisual gl_visual;
GLboolean db_flag; /* double buffered? */
GLboolean rgb_flag; /* RGB mode? */
GLuint depth; /* bits per pixel (1, 8, 24, etc) */
@@ -105,7 +96,7 @@ struct dmesa_buffer {
* Add system-specific fields to it.
*/
struct dmesa_context {
GLcontext *gl_ctx; /* the core library context */
GLcontext gl_ctx; /* the core library context */
DMesaVisual visual;
DMesaBuffer Buffer;
GLuint ClearColor;
@@ -141,7 +132,7 @@ struct dmesa_context {
static void write_rgba_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte rgba[][4], const GLubyte mask[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, offset;
#ifndef MATROX
@@ -189,7 +180,7 @@ static void write_rgba_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
static void write_rgb_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte rgb[][3], const GLubyte mask[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, offset;
offset = DSTRIDE * FLIP(y) + x;
@@ -214,7 +205,7 @@ static void write_mono_rgba_span (const GLcontext *ctx,
GLuint n, GLint x, GLint y,
const GLchan color[4], const GLubyte mask[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, offset, rgba = vl_mixrgba(color);
offset = DSTRIDE * FLIP(y) + x;
@@ -238,7 +229,7 @@ static void write_mono_rgba_span (const GLcontext *ctx,
static void read_rgba_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
GLubyte rgba[][4])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, offset;
offset = DSTRIDE * FLIP(y) + x;
@@ -254,7 +245,7 @@ static void write_rgba_pixels (const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLubyte rgba[][4], const GLubyte mask[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;
if (mask) {
@@ -278,7 +269,7 @@ static void write_mono_rgba_pixels (const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLchan color[4], const GLubyte mask[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1, rgba = vl_mixrgba(color);
if (mask) {
@@ -302,7 +293,7 @@ static void read_rgba_pixels (const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4], const GLubyte mask[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;
if (mask) {
@@ -329,7 +320,7 @@ static void read_rgba_pixels (const GLcontext *ctx,
static void write_index_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLuint index[], const GLubyte mask[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, offset;
offset = DSTRIDE * FLIP(y) + x;
@@ -353,7 +344,7 @@ static void write_index_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
static void write_index8_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte index[], const GLubyte mask[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, offset;
offset = DSTRIDE * FLIP(y) + x;
@@ -378,7 +369,7 @@ static void write_mono_index_span (const GLcontext *ctx,
GLuint n, GLint x, GLint y,
GLuint colorIndex, const GLubyte mask[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, offset;
offset = DSTRIDE * FLIP(y) + x;
@@ -402,7 +393,7 @@ static void write_mono_index_span (const GLcontext *ctx,
static void read_index_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
GLuint index[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, offset;
offset = DSTRIDE * FLIP(y) + x;
@@ -418,7 +409,7 @@ static void write_index_pixels (const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLuint index[], const GLubyte mask[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;
if (mask) {
@@ -442,7 +433,7 @@ static void write_mono_index_pixels (const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLuint colorIndex, const GLubyte mask[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;
if (mask) {
@@ -466,7 +457,7 @@ static void read_index_pixels (const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[],
GLuint index[], const GLubyte mask[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;
if (mask) {
@@ -494,7 +485,7 @@ static void read_index_pixels (const GLcontext *ctx,
static void write_depth_span (GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLdepth depth[], const GLubyte mask[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, offset;
offset = DSTRIDE * FLIP(y) + x;
@@ -518,7 +509,7 @@ static void write_depth_span (GLcontext *ctx, GLuint n, GLint x, GLint y,
static void read_depth_span (GLcontext *ctx, GLuint n, GLint x, GLint y,
GLdepth depth[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, offset;
offset = DSTRIDE * FLIP(y) + x;
@@ -534,7 +525,7 @@ static void write_depth_pixels (GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[],
const GLdepth depth[], const GLubyte mask[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;
if (mask) {
@@ -558,7 +549,7 @@ static void read_depth_pixels (GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[],
GLdepth depth[])
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;
/* read all values */
@@ -582,7 +573,7 @@ static void tri_rgb_flat (GLcontext *ctx,
const SWvertex *v1,
const SWvertex *v2)
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint _b_ = dmesa->Buffer->height - 1;
#ifndef MATROX
GLuint _w_ = dmesa->Buffer->width;
@@ -619,7 +610,7 @@ static void tri_rgb_flat_zless (GLcontext *ctx,
const SWvertex *v1,
const SWvertex *v2)
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint _b_ = dmesa->Buffer->height - 1;
#ifndef MATROX
GLuint _w_ = dmesa->Buffer->width;
@@ -666,7 +657,7 @@ static void tri_rgb_iter (GLcontext *ctx,
const SWvertex *v1,
const SWvertex *v2)
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint _b_ = dmesa->Buffer->height - 1;
#ifndef MATROX
GLuint _w_ = dmesa->Buffer->width;
@@ -707,7 +698,7 @@ static void tri_rgb_iter_zless (GLcontext *ctx,
const SWvertex *v1,
const SWvertex *v2)
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint _b_ = dmesa->Buffer->height - 1;
#ifndef MATROX
GLuint _w_ = dmesa->Buffer->width;
@@ -839,7 +830,7 @@ static void line_rgb_flat (GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1)
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint _b_ = dmesa->Buffer->height - 1;
#ifndef MATROX
GLuint _w_ = dmesa->Buffer->width;
@@ -867,7 +858,7 @@ static void line_rgb_flat_zless (GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1)
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint _b_ = dmesa->Buffer->height - 1;
#ifndef MATROX
GLuint _w_ = dmesa->Buffer->width;
@@ -907,7 +898,7 @@ static void line_rgb_iter (GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1)
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint _b_ = dmesa->Buffer->height - 1;
MGAvertex m0, m1;
matrox_line_clip_hack(ctx, _b_, &m0, vert0, &m1, vert1);
@@ -925,7 +916,7 @@ static void line_rgb_iter_zless (GLcontext *ctx,
const SWvertex *vert0,
const SWvertex *vert1)
{
const DMesaContext dmesa = (DMesaContext)ctx->DriverCtx;
const DMesaContext dmesa = (DMesaContext)ctx;
GLuint _b_ = dmesa->Buffer->height - 1;
MGAvertex m0, m1;
matrox_line_clip_hack(ctx, _b_, &m0, vert0, &m1, vert1);
@@ -992,7 +983,7 @@ static void dmesa_choose_line (GLcontext *ctx)
static void clear_index (GLcontext *ctx, GLuint index)
{
((DMesaContext)ctx->DriverCtx)->ClearIndex = index;
((DMesaContext)ctx)->ClearIndex = index;
}
static void clear_color (GLcontext *ctx, const GLfloat color[4])
@@ -1002,7 +993,7 @@ static void clear_color (GLcontext *ctx, const GLfloat color[4])
CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);
CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]);
CLAMPED_FLOAT_TO_UBYTE(col[3], color[3]);
((DMesaContext)ctx->DriverCtx)->ClearColor = vl_mixrgba(col);
((DMesaContext)ctx)->ClearColor = vl_mixrgba(col);
}
@@ -1010,7 +1001,7 @@ static void clear_color (GLcontext *ctx, const GLfloat color[4])
static void clear (GLcontext *ctx, GLbitfield mask, GLboolean all,
GLint x, GLint y, GLint width, GLint height)
{
const DMesaContext c = (DMesaContext)ctx->DriverCtx;
const DMesaContext c = (DMesaContext)ctx;
const GLuint *colorMask = (GLuint *)&ctx->Color.ColorMask;
/*
@@ -1234,7 +1225,7 @@ static void dmesa_init_pointers (GLcontext *ctx)
* pretty sure they will never change during the life of the Visual
*/
#ifdef MATROX
if (((DMesaContext)ctx->DriverCtx)->visual->zbuffer == -1) {
if (((DMesaContext)ctx)->visual->zbuffer == -1) {
/* Depth span/pixel functions */
dd->WriteDepthSpan = write_depth_span;
dd->WriteDepthPixels = write_depth_pixels;
@@ -1363,9 +1354,10 @@ DMesaVisual DMesaCreateVisual (GLint width,
alphaBits = 8;
}
if ((v=(DMesaVisual)calloc(1, sizeof(struct dmesa_visual))) != NULL) {
if ((v=(DMesaVisual)CALLOC_STRUCT(dmesa_visual)) != NULL) {
/* Create core visual */
v->gl_visual = _mesa_create_visual(rgbFlag, /* rgb */
_mesa_initialize_visual((GLvisual *)v,
rgbFlag, /* rgb */
dbFlag,
GL_FALSE, /* stereo */
redBits,
@@ -1420,8 +1412,7 @@ DMesaVisual DMesaCreateVisual (GLint width,
void DMesaDestroyVisual (DMesaVisual v)
{
#ifndef FX
_mesa_destroy_visual(v->gl_visual);
free(v);
_mesa_destroy_visual((GLvisual *)v);
#ifndef MATROX
vl_video_exit();
@@ -1443,14 +1434,13 @@ DMesaBuffer DMesaCreateBuffer (DMesaVisual visual,
#ifndef FX
DMesaBuffer b;
if ((b=(DMesaBuffer)calloc(1, sizeof(struct dmesa_buffer))) != NULL) {
_mesa_initialize_framebuffer(&b->gl_buffer,
visual->gl_visual,
if ((b=(DMesaBuffer)CALLOC_STRUCT(dmesa_buffer)) != NULL) {
_mesa_initialize_framebuffer((GLframebuffer *)b,
(GLvisual *)visual,
visual->zbuffer == 1,
visual->gl_visual->stencilBits > 0,
visual->gl_visual->accumRedBits > 0,
visual->gl_visual->alphaBits > 0);
((GLvisual *)visual)->stencilBits > 0,
((GLvisual *)visual)->accumRedBits > 0,
((GLvisual *)visual)->alphaBits > 0);
b->xpos = xpos;
b->ypos = ypos;
b->width = width;
@@ -1471,8 +1461,7 @@ void DMesaDestroyBuffer (DMesaBuffer b)
#ifndef MATROX
free(b->the_window);
#endif
_mesa_free_framebuffer_data(&b->gl_buffer);
free(b);
_mesa_destroy_framebuffer((GLframebuffer *)b);
#endif
}
@@ -1485,28 +1474,29 @@ DMesaContext DMesaCreateContext (DMesaVisual visual,
DMesaContext c;
GLboolean direct = GL_FALSE;
if ((c=(DMesaContext)calloc(1, sizeof(struct dmesa_context))) != NULL) {
c->gl_ctx = _mesa_create_context(visual->gl_visual,
share ? share->gl_ctx : NULL,
if ((c=(DMesaContext)CALLOC_STRUCT(dmesa_context)) != NULL) {
_mesa_initialize_context((GLcontext *)c,
(GLvisual *)visual,
(GLcontext *)share,
(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);
_mesa_enable_sw_extensions((GLcontext *)c);
_mesa_enable_1_3_extensions((GLcontext *)c);
_mesa_enable_1_4_extensions((GLcontext *)c);
/* you probably have to do a bunch of other initializations here. */
c->visual = visual;
c->gl_ctx->Driver.UpdateState = dmesa_update_state;
((GLcontext *)c)->Driver.UpdateState = dmesa_update_state;
/* Initialize the software rasterizer and helper modules.
*/
_swrast_CreateContext(c->gl_ctx);
_ac_CreateContext(c->gl_ctx);
_tnl_CreateContext(c->gl_ctx);
_swsetup_CreateContext(c->gl_ctx);
if (visual->rgb_flag) dmesa_register_swrast_functions(c->gl_ctx);
dmesa_init_pointers(c->gl_ctx);
_swrast_CreateContext((GLcontext *)c);
_ac_CreateContext((GLcontext *)c);
_tnl_CreateContext((GLcontext *)c);
_swsetup_CreateContext((GLcontext *)c);
if (visual->rgb_flag) dmesa_register_swrast_functions((GLcontext *)c);
dmesa_init_pointers((GLcontext *)c);
}
return c;
@@ -1521,14 +1511,13 @@ DMesaContext DMesaCreateContext (DMesaVisual visual,
void DMesaDestroyContext (DMesaContext c)
{
#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);
if (c) {
_swsetup_DestroyContext((GLcontext *)c);
_swrast_DestroyContext((GLcontext *)c);
_tnl_DestroyContext((GLcontext *)c);
_ac_DestroyContext((GLcontext *)c);
_mesa_destroy_context((GLcontext *)c);
}
free(c);
#endif
}
@@ -1538,7 +1527,7 @@ GLboolean DMesaMoveBuffer (GLint xpos, GLint ypos)
{
#if !defined(FX) && !defined(MATROX)
GET_CURRENT_CONTEXT(ctx);
DMesaBuffer b = ((DMesaContext)ctx->DriverCtx)->Buffer;
DMesaBuffer b = ((DMesaContext)ctx)->Buffer;
if (vl_sync_buffer(&b->the_window, xpos, ypos, b->width, b->height) != 0) {
return GL_FALSE;
@@ -1559,7 +1548,7 @@ GLboolean DMesaResizeBuffer (GLint width, GLint height)
{
#if !defined(FX) && !defined(MATROX)
GET_CURRENT_CONTEXT(ctx);
DMesaBuffer b = ((DMesaContext)ctx->DriverCtx)->Buffer;
DMesaBuffer b = ((DMesaContext)ctx)->Buffer;
if (vl_sync_buffer(&b->the_window, b->xpos, b->ypos, width, height) != 0) {
return GL_FALSE;
@@ -1591,8 +1580,8 @@ GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b)
c->Buffer = b;
_mesa_make_current(c->gl_ctx, &b->gl_buffer);
if (c->gl_ctx->Viewport.Width == 0) {
_mesa_make_current((GLcontext *)c, (GLframebuffer *)b);
if (((GLcontext *)c)->Viewport.Width == 0) {
/* initialize viewport to window size */
_mesa_Viewport(0, 0, b->width, b->height);
}
@@ -1619,7 +1608,7 @@ void DMesaSwapBuffers (DMesaBuffer b)
#ifndef MATROX
vl_flip();
#else
if (((DMesaContext)ctx->DriverCtx)->visual->db_flag) {
if (((DMesaContext)ctx)->visual->db_flag) {
mga_swapbuffers(1);
}
#endif
@@ -1643,7 +1632,7 @@ DMesaContext DMesaGetCurrentContext (void)
{
#ifndef FX
GET_CURRENT_CONTEXT(ctx);
return (ctx == NULL) ? NULL : (DMesaContext)ctx->DriverCtx;
return (DMesaContext)ctx;
#else
return (DMesaContext)fxMesaGetCurrentContext();
#endif
@@ -1655,7 +1644,7 @@ int DMesaGetIntegerv (GLenum pname, GLint *params)
{
#ifndef FX
GET_CURRENT_CONTEXT(ctx);
const DMesaContext c = (ctx == NULL) ? NULL : (DMesaContext)ctx->DriverCtx;
const DMesaContext c = (DMesaContext)ctx;
#else
const fxMesaContext c = fxMesaGetCurrentContext();
#endif

View File

@@ -89,11 +89,13 @@ endif
AR = ar
ARFLAGS = rus
ifneq ($(wildcard $(DJDIR)/lib/dxe3.ld),)
DXE3GEN = $(wildcard $(addsuffix /dxe3gen.exe,$(subst ;, ,$(PATH))))
endif
HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe)
RM = del
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = del $(subst /,\,$(1))
else
UNLINK = $(RM) $(1)
endif
CORE_SOURCES = \
api_arrayelt.c \
@@ -173,6 +175,7 @@ CORE_SOURCES = \
swrast/s_drawpix.c \
swrast/s_feedback.c \
swrast/s_fog.c \
swrast/s_histogram.c \
swrast/s_imaging.c \
swrast/s_lines.c \
swrast/s_logic.c \
@@ -310,9 +313,8 @@ $(LIBDIR)/$(GL_LIB): $(OBJECTS)
$(AR) $(ARFLAGS) $(LIBDIR)/$(GL_LIB) $(OBJECTS)
$(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_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.)
ifeq ($(HAVEDXE3),)
$(warning Missing DXE3 package... Skipping $(GL_DXE))
else
ifeq ($(FX),1)
-dxe3gen -o $(LIBDIR)/$(GL_DXE) -I $(LIBDIR)/$(GL_IMP) -D $(LIBNAME) -E _gl -E _DMesa -P glid3.dxe -U $(OBJECTS)
@@ -330,15 +332,15 @@ X86/gen_matypes.exe: X86/gen_matypes.c
$(CC) -o $@ $(CFLAGS) -s $<
clean:
-$(RM) $(subst /,\,*.o)
-$(RM) $(subst /,\,array_cache/*.o)
-$(RM) $(subst /,\,math/*.o)
-$(RM) $(subst /,\,swrast/*.o)
-$(RM) $(subst /,\,swrast_setup/*.o)
-$(RM) $(subst /,\,tnl/*.o)
-$(RM) $(subst /,\,X86/*.o)
-$(RM) $(subst /,\,DOS/*.o)
-$(RM) $(subst /,\,DOS/mga/*.o)
-$(RM) $(subst /,\,FX/*.o)
-$(call UNLINK,*.o)
-$(call UNLINK,array_cache/*.o)
-$(call UNLINK,math/*.o)
-$(call UNLINK,swrast/*.o)
-$(call UNLINK,swrast_setup/*.o)
-$(call UNLINK,tnl/*.o)
-$(call UNLINK,X86/*.o)
-$(call UNLINK,DOS/*.o)
-$(call UNLINK,DOS/mga/*.o)
-$(call UNLINK,FX/*.o)
-include depend