ReactOS  0.4.14-dev-49-gfb4591c
d3d9_swapchain.h File Reference
#include "d3d9_common.h"
#include <d3d9.h>
#include <ddraw.h>
#include "d3d9_baseobject.h"
Include dependency graph for d3d9_swapchain.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _Direct3DSwapChain9_INT
 

Typedefs

typedef struct _Direct3DSwapChain9_INT Direct3DSwapChain9_INT
 
typedef struct _Direct3DSwapChain9_INTLPDIRECT3DSWAPCHAIN9_INT
 

Functions

LPDIRECT3DSWAPCHAIN9_INT IDirect3DSwapChain9ToImpl (LPDIRECT3DSWAPCHAIN9 iface)
 
Direct3DSwapChain9_INTCreateDirect3DSwapChain9 (enum REF_TYPE RefType, struct _Direct3DDevice9_INT *pBaseDevice, DWORD ChainIndex)
 
VOID Direct3DSwapChain9_SetDisplayMode (Direct3DSwapChain9_INT *pThisSwapChain, D3DPRESENT_PARAMETERS *pPresentationParameters)
 
HRESULT Direct3DSwapChain9_Init (Direct3DSwapChain9_INT *pThisSwapChain, D3DPRESENT_PARAMETERS *pPresentationParameters)
 
HRESULT Direct3DSwapChain9_Reset (Direct3DSwapChain9_INT *pThisSwapChain, D3DPRESENT_PARAMETERS *pPresentationParameters)
 
VOID Direct3DSwapChain9_GetGammaRamp (Direct3DSwapChain9_INT *pThisSwapChain, D3DGAMMARAMP *pRamp)
 
VOID Direct3DSwapChain9_SetGammaRamp (Direct3DSwapChain9_INT *pThisSwapChain, DWORD Flags, CONST D3DGAMMARAMP *pRamp)
 

Typedef Documentation

◆ Direct3DSwapChain9_INT

◆ LPDIRECT3DSWAPCHAIN9_INT

Function Documentation

◆ CreateDirect3DSwapChain9()

Direct3DSwapChain9_INT* CreateDirect3DSwapChain9 ( enum REF_TYPE  RefType,
struct _Direct3DDevice9_INT pBaseDevice,
DWORD  ChainIndex 
)

Definition at line 183 of file d3d9_swapchain.c.

184 {
185  Direct3DSwapChain9_INT* pThisSwapChain;
186  if (FAILED(AlignedAlloc((LPVOID*)&pThisSwapChain, sizeof(Direct3DSwapChain9_INT))))
187  {
188  DPRINT1("Could not create Direct3DSwapChain9_INT");
189  return NULL;
190  }
191 
192  InitD3D9BaseObject((D3D9BaseObject*) &pThisSwapChain->BaseObject.lpVtbl, RefType, (IUnknown*) &pBaseDevice->lpVtbl);
193 
194  pThisSwapChain->lpVtbl = &Direct3DSwapChain9_Vtbl;
195 
196  pThisSwapChain->ChainIndex = ChainIndex;
197  pThisSwapChain->AdapterGroupIndex = ChainIndex;
198  pThisSwapChain->pUnknown6BC = pBaseDevice->DeviceData[ChainIndex].pUnknown6BC;
199  pThisSwapChain->pUnknown015c = (LPVOID)0xD3D9D3D9;
200 
201  return pThisSwapChain;
202 }
struct _IDirect3DDevice9Vtbl_INT * lpVtbl
Definition: d3d9_device.h:88
smooth NULL
Definition: ftsmooth.c:416
HRESULT AlignedAlloc(IN OUT LPVOID *ppObject, IN SIZE_T dwSize)
Definition: d3d9_helpers.c:95
static IDirect3DSwapChain9Vtbl Direct3DSwapChain9_Vtbl
#define LPVOID
Definition: nt_native.h:45
D3D9_DEVICEDATA DeviceData[D3D9_INT_MAX_NUM_ADAPTERS]
Definition: d3d9_device.h:121
#define DPRINT1
Definition: precomp.h:8
VOID InitD3D9BaseObject(D3D9BaseObject *pBaseObject, enum REF_TYPE RefType, IUnknown *pUnknown)
struct _D3D9_Unknown6BC * pUnknown6BC
Definition: d3d9_private.h:142

Referenced by IDirect3DDevice9Base_CreateAdditionalSwapChain(), and InitD3D9BaseDevice().

◆ Direct3DSwapChain9_GetGammaRamp()

VOID Direct3DSwapChain9_GetGammaRamp ( Direct3DSwapChain9_INT pThisSwapChain,
D3DGAMMARAMP pRamp 
)

Definition at line 248 of file d3d9_swapchain.c.

249 {
250  memcpy(pRamp, &pThisSwapChain->GammaRamp, sizeof(D3DGAMMARAMP));
251 }
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by IDirect3DDevice9Base_GetGammaRamp().

