Header file clean-up:
[mesa.git] / src / mesa / drivers / dos / dmesa.c
index c9bc898dcbf5d14369621cc75294952cd034b9be..474d1336e3df22aaeaf66422033c93bd78e33d20 100644 (file)
@@ -23,7 +23,7 @@
  */\r
 \r
 /*\r
- * DOS/DJGPP device driver v1.0 for Mesa 4.0\r
+ * DOS/DJGPP device driver v1.1 for Mesa 4.0\r
  *\r
  *  Copyright (C) 2002 - Borca Daniel\r
  *  Email : dborca@yahoo.com\r
  */\r
 \r
 \r
-#ifdef PC_HEADER\r
-#include "all.h"\r
-#else\r
 #include "glheader.h"\r
 #include "context.h"\r
 #include "GL/dmesa.h"\r
 #include "extensions.h"\r
-#inlcude "imports.h"\r
 #include "macros.h"\r
 #include "matrix.h"\r
 #include "mmath.h"\r
@@ -55,7 +51,6 @@
 #include "tnl/tnl.h"\r
 #include "tnl/t_context.h"\r
 #include "tnl/t_pipeline.h"\r
-#endif\r
 \r
 #include "video.h"\r
 \r
@@ -80,10 +75,9 @@ struct dmesa_buffer {
    GLframebuffer gl_buffer;     /* The depth, stencil, accum, etc buffers */\r
    void *the_window;            /* your window handle, etc */\r
 \r
-   int bypp;                    /* bytes per pixel */\r
    int xpos, ypos;              /* position */\r
    int width, height;           /* size in pixels */\r
-   int bwidth, len;             /* bytes in a line, then total */\r
+   int bypp, stride, bytes;     /* bytes per pixel, in a line, then total */\r
 };\r
 \r
 /*\r
@@ -469,8 +463,13 @@ static void dmesa_choose_tri (GLcontext *ctx)
 \r
 static void clear_color (GLcontext *ctx, const GLchan color[4])\r
 {\r
+ const GLubyte col[4];\r
  DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
- c->ClearColor = vl_mixrgba(color);\r
+ CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]);\r
+ CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);\r
+ CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]);\r
+ CLAMPED_FLOAT_TO_UBYTE(col[3], color[3]);\r
+ c->ClearColor = vl_mixrgba(col);\r
 }\r
 \r
 \r
@@ -494,7 +493,7 @@ static void clear (GLcontext *ctx, GLbitfield mask, GLboolean all,
  if (*colorMask==0xffffffff) {\r
     if (mask & DD_BACK_LEFT_BIT) {\r
        if (all) {\r
-          vl_clear(b->the_window, b->len, c->ClearColor);\r
+          vl_clear(b->the_window, b->bytes, c->ClearColor);\r
        } else {\r
           vl_rect(b->the_window, x, y, width, height, c->ClearColor);\r
        }\r
@@ -515,10 +514,9 @@ static void clear (GLcontext *ctx, GLbitfield mask, GLboolean all,
 static void set_read_buffer (GLcontext *ctx, GLframebuffer *buffer,\r
                              GLenum mode)\r
 {\r
-/*\r
- DMesaContext c = (DMesaContext)ctx->DriverCtx;\r
- dmesa_update_state(ctx);\r
-*/\r
+   /*\r
+     XXX this has to be fixed\r
+   */\r
 }\r
 \r
 \r
@@ -554,7 +552,7 @@ static const GLubyte* get_string (GLcontext *ctx, GLenum name)
 {\r
  switch (name) {\r
         case GL_RENDERER:\r
-             return (const GLubyte *)"Mesa DOS\0DJGPP port (c) Borca Daniel 31-mar-2002";\r
+             return (const GLubyte *)"Mesa DJGPP\0port (c) Borca Daniel 3-sep-2002";\r
         default:\r
              return NULL;\r
  }\r
@@ -652,16 +650,19 @@ void dmesa_init_pointers (GLcontext *ctx)
  ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;\r
  ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;\r
 \r
+ ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d;\r
+ ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d;\r
+ ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d;\r
+ ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;\r
+ ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;\r
+ ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;\r
+\r
  ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;\r
  ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;\r
  ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;\r
  ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;\r
  ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;\r
 \r
- ctx->Driver.BaseCompressedTexFormat = _mesa_base_compressed_texformat;\r
- ctx->Driver.CompressedTextureSize = _mesa_compressed_texture_size;\r
- ctx->Driver.GetCompressedTexImage = _mesa_get_compressed_teximage;\r
-\r
  /* Swrast hooks for imaging extensions:\r
   */\r
  ctx->Driver.CopyColorTable = _swrast_CopyColorTable;\r
@@ -730,6 +731,12 @@ DMesaVisual DMesaCreateVisual (GLint width, GLint height, GLint colDepth,
  DMesaVisual v;\r
  GLint redBits, greenBits, blueBits, alphaBits;\r
 \r
+ int refresh;\r
+ char *var = getenv("DMESA_REFRESH");\r
+ if ((var == NULL) || ((refresh=atoi(var)) == 0)) {\r
+    refresh = 60;\r
+ }\r
+\r
  if (!dbFlag) {\r
     return NULL;\r
  }\r
@@ -756,7 +763,7 @@ DMesaVisual DMesaCreateVisual (GLint width, GLint height, GLint colDepth,
              return NULL;\r
  }\r
 \r
- if (vl_video_init(width, height, colDepth)!=0) {\r
+ if (vl_video_init(width, height, colDepth, refresh) != 0) {\r
     return NULL;\r
  }\r
 \r
@@ -789,7 +796,7 @@ DMesaVisual DMesaCreateVisual (GLint width, GLint height, GLint colDepth,
 \r
 void DMesaDestroyVisual (DMesaVisual v)\r
 {\r
- vl_video_exit(!0);\r
+ vl_video_exit();\r
  _mesa_destroy_visual(v->gl_visual);\r
  free(v);\r
 }\r
@@ -838,11 +845,9 @@ DMesaContext DMesaCreateContext (DMesaVisual visual,
  GLboolean direct = GL_FALSE;\r
 \r
  if ((c=(DMesaContext)calloc(1, sizeof(struct dmesa_context)))!=NULL) {\r
-    __GLimports imports;\r
-    _mesa_init_default_imports( &imports, (void *) c);\r
     c->gl_ctx = _mesa_create_context(visual->gl_visual,\r
                                      share ? share->gl_ctx : NULL,\r
-                                     &imports);\r
+                                     (void *)c, direct);\r
 \r
     _mesa_enable_sw_extensions(c->gl_ctx);\r
     _mesa_enable_1_3_extensions(c->gl_ctx);\r
@@ -887,8 +892,8 @@ GLboolean DMesaViewport (DMesaBuffer b,
     b->ypos = ypos;\r
     b->width = width;\r
     b->height = height;\r
-    b->bwidth = width * b->bypp;\r
-    b->len = b->bwidth * height;\r
+    b->stride = width * b->bypp;\r
+    b->bytes = b->stride * height;\r
     return GL_TRUE;\r
  }\r
 }\r
@@ -926,5 +931,7 @@ GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b)
 void DMesaSwapBuffers (DMesaBuffer b)\r
 {\r
  /* copy/swap back buffer to front if applicable */\r
- vl_flip(b->the_window, b->bwidth, b->height);\r
+ GET_CURRENT_CONTEXT(ctx);\r
+ _mesa_notifySwapBuffers(ctx);\r
+ vl_flip(b->the_window, b->stride, b->height);\r
 }\r