ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

dglpf.c
Go to the documentation of this file.
00001 /****************************************************************************
00002 *
00003 *                        Mesa 3-D graphics library
00004 *                        Direct3D Driver Interface
00005 *
00006 *  ========================================================================
00007 *
00008 *   Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
00009 *
00010 *   Permission is hereby granted, free of charge, to any person obtaining a
00011 *   copy of this software and associated documentation files (the "Software"),
00012 *   to deal in the Software without restriction, including without limitation
00013 *   the rights to use, copy, modify, merge, publish, distribute, sublicense,
00014 *   and/or sell copies of the Software, and to permit persons to whom the
00015 *   Software is furnished to do so, subject to the following conditions:
00016 *
00017 *   The above copyright notice and this permission notice shall be included
00018 *   in all copies or substantial portions of the Software.
00019 *
00020 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00021 *   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00022 *   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00023 *   SCITECH SOFTWARE INC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
00024 *   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
00025 *   OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00026 *   SOFTWARE.
00027 *
00028 *  ========================================================================
00029 *
00030 * Language:     ANSI C
00031 * Environment:  Windows 9x (Win32)
00032 *
00033 * Description:  Pixel Formats.
00034 *
00035 ****************************************************************************/
00036 
00037 #include "dglpf.h"
00038 
00039 #ifdef _USE_GLD3_WGL
00040 #include "gld_driver.h"
00041 #endif
00042 
00043 // ***********************************************************************
00044 
00045 char    szColorDepthWarning[] =
00046 "GLDirect does not support the current desktop\n\
00047 color depth.\n\n\
00048 You may need to change the display resolution to\n\
00049 16 bits per pixel or higher color depth using\n\
00050 the Windows Display Settings control panel\n\
00051 before running this OpenGL application.\n";
00052 
00053 // ***********************************************************************
00054 // This pixel format will be used as a template when compiling the list
00055 // of pixel formats supported by the hardware. Many fields will be
00056 // filled in at runtime.
00057 // PFD flag defaults are upgraded to match ChoosePixelFormat() -- DaveM
00058 DGL_pixelFormat pfTemplateHW =
00059 {
00060     {
00061     sizeof(PIXELFORMATDESCRIPTOR),  // Size of the data structure
00062         1,                          // Structure version - should be 1
00063                                     // Flags:
00064         PFD_DRAW_TO_WINDOW |        // The buffer can draw to a window or device surface.
00065         PFD_DRAW_TO_BITMAP |        // The buffer can draw to a bitmap. (DaveM)
00066         PFD_SUPPORT_GDI |           // The buffer supports GDI drawing. (DaveM)
00067         PFD_SUPPORT_OPENGL |        // The buffer supports OpenGL drawing.
00068         PFD_DOUBLEBUFFER |          // The buffer is double-buffered.
00069         0,                          // Placeholder for easy commenting of above flags
00070         PFD_TYPE_RGBA,              // Pixel type RGBA.
00071         16,                         // Total colour bitplanes (excluding alpha bitplanes)
00072         5, 0,                       // Red bits, shift
00073         5, 5,                       // Green bits, shift
00074         5, 10,                      // Blue bits, shift
00075         0, 0,                       // Alpha bits, shift (destination alpha)
00076         0,                          // Accumulator bits (total)
00077         0, 0, 0, 0,                 // Accumulator bits: Red, Green, Blue, Alpha
00078         0,                          // Depth bits
00079         0,                          // Stencil bits
00080         0,                          // Number of auxiliary buffers
00081         0,                          // Layer type
00082         0,                          // Specifies the number of overlay and underlay planes.
00083         0,                          // Layer mask
00084         0,                          // Specifies the transparent color or index of an underlay plane.
00085         0                           // Damage mask
00086     },
00087     -1, // No depth/stencil buffer
00088 };
00089 
00090 // ***********************************************************************
00091 // Return the count of the number of bits in a Bit Mask.
00092 int BitCount(
00093     DWORD dw)
00094 {
00095     int i;
00096 
00097     if (dw == 0)
00098         return 0;   // account for non-RGB mode
00099 
00100     for (i=0; dw; dw=dw>>1)
00101         i += (dw & 1);
00102     return i;
00103 }
00104 
00105 // ***********************************************************************
00106 
00107 DWORD BitShift(
00108     DWORD dwMaskIn)
00109 {
00110     DWORD dwShift, dwMask;
00111 
00112     if (dwMaskIn == 0)
00113         return 0;   // account for non-RGB mode
00114 
00115     for (dwShift=0, dwMask=dwMaskIn; !(dwMask&1); dwShift++, dwMask>>=1);
00116 
00117     return dwShift;
00118 }
00119 
00120 // ***********************************************************************
00121 
00122 BOOL IsValidPFD(int iPFD)
00123 {
00124     DGL_pixelFormat *lpPF;
00125 
00126     // Validate license
00127     if (!dglValidate())
00128         return FALSE;
00129 
00130     if ((glb.lpPF == NULL) ||
00131         (glb.nPixelFormatCount == 0))
00132         return FALSE;
00133 
00134     // Check PFD range
00135     if ( (iPFD < 1) || (iPFD > glb.nPixelFormatCount) ) {
00136         ddlogMessage(DDLOG_ERROR, "PFD out of range\n");
00137         return FALSE; // PFD is invalid
00138     }
00139 
00140     // Make a pointer to the pixel format
00141     lpPF = &glb.lpPF[iPFD-1];
00142 
00143     // Check size
00144     if (lpPF->pfd.nSize != sizeof(PIXELFORMATDESCRIPTOR)) {
00145         ddlogMessage(DDLOG_ERROR, "Bad PFD size\n");
00146         return FALSE; // PFD is invalid
00147     }
00148 
00149     // Check version
00150     if (lpPF->pfd.nVersion != 1) {
00151         ddlogMessage(DDLOG_ERROR, "PFD is not Version 1\n");
00152         return FALSE; // PFD is invalid
00153     }
00154 
00155     return TRUE; // PFD is valid
00156 }
00157 
00158 // ***********************************************************************
00159 
00160 #ifndef _USE_GLD3_WGL
00161 
00162 int     iEnumCount;         // Enumeration count
00163 DWORD   dwDisplayBitDepth;  // Bit depth of current display mode
00164 
00165 // ***********************************************************************
00166 
00167 HRESULT WINAPI EnumDisplayModesCallback(
00168     DDSURFACEDESC2* pddsd,
00169     void *pvContext)
00170 {
00171     DWORD           dwModeDepth;
00172     DDSURFACEDESC2  *lpDisplayMode;
00173     char            buf[32];
00174 
00175     // Check parameters
00176     if (pddsd == NULL)
00177         return DDENUMRET_CANCEL;
00178 
00179     dwModeDepth = pddsd->ddpfPixelFormat.dwRGBBitCount;
00180     lpDisplayMode = (DDSURFACEDESC2 *)pvContext;
00181 
00182     // Check mode for compatability with device.
00183     if (dwModeDepth != dwDisplayBitDepth)
00184         return DDENUMRET_OK;
00185 
00186     if (lpDisplayMode != NULL) {
00187         memcpy(&lpDisplayMode[iEnumCount], pddsd, sizeof(DDSURFACEDESC2));
00188         sprintf(buf, TEXT("Mode: %ld x %ld x %ld\n"),
00189                 pddsd->dwWidth, pddsd->dwHeight, dwModeDepth);
00190         ddlogMessage(DDLOG_INFO, buf);
00191     }
00192 
00193     iEnumCount++;
00194 
00195     return DDENUMRET_OK;
00196 }
00197 
00198 // ***********************************************************************
00199 
00200 HRESULT CALLBACK d3dEnumZBufferFormatsCallback(
00201     DDPIXELFORMAT* pddpf,
00202     VOID* lpZBufferPF )
00203 {
00204     char buf[64];
00205 
00206     if(pddpf == NULL)
00207         return D3DENUMRET_CANCEL;
00208 
00209     if (pddpf->dwFlags & DDPF_ZBUFFER) {
00210         if (lpZBufferPF == NULL) {
00211             // Pass 1. Merely counting the PF
00212             glb.nZBufferPFCount++;
00213         } else {
00214             // Pass 2. Save the PF
00215             if (pddpf->dwFlags & DDPF_STENCILBUFFER) {
00216                 sprintf(buf, " %d: Z=%d S=%d\n",
00217                     iEnumCount,
00218                     pddpf->dwZBufferBitDepth,
00219                     pddpf->dwStencilBitDepth);
00220             } else {
00221                 sprintf(buf, " %d: Z=%d S=0\n",
00222                     iEnumCount,
00223                     pddpf->dwZBufferBitDepth);
00224             }
00225             ddlogMessage(DDLOG_INFO, buf);
00226 
00227             memcpy(&glb.lpZBufferPF[iEnumCount++],
00228                 pddpf,
00229                 sizeof(DDPIXELFORMAT));
00230         }
00231     }
00232 
00233     return D3DENUMRET_OK;
00234 }
00235 #endif // _USE_GLD3_WGL
00236 
00237 // ***********************************************************************
00238 
00239 BOOL IsStencilSupportBroken(LPDIRECTDRAW4 lpDD4)
00240 {
00241     DDDEVICEIDENTIFIER  dddi; // DX6 device identifier
00242     BOOL                bBroken = FALSE;
00243 
00244     // Microsoft really fucked up with the GetDeviceIdentifier function
00245     // on Windows 2000, since it locks up on stock driers on the CD. Updated
00246     // drivers from vendors appear to work, but we can't identify the drivers
00247     // without this function!!! For now we skip these tests on Windows 2000.
00248     if ((GetVersion() & 0x80000000UL) == 0)
00249         return FALSE;
00250 
00251     // Obtain device info
00252     if (FAILED(IDirectDraw4_GetDeviceIdentifier(lpDD4, &dddi, 0)))
00253         return FALSE;
00254 
00255     // Matrox G400 stencil buffer support does not draw anything in AutoCAD,
00256     // but ordinary Z buffers draw shaded models fine. (DaveM)
00257     if (dddi.dwVendorId == 0x102B) {        // Matrox
00258         if (dddi.dwDeviceId == 0x0525) {    // G400
00259             bBroken = TRUE;
00260         }
00261     }
00262 
00263     return bBroken;
00264 }
00265 
00266 // ***********************************************************************
00267 
00268 void dglBuildPixelFormatList()
00269 {
00270     int             i;
00271     char            buf[128];
00272     char            cat[8];
00273     DGL_pixelFormat *lpPF;
00274 
00275 #ifdef _USE_GLD3_WGL
00276     _gldDriver.BuildPixelformatList();
00277 #else
00278     HRESULT         hRes;
00279     IDirectDraw     *lpDD1 = NULL;
00280     IDirectDraw4    *lpDD4 = NULL;
00281     IDirect3D3      *lpD3D3 = NULL;
00282     DDSURFACEDESC2  ddsdDisplayMode;
00283 
00284     DWORD           dwRb, dwGb, dwBb, dwAb; // Bit counts
00285     DWORD           dwRs, dwGs, dwBs, dwAs; // Bit shifts
00286     DWORD           dwPixelType;            // RGB or color index
00287 
00288     // Set defaults
00289     glb.nPixelFormatCount   = 0;
00290     glb.lpPF                = NULL;
00291     glb.nZBufferPFCount     = 0;
00292     glb.lpZBufferPF         = NULL;
00293     glb.nDisplayModeCount   = 0;
00294     glb.lpDisplayModes      = NULL;
00295 
00296     //
00297     // Examine the hardware for depth and stencil
00298     //
00299 
00300     if (glb.bPrimary)
00301         hRes = DirectDrawCreate(NULL, &lpDD1, NULL);
00302     else
00303         hRes = DirectDrawCreate(&glb.ddGuid, &lpDD1, NULL);
00304         
00305     if (FAILED(hRes)) {
00306         ddlogError(DDLOG_ERROR, "dglBPFL: DirectDrawCreate failed", hRes);
00307         return;
00308     }
00309 
00310     // Query for DX6 IDirectDraw4.
00311     hRes = IDirectDraw_QueryInterface(
00312                 lpDD1,
00313                 &IID_IDirectDraw4,
00314                 (void**)&lpDD4);
00315     if (FAILED(hRes)) {
00316         ddlogError(DDLOG_ERROR, "dglBPFL: QueryInterface (DD4) failed", hRes);
00317         goto clean_up;
00318     }
00319 
00320 
00321     // Retrieve caps of current display mode
00322     ZeroMemory(&ddsdDisplayMode, sizeof(ddsdDisplayMode));
00323     ddsdDisplayMode.dwSize = sizeof(ddsdDisplayMode);
00324     hRes = IDirectDraw4_GetDisplayMode(lpDD4, &ddsdDisplayMode);
00325     if (FAILED(hRes))
00326         goto clean_up;
00327 
00328     dwDisplayBitDepth = ddsdDisplayMode.ddpfPixelFormat.dwRGBBitCount;
00329     dwPixelType = (dwDisplayBitDepth <= 8) ? PFD_TYPE_COLORINDEX : PFD_TYPE_RGBA;
00330     dwRb = BitCount(ddsdDisplayMode.ddpfPixelFormat.dwRBitMask);
00331     dwGb = BitCount(ddsdDisplayMode.ddpfPixelFormat.dwGBitMask);
00332     dwBb = BitCount(ddsdDisplayMode.ddpfPixelFormat.dwBBitMask);
00333     dwRs = BitShift(ddsdDisplayMode.ddpfPixelFormat.dwRBitMask);
00334     dwGs = BitShift(ddsdDisplayMode.ddpfPixelFormat.dwGBitMask);
00335     dwBs = BitShift(ddsdDisplayMode.ddpfPixelFormat.dwBBitMask);
00336 
00337     if (BitCount(ddsdDisplayMode.ddpfPixelFormat.dwRGBAlphaBitMask)) {
00338         dwAb = BitCount(ddsdDisplayMode.ddpfPixelFormat.dwRGBAlphaBitMask);
00339         dwAs = BitShift(ddsdDisplayMode.ddpfPixelFormat.dwRGBAlphaBitMask);
00340     } else {
00341         dwAb = 0;
00342         dwAs = 0;
00343     }
00344 
00345     // Query for available display modes
00346     ddlogMessage(DDLOG_INFO, "\n");
00347     ddlogMessage(DDLOG_INFO, "Display Modes:\n");
00348 
00349     // Pass 1: Determine count
00350     iEnumCount = 0;
00351     hRes = IDirectDraw4_EnumDisplayModes(
00352                 lpDD4,
00353                 0,
00354                 NULL,
00355                 NULL,
00356                 EnumDisplayModesCallback);
00357     if (FAILED(hRes)) {
00358         ddlogError(DDLOG_ERROR, "dglBPFL: EnumDisplayModes failed", hRes);
00359         goto clean_up;
00360     }
00361     if (iEnumCount == 0) {
00362         ddlogMessage(DDLOG_ERROR, "dglBPFL: No display modes found");
00363         goto clean_up;
00364     }
00365     glb.lpDisplayModes = (DDSURFACEDESC2 *)calloc(iEnumCount,
00366                                                 sizeof(DDSURFACEDESC2));
00367     if (glb.lpDisplayModes == NULL) {
00368         ddlogMessage(DDLOG_ERROR, "dglBPFL: DDSURFACEDESC2 calloc failed");
00369         goto clean_up;
00370     }
00371     glb.nDisplayModeCount = iEnumCount;
00372     // Pass 2: Save modes
00373     iEnumCount = 0;
00374     hRes = IDirectDraw4_EnumDisplayModes(
00375                 lpDD4,
00376                 0,
00377                 NULL,
00378                 (void *)glb.lpDisplayModes,
00379                 EnumDisplayModesCallback);
00380     if (FAILED(hRes)) {
00381         ddlogError(DDLOG_ERROR, "dglBPFL: EnumDisplayModes failed", hRes);
00382         goto clean_up;
00383     }
00384                               // Query for IDirect3D3 interface
00385     hRes = IDirectDraw4_QueryInterface(
00386                 lpDD4,
00387                 &IID_IDirect3D3,
00388                 (void**)&lpD3D3);
00389     if (FAILED(hRes)) {
00390         ddlogError(DDLOG_ERROR, "dglBPFL: QueryInterface (D3D3) failed", hRes);
00391         goto clean_up;
00392     }
00393 
00394     ddlogMessage(DDLOG_INFO, "\n");
00395     ddlogMessage(DDLOG_INFO, "ZBuffer formats:\n");
00396 
00397     // Pass 1. Count the ZBuffer pixel formats
00398     hRes = IDirect3D3_EnumZBufferFormats(
00399                 lpD3D3,
00400                 &glb.d3dGuid,
00401                 d3dEnumZBufferFormatsCallback,
00402                 NULL);
00403 
00404     if (FAILED(hRes))
00405         goto clean_up;
00406 
00407     if (glb.nZBufferPFCount) {
00408         glb.lpZBufferPF = (DDPIXELFORMAT *)calloc(glb.nZBufferPFCount,
00409                                                 sizeof(DDPIXELFORMAT));
00410         if(glb.lpZBufferPF == NULL)
00411             goto clean_up;
00412 
00413         // Pass 2. Cache the ZBuffer pixel formats
00414         iEnumCount = 0; // (Used by the enum function)
00415         hRes = IDirect3D3_EnumZBufferFormats(
00416                     lpD3D3,
00417                     &glb.d3dGuid,
00418                     d3dEnumZBufferFormatsCallback,
00419                     glb.lpZBufferPF);
00420 
00421         if (FAILED(hRes))
00422             goto clean_up;
00423     }
00424 
00425     // Remove stencil support for boards which don't work for AutoCAD;
00426     // Matrox G400 does not work, but NVidia TNT2 and ATI Rage128 do... (DaveM)
00427     if (IsStencilSupportBroken(lpDD4)) {
00428         for (i=0; i<iEnumCount; i++)
00429             if (glb.lpZBufferPF[i].dwFlags & DDPF_STENCILBUFFER)
00430                 glb.nZBufferPFCount--;
00431     }
00432 
00433     // One each for every ZBuffer pixel format (including no depth buffer)
00434     // Times-two because duplicated for single buffering (as opposed to double)
00435     glb.nPixelFormatCount = 2 * (glb.nZBufferPFCount + 1);
00436     glb.lpPF = (DGL_pixelFormat *)calloc(glb.nPixelFormatCount,
00437                                         sizeof(DGL_pixelFormat));
00438     if (glb.lpPF == NULL)
00439         goto clean_up;
00440     //
00441     // Fill in the pixel formats
00442     // Note: Depth buffer bits are really (dwZBufferBitDepth-dwStencilBitDepth)
00443     //       but this will pass wierd numbers to the OpenGL app. (?)
00444     //
00445 
00446     pfTemplateHW.pfd.iPixelType     = dwPixelType;
00447     pfTemplateHW.pfd.cColorBits     = dwDisplayBitDepth;
00448     pfTemplateHW.pfd.cRedBits       = dwRb;
00449     pfTemplateHW.pfd.cGreenBits     = dwGb;
00450     pfTemplateHW.pfd.cBlueBits      = dwBb;
00451     pfTemplateHW.pfd.cAlphaBits     = dwAb;
00452     pfTemplateHW.pfd.cRedShift      = dwRs;
00453     pfTemplateHW.pfd.cGreenShift    = dwGs;
00454     pfTemplateHW.pfd.cBlueShift     = dwBs;
00455     pfTemplateHW.pfd.cAlphaShift    = dwAs;
00456 
00457     lpPF = glb.lpPF;
00458 
00459     // Fill in the double-buffered pixel formats
00460     for (i=0; i<(glb.nZBufferPFCount + 1); i++, lpPF++) {
00461         memcpy(lpPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
00462         if (i) {
00463             lpPF->iZBufferPF        = i-1;
00464             lpPF->pfd.cDepthBits    = glb.lpZBufferPF[i-1].dwZBufferBitDepth;
00465             lpPF->pfd.cStencilBits  = glb.lpZBufferPF[i-1].dwStencilBitDepth;
00466         }
00467     }
00468     // Fill in the single-buffered pixel formats
00469     for (i=0; i<(glb.nZBufferPFCount + 1); i++, lpPF++) {
00470         memcpy(lpPF, &pfTemplateHW, sizeof(DGL_pixelFormat));
00471         if (i) {
00472             lpPF->iZBufferPF        = i-1;
00473             lpPF->pfd.cDepthBits    = glb.lpZBufferPF[i-1].dwZBufferBitDepth;
00474             lpPF->pfd.cStencilBits  = glb.lpZBufferPF[i-1].dwStencilBitDepth;
00475         }
00476         // Remove double-buffer flag. Could use XOR instead...
00477         lpPF->pfd.dwFlags &= (~(PFD_DOUBLEBUFFER));
00478         // Insert GDI flag for single buffered format only.
00479         lpPF->pfd.dwFlags |= PFD_SUPPORT_GDI;
00480     }
00481 #endif // _USE_GLD3_WGL
00482 
00483     // Lets dump the list to the log
00484     // ** Based on "wglinfo" by Nate Robins **
00485     ddlogMessage(DDLOG_INFO, "\n");
00486     ddlogMessage(DDLOG_INFO, "Pixel Formats:\n");
00487     ddlogMessage(DDLOG_INFO,
00488         "   visual  x  bf lv rg d st  r  g  b a  ax dp st accum buffs  ms\n");
00489     ddlogMessage(DDLOG_INFO,
00490         " id dep cl sp sz l  ci b ro sz sz sz sz bf th cl  r  g  b  a ns b\n");
00491     ddlogMessage(DDLOG_INFO,
00492         "-----------------------------------------------------------------\n");
00493     for (i=0, lpPF = glb.lpPF; i<glb.nPixelFormatCount; i++, lpPF++) {
00494         sprintf(buf, "0x%02x ", i+1);
00495 
00496         sprintf(cat, "%2d ", lpPF->pfd.cColorBits);
00497         strcat(buf, cat);
00498         if(lpPF->pfd.dwFlags & PFD_DRAW_TO_WINDOW)      sprintf(cat, "wn ");
00499         else if(lpPF->pfd.dwFlags & PFD_DRAW_TO_BITMAP) sprintf(cat, "bm ");
00500         else sprintf(cat, ".  ");
00501         strcat(buf, cat);
00502 
00503         /* should find transparent pixel from LAYERPLANEDESCRIPTOR */
00504         sprintf(cat, " . "); 
00505         strcat(buf, cat);
00506 
00507         sprintf(cat, "%2d ", lpPF->pfd.cColorBits);
00508         strcat(buf, cat);
00509 
00510         /* bReserved field indicates number of over/underlays */
00511         if(lpPF->pfd.bReserved) sprintf(cat, " %d ", lpPF->pfd.bReserved);
00512         else sprintf(cat, " . "); 
00513         strcat(buf, cat);
00514 
00515         sprintf(cat, " %c ", lpPF->pfd.iPixelType == PFD_TYPE_RGBA ? 'r' : 'c');
00516         strcat(buf, cat);
00517 
00518         sprintf(cat, "%c ", lpPF->pfd.dwFlags & PFD_DOUBLEBUFFER ? 'y' : '.');
00519         strcat(buf, cat);
00520 
00521         sprintf(cat, " %c ", lpPF->pfd.dwFlags & PFD_STEREO ? 'y' : '.');
00522         strcat(buf, cat);
00523 
00524         if(lpPF->pfd.cRedBits && lpPF->pfd.iPixelType == PFD_TYPE_RGBA) 
00525             sprintf(cat, "%2d ", lpPF->pfd.cRedBits);
00526         else sprintf(cat, " . ");
00527         strcat(buf, cat);
00528 
00529         if(lpPF->pfd.cGreenBits && lpPF->pfd.iPixelType == PFD_TYPE_RGBA) 
00530             sprintf(cat, "%2d ", lpPF->pfd.cGreenBits);
00531         else sprintf(cat, " . ");
00532         strcat(buf, cat);
00533 
00534         if(lpPF->pfd.cBlueBits && lpPF->pfd.iPixelType == PFD_TYPE_RGBA) 
00535             sprintf(cat, "%2d ", lpPF->pfd.cBlueBits);
00536         else sprintf(cat, " . ");
00537         strcat(buf, cat);
00538     
00539         if(lpPF->pfd.cAlphaBits && lpPF->pfd.iPixelType == PFD_TYPE_RGBA) 
00540             sprintf(cat, "%2d ", lpPF->pfd.cAlphaBits);
00541         else sprintf(cat, " . ");
00542         strcat(buf, cat);
00543     
00544         if(lpPF->pfd.cAuxBuffers)     sprintf(cat, "%2d ", lpPF->pfd.cAuxBuffers);
00545         else sprintf(cat, " . ");
00546         strcat(buf, cat);
00547     
00548         if(lpPF->pfd.cDepthBits)      sprintf(cat, "%2d ", lpPF->pfd.cDepthBits);
00549         else sprintf(cat, " . ");
00550         strcat(buf, cat);
00551     
00552         if(lpPF->pfd.cStencilBits)    sprintf(cat, "%2d ", lpPF->pfd.cStencilBits);
00553         else sprintf(cat, " . ");
00554         strcat(buf, cat);
00555     
00556         if(lpPF->pfd.cAccumRedBits)   sprintf(cat, "%2d ", lpPF->pfd.cAccumRedBits);
00557         else sprintf(cat, " . ");
00558         strcat(buf, cat);
00559 
00560         if(lpPF->pfd.cAccumGreenBits) sprintf(cat, "%2d ", lpPF->pfd.cAccumGreenBits);
00561         else sprintf(cat, " . ");
00562         strcat(buf, cat);
00563     
00564         if(lpPF->pfd.cAccumBlueBits)  sprintf(cat, "%2d ", lpPF->pfd.cAccumBlueBits);
00565         else sprintf(cat, " . ");
00566         strcat(buf, cat);
00567     
00568         if(lpPF->pfd.cAccumAlphaBits) sprintf(cat, "%2d ", lpPF->pfd.cAccumAlphaBits);
00569         else sprintf(cat, " . ");
00570         strcat(buf, cat);
00571     
00572         /* no multisample in Win32 */
00573         sprintf(cat, " . .\n");
00574         strcat(buf, cat);
00575 
00576         ddlogMessage(DDLOG_INFO, buf);
00577     }
00578     ddlogMessage(DDLOG_INFO,
00579         "-----------------------------------------------------------------\n");
00580     ddlogMessage(DDLOG_INFO, "\n");
00581 
00582 #ifndef _USE_GLD3_WGL
00583 clean_up:
00584     // Release COM objects
00585     RELEASE(lpD3D3);
00586     RELEASE(lpDD4);
00587     RELEASE(lpDD1);
00588 
00589     // Popup warning message if non RGB color mode
00590     if (dwDisplayBitDepth <= 8) {
00591         ddlogPrintf(DDLOG_WARN, "Current Color Depth %d bpp is not supported", dwDisplayBitDepth);
00592         MessageBox(NULL, szColorDepthWarning, "GLDirect", MB_OK | MB_ICONWARNING);
00593     }
00594 #endif // _USE_GLD3_WGL
00595 }
00596 
00597 // ***********************************************************************
00598 
00599 void dglReleasePixelFormatList()
00600 {
00601     glb.nPixelFormatCount = 0;
00602     if (glb.lpPF) {
00603         free(glb.lpPF);
00604         glb.lpPF = NULL;
00605     }
00606 #ifndef _USE_GLD3_WGL
00607     glb.nZBufferPFCount = 0;
00608     if (glb.lpZBufferPF) {
00609         free(glb.lpZBufferPF);
00610         glb.lpZBufferPF = NULL;
00611     }
00612     glb.nDisplayModeCount = 0;
00613     if (glb.lpDisplayModes) {
00614         free(glb.lpDisplayModes);
00615         glb.lpDisplayModes = NULL;
00616     }
00617 #endif // _USE_GLD3_WGL
00618 }
00619 
00620 // ***********************************************************************

Generated on Sat May 26 2012 04:18:44 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.