ReactOS 0.4.15-dev-5667-ged97270
d3d.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * PURPOSE: Native driver for dxg implementation
5 * FILE: win32ss/reactx/dxg/d3d.c
6 * PROGRAMER: Sebastian Gasiorek (sebastian.gasiorek@reactos.org)
7 */
8
9#include <string.h>
10#include <dxg_int.h>
11
15 HANDLE DdHandle,
16 PDD_CANCREATESURFACEDATA SurfaceData)
17{
21
23 if (!peDdL)
24 return RetVal;
25
26 peDdGl = peDdL->peDirectDrawGlobal2;
28
29 // assign out DirectDrawGlobal to SurfaceData
30 SurfaceData->lpDD = (PDD_DIRECTDRAW_GLOBAL)peDdGl;
31
33 RetVal = peDdGl->d3dBufCallbacks.CanCreateD3DBuffer(SurfaceData);
34
37
38 return RetVal;
39}
40
44 PEDD_SURFACE pDdSurfList, DDSURFACEDESC2 *a3,
45 DD_SURFACE_GLOBAL *pDdSurfGlob,
46 DD_SURFACE_LOCAL *pDdSurfLoc,
47 DD_SURFACE_MORE *pDdSurfMore,
48 DD_CREATESURFACEDATA *pDdCreateSurfaceData,
50{
53 DD_SURFACE_LOCAL *pCurSurfLocal;
54 DD_SURFACE_GLOBAL *pCurSurfGlobal;
55 DD_SURFACE_MORE *pCurSurfMore;
56 PEDD_SURFACE pCurSurf;
57
58 ULONG CurSurf;
59
60 if (!pDdCreateSurfaceData)
61 return FALSE;
62
63 if (!pDdCreateSurfaceData->dwSCnt)
64 {
65 pDdCreateSurfaceData->ddRVal = E_FAIL;
66 return FALSE;
67 }
68
69 peDdL = (PEDD_DIRECTDRAW_LOCAL)DdHmgLock(hDirectDrawLocal, ObjType_DDLOCAL_TYPE, FALSE);
70 if (!peDdL)
71 return FALSE;
72
73 peDdGl = peDdL->peDirectDrawGlobal2;
74
75 if (!(pDdSurfLoc->ddsCaps.dwCaps & DDSCAPS_VISIBLE) && !(peDdGl->ddCallbacks.dwFlags & DDHAL_CB32_CREATESURFACE))
76 {
77 pDdCreateSurfaceData->ddRVal = E_FAIL;
78 return FALSE;
79 }
80
81 pDdSurfList = (PEDD_SURFACE)EngAllocMem(FL_ZERO_MEMORY, pDdCreateSurfaceData->dwSCnt * sizeof(EDD_SURFACE), TAG_GDDP);
82 pDdSurfGlob = (DD_SURFACE_GLOBAL *)EngAllocMem(FL_ZERO_MEMORY, pDdCreateSurfaceData->dwSCnt * sizeof(DD_SURFACE_GLOBAL), TAG_GDDP);
83 pDdSurfLoc = (DD_SURFACE_LOCAL *)EngAllocMem(FL_ZERO_MEMORY, pDdCreateSurfaceData->dwSCnt * sizeof(DD_SURFACE_LOCAL), TAG_GDDP);
84 pDdSurfMore = (DD_SURFACE_MORE *)EngAllocMem(FL_ZERO_MEMORY, pDdCreateSurfaceData->dwSCnt * sizeof(DD_SURFACE_MORE), TAG_GDDP);
85
88
89 // create all surface objects
90 for (CurSurf = 0; CurSurf < pDdCreateSurfaceData->dwSCnt; CurSurf++)
91 {
92 pCurSurf = &pDdSurfList[CurSurf];
93 pCurSurfLocal = &pDdSurfLoc[CurSurf];
94 pCurSurfGlobal = &pDdSurfGlob[CurSurf];
95 pCurSurfMore = &pDdSurfMore[CurSurf];
96
98 peDdL,
99 pCurSurf,
100 pCurSurfGlobal,
101 pCurSurfLocal,
102 pCurSurfMore);
103 Address = pCurSurf;
104 }
105
108
110}
111
112DWORD
113NTAPI
115 HANDLE hDirectDrawLocal,
116 PEDD_SURFACE pDdSurfList,
118 DD_SURFACE_GLOBAL *pDdSurfGlob,
119 DD_SURFACE_LOCAL *pDdSurfLoc,
120 DD_SURFACE_MORE *pDdSurfMore,
121 DD_CREATESURFACEDATA *pDdCreateSurfaceData,
123{
124 return intDdCreateSurfaceOrBuffer(hDirectDrawLocal, pDdSurfList, a3, pDdSurfGlob, pDdSurfLoc, pDdSurfMore, pDdCreateSurfaceData, Address);
125}
#define InterlockedDecrement
Definition: armddk.h:52
PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned)
Definition: ddhmg.c:147
#define DDHAL_DRIVER_HANDLED
Definition: ddrawi.h:321
#define E_FAIL
Definition: ddrawi.h:102
#define DDHAL_CB32_CREATESURFACE
Definition: ddrawi.h:654
#define DDHAL_DRIVER_NOTHANDLED
Definition: ddrawi.h:320
struct _DD_DIRECTDRAW_GLOBAL * PDD_DIRECTDRAW_GLOBAL
struct _EDD_DIRECTDRAW_LOCAL * PEDD_DIRECTDRAW_LOCAL
struct _EDD_SURFACE * PEDD_SURFACE
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
DWORD FASTCALL intDdCreateSurfaceOrBuffer(HANDLE hDirectDrawLocal, PEDD_SURFACE pDdSurfList, DDSURFACEDESC2 *a3, DD_SURFACE_GLOBAL *pDdSurfGlob, DD_SURFACE_LOCAL *pDdSurfLoc, DD_SURFACE_MORE *pDdSurfMore, DD_CREATESURFACEDATA *pDdCreateSurfaceData, PVOID Address)
Definition: d3d.c:43
DWORD NTAPI DxDdCreateD3DBuffer(HANDLE hDirectDrawLocal, PEDD_SURFACE pDdSurfList, DDSURFACEDESC2 *a3, DD_SURFACE_GLOBAL *pDdSurfGlob, DD_SURFACE_LOCAL *pDdSurfLoc, DD_SURFACE_MORE *pDdSurfMore, DD_CREATESURFACEDATA *pDdCreateSurfaceData, PVOID Address)
Definition: d3d.c:114
DWORD NTAPI DxDdCanCreateD3DBuffer(HANDLE DdHandle, PDD_CANCREATESURFACEDATA SurfaceData)
Definition: d3d.c:14
DXENG_FUNCTIONS gpEngFuncs
Definition: main.c:20
#define ObjType_DDLOCAL_TYPE
Definition: dxg_int.h:56
unsigned long DWORD
Definition: ntddk_ex.h:95
static const struct update_accum a3
Definition: msg.c:600
#define FASTCALL
Definition: nt_native.h:50
static WCHAR Address[46]
Definition: ping.c:68
#define FL_ZERO_MEMORY
Definition: polytest.cpp:58
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
#define DDSCAPS_VISIBLE
Definition: ddraw.h:265
DWORD dwFlags
Definition: ddrawint.h:499
DWORD dwCaps
Definition: ddraw.h:727
USHORT cExclusiveLock
Definition: dxg_int.h:39
PDD_DIRECTDRAW_GLOBAL lpDD
Definition: ddrawint.h:456
PDD_CANCREATESURFACE CanCreateD3DBuffer
Definition: ddrawint.h:1032
DDSCAPS ddsCaps
Definition: ddrawint.h:174
PFN_DxEngUnlockShareSem DxEngUnlockShareSem
Definition: dxg_int.h:135
PFN_DxEngUnlockHdev DxEngUnlockHdev
Definition: dxg_int.h:138
PFN_DxEngLockShareSem DxEngLockShareSem
Definition: dxg_int.h:134
PFN_DxEngLockHdev DxEngLockHdev
Definition: dxg_int.h:137
DD_D3DBUFCALLBACKS d3dBufCallbacks
Definition: directxint.h:165
DD_CALLBACKS ddCallbacks
Definition: directxint.h:160
struct _EDD_DIRECTDRAW_GLOBAL * peDirectDrawGlobal2
Definition: directxint.h:22
DD_BASEOBJECT pobj
Definition: directxint.h:16
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG
Definition: typedefs.h:59
PEDD_SURFACE NTAPI intDdCreateNewSurfaceObject(PEDD_DIRECTDRAW_LOCAL peDdL, HANDLE hDirectDrawLocal, PDD_SURFACE_GLOBAL pDdSurfGlob, PDD_SURFACE_LOCAL pDdSurfLoc, PDD_SURFACE_MORE pDdSurfMore)
Definition: ddraw.c:588
#define TAG_GDDP
Definition: tags.h:5