From 4efa4a4b9c84e6bf9eefcd9e3956239f8901aafa Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Sun, 21 Oct 2007 01:25:26 +0000 Subject: [PATCH] Add documentations : how NtGdiDdCreateD3DBuffer works, did nott add full docs, but egunt for people start using it if they read msdn as well Optimize : NtGdiDdCreateD3DBuffer svn path=/branches/reactx/; revision=29725 --- reactos/subsystems/win32/win32k/ntddraw/d3d.c | 60 ++++++++++++++++--- 1 file changed, 53 insertions(+), 7 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntddraw/d3d.c b/reactos/subsystems/win32/win32k/ntddraw/d3d.c index 399a41e768f..c5de4705177 100644 --- a/reactos/subsystems/win32/win32k/ntddraw/d3d.c +++ b/reactos/subsystems/win32/win32k/ntddraw/d3d.c @@ -48,6 +48,7 @@ * for the ddRVal will other wise be unchange if some error happen inside the driver. * puCanCreateSurfaceData->lpDD is pointer to DDRAWI_DIRECTDRAW_GBL, MSDN say it is PDD_DIRECTDRAW_GLOBAL it is not. * puCanCreateSurfaceData->lpDD->hDD need also be fill in with the handle we got from NtGdiDdCreateDirectDrawObject +* puCreateSurfaceData->CanCreateSurface pointer to the real functions the HAL or HEL, that u need fill in * *--*/ @@ -195,9 +196,57 @@ NtGdiD3dContextDestroyAll(LPD3DNTHAL_CONTEXTDESTROYALLDATA pdcad) return pfnD3dContextDestroyAll(pdcad); } -/************************************************************************/ -/* NtGdiDdCreateD3DBuffer */ -/************************************************************************/ +/*++ +* @name NtGdiDdCreateD3DBuffer +* @implemented +* +* The function NtGdiDdCreateD3DBuffer create a +* surface for DirectX. It is redirected to dxg.sys. +* +* @param HANDLE hDirectDraw +* The handle we got from NtGdiDdCreateDirectDrawObject +* +* @param HANDLE *hSurface +* +* +* @param DDSURFACEDESC puSurfaceDescription +* surface desc what kind of surface it should be, example rgb, compress, deep, and more, +* see DDSURFACEDESC for more infomations +* +* @param DD_SURFACE_GLOBAL *puSurfaceGlobalData +* +* +* @param DD_SURFACE_LOCAL *puSurfaceLocalData +* +* +* @param DD_SURFACE_MORE *puSurfaceMoreData +* +* +* @param PDD_CREATESURFACEDATA puCreateSurfaceData +* +* +* @param HANDLE *puhSurface +* +* +* @return +* Depending on if the driver supports this API or not, DDHAL_DRIVER_HANDLED +* or DDHAL_DRIVER_NOTHANDLED is returned. +* To check if the function has been successful, do a full check. +* A full check is done by checking if the return value is DDHAL_DRIVER_HANDLED +* and puCanCreateSurfaceData->ddRVal is set to DD_OK. +* +* @remarks. +* dxg.sys NtGdiDdCreateD3DBuffer and NtGdiDdCreateSurface call are redirect to dxg.sys +* inside the dxg.sys they ar redirect to same functions. examine the driver list functions +* table, the memory address you will see they are pointed to same memory address. +* +* Before call to this api please set the puCreateSurfaceData->ddRVal to a error value example DDERR_NOTUSPORTED. +* for the ddRVal will other wise be unchange if some error happen inside the driver. +* puCreateSurfaceData->lpDD is pointer to DDRAWI_DIRECTDRAW_GBL, MSDN say it is PDD_DIRECTDRAW_GLOBAL it is not. +* puCreateSurfaceData->lpDD->hDD need also be fill in with the handle we got from NtGdiDdCreateDirectDrawObject +* puCreateSurfaceData->CreateSurface pointer to the real functions the HAL or HEL, that u need fill in +* +*--*/ DWORD STDCALL NtGdiDdCreateD3DBuffer(HANDLE hDirectDraw, @@ -209,10 +258,7 @@ NtGdiDdCreateD3DBuffer(HANDLE hDirectDraw, PDD_CREATESURFACEDATA puCreateSurfaceData, HANDLE *puhSurface) { - PGD_DDCREATED3DBUFFER pfnDdCreateD3DBuffer = NULL; - INT i; - - DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdCreateD3DBuffer, pfnDdCreateD3DBuffer); + PGD_DDCREATED3DBUFFER pfnDdCreateD3DBuffer = (PGD_D3DCONTEXTDESTROYALL)gpDxFuncs[DXG_INDEX_DxDdCreateD3DBuffer].pfn; if (pfnDdCreateD3DBuffer == NULL) {