diff options
author | Brian Paul <[email protected]> | 2002-03-08 19:27:17 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2002-03-08 19:27:17 +0000 |
commit | b43a828ad44d0ff092c667f0ba289b8200aef22c (patch) | |
tree | 4e98ce42d6eff3fc136e26f64f6c20e74c27f510 | |
parent | 7fd50afbbf8bb36642efe0254706039af3c9c588 (diff) |
DOS driver updates from Daniel Borca
-rw-r--r-- | docs/README.DJ | 24 | ||||
-rw-r--r-- | src/mesa/drivers/dos/dmesa.c | 173 | ||||
-rw-r--r-- | src/mesa/main/Makefile.DJ | 7 |
3 files changed, 78 insertions, 126 deletions
diff --git a/docs/README.DJ b/docs/README.DJ index e20454a3d2e..8b3a0f5998b 100644 --- a/docs/README.DJ +++ b/docs/README.DJ @@ -1,4 +1,4 @@ - Mesa 4.0.1 DOS/DJGPP Port version 0.2
+ Mesa 4.0.1 DOS/DJGPP Port version 0.3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -6,13 +6,7 @@ Description:
~~~~~~~~~~~~
-This is the DOS port of MESA 4.0, for DJGPP programmers... It features some
-sort of hardware acceleration, but it's pretty thin: it is entirely based on
-VBEAF.DRV from the FreeBE/AF project (http://www.talula.demon.co.uk/freebe/).
-Note that SciTech's driver isn't supported because I hate the `nearptr' hack.
-Anyway, these drivers don't provide ANY 3D function :-( Moreover, it seems to
-me the FreeBE/AF project is not really up to date... Well, it's not much, my
-intention was to open the door ;-)
+Well, guess what... this is the DOS port of MESA 4.0, for DJGPP fans... Whoa!
@@ -54,17 +48,11 @@ style :-( Sorry! Pitfalls:
1. The current version supports only RGB[A] modes, for it made no sense to me
to endorse color-index (aka palette) modes.
-2. Double-buffered uses page flipping if acceleration is available, else falls
- back to virtual buffer.
-3. Single-buffered is not allowed with 24-bit modes, because direct access was
- wrong and fixing it would mean to slow down the other routines; until this
- is really, really necessary, it won't get reimplemented.
-4. Another weird "feature" is that buffer width must be multiple of 4 (I'm a
+2. Single-buffered is not allowed at all. Until I can find a way to use *REAL*
+ hardware acceleration, it won't get implemented.
+3. Another weird "feature" is that buffer width must be multiple of 4 (I'm a
lazy programmer and I found that the easiest way to keep buffer handling at
peak performance ;-).
-5. The FreeBE/AF driver is searched in the current directory only; therefore,
- to disable hardware acceleration, make sure you don't have VBEAF.DRV where
- your application resides.
@@ -123,6 +111,8 @@ v0.2 feb-2002 + fast triangle rasterizers + glut has now an internal timer
* glut changed to support multi-window (unfinished)
! minor PC_HW corrections
+v0.3 mar-2002 - removed FreeBE/AF code
+ - removed single-buffer modes
diff --git a/src/mesa/drivers/dos/dmesa.c b/src/mesa/drivers/dos/dmesa.c index 5ab323d33a9..454b891c08b 100644 --- a/src/mesa/drivers/dos/dmesa.c +++ b/src/mesa/drivers/dos/dmesa.c @@ -23,7 +23,7 @@ */
/*
- * DOS/DJGPP device driver v0.2 for Mesa 4.0
+ * DOS/DJGPP device driver v0.3 for Mesa 4.0
*
* Copyright (C) 2002 - Borca Daniel
* Email : [email protected]
@@ -66,10 +66,9 @@ */
struct dmesa_visual {
GLvisual *gl_visual;
+ GLboolean db_flag; /* double buffered? */
GLboolean rgb_flag; /* RGB mode? */
GLuint depth; /* bits per pixel (1, 8, 24, etc) */
-
- GLint caps; /* video mode capabilities */
};
/*
@@ -82,12 +81,7 @@ struct dmesa_buffer { int xpos, ypos; /* position */
int width, height; /* size in pixels */
- int pitch, len; /* number of bytes in a line, then total */
- int cwidth; /* scan width */
-
- int caps; /* video mode capabilities */
-
- void (*tri_rgb_flat) ();
+ int bwidth, len; /* bytes in a line, then total */
};
/*
@@ -126,7 +120,7 @@ static void write_rgba_span (const GLcontext *ctx, GLuint n, GLint x, GLint y, void *b = c->Buffer->the_window;
GLuint i, offset;
- offset = c->Buffer->cwidth * FLIP(y) + x;
+ offset = c->Buffer->width * FLIP(y) + x;
if (mask) {
/* draw some pixels */
for (i=0; i<n; i++, offset++) {
@@ -149,7 +143,7 @@ static void write_rgb_span (const GLcontext *ctx, GLuint n, GLint x, GLint y, void *b = c->Buffer->the_window;
GLuint i, offset;
- offset = c->Buffer->cwidth * FLIP(y) + x;
+ offset = c->Buffer->width * FLIP(y) + x;
if (mask) {
/* draw some pixels */
for (i=0; i<n; i++, offset++) {
@@ -173,7 +167,7 @@ static void write_mono_rgba_span (const GLcontext *ctx, void *b = c->Buffer->the_window;
GLuint i, offset, rgba = vl_mixrgba(color);
- offset = c->Buffer->cwidth * FLIP(y) + x;
+ offset = c->Buffer->width * FLIP(y) + x;
if (mask) {
/* draw some pixels */
for (i=0; i<n; i++, offset++) {
@@ -196,7 +190,7 @@ static void read_rgba_span (const GLcontext *ctx, GLuint n, GLint x, GLint y, void *b = c->Buffer->the_window;
GLuint i, offset;
- offset = c->Buffer->cwidth * FLIP(y) + x;
+ offset = c->Buffer->width * FLIP(y) + x;
/* read all pixels */
for (i=0; i<n; i++, offset++) {
vl_getrgba(b, offset, rgba[i]);
@@ -209,7 +203,7 @@ static void write_rgba_pixels (const GLcontext *ctx, {
DMesaContext c = (DMesaContext)ctx->DriverCtx;
void *b = c->Buffer->the_window;
- GLuint i, w = c->Buffer->cwidth, h = c->Buffer->height;
+ GLuint i, w = c->Buffer->width, h = c->Buffer->height;
if (mask) {
/* draw some pixels */
@@ -232,7 +226,7 @@ static void write_mono_rgba_pixels (const GLcontext *ctx, {
DMesaContext c = (DMesaContext)ctx->DriverCtx;
void *b = c->Buffer->the_window;
- GLuint i, w = c->Buffer->cwidth, h = c->Buffer->height, rgba = vl_mixrgba(color);
+ GLuint i, w = c->Buffer->width, h = c->Buffer->height, rgba = vl_mixrgba(color);
if (mask) {
/* draw some pixels */
@@ -255,7 +249,7 @@ static void read_rgba_pixels (const GLcontext *ctx, {
DMesaContext c = (DMesaContext)ctx->DriverCtx;
void *b = c->Buffer->the_window;
- GLuint i, w = c->Buffer->cwidth, h = c->Buffer->height;
+ GLuint i, w = c->Buffer->width, h = c->Buffer->height;
if (mask) {
/* read some pixels */
@@ -290,24 +284,17 @@ static void tri_rgb_flat (GLcontext *ctx, {
DMesaContext c = (DMesaContext)ctx->DriverCtx;
void *b = c->Buffer->the_window;
- GLuint w = c->Buffer->cwidth, h = c->Buffer->height;
+ GLuint w = c->Buffer->width, h = c->Buffer->height;
- if (c->Buffer->tri_rgb_flat) {
- c->Buffer->tri_rgb_flat(IROUND(v0->win[0]), IROUND(FLIP2(v0->win[1])),
- IROUND(v1->win[0]), IROUND(FLIP2(v1->win[1])),
- IROUND(v2->win[0]), IROUND(FLIP2(v2->win[1])),
- vl_mixrgb(v2->color));
- } else {
#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.count; i++, offset++) { \
- vl_putpixel(b, offset, rgb); \
- }
+ GLuint i, offset = FLIP2(span.y)*w + span.x; \
+ for (i = 0; i < span.count; i++, offset++) { \
+ vl_putpixel(b, offset, rgb); \
+ }
#include "swrast/s_tritemp.h"
- }
}
@@ -322,22 +309,22 @@ static void tri_rgb_flat_z (GLcontext *ctx, {
DMesaContext c = (DMesaContext)ctx->DriverCtx;
void *b = c->Buffer->the_window;
- GLuint w = c->Buffer->cwidth, h = c->Buffer->height;
+ GLuint w = c->Buffer->width, h = c->Buffer->height;
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#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.count; i++, offset++) { \
- const DEPTH_TYPE z = FixedToDepth(span.z); \
- if (z < zRow[i]) { \
- vl_putpixel(b, offset, rgb); \
- zRow[i] = z; \
- } \
- span.z += span.zStep; \
- }
+ GLuint i, offset = FLIP2(span.y)*w + span.x; \
+ for (i = 0; i < span.count; i++, offset++) { \
+ const DEPTH_TYPE z = FixedToDepth(span.z); \
+ if (z < zRow[i]) { \
+ vl_putpixel(b, offset, rgb); \
+ zRow[i] = z; \
+ } \
+ span.z += span.zStep; \
+ }
#include "swrast/s_tritemp.h"
}
@@ -354,21 +341,21 @@ static void tri_rgb_smooth (GLcontext *ctx, {
DMesaContext c = (DMesaContext)ctx->DriverCtx;
void *b = c->Buffer->the_window;
- GLuint w = c->Buffer->cwidth, h = c->Buffer->height;
+ GLuint w = c->Buffer->width, h = c->Buffer->height;
#define INTERP_RGB 1
#define RENDER_SPAN(span) \
- GLuint i, offset = FLIP2(span.y)*w + span.x; \
- for (i = 0; i < span.count; 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; \
- }
+ GLuint i, offset = FLIP2(span.y)*w + span.x; \
+ for (i = 0; i < span.count; 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; \
+ }
#include "swrast/s_tritemp.h"
}
@@ -385,29 +372,29 @@ static void tri_rgb_smooth_z (GLcontext *ctx, {
DMesaContext c = (DMesaContext)ctx->DriverCtx;
void *b = c->Buffer->the_window;
- GLuint w = c->Buffer->cwidth, h = c->Buffer->height;
+ GLuint w = c->Buffer->width, h = c->Buffer->height;
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define INTERP_RGB 1
#define RENDER_SPAN(span) \
- GLuint i, offset = FLIP2(span.y)*w + span.x; \
- for (i = 0; i < span.count; 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; \
- }
+ GLuint i, offset = FLIP2(span.y)*w + span.x; \
+ for (i = 0; i < span.count; 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; \
+ }
#include "swrast/s_tritemp.h"
}
@@ -505,26 +492,12 @@ static void clear (GLcontext *ctx, GLbitfield mask, GLboolean all, if (*colorMask==0xffffffff) {
if (mask & DD_BACK_LEFT_BIT) {
if (all) {
- if CHECK_SOFTDB(b->caps) {
- vl_clear_virtual(b->the_window, b->len, c->ClearColor);
- } else {
- vl_clear(b->the_window, 0, 0, b->width, b->height, c->ClearColor);
- }
+ vl_clear(b->the_window, b->len, c->ClearColor);
} else {
- vl_clear(b->the_window, x, y, width, height, c->ClearColor);
+ vl_rect(b->the_window, x, y, width, height, c->ClearColor);
}
mask &= ~DD_BACK_LEFT_BIT;
}
- if (mask & DD_FRONT_LEFT_BIT) {
- if (all) {
- x = 0;
- y = 0;
- width = b->width;
- height = b->height;
- }
- vl_clear(b->the_window, x, y, width, height, c->ClearColor);
- mask &= ~DD_FRONT_LEFT_BIT;
- }
}
if (mask) {
@@ -553,7 +526,7 @@ static void set_read_buffer (GLcontext *ctx, GLframebuffer *buffer, */
static GLboolean set_draw_buffer (GLcontext *ctx, GLenum mode)
{
- if (mode==GL_BACK_LEFT || mode==GL_FRONT_LEFT) {
+ if (mode==GL_BACK_LEFT) {
return GL_TRUE;
} else {
return GL_FALSE;
@@ -756,8 +729,10 @@ DMesaVisual DMesaCreateVisual (GLint width, GLint height, GLint colDepth, {
DMesaVisual v;
GLint redBits, greenBits, blueBits, alphaBits;
- GLint caps;
+ if (!dbFlag) {
+ return NULL;
+ }
alphaBits = 0;
switch (colDepth) {
case 15:
@@ -781,11 +756,7 @@ DMesaVisual DMesaCreateVisual (GLint width, GLint height, GLint colDepth, return NULL;
}
- caps = 0;
- if (!dbFlag) {
- caps |= VL_SINGLE;
- }
- if (vl_video_init(width, height, colDepth, &caps)!=0) {
+ if (vl_video_init(width, height, colDepth)!=0) {
return NULL;
}
@@ -808,7 +779,7 @@ DMesaVisual DMesaCreateVisual (GLint width, GLint height, GLint colDepth, 1); /* numSamples */
v->depth = colDepth;
- v->caps = caps;
+ v->db_flag = dbFlag;
}
return v;
@@ -818,7 +789,7 @@ DMesaVisual DMesaCreateVisual (GLint width, GLint height, GLint colDepth, void DMesaDestroyVisual (DMesaVisual v)
{
- vl_video_exit();
+ vl_video_exit(!0);
_mesa_destroy_visual(v->gl_visual);
free(v);
}
@@ -841,12 +812,9 @@ DMesaBuffer DMesaCreateBuffer (DMesaVisual visual, b->xpos = xpos;
b->ypos = ypos;
b->width = width;
+ b->bwidth = width * ((visual->depth+7)/8);
b->height = height;
- b->caps = visual->caps;
- b->pitch = b->width*((visual->depth+7)/8);
- b->len = b->pitch*b->height;
-
- b->tri_rgb_flat = vl_getprim(TRI_RGB_FLAT);
+ b->len = b->bwidth * b->height;
}
return b;
@@ -856,9 +824,7 @@ DMesaBuffer DMesaCreateBuffer (DMesaVisual visual, void DMesaDestroyBuffer (DMesaBuffer b)
{
- if CHECK_SOFTDB(b->caps) {
- free(b->the_window);
- }
+ free(b->the_window);
_mesa_destroy_framebuffer(b->gl_buffer);
free(b);
}
@@ -911,13 +877,10 @@ void DMesaDestroyContext (DMesaContext c) GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b)
{
if (c&&b) {
- void *ptr = vl_sync_buffer(b->the_window, b->xpos, b->ypos, b->width, b->height, &b->cwidth);
-
- if (b->cwidth==-1) {
+ if ((b->the_window=vl_sync_buffer(b->the_window, b->xpos, b->ypos, b->width, b->height))==NULL) {
return GL_FALSE;
}
- b->the_window = ptr;
c->Buffer = b;
dmesa_update_state(c->gl_ctx, 0);
@@ -939,5 +902,5 @@ GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b) void DMesaSwapBuffers (DMesaBuffer b)
{
/* copy/swap back buffer to front if applicable */
- b->the_window = vl_flip(b->the_window, b->width, b->height, b->pitch);
+ vl_flip(b->the_window, b->bwidth, b->height);
}
diff --git a/src/mesa/main/Makefile.DJ b/src/mesa/main/Makefile.DJ index e6be4205d6a..214882d1cfa 100644 --- a/src/mesa/main/Makefile.DJ +++ b/src/mesa/main/Makefile.DJ @@ -157,7 +157,7 @@ CORE_SOURCES = \ tnl/t_vb_texmat.c \
tnl/t_vb_vertex.c
-DRIVER_SOURCES = DOS/dmesa.c DOS/video.c DOS/vbeaf.c DOS/dpmi.c
+DRIVER_SOURCES = DOS/dmesa.c DOS/video.c DOS/dpmi.c
SOURCES = $(CORE_SOURCES) $(DRIVER_SOURCES)
@@ -184,6 +184,5 @@ DOS/dmesa.o: DOS/dmesa.c glheader.h ../include/GL/gl.h context.h glapi.h \ swrast/s_depth.h swrast/s_lines.h swrast/s_triangle.h swrast/s_trispan.h \
swrast_setup/swrast_setup.h tnl/tnl.h tnl/t_context.h math/m_vector.h \
math/m_xform.h tnl/t_pipeline.h DOS/video.h swrast/s_tritemp.h
-DOS/dpmi.o: DOS/dpmi.c DOS/vbeaf.h DOS/dpmiint.h
-DOS/vbeaf.o: DOS/vbeaf.c DOS/dpmiint.h DOS/vbeaf.h DOS/video.h
-DOS/video.o: DOS/video.c DOS/video.h DOS/dpmiint.h DOS/vbeafint.h DOS/vbeaf.h
+DOS/dpmi.o: DOS/dpmi.c DOS/dpmiint.h
+DOS/video.o: DOS/video.c DOS/video.h DOS/dpmiint.h
|