1 /****************************************************************************
3 * Mesa 3-D graphics library
4 * Direct3D Driver Interface
6 * ========================================================================
8 * Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
17 * The above copyright notice and this permission notice shall be included
18 * in all copies or substantial portions of the Software.
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
25 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 * ======================================================================
31 * Environment: Windows 9x/2000/XP/XBox (Win32)
33 * Description: Mesa Software WGL (WindowsGL)
35 ****************************************************************************/
38 #define GL_GLEXT_PROTOTYPES
48 #include "extensions.h"
54 #include "texformat.h"
58 #include "swrast/swrast.h"
59 #include "swrast_setup/swrast_setup.h"
60 #include "swrast/s_context.h"
61 #include "swrast/s_depth.h"
62 #include "swrast/s_lines.h"
63 #include "swrast/s_triangle.h"
64 #include "swrast/s_trispan.h"
66 #include "tnl/t_context.h"
67 #include "tnl/t_pipeline.h"
69 #include "dglcontext.h"
70 #include "gld_driver.h"
72 //---------------------------------------------------------------------------
73 //---------------------------------------------------------------------------
75 DGL_pixelFormat pfTemplateMesaSW
=
78 sizeof(PIXELFORMATDESCRIPTOR
), // Size of the data structure
79 1, // Structure version - should be 1
81 PFD_DRAW_TO_WINDOW
| // The buffer can draw to a window or device surface.
82 PFD_DRAW_TO_BITMAP
| // The buffer can draw to a bitmap. (DaveM)
83 PFD_SUPPORT_GDI
| // The buffer supports GDI drawing. (DaveM)
84 PFD_SUPPORT_OPENGL
| // The buffer supports OpenGL drawing.
85 PFD_DOUBLEBUFFER
| // The buffer is double-buffered.
86 0, // Placeholder for easy commenting of above flags
87 PFD_TYPE_RGBA
, // Pixel type RGBA.
88 32, // Total colour bitplanes (excluding alpha bitplanes)
89 8, 0, // Red bits, shift
90 8, 8, // Green bits, shift
91 8, 16, // Blue bits, shift
92 8, 24, // Alpha bits, shift (destination alpha)
93 64, // Accumulator bits (total)
94 16, 16, 16, 16, // Accumulator bits: Red, Green, Blue, Alpha
97 0, // Number of auxiliary buffers
99 0, // Specifies the number of overlay and underlay planes.
101 0, // Specifies the transparent color or index of an underlay plane.
107 //---------------------------------------------------------------------------
109 //---------------------------------------------------------------------------
116 static GLD_extension GLD_extList
[] = {
117 #ifdef GL_EXT_polygon_offset
118 { (PROC
)glPolygonOffsetEXT
, "glPolygonOffsetEXT" },
120 { (PROC
)glBlendEquationEXT
, "glBlendEquationEXT" },
121 { (PROC
)glBlendColorEXT
, "glBlendColorExt" },
122 { (PROC
)glVertexPointerEXT
, "glVertexPointerEXT" },
123 { (PROC
)glNormalPointerEXT
, "glNormalPointerEXT" },
124 { (PROC
)glColorPointerEXT
, "glColorPointerEXT" },
125 { (PROC
)glIndexPointerEXT
, "glIndexPointerEXT" },
126 { (PROC
)glTexCoordPointerEXT
, "glTexCoordPointer" },
127 { (PROC
)glEdgeFlagPointerEXT
, "glEdgeFlagPointerEXT" },
128 { (PROC
)glGetPointervEXT
, "glGetPointervEXT" },
129 { (PROC
)glArrayElementEXT
, "glArrayElementEXT" },
130 { (PROC
)glDrawArraysEXT
, "glDrawArrayEXT" },
131 { (PROC
)glAreTexturesResidentEXT
, "glAreTexturesResidentEXT" },
132 { (PROC
)glBindTextureEXT
, "glBindTextureEXT" },
133 { (PROC
)glDeleteTexturesEXT
, "glDeleteTexturesEXT" },
134 { (PROC
)glGenTexturesEXT
, "glGenTexturesEXT" },
135 { (PROC
)glIsTextureEXT
, "glIsTextureEXT" },
136 { (PROC
)glPrioritizeTexturesEXT
, "glPrioritizeTexturesEXT" },
137 { (PROC
)glCopyTexSubImage3DEXT
, "glCopyTexSubImage3DEXT" },
138 { (PROC
)glTexImage3DEXT
, "glTexImage3DEXT" },
139 { (PROC
)glTexSubImage3DEXT
, "glTexSubImage3DEXT" },
140 { (PROC
)glPointParameterfEXT
, "glPointParameterfEXT" },
141 { (PROC
)glPointParameterfvEXT
, "glPointParameterfvEXT" },
142 { (PROC
)glLockArraysEXT
, "glLockArraysEXT" },
143 { (PROC
)glUnlockArraysEXT
, "glUnlockArraysEXT" },
147 //---------------------------------------------------------------------------
148 // WMesa Internal Functions
149 //---------------------------------------------------------------------------
151 #define PAGE_FILE 0xffffffff
154 #define REDSHIFT 0x00
155 #define GREENBITS 0x03
156 #define GREENSHIFT 0x03
157 #define BLUEBITS 0x02
158 #define BLUESHIFT 0x06
160 typedef struct _dibSection
{
165 } WMDIBSECTION
, *PWMDIBSECTION
;
167 typedef struct wmesa_context
{
171 HPALETTE hOldPalette
;
176 // 3D projection stuff
184 GLboolean db_flag
; //* double buffered?
185 GLboolean rgb_flag
; //* RGB mode?
186 GLboolean dither_flag
; //* use dither when 256 color mode for RGB?
187 GLuint depth
; //* bits per pixel (1, 8, 24, etc)
188 ULONG pixel
; // current color index or RGBA pixel value
189 ULONG clearpixel
; //* pixel for clearing the color buffers
190 PBYTE ScreenMem
; // WinG memory
191 BITMAPINFO
*IndexFormat
;
192 HPALETTE hPal
; // Current Palette
193 HPALETTE hPalHalfTone
;
200 HBITMAP Old_Compat_BM
;
201 HBITMAP Compat_BM
; // Bitmap for double buffering
213 // We always double-buffer, for performance reasons, but
214 // we need to know which of SwapBuffers() or glFlush() to
215 // handle. If we're emulating, then we update on Flush(),
216 // otherwise we update on SwapBufers(). KeithH
217 BOOL bEmulateSingleBuffer
;
218 } WMesaContext
, *PWMC
;
220 #define GLD_GET_WMESA_DRIVER(c) (WMesaContext*)(c)->glPriv
223 GLint stereo_flag
= 0 ;
225 /* If we are double-buffering, we want to get the DC for the
226 * off-screen DIB, otherwise the DC for the window.
228 #define DD_GETDC ((Current->db_flag) ? Current->dib.hDC : Current->hDC )
231 #define FLIP(Y) (Current->height-(Y)-1)
233 struct DISPLAY_OPTIONS
{
240 struct DISPLAY_OPTIONS displayOptions
;
242 //---------------------------------------------------------------------------
244 static unsigned char threeto8
[8] = {
245 0, 0111>>1, 0222>>1, 0333>>1, 0444>>1, 0555>>1, 0666>>1, 0377
248 static unsigned char twoto8
[4] = {
252 static unsigned char oneto8
[2] = {
256 //---------------------------------------------------------------------------
258 BYTE
DITHER_RGB_2_8BIT( int red
, int green
, int blue
, int pixel
, int scanline
)
260 char unsigned redtemp
, greentemp
, bluetemp
, paletteindex
;
262 //*** now, look up each value in the halftone matrix
263 //*** using an 8x8 ordered dither.
264 redtemp
= aDividedBy51
[red
]
265 + (aModulo51
[red
] > aHalftone8x8
[(pixel
%8)*8
267 greentemp
= aDividedBy51
[(char unsigned)green
]
268 + (aModulo51
[green
] > aHalftone8x8
[
269 (pixel
%8)*8 + scanline
%8]);
270 bluetemp
= aDividedBy51
[(char unsigned)blue
]
271 + (aModulo51
[blue
] > aHalftone8x8
[
272 (pixel
%8)*8 +scanline
%8]);
274 //*** recombine the halftoned rgb values into a palette index
276 redtemp
+ aTimes6
[greentemp
] + aTimes36
[bluetemp
];
278 //*** and translate through the wing halftone palette
279 //*** translation vector to give the correct value.
280 return aWinGHalftoneTranslation
[paletteindex
];
283 //---------------------------------------------------------------------------
285 static unsigned char componentFromIndex(UCHAR i
, UINT nbits
, UINT shift
)
302 return threeto8
[val
];
309 //---------------------------------------------------------------------------
312 void wmSetPixel(PWMC pwc
, int iScanLine
, int iPixel
, BYTE r
, BYTE g
, BYTE b
)
314 WMesaContext
*Current
= pwc
;
316 // Test for invalid scanline parameter. KeithH
317 if ((iScanLine
< 0) || (iScanLine
>= pwc
->height
))
320 if (Current
->db_flag
) {
321 LPBYTE lpb
= pwc
->pbPixels
;
322 UINT nBypp
= pwc
->cColorBits
>> 3;
323 UINT nOffset
= iPixel
% nBypp
;
325 lpb
+= pwc
->ScanWidth
* iScanLine
;
326 lpb
+= iPixel
* nBypp
;
330 *lpb
= DITHER_RGB_2_8BIT(r
,g
,b
,iScanLine
,iPixel
);
335 *((LPWORD
)lpb
) = BGR16(r
,g
,b
);
337 *((LPDWORD
)lpb
) = BGR24(r
,g
,b
);
339 *((LPDWORD
)lpb
) = BGR32(r
,g
,b
);
342 SetPixel(Current
->hDC
, iPixel
, iScanLine
, RGB(r
,g
,b
));
346 //---------------------------------------------------------------------------
348 void wmCreateDIBSection(
350 PWMC pwc
, // handle of device context
351 CONST BITMAPINFO
*pbmi
, // bitmap size, format, and color data
352 UINT iUsage
// color data type indicator: RGB values or palette indices
357 UINT nBypp
= pwc
->cColorBits
/ 8;
360 dwScanWidth
= (((pwc
->ScanWidth
* nBypp
)+ 3) & ~3);
362 pwc
->ScanWidth
=pwc
->pitch
= dwScanWidth
;
365 pwc
->ScanWidth
= 2* pwc
->pitch
;
367 dwSize
= sizeof(BITMAPINFO
) + (dwScanWidth
* pwc
->height
);
369 pwc
->dib
.hFileMap
= CreateFileMapping((HANDLE
)PAGE_FILE
,
371 PAGE_READWRITE
| SEC_COMMIT
,
376 if (!pwc
->dib
.hFileMap
)
379 pwc
->dib
.base
= MapViewOfFile(pwc
->dib
.hFileMap
,
386 CloseHandle(pwc
->dib
.hFileMap
);
391 CopyMemory(pwc
->dib
.base
, pbmi
, sizeof(BITMAPINFO
));
393 hic
= CreateIC("display", NULL
, NULL
, NULL
);
394 pwc
->dib
.hDC
= CreateCompatibleDC(hic
);
397 pwc
->hbmDIB
= CreateDIBSection(hic
,
399 (iUsage
? DIB_PAL_COLORS
: DIB_RGB_COLORS
),
403 pwc
->ScreenMem
= pwc
->addrOffScreen
= pwc
->pbPixels
;
404 pwc
->hOldBitmap
= SelectObject(pwc
->dib
.hDC
, pwc
->hbmDIB
);
412 //---------------------------------------------------------------------------
414 void wmCreatePalette( PWMC pwdc
)
416 /* Create a compressed and re-expanded 3:3:2 palette */
419 BYTE rb
, rs
, gb
, gs
, bb
, bs
;
421 pwdc
->nColors
= 0x100;
423 pPal
= (PLOGPALETTE
)malloc(sizeof(LOGPALETTE
) +
424 pwdc
->nColors
* sizeof(PALETTEENTRY
));
425 memset( pPal
, 0, sizeof(LOGPALETTE
) + pwdc
->nColors
* sizeof(PALETTEENTRY
) );
427 pPal
->palVersion
= 0x300;
438 /* Need to make two palettes: one for the screen DC and one for the DIB. */
439 pPal
->palNumEntries
= pwdc
->nColors
;
440 for (i
= 0; i
< pwdc
->nColors
; i
++) {
441 pPal
->palPalEntry
[i
].peRed
= componentFromIndex( i
, rb
, rs
);
442 pPal
->palPalEntry
[i
].peGreen
= componentFromIndex( i
, gb
, gs
);
443 pPal
->palPalEntry
[i
].peBlue
= componentFromIndex( i
, bb
, bs
);
444 pPal
->palPalEntry
[i
].peFlags
= 0;
446 pwdc
->hGLPalette
= CreatePalette( pPal
);
447 pwdc
->hPalette
= CreatePalette( pPal
);
451 pPal
->palNumEntries
= pwdc
->nColors
;
452 for (i
= 0; i
< pwdc
->nColors
; i
++) {
453 pPal
->palPalEntry
[i
].peRed
= componentFromIndex( i
, rb
, rs
);
454 pPal
->palPalEntry
[i
].peGreen
= componentFromIndex( i
, gb
, gs
);
455 pPal
->palPalEntry
[i
].peBlue
= componentFromIndex( i
, bb
, bs
);
456 pPal
->palPalEntry
[i
].peFlags
= 0;
458 pwdc
->hGLPalette
= CreatePalette( pPal
);
465 //---------------------------------------------------------------------------
467 /* This function sets the color table of a DIB section
468 * to match that of the destination DC
470 BOOL
wmSetDibColors(PWMC pwc
)
472 RGBQUAD
*pColTab
, *pRGB
;
473 PALETTEENTRY
*pPal
, *pPE
;
478 /* Build a color table in the DIB that maps to the
479 * selected palette in the DC.
481 nColors
= 1 << pwc
->cColorBits
;
482 pPal
= (PALETTEENTRY
*)malloc( nColors
* sizeof(PALETTEENTRY
));
483 memset( pPal
, 0, nColors
* sizeof(PALETTEENTRY
) );
484 GetPaletteEntries( pwc
->hGLPalette
, 0, nColors
, pPal
);
485 pColTab
= (RGBQUAD
*)malloc( nColors
* sizeof(RGBQUAD
));
486 for (i
= 0, pRGB
= pColTab
, pPE
= pPal
; i
< nColors
; i
++, pRGB
++, pPE
++) {
487 pRGB
->rgbRed
= pPE
->peRed
;
488 pRGB
->rgbGreen
= pPE
->peGreen
;
489 pRGB
->rgbBlue
= pPE
->peBlue
;
492 bRet
= SetDIBColorTable(pwc
->dib
.hDC
, 0, nColors
, pColTab
);
495 dwErr
= GetLastError();
503 //---------------------------------------------------------------------------
505 static void wmSetPixelFormat( PWMC wc
, HDC hDC
)
508 wc
->cColorBits
= GetDeviceCaps(hDC
, BITSPIXEL
);
511 switch(wc
->cColorBits
){
513 if(wc
->dither_flag
!= GL_TRUE
)
514 wc
->pixelformat
= PF_INDEX8
;
516 wc
->pixelformat
= PF_DITHER8
;
519 wc
->pixelformat
= PF_5R6G5B
;
522 wc
->pixelformat
= PF_8R8G8B
;
525 wc
->pixelformat
= PF_BADFORMAT
;
529 //---------------------------------------------------------------------------
532 * This function creates the DIB section that is used for combined
535 BOOL
wmCreateBackingStore(PWMC pwc
, long lxSize
, long lySize
)
538 LPBITMAPINFO pbmi
= &(pwc
->bmi
);
541 pbmi
->bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
542 pbmi
->bmiHeader
.biWidth
= lxSize
;
543 pbmi
->bmiHeader
.biHeight
= -lySize
;
544 pbmi
->bmiHeader
.biPlanes
= 1;
546 pbmi
->bmiHeader
.biBitCount
= GetDeviceCaps(pwc
->hDC
, BITSPIXEL
);
548 pbmi
->bmiHeader
.biBitCount
= 8;
549 pbmi
->bmiHeader
.biCompression
= BI_RGB
;
550 pbmi
->bmiHeader
.biSizeImage
= 0;
551 pbmi
->bmiHeader
.biXPelsPerMeter
= 0;
552 pbmi
->bmiHeader
.biYPelsPerMeter
= 0;
553 pbmi
->bmiHeader
.biClrUsed
= 0;
554 pbmi
->bmiHeader
.biClrImportant
= 0;
556 iUsage
= (pbmi
->bmiHeader
.biBitCount
<= 8) ? DIB_PAL_COLORS
: DIB_RGB_COLORS
;
558 pwc
->cColorBits
= pbmi
->bmiHeader
.biBitCount
;
559 pwc
->ScanWidth
= pwc
->pitch
= lxSize
;
561 pwc
->height
= lySize
;
563 wmCreateDIBSection(hdc
, pwc
, pbmi
, iUsage
);
565 if ((iUsage
== DIB_PAL_COLORS
) && !(pwc
->hGLPalette
)) {
566 wmCreatePalette( pwc
);
567 wmSetDibColors( pwc
);
569 wmSetPixelFormat(pwc
, pwc
->hDC
);
573 //---------------------------------------------------------------------------
576 * Free up the dib section that was created
578 BOOL
wmDeleteBackingStore(PWMC pwc
)
580 SelectObject(pwc
->dib
.hDC
, pwc
->hOldBitmap
);
581 DeleteDC(pwc
->dib
.hDC
);
582 DeleteObject(pwc
->hbmDIB
);
583 UnmapViewOfFile(pwc
->dib
.base
);
584 CloseHandle(pwc
->dib
.hFileMap
);
588 //---------------------------------------------------------------------------
591 * Blit memory DC to screen DC
593 BOOL
wmFlush(PWMC pwc
, HDC hDC
)
598 // Now using bEmulateSingleBuffer in the calling function. KeithH
601 bRet
= BitBlt(hDC
, 0, 0, pwc
->width
, pwc
->height
,
602 pwc
->dib
.hDC
, 0, 0, SRCCOPY
);
609 //---------------------------------------------------------------------------
611 //---------------------------------------------------------------------------
613 static void flush(struct gl_context
* ctx
)
615 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
616 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
618 if((Current->rgb_flag &&!(Current->db_flag))
619 ||(!Current->rgb_flag))
621 wmFlush(Current, Current->hDC);
624 // Only flush if we're not in double-buffer mode. KeithH
625 // The demo fractal.c calls glutSwapBuffers() then glFlush()!
626 if (Current
->bEmulateSingleBuffer
) {
627 wmFlush(Current
, Current
->hDC
);
632 //---------------------------------------------------------------------------
635 * Set the color used to clear the color buffer.
637 //static void clear_color( struct gl_context* ctx, const GLchan color[4] )
638 // Changed for Mesa 5.x. KeithH
639 static void clear_color(
640 struct gl_context
* ctx
,
641 const GLfloat color
[4])
643 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
644 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
646 CLAMPED_FLOAT_TO_UBYTE(col
[0], color
[0]);
647 CLAMPED_FLOAT_TO_UBYTE(col
[1], color
[1]);
648 CLAMPED_FLOAT_TO_UBYTE(col
[2], color
[2]);
649 Current
->clearpixel
= RGB(col
[0], col
[1], col
[2]);
653 //---------------------------------------------------------------------------
657 * Clear the specified region of the color buffer using the clear color
658 * or index as specified by one of the two functions above.
660 * This procedure clears either the front and/or the back COLOR buffers.
661 * Only the "left" buffer is cleared since we are not stereo.
662 * Clearing of the other non-color buffers is left to the swrast.
663 * We also only clear the color buffers if the color masks are all 1's.
664 * Otherwise, we let swrast do it.
667 static clear(struct gl_context
* ctx
, GLbitfield mask
,
668 GLboolean all
, GLint x
, GLint y
, GLint width
, GLint height
)
670 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
671 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
675 LPDWORD lpdw
= (LPDWORD
)Current
->pbPixels
;
676 LPWORD lpw
= (LPWORD
)Current
->pbPixels
;
677 LPBYTE lpb
= Current
->pbPixels
;
679 const GLuint
*colorMask
= (GLuint
*) &ctx
->Color
.ColorMask
;
683 width
=Current
->width
;
684 height
=Current
->height
;
688 /* sanity check - can't have right(stereo) buffers */
689 assert((mask
& (DD_FRONT_RIGHT_BIT
| DD_BACK_RIGHT_BIT
)) == 0);
692 if ((mask
& (DD_FRONT_LEFT_BIT
| DD_BACK_RIGHT_BIT
)) &&
693 ctx
->DrawBuffer
->UseSoftwareAlphaBuffers
&&
694 ctx
->Color
.ColorMask
[ACOMP
]) {
695 _swrast_clear_alpha_buffers( ctx
);
698 if (*colorMask
== 0xffffffff && ctx
->Color
.IndexMask
== 0xffffffff) {
699 if (mask
& DD_BACK_LEFT_BIT
) {
700 /* Double-buffering - clear back buffer */
701 UINT nBypp
= Current
->cColorBits
/ 8;
705 assert(Current
->db_flag
==GL_TRUE
); /* we'd better be double buffer */
707 iSize
= Current
->width
/4;
708 bColor
= BGR8(GetRValue(Current
->clearpixel
),
709 GetGValue(Current
->clearpixel
),
710 GetBValue(Current
->clearpixel
));
711 wColor
= MAKEWORD(bColor
,bColor
);
712 dwColor
= MAKELONG(wColor
, wColor
);
715 iSize
= Current
->width
/ 2;
716 wColor
= BGR16(GetRValue(Current
->clearpixel
),
717 GetGValue(Current
->clearpixel
),
718 GetBValue(Current
->clearpixel
));
719 dwColor
= MAKELONG(wColor
, wColor
);
722 iSize
= Current
->width
;
723 dwColor
= BGR32(GetRValue(Current
->clearpixel
),
724 GetGValue(Current
->clearpixel
),
725 GetBValue(Current
->clearpixel
));
735 /* This is the 24bit case */
737 iSize
= Current
->width
*3/4;
738 dwColor
= BGR24(GetRValue(Current
->clearpixel
),
739 GetGValue(Current
->clearpixel
),
740 GetBValue(Current
->clearpixel
));
754 /* copy cleared line to other lines in buffer */
756 memcpy(lpb
, Current
->pbPixels
, iSize
*4);
757 lpb
+= Current
->ScanWidth
;
761 mask
&= ~DD_BACK_LEFT_BIT
;
762 } /* double-buffer */
764 if (mask
& DD_FRONT_LEFT_BIT
) {
767 HPEN Pen
=CreatePen(PS_SOLID
,1,Current
->clearpixel
);
768 HBRUSH Brush
=CreateSolidBrush(Current
->clearpixel
);
769 HPEN Old_Pen
=SelectObject(DC
,Pen
);
770 HBRUSH Old_Brush
=SelectObject(DC
,Brush
);
771 Rectangle(DC
,x
,y
,x
+width
,y
+height
);
772 SelectObject(DC
,Old_Pen
);
773 SelectObject(DC
,Old_Brush
);
777 mask
&= ~DD_FRONT_LEFT_BIT
;
778 } /* single-buffer */
779 } /* if masks are all 1's */
781 /* Call swrast if there is anything left to clear (like DEPTH) */
783 _swrast_Clear( ctx
, mask
, all
, x
, y
, width
, height
);
787 //---------------------------------------------------------------------------
790 static void enable( struct gl_context
* ctx
, GLenum pname
, GLboolean enable
)
792 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
793 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
798 if (pname
== GL_DITHER
) {
799 if(enable
== GL_FALSE
){
800 Current
->dither_flag
= GL_FALSE
;
801 if(Current
->cColorBits
== 8)
802 Current
->pixelformat
= PF_INDEX8
;
805 if (Current
->rgb_flag
&& Current
->cColorBits
== 8){
806 Current
->pixelformat
= PF_DITHER8
;
807 Current
->dither_flag
= GL_TRUE
;
810 Current
->dither_flag
= GL_FALSE
;
815 //---------------------------------------------------------------------------
817 static GLboolean
set_draw_buffer( struct gl_context
* ctx
, GLenum mode
)
819 /* TODO: this could be better */
820 if (mode
==GL_FRONT_LEFT
|| mode
==GL_BACK_LEFT
) {
828 //---------------------------------------------------------------------------
831 static void set_read_buffer(struct gl_context
*ctx
, struct gl_framebuffer
*colorBuffer
,
839 //---------------------------------------------------------------------------
842 /* Return characteristics of the output buffer. */
843 //static void buffer_size( struct gl_context* ctx, GLuint *width, GLuint *height )
844 // Altered for Mesa 5.x. KeithH
845 static void buffer_size(
846 struct gl_framebuffer
*buffer
,
850 // For some reason the context is not passed into this function.
851 // Therefore we have to explicitly retrieve it.
852 GET_CURRENT_CONTEXT(ctx
);
854 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
855 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
859 GetClientRect(Current
->Window
,&CR
);
864 New_Size
=((*width
)!=Current
->width
) || ((*height
)!=Current
->height
);
867 Current
->width
=*width
;
868 Current
->height
=*height
;
869 Current
->ScanWidth
=Current
->width
;
870 if ((Current
->ScanWidth
%sizeof(long))!=0)
871 Current
->ScanWidth
+=(sizeof(long)-(Current
->ScanWidth
%sizeof(long)));
873 if (Current
->db_flag
){
874 if (Current
->rgb_flag
==GL_TRUE
&& Current
->dither_flag
!=GL_TRUE
){
875 wmDeleteBackingStore(Current
);
876 wmCreateBackingStore(Current
, Current
->width
, Current
->height
);
885 /**********************************************************************/
886 /***** Accelerated point, line, polygon rendering *****/
887 /**********************************************************************/
889 /* Accelerated routines are not implemented in 4.0. See OSMesa for ideas. */
891 static void fast_rgb_points( struct gl_context
* ctx
, GLuint first
, GLuint last
)
895 //---------------------------------------------------------------------------
897 /* Return pointer to accelerated points function */
898 extern tnl_points_func
choose_points_function( struct gl_context
* ctx
)
903 //---------------------------------------------------------------------------
905 static void fast_flat_rgb_line( struct gl_context
* ctx
, GLuint v0
,
906 GLuint v1
, GLuint pv
)
910 //---------------------------------------------------------------------------
912 static tnl_line_func
choose_line_function( struct gl_context
* ctx
)
917 /**********************************************************************/
918 /***** Span-based pixel drawing *****/
919 /**********************************************************************/
922 /* Write a horizontal span of 32-bit color-index pixels with a boolean mask. */
923 static void write_ci32_span( const struct gl_context
* ctx
,
924 GLuint n
, GLint x
, GLint y
,
925 const GLuint index
[],
926 const GLubyte mask
[] )
928 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
929 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
931 PBYTE Mem
=Current
->ScreenMem
+FLIP(y
)*Current
->ScanWidth
+x
;
932 assert(Current
->rgb_flag
==GL_FALSE
);
939 //---------------------------------------------------------------------------
941 /* Write a horizontal span of 8-bit color-index pixels with a boolean mask. */
942 static void write_ci8_span( const struct gl_context
* ctx
,
943 GLuint n
, GLint x
, GLint y
,
944 const GLubyte index
[],
945 const GLubyte mask
[] )
947 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
948 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
950 PBYTE Mem
=Current
->ScreenMem
+FLIP(y
)*Current
->ScanWidth
+x
;
951 assert(Current
->rgb_flag
==GL_FALSE
);
958 //---------------------------------------------------------------------------
962 * Write a horizontal span of pixels with a boolean mask. The current
963 * color index is used for all pixels.
965 static void write_mono_ci_span(const struct gl_context
* ctx
,
966 GLuint n
,GLint x
,GLint y
,
967 GLuint colorIndex
, const GLubyte mask
[])
969 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
970 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
972 BYTE
*Mem
=Current
->ScreenMem
+FLIP(y
)*Current
->ScanWidth
+x
;
973 assert(Current
->rgb_flag
==GL_FALSE
);
979 //---------------------------------------------------------------------------
982 * To improve the performance of this routine, frob the data into an actual
983 * scanline and call bitblt on the complete scan line instead of SetPixel.
986 /* Write a horizontal span of RGBA color pixels with a boolean mask. */
987 static void write_rgba_span( const struct gl_context
* ctx
, GLuint n
, GLint x
, GLint y
,
988 const GLubyte rgba
[][4], const GLubyte mask
[] )
990 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
991 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
994 if (pwc
->rgb_flag
==GL_TRUE
)
1002 wmSetPixel(pwc
, y
, x
+ i
,
1003 rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]);
1007 wmSetPixel(pwc
, y
, x
+ i
,
1008 rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
1015 BYTE
*Mem
=Current
->ScreenMem
+y
*Current
->ScanWidth
+x
;
1020 Mem
[i
] = GetNearestPaletteIndex(Current
->hPal
,
1027 Mem
[i
] = GetNearestPaletteIndex(Current
->hPal
,
1035 //---------------------------------------------------------------------------
1037 /* Write a horizontal span of RGB color pixels with a boolean mask. */
1038 static void write_rgb_span( const struct gl_context
* ctx
,
1039 GLuint n
, GLint x
, GLint y
,
1040 const GLubyte rgb
[][3], const GLubyte mask
[] )
1042 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
1043 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
1046 if (pwc
->rgb_flag
==GL_TRUE
)
1054 wmSetPixel(pwc
, y
, x
+ i
,
1055 rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]);
1059 wmSetPixel(pwc
, y
, x
+ i
,
1060 rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
1067 BYTE
*Mem
=Current
->ScreenMem
+y
*Current
->ScanWidth
+x
;
1072 Mem
[i
] = GetNearestPaletteIndex(Current
->hPal
,
1079 Mem
[i
] = GetNearestPaletteIndex(Current
->hPal
,
1087 //---------------------------------------------------------------------------
1090 * Write a horizontal span of pixels with a boolean mask. The current color
1091 * is used for all pixels.
1093 static void write_mono_rgba_span( const struct gl_context
* ctx
,
1094 GLuint n
, GLint x
, GLint y
,
1095 const GLchan color
[4], const GLubyte mask
[])
1097 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
1098 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
1099 ULONG pixel
= RGB( color
[RCOMP
], color
[GCOMP
], color
[BCOMP
] );
1103 assert(Current
->rgb_flag
==GL_TRUE
);
1105 if(Current
->rgb_flag
==GL_TRUE
){
1108 wmSetPixel(pwc
,y
,x
+i
,color
[RCOMP
], color
[GCOMP
], color
[BCOMP
]);
1113 SetPixel(DC
, y
, x
+i
, pixel
);
1120 /**********************************************************************/
1121 /***** Array-based pixel drawing *****/
1122 /**********************************************************************/
1125 /* Write an array of 32-bit index pixels with a boolean mask. */
1126 static void write_ci32_pixels( const struct gl_context
* ctx
,
1127 GLuint n
, const GLint x
[], const GLint y
[],
1128 const GLuint index
[], const GLubyte mask
[] )
1130 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
1131 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
1133 assert(Current
->rgb_flag
==GL_FALSE
);
1134 for (i
=0; i
<n
; i
++) {
1136 BYTE
*Mem
=Current
->ScreenMem
+FLIP(y
[i
])*Current
->ScanWidth
+x
[i
];
1143 //---------------------------------------------------------------------------
1147 * Write an array of pixels with a boolean mask. The current color
1148 * index is used for all pixels.
1150 static void write_mono_ci_pixels( const struct gl_context
* ctx
,
1152 const GLint x
[], const GLint y
[],
1153 GLuint colorIndex
, const GLubyte mask
[] )
1155 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
1156 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
1158 assert(Current
->rgb_flag
==GL_FALSE
);
1159 for (i
=0; i
<n
; i
++) {
1161 BYTE
*Mem
=Current
->ScreenMem
+FLIP(y
[i
])*Current
->ScanWidth
+x
[i
];
1168 //---------------------------------------------------------------------------
1171 /* Write an array of RGBA pixels with a boolean mask. */
1172 static void write_rgba_pixels( const struct gl_context
* ctx
,
1173 GLuint n
, const GLint x
[], const GLint y
[],
1174 const GLubyte rgba
[][4], const GLubyte mask
[] )
1176 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
1177 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
1181 assert(Current
->rgb_flag
==GL_TRUE
);
1184 wmSetPixel(pwc
, FLIP(y
[i
]), x
[i
],
1185 rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]);
1190 //---------------------------------------------------------------------------
1194 * Write an array of pixels with a boolean mask. The current color
1195 * is used for all pixels.
1197 static void write_mono_rgba_pixels( const struct gl_context
* ctx
,
1199 const GLint x
[], const GLint y
[],
1200 const GLchan color
[4],
1201 const GLubyte mask
[] )
1203 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
1204 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
1208 assert(Current
->rgb_flag
==GL_TRUE
);
1211 wmSetPixel(pwc
, FLIP(y
[i
]),x
[i
],color
[RCOMP
],
1212 color
[GCOMP
], color
[BCOMP
]);
1216 /**********************************************************************/
1217 /***** Read spans/arrays of pixels *****/
1218 /**********************************************************************/
1220 /* Read a horizontal span of color-index pixels. */
1221 static void read_ci32_span( const struct gl_context
* ctx
, GLuint n
, GLint x
, GLint y
,
1224 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
1225 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
1227 BYTE
*Mem
=Current
->ScreenMem
+FLIP(y
)*Current
->ScanWidth
+x
;
1228 assert(Current
->rgb_flag
==GL_FALSE
);
1233 //---------------------------------------------------------------------------
1235 /* Read an array of color index pixels. */
1236 static void read_ci32_pixels( const struct gl_context
* ctx
,
1237 GLuint n
, const GLint x
[], const GLint y
[],
1238 GLuint indx
[], const GLubyte mask
[] )
1240 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
1241 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
1243 assert(Current
->rgb_flag
==GL_FALSE
);
1244 for (i
=0; i
<n
; i
++) {
1246 indx
[i
]=*(Current
->ScreenMem
+FLIP(y
[i
])*Current
->ScanWidth
+x
[i
]);
1251 //---------------------------------------------------------------------------
1253 /* Read a horizontal span of color pixels. */
1254 static void read_rgba_span( const struct gl_context
* ctx
,
1255 GLuint n
, GLint x
, GLint y
,
1258 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
1259 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
1263 assert(Current
->rgb_flag
==GL_TRUE
);
1264 y
= Current
->height
- y
- 1;
1265 for (i
=0; i
<n
; i
++) {
1266 Color
=GetPixel(DC
,x
+i
,y
);
1267 rgba
[i
][RCOMP
] = GetRValue(Color
);
1268 rgba
[i
][GCOMP
] = GetGValue(Color
);
1269 rgba
[i
][BCOMP
] = GetBValue(Color
);
1270 rgba
[i
][ACOMP
] = 255;
1275 //---------------------------------------------------------------------------
1277 /* Read an array of color pixels. */
1278 static void read_rgba_pixels( const struct gl_context
* ctx
,
1279 GLuint n
, const GLint x
[], const GLint y
[],
1280 GLubyte rgba
[][4], const GLubyte mask
[] )
1282 GLD_context
*gldCtx
= GLD_GET_CONTEXT(ctx
);
1283 WMesaContext
*Current
= GLD_GET_WMESA_DRIVER(gldCtx
);
1287 assert(Current
->rgb_flag
==GL_TRUE
);
1288 for (i
=0; i
<n
; i
++) {
1290 GLint y2
= Current
->height
- y
[i
] - 1;
1291 Color
=GetPixel(DC
,x
[i
],y2
);
1292 rgba
[i
][RCOMP
] = GetRValue(Color
);
1293 rgba
[i
][GCOMP
] = GetGValue(Color
);
1294 rgba
[i
][BCOMP
] = GetBValue(Color
);
1295 rgba
[i
][ACOMP
] = 255;
1301 //---------------------------------------------------------------------------
1303 static void wmesa_update_state(
1304 struct gl_context
*ctx
,
1307 _swrast_InvalidateState( ctx
, new_state
);
1308 _swsetup_InvalidateState( ctx
, new_state
);
1309 _vbo_InvalidateState( ctx
, new_state
);
1310 _tnl_InvalidateState( ctx
, new_state
);
1313 //---------------------------------------------------------------------------
1315 static void wmesa_viewport(
1316 struct gl_context
*ctx
,
1322 // ctx->Driver.ResizeBuffersMESA(ctx);
1325 //---------------------------------------------------------------------------
1327 static void wmesa_update_state_first_time(
1328 struct gl_context
*ctx
,
1331 struct swrast_device_driver
*swdd
= _swrast_GetDeviceDriverReference( ctx
);
1332 TNLcontext
*tnl
= TNL_CONTEXT(ctx
);
1334 _mesa_init_driver_functions(&ctx
->Driver
);
1337 * XXX these function pointers could be initialized just once during
1338 * context creation since they don't depend on any state changes.
1339 * kws - This is true - this function gets called a lot and it
1340 * would be good to minimize setting all this when not needed.
1342 // Good idea, so I'll do it. KeithH. :-)
1344 ctx
->Driver
.GetString
= _gldGetStringGeneric
;
1345 ctx
->Driver
.UpdateState
= wmesa_update_state
;
1346 ctx
->Driver
.DrawBuffer
= set_draw_buffer
;
1347 ctx
->Driver
.ResizeBuffers
= _swrast_alloc_buffers
;
1348 ctx
->Driver
.GetBufferSize
= buffer_size
;
1350 ctx
->Driver
.Viewport
= wmesa_viewport
;
1352 ctx
->Driver
.Clear
= clear
;
1354 ctx
->Driver
.Flush
= flush
;
1355 ctx
->Driver
.ClearColor
= clear_color
;
1356 ctx
->Driver
.Enable
= enable
;
1359 // Does not apply for Mesa 5.x
1360 //ctx->Driver.BaseCompressedTexFormat = _mesa_base_compressed_texformat;
1361 //ctx->Driver.CompressedTextureSize = _mesa_compressed_texture_size;
1362 //ctx->Driver.GetCompressedTexImage = _mesa_get_compressed_teximage;
1364 swdd
->SetBuffer
= set_read_buffer
;
1367 /* Pixel/span writing functions: */
1368 swdd
->WriteRGBASpan
= write_rgba_span
;
1369 swdd
->WriteRGBSpan
= write_rgb_span
;
1370 swdd
->WriteMonoRGBASpan
= write_mono_rgba_span
;
1371 swdd
->WriteRGBAPixels
= write_rgba_pixels
;
1372 swdd
->WriteMonoRGBAPixels
= write_mono_rgba_pixels
;
1373 swdd
->WriteCI32Span
= write_ci32_span
;
1374 swdd
->WriteCI8Span
= write_ci8_span
;
1375 swdd
->WriteMonoCISpan
= write_mono_ci_span
;
1376 swdd
->WriteCI32Pixels
= write_ci32_pixels
;
1377 swdd
->WriteMonoCIPixels
= write_mono_ci_pixels
;
1379 swdd
->ReadCI32Span
= read_ci32_span
;
1380 swdd
->ReadRGBASpan
= read_rgba_span
;
1381 swdd
->ReadCI32Pixels
= read_ci32_pixels
;
1382 swdd
->ReadRGBAPixels
= read_rgba_pixels
;
1385 tnl
->Driver
.RunPipeline
= _tnl_run_pipeline
;
1387 wmesa_update_state(ctx
, new_state
);
1390 //---------------------------------------------------------------------------
1391 // Driver interface functions
1392 //---------------------------------------------------------------------------
1394 BOOL
gldCreateDrawable_MesaSW(
1396 BOOL bPersistantInterface
,
1397 BOOL bPersistantBuffers
)
1400 GLboolean true_color_flag
;
1401 GLboolean rgb_flag
= GL_TRUE
;
1402 GLboolean db_flag
= GL_TRUE
;
1407 c
= (struct wmesa_context
* ) calloc(1,sizeof(struct wmesa_context
));
1414 c
->Window
= pCtx
->hWnd
;
1416 true_color_flag
= GetDeviceCaps(pCtx
->hDC
, BITSPIXEL
) > 8;
1420 if ((true_color_flag
==GL_FALSE
) && (rgb_flag
== GL_TRUE
)){
1421 c
->dither_flag
= GL_TRUE
;
1422 c
->hPalHalfTone
= WinGCreateHalftonePalette();
1425 c
->dither_flag
= GL_FALSE
;
1427 c
->dither_flag
= GL_FALSE
;
1431 if (rgb_flag
==GL_FALSE
)
1433 c
->rgb_flag
= GL_FALSE
;
1435 /* Old WinG stuff???? */
1436 c
->db_flag
= db_flag
=GL_TRUE
; /* WinG requires double buffering */
1437 printf("Single buffer is not supported in color index mode, ",
1438 "setting to double buffer.\n");
1443 c
->rgb_flag
= GL_TRUE
;
1446 // db_flag = pCtx->lpPF->pfd.dwFlags & PFD_DOUBLEBUFFER ? GL_TRUE : GL_FALSE;
1447 db_flag
= GL_TRUE
; // Force double-buffer
1450 /* Double buffered */
1452 wmCreateBackingStore(c
, pCtx
->dwWidth
, pCtx
->dwHeight
);
1456 /* Single Buffered */
1461 c
->bEmulateSingleBuffer
= (pCtx
->lpPF
->pfd
.dwFlags
& PFD_DOUBLEBUFFER
)
1467 //---------------------------------------------------------------------------
1469 BOOL
gldResizeDrawable_MesaSW(
1471 BOOL bDefaultDriver
,
1472 BOOL bPersistantInterface
,
1473 BOOL bPersistantBuffers
)
1485 c
->Window
= ctx
->hWnd
;
1486 // c->width = ctx->dwWidth;
1487 // c->height = ctx->dwHeight;
1490 wmDeleteBackingStore(c
);
1491 wmCreateBackingStore(c
, ctx
->dwWidth
, ctx
->dwHeight
);
1497 //---------------------------------------------------------------------------
1499 BOOL
gldDestroyDrawable_MesaSW(
1511 if (c
->hPalHalfTone
!= NULL
)
1512 DeleteObject(c
->hPalHalfTone
);
1515 wmDeleteBackingStore(c
);
1524 //---------------------------------------------------------------------------
1526 BOOL
gldCreatePrivateGlobals_MesaSW(void)
1528 // Mesa Software driver needs no private globals
1532 //---------------------------------------------------------------------------
1534 BOOL
gldDestroyPrivateGlobals_MesaSW(void)
1536 // Mesa Software driver needs no private globals
1540 //---------------------------------------------------------------------------
1542 BOOL
gldBuildPixelformatList_MesaSW(void)
1544 // Release any existing pixelformat list
1549 glb
.nPixelFormatCount
= 0;
1552 glb
.lpPF
= (DGL_pixelFormat
*)calloc(2, sizeof(DGL_pixelFormat
));
1553 if (glb
.lpPF
== NULL
)
1556 memcpy(&glb
.lpPF
[0], &pfTemplateMesaSW
, sizeof(DGL_pixelFormat
));
1557 glb
.lpPF
[0].pfd
.dwFlags
&= ~PFD_DOUBLEBUFFER
; // Remove doublebuffer flag
1559 memcpy(&glb
.lpPF
[1], &pfTemplateMesaSW
, sizeof(DGL_pixelFormat
));
1560 glb
.nPixelFormatCount
= 2;
1562 // Mark list as 'current'
1563 glb
.bPixelformatsDirty
= FALSE
;
1568 //---------------------------------------------------------------------------
1570 BOOL
gldInitialiseMesa_MesaSW(
1573 struct gl_context
*ctx
;
1580 // Set max texture size to 256
1581 ctx
->Const
.MaxTextureLevels
= 8;
1583 // Multitexture enable/disable
1584 ctx
->Const
.MaxTextureUnits
= (glb
.bMultitexture
) ? MAX_TEXTURE_UNITS
: 1;
1586 /* Initialize the software rasterizer and helper modules.*/
1588 // Added this to force max texture diminsion to 256. KeithH
1589 ctx
->Const
.MaxTextureLevels
= 8;
1590 ctx
->Const
.MaxDrawBuffers
= 1;
1592 _mesa_enable_sw_extensions(ctx
);
1593 _mesa_enable_imaging_extensions(ctx
);
1594 _mesa_enable_1_3_extensions(ctx
);
1596 // _swrast_CreateContext( ctx );
1597 // _vbo_CreateContext( ctx );
1598 // _tnl_CreateContext( ctx );
1599 // _swsetup_CreateContext( ctx );
1601 _swsetup_Wakeup( ctx
);
1603 wmesa_update_state_first_time(ctx
, ~0);
1608 //---------------------------------------------------------------------------
1610 BOOL
gldSwapBuffers_MesaSW(
1624 /* If we're swapping the buffer associated with the current context
1625 * we have to flush any pending rendering commands first.
1628 // Altered to respect bEmulateSingleBuffer. KeithH
1630 if (!c
->bEmulateSingleBuffer
)
1636 //---------------------------------------------------------------------------
1638 PROC
gldGetProcAddress_MesaSW(
1644 for (i
=0; GLD_extList
[i
].proc
; i
++) {
1645 if (!strcmp(a
, GLD_extList
[i
].name
)) {
1646 proc
= GLD_extList
[i
].proc
;
1651 gldLogPrintf(GLDLOG_INFO
, "GetProcAddress: %s (%s)", a
, proc
? "OK" : "Failed");
1656 //---------------------------------------------------------------------------
1658 BOOL
gldGetDisplayMode_MesaSW(
1660 GLD_displayMode
*glddm
)
1668 // A bit hacky... KeithH
1671 hdcDesktop
= GetDC(NULL
);
1672 glddm
->Width
= GetDeviceCaps(hdcDesktop
, HORZRES
);
1673 glddm
->Height
= GetDeviceCaps(hdcDesktop
, VERTRES
);
1674 glddm
->BPP
= GetDeviceCaps(hdcDesktop
, BITSPIXEL
);
1676 ReleaseDC(0, hdcDesktop
);
1681 //---------------------------------------------------------------------------