Author: greatlrd
Date: Fri Apr 7 22:03:21 2006
New Revision: 21510
URL:
http://svn.reactos.ru/svn/reactos?rev=21510&view=rev
Log:
1. Implement almost full dx hal DdBlt into ddraw
we only need adding clipper or not set it to
true or false. Then ddraw dx hal blt is complete
2. Split complete each surface getting own memory
3. Remove create for overlay for now the code need be
more tested
Modified:
trunk/reactos/dll/directx/ddraw/hal/surface_hal.c
trunk/reactos/dll/directx/ddraw/rosdraw.h
Modified: trunk/reactos/dll/directx/ddraw/hal/surface_hal.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/directx/ddraw/hal/surfa…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/hal/surface_hal.c (original)
+++ trunk/reactos/dll/directx/ddraw/hal/surface_hal.c Fri Apr 7 22:03:21 2006
@@ -13,7 +13,7 @@
HRESULT Hal_DirectDraw_CreateSurface (LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD,
IDirectDrawSurfaceImpl *ppSurf, IUnknown *pUnkOuter)
{
- UINT i;
+ //UINT i;
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
IDirectDrawSurfaceImpl* That = ppSurf;
@@ -28,11 +28,12 @@
mDdCreateSurface.CreateSurface = This->mCallbacks.HALDD.CreateSurface;
if (pDDSD->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
- {
- memcpy(&This->mddsdPrimary,pDDSD,sizeof(DDSURFACEDESC));
- This->mddsdPrimary.dwSize = sizeof(DDSURFACEDESC);
+ {
+
+ memcpy(&That->Surf->mddsdPrimary,pDDSD,sizeof(DDSURFACEDESC));
+ That->Surf->mddsdPrimary.dwSize = sizeof(DDSURFACEDESC);
mDdCanCreateSurface.bIsDifferentPixelFormat = FALSE;
- mDdCanCreateSurface.lpDDSurfaceDesc = &This->mddsdPrimary;
+ mDdCanCreateSurface.lpDDSurfaceDesc = &That->Surf->mddsdPrimary;
if
(This->mHALInfo.lpDDCallbacks->CanCreateSurface(&mDdCanCreateSurface)==
DDHAL_DRIVER_NOTHANDLED)
{
@@ -44,31 +45,31 @@
return DDERR_NOTINITIALIZED;
}
- memset(&This->mPrimaryGlobal, 0, sizeof(DDRAWI_DDRAWSURFACE_GBL));
- This->mPrimaryGlobal.dwGlobalFlags = DDRAWISURFGBL_ISGDISURFACE;
- This->mPrimaryGlobal.lpDD = &This->mDDrawGlobal;
- This->mPrimaryGlobal.lpDDHandle = &This->mDDrawGlobal;
- This->mPrimaryGlobal.wWidth = (WORD)This->mpModeInfos[0].dwWidth;
- This->mPrimaryGlobal.wHeight = (WORD)This->mpModeInfos[0].dwHeight;
- This->mPrimaryGlobal.lPitch = This->mpModeInfos[0].lPitch;
-
- memset(&This->mPrimaryMore, 0, sizeof(DDRAWI_DDRAWSURFACE_MORE));
- This->mPrimaryMore.dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
-
- memset(&This->mPrimaryLocal, 0, sizeof(DDRAWI_DDRAWSURFACE_LCL));
- This->mPrimaryLocal.lpGbl = &This->mPrimaryGlobal;
- This->mPrimaryLocal.lpSurfMore = &This->mPrimaryMore;
- This->mPrimaryLocal.dwProcessId = GetCurrentProcessId();
+ memset(&That->Surf->mPrimaryGlobal, 0,
sizeof(DDRAWI_DDRAWSURFACE_GBL));
+ That->Surf->mPrimaryGlobal.dwGlobalFlags = DDRAWISURFGBL_ISGDISURFACE;
+ That->Surf->mPrimaryGlobal.lpDD = &This->mDDrawGlobal;
+ That->Surf->mPrimaryGlobal.lpDDHandle = &This->mDDrawGlobal;
+ That->Surf->mPrimaryGlobal.wWidth =
(WORD)This->mpModeInfos[0].dwWidth;
+ That->Surf->mPrimaryGlobal.wHeight =
(WORD)This->mpModeInfos[0].dwHeight;
+ That->Surf->mPrimaryGlobal.lPitch = This->mpModeInfos[0].lPitch;
+
+ memset(&That->Surf->mPrimaryMore, 0,
sizeof(DDRAWI_DDRAWSURFACE_MORE));
+ That->Surf->mPrimaryMore.dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
+
+ memset(&That->Surf->mPrimaryLocal, 0,
sizeof(DDRAWI_DDRAWSURFACE_LCL));
+ That->Surf->mPrimaryLocal.lpGbl =
&That->Surf->mPrimaryGlobal;
+ That->Surf->mPrimaryLocal.lpSurfMore =
&That->Surf->mPrimaryMore;
+ That->Surf->mPrimaryLocal.dwProcessId = GetCurrentProcessId();
/*
FIXME Check the flags if we shall create a primaresurface for overlay or
something else
Examine windows which flags are being set for we assume this is right unsue
I think
*/
- //This->mPrimaryLocal.dwFlags =
DDRAWISURF_PARTOFPRIMARYCHAIN|DDRAWISURF_HASOVERLAYDATA;
- This->mPrimaryLocal.ddsCaps.dwCaps = This->mddsdPrimary.ddsCaps.dwCaps;
- That->Surf->mpPrimaryLocals[0] = &This->mPrimaryLocal;
-
- mDdCreateSurface.lpDDSurfaceDesc = &This->mddsdPrimary;
+ //That->Surf->mPrimaryLocal.dwFlags =
DDRAWISURF_PARTOFPRIMARYCHAIN|DDRAWISURF_HASOVERLAYDATA;
+ That->Surf->mPrimaryLocal.ddsCaps.dwCaps =
That->Surf->mddsdPrimary.ddsCaps.dwCaps;
+ That->Surf->mpPrimaryLocals[0] = &That->Surf->mPrimaryLocal;
+
+ mDdCreateSurface.lpDDSurfaceDesc = &That->Surf->mddsdPrimary;
mDdCreateSurface.lplpSList = That->Surf->mpPrimaryLocals;
mDdCreateSurface.dwSCnt = This->mDDrawGlobal.dsList->dwIntRefCnt ;
@@ -87,121 +88,122 @@
}
else if (pDDSD->ddsCaps.dwCaps & DDSCAPS_OVERLAY)
{
- //memset(&This->mddsdOverlay, 0, sizeof(DDSURFACEDESC));
- memcpy(&This->mddsdOverlay,pDDSD,sizeof(DDSURFACEDESC));
- This->mddsdOverlay.dwSize = sizeof(DDSURFACEDESC);
- //This->mddsdOverlay.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT |
DDSD_BACKBUFFERCOUNT | DDSD_WIDTH | DDSD_HEIGHT;
-
- //This->mddsdOverlay.ddsCaps.dwCaps = DDSCAPS_OVERLAY | DDSCAPS_VIDEOMEMORY
| DDSCAPS_LOCALVIDMEM | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
-
- //This->mddsdOverlay.dwWidth = 100; //pels;
- //This->mddsdOverlay.dwHeight = 100; // lines;
- //This->mddsdOverlay.dwBackBufferCount = 1; //cBuffers;
-
- //This->mddsdOverlay.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
- //This->mddsdOverlay.ddpfPixelFormat.dwFlags = DDPF_RGB;
- //This->mddsdOverlay.ddpfPixelFormat.dwRGBBitCount = 32;
+ ////memset(&This->mddsdOverlay, 0, sizeof(DDSURFACEDESC));
+ //memcpy(&This->mddsdOverlay,pDDSD,sizeof(DDSURFACEDESC));
+ //This->mddsdOverlay.dwSize = sizeof(DDSURFACEDESC);
+ ////This->mddsdOverlay.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT |
DDSD_BACKBUFFERCOUNT | DDSD_WIDTH | DDSD_HEIGHT;
+
+ ////This->mddsdOverlay.ddsCaps.dwCaps = DDSCAPS_OVERLAY |
DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
+
+ ////This->mddsdOverlay.dwWidth = 100; //pels;
+ ////This->mddsdOverlay.dwHeight = 100; // lines;
+ ////This->mddsdOverlay.dwBackBufferCount = 1; //cBuffers;
+
+ ////This->mddsdOverlay.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
+ ////This->mddsdOverlay.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ ////This->mddsdOverlay.ddpfPixelFormat.dwRGBBitCount = 32;
- mDdCanCreateSurface.lpDD = &This->mDDrawGlobal;
- mDdCanCreateSurface.CanCreateSurface =
This->mCallbacks.HALDD.CanCreateSurface;
- mDdCanCreateSurface.bIsDifferentPixelFormat = TRUE; //isDifferentPixelFormat;
- mDdCanCreateSurface.lpDDSurfaceDesc = &This->mddsdOverlay; // pDDSD;
-
-
- if
(This->mHALInfo.lpDDCallbacks->CanCreateSurface(&mDdCanCreateSurface)==
DDHAL_DRIVER_NOTHANDLED)
- {
- return DDERR_NOTINITIALIZED;
- }
-
- if (mDdCanCreateSurface.ddRVal != DD_OK)
- {
- return DDERR_NOTINITIALIZED;
- }
-
- memset(&This->mOverlayGlobal, 0, sizeof(DDRAWI_DDRAWSURFACE_GBL));
- This->mOverlayGlobal.dwGlobalFlags = 0;
- This->mOverlayGlobal.lpDD = &This->mDDrawGlobal;
- This->mOverlayGlobal.lpDDHandle = &This->mDDrawGlobal;
- This->mOverlayGlobal.wWidth = (WORD)This->mddsdOverlay.dwWidth;
- This->mOverlayGlobal.wHeight = (WORD)This->mddsdOverlay.dwHeight;
- This->mOverlayGlobal.lPitch = -1;
- This->mOverlayGlobal.ddpfSurface = This->mddsdOverlay.ddpfPixelFormat;
-
- // setup front- and backbuffer surfaces
- UINT cSurfaces = This->mddsdOverlay.dwBackBufferCount + 1;
- for (i = 0; i < cSurfaces; i++)
- {
- memset(&This->mOverlayMore[i], 0,
sizeof(DDRAWI_DDRAWSURFACE_MORE));
- This->mOverlayMore[i].dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
-
- memset(&This->mOverlayLocal[i], 0,
sizeof(DDRAWI_DDRAWSURFACE_LCL));
- This->mOverlayLocal[i].lpGbl = &This->mOverlayGlobal;
- This->mOverlayLocal[i].lpSurfMore = &This->mOverlayMore[i];
- This->mOverlayLocal[i].dwProcessId = GetCurrentProcessId();
- This->mOverlayLocal[i].dwFlags = (i == 0) ?
- (DDRAWISURF_IMPLICITROOT|DDRAWISURF_FRONTBUFFER):
- (DDRAWISURF_IMPLICITCREATE|DDRAWISURF_BACKBUFFER);
-
- This->mOverlayLocal[i].dwFlags |=
DDRAWISURF_ATTACHED|DDRAWISURF_ATTACHED_FROM| DDRAWISURF_HASPIXELFORMAT|
DDRAWISURF_HASOVERLAYDATA;
-
- This->mOverlayLocal[i].ddsCaps.dwCaps =
This->mddsdOverlay.ddsCaps.dwCaps;
- This->mpOverlayLocals[i] = &This->mOverlayLocal[i];
- }
-
- for (i = 0; i < cSurfaces; i++)
- {
- UINT j = (i + 1) % cSurfaces;
- if (!DdAttachSurface(This->mpOverlayLocals[i],
This->mpOverlayLocals[j]))
- {
- // derr(L"DirectDrawImpl[%08x]::__setupDevice DdAttachSurface(%d,
%d) failed", this, i, j);
- return DD_FALSE;
- }
- }
-
- mDdCreateSurface.lpDD = &This->mDDrawGlobal;
- mDdCreateSurface.CreateSurface = This->mCallbacks.HALDD.CreateSurface;
- mDdCreateSurface.lpDDSurfaceDesc = &This->mddsdOverlay;//pDDSD;
- mDdCreateSurface.lplpSList = This->mpOverlayLocals; //cSurfaces;
- mDdCreateSurface.dwSCnt = 1 ; //ppSurfaces;
-
- if (This->mHALInfo.lpDDCallbacks->CreateSurface(&mDdCreateSurface)
== DDHAL_DRIVER_NOTHANDLED)
- {
- return DDERR_NOTINITIALIZED;
- }
-
- if (mDdCreateSurface.ddRVal != DD_OK)
- {
- return mDdCreateSurface.ddRVal;
- }
-
- DDHAL_UPDATEOVERLAYDATA mDdUpdateOverlay;
- mDdUpdateOverlay.lpDD = &This->mDDrawGlobal;
- mDdUpdateOverlay.UpdateOverlay =
This->mCallbacks.HALDDSurface.UpdateOverlay;
- mDdUpdateOverlay.lpDDDestSurface = That->Surf->mpPrimaryLocals[0];
- mDdUpdateOverlay.lpDDSrcSurface = This->mpOverlayLocals[0];//pDDSurface;
- mDdUpdateOverlay.dwFlags = DDOVER_SHOW;
-
- mDdUpdateOverlay.rDest.top = 0;
- mDdUpdateOverlay.rDest.left = 0;
- mDdUpdateOverlay.rDest.right = 50;
- mDdUpdateOverlay.rDest.bottom = 50;
-
- mDdUpdateOverlay.rSrc.top = 0;
- mDdUpdateOverlay.rSrc.left = 0;
- mDdUpdateOverlay.rSrc.right = 50;
- mDdUpdateOverlay.rSrc.bottom = 50;
+ //mDdCanCreateSurface.lpDD = &This->mDDrawGlobal;
+ //mDdCanCreateSurface.CanCreateSurface =
This->mCallbacks.HALDD.CanCreateSurface;
+ //mDdCanCreateSurface.bIsDifferentPixelFormat = TRUE;
//isDifferentPixelFormat;
+ //mDdCanCreateSurface.lpDDSurfaceDesc = &This->mddsdOverlay; // pDDSD;
+
+
+ //if
(This->mHALInfo.lpDDCallbacks->CanCreateSurface(&mDdCanCreateSurface)==
DDHAL_DRIVER_NOTHANDLED)
+ //{
+ // return DDERR_NOTINITIALIZED;
+ //}
+
+ //if (mDdCanCreateSurface.ddRVal != DD_OK)
+ //{
+ // return DDERR_NOTINITIALIZED;
+ //}
+
+ //memset(&This->mOverlayGlobal, 0, sizeof(DDRAWI_DDRAWSURFACE_GBL));
+ //This->mOverlayGlobal.dwGlobalFlags = 0;
+ //This->mOverlayGlobal.lpDD = &This->mDDrawGlobal;
+ //This->mOverlayGlobal.lpDDHandle = &This->mDDrawGlobal;
+ //This->mOverlayGlobal.wWidth = (WORD)This->mddsdOverlay.dwWidth;
+ //This->mOverlayGlobal.wHeight = (WORD)This->mddsdOverlay.dwHeight;
+ //This->mOverlayGlobal.lPitch = -1;
+ //This->mOverlayGlobal.ddpfSurface =
This->mddsdOverlay.ddpfPixelFormat;
+
+ //// setup front- and backbuffer surfaces
+ //UINT cSurfaces = This->mddsdOverlay.dwBackBufferCount + 1;
+ //for (i = 0; i < cSurfaces; i++)
+ //{
+ // memset(&This->mOverlayMore[i], 0,
sizeof(DDRAWI_DDRAWSURFACE_MORE));
+ // This->mOverlayMore[i].dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
+
+ // memset(&This->mOverlayLocal[i], 0,
sizeof(DDRAWI_DDRAWSURFACE_LCL));
+ // This->mOverlayLocal[i].lpGbl = &This->mOverlayGlobal;
+ // This->mOverlayLocal[i].lpSurfMore = &This->mOverlayMore[i];
+ // This->mOverlayLocal[i].dwProcessId = GetCurrentProcessId();
+ // This->mOverlayLocal[i].dwFlags = (i == 0) ?
+ // (DDRAWISURF_IMPLICITROOT|DDRAWISURF_FRONTBUFFER):
+ // (DDRAWISURF_IMPLICITCREATE|DDRAWISURF_BACKBUFFER);
+
+ // This->mOverlayLocal[i].dwFlags |=
DDRAWISURF_ATTACHED|DDRAWISURF_ATTACHED_FROM| DDRAWISURF_HASPIXELFORMAT|
DDRAWISURF_HASOVERLAYDATA;
+
+ // This->mOverlayLocal[i].ddsCaps.dwCaps =
This->mddsdOverlay.ddsCaps.dwCaps;
+ // This->mpOverlayLocals[i] = &This->mOverlayLocal[i];
+ //}
+
+ //for (i = 0; i < cSurfaces; i++)
+ //{
+ // UINT j = (i + 1) % cSurfaces;
+ // if (!DdAttachSurface(This->mpOverlayLocals[i],
This->mpOverlayLocals[j]))
+ // {
+ // // derr(L"DirectDrawImpl[%08x]::__setupDevice DdAttachSurface(%d,
%d) failed", this, i, j);
+ // return DD_FALSE;
+ // }
+ //}
+
+ //mDdCreateSurface.lpDD = &This->mDDrawGlobal;
+ //mDdCreateSurface.CreateSurface = This->mCallbacks.HALDD.CreateSurface;
+ //mDdCreateSurface.lpDDSurfaceDesc = &This->mddsdOverlay;//pDDSD;
+ //mDdCreateSurface.lplpSList = This->mpOverlayLocals; //cSurfaces;
+ //mDdCreateSurface.dwSCnt = 1 ; //ppSurfaces;
+
+ //if (This->mHALInfo.lpDDCallbacks->CreateSurface(&mDdCreateSurface)
== DDHAL_DRIVER_NOTHANDLED)
+ //{
+ // return DDERR_NOTINITIALIZED;
+ //}
+
+ //if (mDdCreateSurface.ddRVal != DD_OK)
+ //{
+ // return mDdCreateSurface.ddRVal;
+ //}
+
+ //DDHAL_UPDATEOVERLAYDATA mDdUpdateOverlay;
+ //mDdUpdateOverlay.lpDD = &This->mDDrawGlobal;
+ //mDdUpdateOverlay.UpdateOverlay =
This->mCallbacks.HALDDSurface.UpdateOverlay;
+ //mDdUpdateOverlay.lpDDDestSurface = That->Surf->mpPrimaryLocals[0];
+ //mDdUpdateOverlay.lpDDSrcSurface = This->mpOverlayLocals[0];//pDDSurface;
+ //mDdUpdateOverlay.dwFlags = DDOVER_SHOW;
+
+ //mDdUpdateOverlay.rDest.top = 0;
+ //mDdUpdateOverlay.rDest.left = 0;
+ //mDdUpdateOverlay.rDest.right = 50;
+ //mDdUpdateOverlay.rDest.bottom = 50;
+
+ //mDdUpdateOverlay.rSrc.top = 0;
+ //mDdUpdateOverlay.rSrc.left = 0;
+ //mDdUpdateOverlay.rSrc.right = 50;
+ //mDdUpdateOverlay.rSrc.bottom = 50;
- if (mDdUpdateOverlay.UpdateOverlay(&mDdUpdateOverlay) ==
DDHAL_DRIVER_NOTHANDLED)
- {
- return DDERR_NOTINITIALIZED;
- }
-
- if (mDdUpdateOverlay.ddRVal != DD_OK)
- {
- return mDdUpdateOverlay.ddRVal;
- }
-
- return DD_OK;
+ //if (mDdUpdateOverlay.UpdateOverlay(&mDdUpdateOverlay) ==
DDHAL_DRIVER_NOTHANDLED)
+ //{
+ // return DDERR_NOTINITIALIZED;
+ //}
+
+ //if (mDdUpdateOverlay.ddRVal != DD_OK)
+ //{
+ // return mDdUpdateOverlay.ddRVal;
+ //}
+
+ //return DD_OK;
+ return DDERR_INVALIDSURFACETYPE;
}
else if (pDDSD->ddsCaps.dwCaps & DDSCAPS_BACKBUFFER)
@@ -277,7 +279,7 @@
mDdBlt.dwFlags = dwFlags;
- This->Surf->mpPrimaryLocals[0]->hDC =
This->owner->mDDrawGlobal.lpExclusiveOwner->hDC;
+ // This->Surf->mpPrimaryLocals[0]->hDC =
This->owner->mDDrawGlobal.lpExclusiveOwner->hDC;
// FIXME dectect if it clipped or not
mDdBlt.IsClipped = FALSE;
Modified: trunk/reactos/dll/directx/ddraw/rosdraw.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/directx/ddraw/rosdraw.h…
==============================================================================
--- trunk/reactos/dll/directx/ddraw/rosdraw.h (original)
+++ trunk/reactos/dll/directx/ddraw/rosdraw.h Fri Apr 7 22:03:21 2006
@@ -46,21 +46,7 @@
UINT mcTextures;
DDSURFACEDESC *mpTextures;
- /* Surface */
- DDRAWI_DDRAWSURFACE_GBL mPrimaryGlobal;
- DDRAWI_DDRAWSURFACE_MORE mPrimaryMore;
- DDRAWI_DDRAWSURFACE_LCL mPrimaryLocal;
- //DDRAWI_DDRAWSURFACE_LCL *mpPrimaryLocals[1];
- DDRAWI_DDRAWCLIPPER_LCL mPrimaryClipperLocal;
- DDRAWI_DDRAWCLIPPER_GBL mPrimaryClipperGlobal;
- //DDRAWI_DDRAWCLIPPER_INT mPrimaryClipperInterface;
- DDSURFACEDESC mddsdPrimary;
- DDSURFACEDESC mddsdOverlay;
-
- DDRAWI_DDRAWSURFACE_GBL mOverlayGlobal;
- DDRAWI_DDRAWSURFACE_LCL mOverlayLocal[6];
- DDRAWI_DDRAWSURFACE_LCL *mpOverlayLocals[6];
- DDRAWI_DDRAWSURFACE_MORE mOverlayMore[6];
+
/* ExclusiveOwner */
@@ -77,8 +63,16 @@
/******** Surface Object ********/
typedef struct
-{
+{
+ DDRAWI_DDRAWSURFACE_GBL mPrimaryGlobal;
+ DDRAWI_DDRAWSURFACE_MORE mPrimaryMore;
+ DDRAWI_DDRAWSURFACE_LCL mPrimaryLocal;
DDRAWI_DDRAWSURFACE_LCL *mpPrimaryLocals[1];
+
+ DDRAWI_DDRAWCLIPPER_LCL mPrimaryClipperLocal;
+ DDRAWI_DDRAWCLIPPER_GBL mPrimaryClipperGlobal;
+
+ DDSURFACEDESC mddsdPrimary;
} DxSurf;
typedef struct