Ignore:
Timestamp:
Sep 6, 1999, 11:40:08 PM (26 years ago)
Author:
hugh
Message:

Fixed bug in pageflipping, constructor colorfill

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ddraw/OS2DDRAW.CPP

    r587 r850  
    3838  DWORD dwVSize, dwVType;
    3939  ULONG rc;
     40  FOURCC fccModes[100];
    4041
    4142  // Setup table for 3d devices
     
    139140  else
    140141  {
    141     WriteLog("DiveOpen OK\n");
     142    WriteLog("DiveOpen OK Framebuufer at 0x%08X\n",pFrameBuffer);
    142143  }
    143144  memset( &dCaps,
     
    145146          sizeof(DIVE_CAPS) );
    146147  dCaps.ulStructLen = sizeof(DIVE_CAPS);
     148  dCaps.ulFormatLength = 100;
     149  dCaps.pFormatData = &fccModes[0];
    147150
    148151  rc = DiveQueryCaps( &dCaps,
    149152                      DIVE_BUFFER_SCREEN);
     153
     154  WriteLog("DiveQueryCaps rc=0x%08X\n",rc);
    150155
    151156
     
    168173  if(hDive)
    169174    DiveClose(hDive);
    170   if(hDiveColorConv)
    171     DiveClose(hDiveColorConv);
    172175
    173176  // Safty call in case the program did set the pal to all black
     
    753756HRESULT __stdcall DrawGetCaps(THIS, LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps)
    754757{
     758  DWORD dwSize;
     759
    755760  #ifdef DEBUG
    756761    WriteLog("DDGetCaps of ");
     
    766771    WriteLog("Driver\n");
    767772
    768     if(sizeof(DDCAPS)!=lpDDDriverCaps->dwSize)
    769     {
    770       WriteLog("Size Not Set\n");
     773    if( (sizeof(DDCAPS)!=lpDDDriverCaps->dwSize)     &&
     774        (sizeof(DDCAPS_DX5)!=lpDDDriverCaps->dwSize) &&
     775        (sizeof(DDCAPS_DX3)!=lpDDDriverCaps->dwSize) )
     776    {
     777      WriteLog( "Size %d Not supported ",
     778                lpDDDriverCaps->dwSize);
    771779      return(DDERR_INVALIDPARAMS);
    772780    }
    773781    // Clear structure so we only have to set the supported flags
    774782
    775 
    776     memset(lpDDDriverCaps,0,sizeof(DDCAPS));
     783    dwSize = lpDDDriverCaps->dwSize;
     784    memset( lpDDDriverCaps,
     785            0,
     786            lpDDDriverCaps->dwSize);
    777787
    778788
    779789    // Reset the size
    780     lpDDDriverCaps->dwSize = sizeof(DDCAPS);
     790    lpDDDriverCaps->dwSize = dwSize;
    781791
    782792    // Now report the CAPs back which we support
     
    789799
    790800    lpDDDriverCaps->dwCaps2 = DDCAPS2_CERTIFIED |         // Who cares so say yes
    791                               DDCAPS2_CANRENDERWINDOWED | // Better check for Voodoo ?!
     801                              //DDCAPS2_CANRENDERWINDOWED | // Better check for Voodoo ?!
    792802                              DDCAPS2_COPYFOURCC |        // yepp memcpy will do this
    793803                              DDCAPS2_NONLOCALVIDMEM |    // All surfaces are in memory
     
    803813                                DDPCAPS_VSYNC  |        // Vsync yet
    804814                                DDPCAPS_PRIMARYSURFACE; //
    805     lpDDDriverCaps->dwVidMemTotal = 2048*1024;           // total video memory
    806     lpDDDriverCaps->dwVidMemFree  = 2048*1024;            // total free video memory
     815    lpDDDriverCaps->dwVidMemTotal = 4096*1024;          // total video memory
     816    lpDDDriverCaps->dwVidMemFree  = 4096*1024;          // total free video memory
    807817    lpDDDriverCaps->dwNumFourCCCodes;        // number of supported FOURCC codes
    808     lpDDDriverCaps->dwRops[DD_ROP_SPACE];    // supported raster ops
     818/*
     819    ToDo: must finde out ow the array is used for this
     820    lpDDDriverCaps->dwRops[DD_ROP_SPACE] = SRCCOPY |
     821                                           BLACKNESS |
     822                                           WHITENESS;  // Raster OPs implemented
     823*/
    809824    lpDDDriverCaps->dwSVBCaps = DDCAPS_BLT |              // We do blitting
    810825                                DDCAPS_BLTCOLORFILL |     // We do colorfills
     
    812827                                DDCAPS_COLORKEYHWASSIST;
    813828    lpDDDriverCaps->dwSVBCKeyCaps = DDCKEYCAPS_SRCBLT;      // Only source transparent blitting
    814     lpDDDriverCaps->dwSVBFXCaps;             //  .
    815     lpDDDriverCaps->dwSVBRops[DD_ROP_SPACE]; //  .
     829    lpDDDriverCaps->dwSVBFXCaps = DDCAPS_BLT |              // We do blitting
     830                                  DDCAPS_BLTCOLORFILL |     // We do colorfills
     831                                  DDCAPS_COLORKEY |         // We support Colorkeying
     832                                  DDCAPS_COLORKEYHWASSIST;
     833/*
     834    ToDo: must finde out ow the array is used for this
     835    lpDDDriverCaps->dwSVBRops[DD_ROP_SPACE] = SRCCOPY |
     836                                              BLACKNESS |
     837                                              WHITENESS;  // Raster OPs implemented
     838*/
    816839    lpDDDriverCaps->dwVSBCaps = DDCAPS_BLT |              // We do blitting
    817840                                DDCAPS_BLTCOLORFILL |     // We do colorfills
     
    819842                                DDCAPS_COLORKEYHWASSIST;
    820843    lpDDDriverCaps->dwVSBCKeyCaps = DDCKEYCAPS_SRCBLT;      // Only source transparent blitting
    821     lpDDDriverCaps->dwVSBFXCaps;             //  .
    822     lpDDDriverCaps->dwVSBRops[DD_ROP_SPACE]; //  .
     844    lpDDDriverCaps->dwVSBFXCaps = DDCAPS_BLT |              // We do blitting
     845                                  DDCAPS_BLTCOLORFILL |     // We do colorfills
     846                                  DDCAPS_COLORKEY |         // We support Colorkeying
     847                                  DDCAPS_COLORKEYHWASSIST;
     848/*
     849    ToDo: must finde out ow the array is used for this
     850    lpDDDriverCaps->dwVSBRops[DD_ROP_SPACE] = SRCCOPY |
     851                                              BLACKNESS |
     852                                              WHITENESS;  // Raster OPs implemented
     853*/
    823854    lpDDDriverCaps->dwSSBCaps = DDCAPS_BLT |              // We do blitting
    824855                                DDCAPS_BLTCOLORFILL |     // We do colorfills
     
    826857                                DDCAPS_COLORKEYHWASSIST;
    827858    lpDDDriverCaps->dwSSBCKeyCaps = DDCKEYCAPS_SRCBLT;      // Only source transparent blitting
    828     lpDDDriverCaps->dwSSBFXCaps;            //  .
    829     lpDDDriverCaps->dwSSBRops[DD_ROP_SPACE]; //  .
    830     lpDDDriverCaps->dwSVBCaps2 = DDCAPS2_CANRENDERWINDOWED | // Better check for Voodoo ?!
    831                                  DDCAPS2_COPYFOURCC |        // yepp memcpy will do this
    832                                  DDCAPS2_WIDESURFACES;       // Any size you want!
    833     lpDDDriverCaps->dwNLVBCaps = DDCAPS_BLT |              // We do blitting
    834                                  DDCAPS_BLTCOLORFILL |     // We do colorfills
    835                                  DDCAPS_COLORKEY |         // We support Colorkeying
    836                                  DDCAPS_COLORKEYHWASSIST;
    837     lpDDDriverCaps->dwNLVBCaps2 = DDCAPS2_CANRENDERWINDOWED | // Better check for Voodoo ?!
    838                                   DDCAPS2_COPYFOURCC |        // yepp memcpy will do this
    839                                   DDCAPS2_WIDESURFACES;       // Any size you want!
    840     lpDDDriverCaps->dwNLVBCKeyCaps = DDCKEYCAPS_SRCBLT;      // Only source transparent blitting
    841     lpDDDriverCaps->dwNLVBFXCaps;            //  .
    842     lpDDDriverCaps->dwNLVBRops[DD_ROP_SPACE];//  .
    843     DDSCAPS2 ddsCaps;                 // general surface caps
     859    lpDDDriverCaps->dwSSBFXCaps = DDCAPS_BLT |              // We do blitting
     860                                  DDCAPS_BLTCOLORFILL |     // We do colorfills
     861                                  DDCAPS_COLORKEY |         // We support Colorkeying
     862                                  DDCAPS_COLORKEYHWASSIST;
     863/*
     864    ToDo: must finde out ow the array is used for this
     865    lpDDDriverCaps->dwSSBRops[SRCCOPY]   = 1;
     866    lpDDDriverCaps->dwSSBRops[BLACKNESS] = 1;
     867    lpDDDriverCaps->dwSSBRops[WHITENESS] = 1;  // Raster OPs implemented
     868*/
     869    // These are ony in >DX5
     870    if(dwSize>sizeof(DDCAPS_DX3))
     871    {
     872      lpDDDriverCaps->dwSVBCaps2 = //DDCAPS2_CANRENDERWINDOWED | // Better check for Voodoo ?!
     873                                   DDCAPS2_COPYFOURCC |        // yepp memcpy will do this
     874                                   DDCAPS2_WIDESURFACES;       // Any size you want!
     875      lpDDDriverCaps->dwNLVBCaps = DDCAPS_BLT |              // We do blitting
     876                                   DDCAPS_BLTCOLORFILL |     // We do colorfills
     877                                   DDCAPS_COLORKEY |         // We support Colorkeying
     878                                   DDCAPS_COLORKEYHWASSIST;
     879      lpDDDriverCaps->dwNLVBCaps2 = //DDCAPS2_CANRENDERWINDOWED | // Better check for Voodoo ?!
     880                                    DDCAPS2_COPYFOURCC |        // yepp memcpy will do this
     881                                    DDCAPS2_WIDESURFACES;       // Any size you want!
     882      lpDDDriverCaps->dwNLVBCKeyCaps = DDCKEYCAPS_SRCBLT;      // Only source transparent blitting
     883      lpDDDriverCaps->dwNLVBFXCaps = DDCAPS_BLT |              // We do blitting
     884                                     DDCAPS_BLTCOLORFILL |     // We do colorfills
     885                                     DDCAPS_COLORKEY |         // We support Colorkeying
     886                                     DDCAPS_COLORKEYHWASSIST;
     887      lpDDDriverCaps->dwNLVBRops[DD_ROP_SPACE];//  ToDo: Again the array ...
     888
     889      // General Surface caps only in DX6
     890      if(dwSize>sizeof(DDCAPS_DX5))
     891      {
     892        lpDDDriverCaps->ddsCaps.dwCaps = DDSCAPS_ALPHA | DDSCAPS_BACKBUFFER |
     893                                         DDSCAPS_COMPLEX | DDSCAPS_FLIP |
     894                                         DDSCAPS_FRONTBUFFER | DDSCAPS_LOCALVIDMEM |
     895                                         DDSCAPS_NONLOCALVIDMEM | DDSCAPS_OFFSCREENPLAIN |
     896                                         // DDSCAPS_OVERLAY |
     897                                         DDSCAPS_PALETTE | DDSCAPS_PRIMARYSURFACE |
     898                                         DDSCAPS_SYSTEMMEMORY |DDSCAPS_VIDEOMEMORY |
     899                                         DDSCAPS_VISIBLE;
     900
     901      #ifdef USE_OPENGL
     902        lpDDDriverCaps->dwCaps |= DDCAPS_3D | DDCAPS_ZBLTS;
     903        // ToDO find and put the value for DDCAPS2_NO2DDURING3DSCENE in ddraw.h
     904        // lpDDDriverCaps->dwCaps2 |=  DDCAPS2_NO2DDURING3DSCENE;
     905        lpDDDriverCaps->ddsCaps.dwCaps |= DDSCAPS_3DDEVICE | DDSCAPS_MIPMAP |
     906                                          DDSCAPS_TEXTURE | DDSCAPS_ZBUFFER;
     907      #endif
     908      }
     909    }
     910
    844911
    845912  }
     
    13441411 ULONG rc;
    13451412 OS2IDirectDraw        *me = (OS2IDirectDraw *)This;
     1413 SETUP_BLITTER sBlt;
    13461414
    13471415  #ifdef DEBUG
     
    13521420  me->screenheight = dwHeight;
    13531421  me->screenbpp    = dwBPP;
    1354   if(me->screenbpp!=me->dCaps.ulDepth)
    1355   {
    1356     rc = DiveOpen( &me->hDiveColorConv,
    1357                    FALSE,
    1358                    0);
    1359     WriteLog("Screen in different mode than requested, open addional DIVE instance(rc=%X)\n\n",rc);
    1360 
    1361   }
    1362 //  _interrupt(3);
     1422
     1423  memset(&sBlt,0,sizeof(sBlt));
     1424  sBlt.ulStructLen = sizeof(sBlt);
     1425  sBlt.fccSrcColorFormat = FOURCC_SCRN;
     1426  sBlt.ulSrcWidth        = dwWidth;
     1427  sBlt.ulSrcHeight       = dwHeight;
     1428  sBlt.ulSrcPosX         = 0;
     1429  sBlt.ulSrcPosY         = 0;
     1430  sBlt.fccDstColorFormat = FOURCC_SCRN;
     1431  sBlt.ulDstWidth        = dwWidth;
     1432  sBlt.ulDstHeight       = dwHeight;
     1433  sBlt.lDstPosX          = 0;
     1434  sBlt.lDstPosY          = 0;
     1435  sBlt.lScreenPosX       = 0;
     1436  sBlt.lScreenPosY       = me->dCaps.ulVerticalResolution-dwHeight;
     1437  sBlt.ulNumDstRects     = DIVE_FULLY_VISIBLE;
     1438
     1439  rc = DiveSetupBlitter( me->hDive,
     1440                         &sBlt);
     1441
    13631442  return(DD_OK);
    13641443}
     
    13701449 ULONG rc;
    13711450 OS2IDirectDraw        *me = (OS2IDirectDraw *)This;
     1451 SETUP_BLITTER sBlt;
    13721452
    13731453#ifdef DEBUG
     
    13771457  me->screenheight = dwHeight;
    13781458  me->screenbpp    = dwBPP;
    1379   if(me->screenbpp!=me->dCaps.ulDepth)
    1380   {
    1381     rc = DiveOpen( &me->hDiveColorConv,
    1382                    FALSE,
    1383                    0);
    1384     WriteLog("Screen in different mode than requested, open addional DIVE instance(rc=%X)\n\n",rc);
    1385 
    1386   }
    1387 //  _interrupt(3);
     1459
     1460  memset(&sBlt,0,sizeof(sBlt));
     1461  sBlt.ulStructLen = sizeof(sBlt);
     1462  sBlt.fccSrcColorFormat = FOURCC_SCRN;
     1463  sBlt.ulSrcWidth        = dwWidth;
     1464  sBlt.ulSrcHeight       = dwHeight;
     1465  sBlt.ulSrcPosX         = 0;
     1466  sBlt.ulSrcPosY         = 0;
     1467  sBlt.fccDstColorFormat = FOURCC_SCRN;
     1468  sBlt.ulDstWidth        = dwWidth;
     1469  sBlt.ulDstHeight       = dwHeight;
     1470  sBlt.lDstPosX          = 0;
     1471  sBlt.lDstPosY          = 0;
     1472  sBlt.lScreenPosX       = 0;
     1473  sBlt.lScreenPosY       = me->dCaps.ulVerticalResolution-dwHeight;
     1474  sBlt.ulNumDstRects     = DIVE_FULLY_VISIBLE;
     1475
     1476  rc = DiveSetupBlitter( me->hDive,
     1477                         &sBlt);
     1478
    13881479  return(DD_OK);
    13891480}
Note: See TracChangeset for help on using the changeset viewer.