lazy programmer and I found that the easiest way to keep buffer handling
at peak performance ;-).
+ Q) I'm getting a "bad font!" fatal error.
+ A) By default, DOS GLUT compiles with GLUT_IMPORT_LIB, to cope with variable
+ access inside dynamic modules (same mechanism used for Win32 _DLL). Since
+ -DGLUT_IMPORT_LIB affects Mesa's `glut.h', your apps must be compiled the
+ same way GLUT was compiled (either with or without defining it). If you
+ want to use another `glut.h' when building your own demos, or just don't
+ feel happy about this, make sure you remove the line with GLUT_IMPORT_LIB
+ from `Mesa/src/glut/dos/Makefile.DJ' before (re)making GLUT. Beware, this
+ means you will never EVER be able to safely use `glut.dxe'!
+
Q) How do I query for a list of available video modes to choose as a visual?
A) This is an ugly hack, for which I'm sure I'll burn in hell.
First, query for a list of modes:
x more changes to the 3dfx driver
v1.6 (???-2004)
- * fixed a horrible bug in VGA initialization routine
+ + added DMesaGetProcAddress
+ ! fixed a horrible bug in VGA initialization routine
/*
* Mesa 3-D graphics library
- * Version: 5.0
+ * Version: 6.1
*
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 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"),
*/
/*
- * DOS/DJGPP device driver v1.5 for Mesa
+ * DOS/DJGPP device driver v1.6 for Mesa
*
* Copyright (C) 2002 - Borca Daniel
* Email : dborca@users.sourceforge.net
#ifndef DMESA_H_included
#define DMESA_H_included
-#define DMESA_MAJOR_VERSION 5
-#define DMESA_MINOR_VERSION 0
+#define DMESA_MAJOR_VERSION 6
+#define DMESA_MINOR_VERSION 1
/* Sample Usage:
*
*/
void DMesaSetCI (int ndx, GLfloat red, GLfloat green, GLfloat blue);
+/*
+ * DMesa functions
+ */
+void *DMesaGetProcAddress (const char *name);
+
/*
* DMesa state retrieval.
*/
# 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.5 for Mesa
+# DOS/DJGPP core makefile v1.6 for Mesa
#
# Copyright (C) 2002 - Borca Daniel
# Email : dborca@users.sourceforge.net
drivers/dos/dpmi.c
endif
-SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES)
+SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(COMMON_DRIVER_SOURCES) $(DRIVER_SOURCES)
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
# 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.
-# MinGW core makefile v1.1 for Mesa
+# MinGW core makefile v1.2 for Mesa
#
# Copyright (C) 2002 - Borca Daniel
# Email : dborca@users.sourceforge.net
drivers/windows/gdi/wgl.c
endif
-SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES)
+SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(COMMON_DRIVER_SOURCES) $(DRIVER_SOURCES)
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.1
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 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"),
*/
/*
- * DOS/DJGPP device driver v1.5 for Mesa
+ * DOS/DJGPP device driver v1.6 for Mesa
*
* Copyright (c) 2003 - Borca Daniel
* Email : dborca@users.sourceforge.net
#include "tnl/tnl.h"
#include "tnl/t_context.h"
#include "tnl/t_pipeline.h"
+#include "drivers/common/driverfuncs.h"
#include "video.h"
#else /* FX */
#include "GL/fxmesa.h"
+static void dmesa_update_state (GLcontext *ctx, GLuint new_state)
+{
+ /* Propagate statechange information to swrast and swrast_setup
+ * modules. The DMesa driver has no internal GL-dependent state.
+ */
+ _swrast_InvalidateState( ctx, new_state );
+ _ac_InvalidateState( ctx, new_state );
+ _tnl_InvalidateState( ctx, new_state );
+ _swsetup_InvalidateState( ctx, new_state );
+}
+
+
+
+/* Initialize the device driver function table with the functions
+ * we implement in this driver.
+ */
+static void dmesa_init_driver_functions (DMesaVisual visual,
+ struct dd_function_table *driver)
+{
+ driver->UpdateState = dmesa_update_state;
+ driver->GetString = get_string;
+ driver->GetBufferSize = get_buffer_size;
+ driver->Flush = flush;
+ driver->Finish = finish;
+ driver->Clear = clear;
+ driver->ClearColor = clear_color;
+ driver->ClearIndex = clear_index;
+}
+
+
+
/* Setup pointers and other driver state that is constant for the life
* of a context.
*/
static void dmesa_init_pointers (GLcontext *ctx)
{
- TNLcontext *tnl;
struct swrast_device_driver *dd = _swrast_GetDeviceDriverReference(ctx);
- ctx->Driver.GetString = get_string;
- ctx->Driver.GetBufferSize = get_buffer_size;
- ctx->Driver.Flush = flush;
- ctx->Driver.Finish = finish;
-
- /* Software rasterizer pixel paths:
- */
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.Clear = clear;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
- ctx->Driver.DrawBuffer = _swrast_DrawBuffer;
-
- /* Software texture functions:
- */
- ctx->Driver.ChooseTextureFormat = _mesa_choose_tex_format;
- ctx->Driver.TexImage1D = _mesa_store_teximage1d;
- ctx->Driver.TexImage2D = _mesa_store_teximage2d;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
- ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
-
- ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d;
- ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d;
- ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d;
- ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
- ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
- ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
-
- /* Swrast hooks for imaging extensions:
- */
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-
- /* Statechange callbacks:
- */
- ctx->Driver.ClearColor = clear_color;
- ctx->Driver.ClearIndex = clear_index;
-
- /* Initialize the TNL driver interface:
- */
- tnl = TNL_CONTEXT(ctx);
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
-
dd->SetBuffer = set_buffer;
-
- /* Install swsetup for tnl->Driver.Render.*:
- */
- _swsetup_Wakeup(ctx);
/* The span functions should be in `dmesa_update_state', but I'm
* pretty sure they will never change during the life of the Visual
dd->ReadRGBASpan = read_rgba_span;
dd->ReadRGBAPixels = read_rgba_pixels;
}
-
-
-
-static void dmesa_update_state (GLcontext *ctx, GLuint new_state)
-{
- /* Propagate statechange information to swrast and swrast_setup
- * modules. The DMesa driver has no internal GL-dependent state.
- */
- _swrast_InvalidateState( ctx, new_state );
- _ac_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
-}
#endif /* FX */
DMesaContext share)
{
#ifndef FX
- DMesaContext c;
- GLboolean direct = GL_FALSE;
+ GLcontext *c;
+ TNLcontext *tnl;
+ struct dd_function_table functions;
- if ((c=(DMesaContext)CALLOC_STRUCT(dmesa_context)) != NULL) {
- _mesa_initialize_context((GLcontext *)c,
+ if ((c=(GLcontext *)CALLOC_STRUCT(dmesa_context)) != NULL) {
+ /* Initialize device driver function table */
+ _mesa_init_driver_functions(&functions);
+ /* override with our functions */
+ dmesa_init_driver_functions(visual, &functions);
+
+ _mesa_initialize_context(c,
(GLvisual *)visual,
(GLcontext *)share,
- (void *)c, direct);
-
- _mesa_enable_sw_extensions((GLcontext *)c);
- _mesa_enable_1_3_extensions((GLcontext *)c);
- _mesa_enable_1_4_extensions((GLcontext *)c);
- _mesa_enable_1_5_extensions((GLcontext *)c);
+ &functions,
+ (void *)c);
+
+ _mesa_enable_sw_extensions(c);
+ _mesa_enable_1_3_extensions(c);
+ _mesa_enable_1_4_extensions(c);
+ _mesa_enable_1_5_extensions(c);
/* you probably have to do a bunch of other initializations here. */
- c->visual = visual;
-
- ((GLcontext *)c)->Driver.UpdateState = dmesa_update_state;
+ ((DMesaContext)c)->visual = visual;
/* Initialize the software rasterizer and helper modules.
*/
- _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);
+ _swrast_CreateContext(c);
+ _ac_CreateContext(c);
+ _tnl_CreateContext(c);
+ _swsetup_CreateContext(c);
+ /* tnl setup */
+ tnl = TNL_CONTEXT(c);
+ tnl->Driver.RunPipeline = _tnl_run_pipeline;
+ /* swrast setup */
+ if (visual->rgb_flag) dmesa_register_swrast_functions(c);
+ dmesa_init_pointers(c);
+ _swsetup_Wakeup(c);
}
- return c;
+ return (DMesaContext)c;
#else /* FX */
return (DMesaContext)visual;
+void *DMesaGetProcAddress (const char *name)
+{
+ void *p = (void *)_glapi_get_proc_address(name);
+
+/* TODO: handle DMesa* namespace
+ if (p == NULL) {
+ }
+*/
+
+ return p;
+}
+
+
+
int DMesaGetIntegerv (GLenum pname, GLint *params)
{
switch (pname) {
#if defined(FX)
#include "fxdrv.h"
+#include "drivers/common/driverfuncs.h"
+
#ifndef TDFX_DEBUG
int TDFX_DEBUG = (0
/* | VERBOSE_VARRAY */
}
_mesa_init_driver_functions(&functions);
- ctx->Driver.
ctx = fxMesa->glCtx = _mesa_create_context(fxMesa->glVis, shareCtx,
&functions, (void *) fxMesa);
if (!ctx) {
if (fxMesa->HaveMirExt) {
_mesa_enable_extension(ctx, "GL_ARB_texture_mirrored_repeat");
}
+
+ /* core-level extensions */
+#if 1
+ _mesa_enable_extension(ctx, "GL_ARB_vertex_buffer_object");
+#endif
}
ctx->Driver.Clear = fxDDClear;
ctx->Driver.DrawBuffer = fxDDSetDrawBuffer;
ctx->Driver.GetBufferSize = fxDDBufferSize;
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
switch (fxMesa->colDepth) {
case 15:
ctx->Driver.ReadPixels = fxDDReadPixels555;
ctx->Driver.Bitmap = fxDDDrawBitmap4;
break;
}
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
ctx->Driver.Finish = fxDDFinish;
ctx->Driver.Flush = NULL;
ctx->Driver.ChooseTextureFormat = fxDDChooseTextureFormat;
- ctx->Driver.TexImage1D = _mesa_store_teximage1d;
ctx->Driver.TexImage2D = fxDDTexImage2D;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
ctx->Driver.TexSubImage2D = fxDDTexSubImage2D;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d;
ctx->Driver.CompressedTexImage2D = fxDDCompressedTexImage2D;
- ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d;
- ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
ctx->Driver.CompressedTexSubImage2D = fxDDCompressedTexSubImage2D;
- ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
ctx->Driver.IsCompressedFormat = fxDDIsCompressedFormat;
ctx->Driver.CompressedTextureSize = fxDDCompressedTextureSize;
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
ctx->Driver.TexEnv = fxDDTexEnv;
ctx->Driver.TexParameter = fxDDTexParam;
ctx->Driver.BindTexture = fxDDTexBind;
tObj->DriverData = fxAllocTexObjData(fxMesa);
}
ti = fxTMGetTexInfo(tObj);
- assert(ti);
fxMesa->texBindNumber++;
ti->lastTimeUsed = fxMesa->texBindNumber;
if (!tObj->DriverData)
tObj->DriverData = fxAllocTexObjData(fxMesa);
ti = fxTMGetTexInfo(tObj);
- assert(ti);
switch (pname) {
case GL_TEXTURE_MIN_FILTER:
if (!tObj->DriverData)
tObj->DriverData = fxAllocTexObjData(fxMesa);
ti = fxTMGetTexInfo(tObj);
- assert(ti);
ti->paltype = convertPalette(fxMesa, ti->palette.data, &tObj->Palette);
fxTexInvalidate(ctx, tObj);
}
struct gl_texture_object *tObj = ctx->Texture.Unit[0]._Current;
if (!tObj->DriverData)
tObj->DriverData = fxAllocTexObjData(fxMesa);
- assert(tObj->DriverData);
fxTexInvalidate(ctx, tObj);
}
}
#include "math/m_vector.h"
-#include "drivers/common/driverfuncs.h"
-
/* Define some shorter names for these things.
*/
struct gl_texture_unit *t0 = &ctx->Texture.Unit[fxMesa->tmu_source[0]];
struct gl_texture_unit *t1 = &ctx->Texture.Unit[fxMesa->tmu_source[1]];
- if (t0 && t0->_Current && FX_TEXTURE_DATA(t0)) {
+ if (t0->_Current && FX_TEXTURE_DATA(t0)) {
fxMesa->s0scale = FX_TEXTURE_DATA(t0)->sScale;
fxMesa->t0scale = FX_TEXTURE_DATA(t0)->tScale;
fxMesa->inv_s0scale = 1.0 / fxMesa->s0scale;
fxMesa->inv_t0scale = 1.0 / fxMesa->t0scale;
}
- if (t1 && t1->_Current && FX_TEXTURE_DATA(t1)) {
+ if (t1->_Current && FX_TEXTURE_DATA(t1)) {
fxMesa->s1scale = FX_TEXTURE_DATA(t1)->sScale;
fxMesa->t1scale = FX_TEXTURE_DATA(t1)->tScale;
fxMesa->inv_s1scale = 1.0 / fxMesa->s1scale;
FXMESA_NONE}
}
};
-static int qt_pix = sizeof(pix) / sizeof(pix[0]);
static fxMesaContext ctx = NULL;
static WNDPROC hWNDOldProc;
return (FALSE);
}
+static int pfd_tablen (void)
+{
+ /* we should take an envvar for `fxMesaSelectCurrentBoard' */
+ return (fxMesaSelectCurrentBoard(0) < GR_SSTTYPE_Voodoo4)
+ ? 2 /* only 16bit entries */
+ : sizeof(pix) / sizeof(pix[0]); /* full table */
+}
+
GLAPI int GLAPIENTRY
wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR * ppfd)
{
}
#endif
- qt_valid_pix = qt_pix;
+ qt_valid_pix = pfd_tablen();
if (ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR) || ppfd->nVersion != 1) {
SetLastError(0);
{
int qt_valid_pix;
- qt_valid_pix = qt_pix;
+ qt_valid_pix = pfd_tablen();
if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix ||
((nBytes != sizeof(PIXELFORMATDESCRIPTOR)) && (nBytes != 0))) {
{
int qt_valid_pix;
- qt_valid_pix = qt_pix;
+ qt_valid_pix = pfd_tablen();
if (iPixelFormat < 1 || iPixelFormat > qt_valid_pix) {
if (ppfd == NULL) {