◆ Direct3DSwapChain9_Init()

HRESULT Direct3DSwapChain9_Init ( Direct3DSwapChain9_INT pThisSwapChain,
D3DPRESENT_PARAMETERS pPresentationParameters 
)

Definition at line 210 of file d3d9_swapchain.c.

211 {
212  int i;
213  DIRECT3DDEVICE9_INT* pDevice;
214 
215  for (i = 0; i < 256; i++)
216  {
217  pThisSwapChain->GammaRamp.red[i] =
218  pThisSwapChain->GammaRamp.green[i] =
219  pThisSwapChain->GammaRamp.blue[i] = i;
220  }
221 
222  pThisSwapChain->PresentParameters = pPresentationParameters[pThisSwapChain->ChainIndex];
223  pThisSwapChain->SwapEffect = pPresentationParameters->SwapEffect;
224  Direct3DSwapChain9_SetDisplayMode(pThisSwapChain, &pThisSwapChain->PresentParameters);
225 
226  if (FAILED(D3D9BaseObject_GetDeviceInt(&pThisSwapChain->BaseObject, &pDevice)))
227  {
228  DPRINT1("Could not get the swapchain device");
229  return DDERR_GENERIC;
230  }
231 
232  pThisSwapChain->pCursor = CreateD3D9Cursor(pDevice, pThisSwapChain);
233  if (NULL == pThisSwapChain->pCursor)
234  {
235  DPRINT1("Could not allocate D3D9Cursor");
236  return DDERR_OUTOFMEMORY;
237  }
238 
239  return Direct3DSwapChain9_Reset(pThisSwapChain, pPresentationParameters);
240 }
D3D9Cursor * CreateD3D9Cursor(struct _Direct3DDevice9_INT *pBaseDevice, struct _Direct3DSwapChain9_INT *pSwapChain)
Definition: d3d9_cursor.c:18
WORD red[256]
Definition: d3d8types.h:1046
WORD blue[256]
Definition: d3d8types.h:1048
#define DDERR_OUTOFMEMORY
Definition: ddraw.h:111
HRESULT D3D9BaseObject_GetDeviceInt(D3D9BaseObject *pBaseObject, DIRECT3DDEVICE9_INT **ppDevice)
HRESULT Direct3DSwapChain9_Reset(Direct3DSwapChain9_INT *pThisSwapChain, D3DPRESENT_PARAMETERS *pPresentationParameters)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID Direct3DSwapChain9_SetDisplayMode(Direct3DSwapChain9_INT *pThisSwapChain, D3DPRESENT_PARAMETERS *pPresentationParameters)
struct _D3D9Cursor * pCursor
D3D9BaseObject BaseObject
smooth NULL
Definition: ftsmooth.c:416
#define DDERR_GENERIC
Definition: ddraw.h:72
D3DPRESENT_PARAMETERS PresentParameters
D3DSWAPEFFECT SwapEffect
WORD green[256]
Definition: d3d8types.h:1047
#define DPRINT1
Definition: precomp.h:8
D3DSWAPEFFECT SwapEffect
Definition: d3d8types.h:1128

Referenced by IDirect3DDevice9Base_CreateAdditionalSwapChain(), and InitD3D9BaseDevice().

◆ Direct3DSwapChain9_Reset()

HRESULT Direct3DSwapChain9_Reset ( Direct3DSwapChain9_INT pThisSwapChain,
D3DPRESENT_PARAMETERS pPresentationParameters 
)

Definition at line 242 of file d3d9_swapchain.c.

243 {
244  // TODO: Do all the dirty work...
245  return D3D_OK;
246 }
#define D3D_OK
Definition: d3d.h:106

Referenced by Direct3DSwapChain9_Init().

◆ Direct3DSwapChain9_SetDisplayMode()

VOID Direct3DSwapChain9_SetDisplayMode ( Direct3DSwapChain9_INT pThisSwapChain,
D3DPRESENT_PARAMETERS pPresentationParameters 
)

Definition at line 204 of file d3d9_swapchain.c.

205 {
206  pThisSwapChain->dwWidth = pPresentationParameters->BackBufferWidth;
207  pThisSwapChain->dwHeight = pPresentationParameters->BackBufferHeight;
208 }

Referenced by Direct3DSwapChain9_Init().

◆ Direct3DSwapChain9_SetGammaRamp()

VOID Direct3DSwapChain9_SetGammaRamp ( Direct3DSwapChain9_INT pThisSwapChain,
DWORD  Flags,
CONST D3DGAMMARAMP pRamp 
)

Definition at line 253 of file d3d9_swapchain.c.

254 {
256 }
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by IDirect3DDevice9Base_SetGammaRamp().

◆ IDirect3DSwapChain9ToImpl()