Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright 2011 Joakim Sindholt <opensource@zhasha.com>
  3.  *
  4.  * Permission is hereby granted, free of charge, to any person obtaining a
  5.  * copy of this software and associated documentation files (the "Software"),
  6.  * to deal in the Software without restriction, including without limitation
  7.  * on the rights to use, copy, modify, merge, publish, distribute, sub
  8.  * license, and/or sell copies of the Software, and to permit persons to whom
  9.  * the Software is furnished to do so, subject to the following conditions:
  10.  *
  11.  * The above copyright notice and this permission notice (including the next
  12.  * paragraph) shall be included in all copies or substantial portions of the
  13.  * Software.
  14.  *
  15.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17.  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  18.  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
  19.  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  20.  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  21.  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
  22.  
  23. #ifndef _D3DADAPTER_PRESENT_H_
  24. #define _D3DADAPTER_PRESENT_H_
  25.  
  26. #include <d3d9.h>
  27.  
  28. #ifndef D3DOK_WINDOW_OCCLUDED
  29. #define D3DOK_WINDOW_OCCLUDED MAKE_D3DSTATUS(2531)
  30. #endif /* D3DOK_WINDOW_OCCLUDED */
  31.  
  32. #ifndef __cplusplus
  33. typedef struct ID3DPresent ID3DPresent;
  34. typedef struct ID3DPresentGroup ID3DPresentGroup;
  35. typedef struct ID3DAdapter9 ID3DAdapter9;
  36. typedef struct D3DWindowBuffer D3DWindowBuffer;
  37.  
  38. /* Presentation backend for drivers to display their brilliant work */
  39. typedef struct ID3DPresentVtbl
  40. {
  41.     /* IUnknown */
  42.     HRESULT (WINAPI *QueryInterface)(ID3DPresent *This, REFIID riid, void **ppvObject);
  43.     ULONG (WINAPI *AddRef)(ID3DPresent *This);
  44.     ULONG (WINAPI *Release)(ID3DPresent *This);
  45.  
  46.     /* ID3DPresent */
  47.     /* This function initializes the screen and window provided at creation.
  48.      * Hence why this should always be called as the one of first things a new
  49.      * swap chain does */
  50.     HRESULT (WINAPI *SetPresentParameters)(ID3DPresent *This, D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode);
  51.     /* Make a buffer visible to the window system via dma-buf fd.
  52.      * For better compatibility, it must be 32bpp and format ARGB/XRGB */
  53.     HRESULT (WINAPI *NewD3DWindowBufferFromDmaBuf)(ID3DPresent *This, int dmaBufFd, int width, int height, int stride, int depth, int bpp, D3DWindowBuffer **out);
  54.     HRESULT (WINAPI *DestroyD3DWindowBuffer)(ID3DPresent *This, D3DWindowBuffer *buffer);
  55.     /* After presenting a buffer to the window system, the buffer
  56.      * may be used as is (no copy of the content) by the window system.
  57.      * You must not use a non-released buffer, else the user may see undefined content. */
  58.     HRESULT (WINAPI *WaitBufferReleased)(ID3DPresent *This, D3DWindowBuffer *buffer);
  59.     HRESULT (WINAPI *FrontBufferCopy)(ID3DPresent *This, D3DWindowBuffer *buffer);
  60.     /* It is possible to do partial copy, but impossible to do resizing, which must
  61.      * be done by the client after checking the front buffer size */
  62.     HRESULT (WINAPI *PresentBuffer)(ID3DPresent *This, D3DWindowBuffer *buffer, HWND hWndOverride, const RECT *pSourceRect, const RECT *pDestRect, const RGNDATA *pDirtyRegion, DWORD Flags);
  63.     HRESULT (WINAPI *GetRasterStatus)(ID3DPresent *This, D3DRASTER_STATUS *pRasterStatus);
  64.     HRESULT (WINAPI *GetDisplayMode)(ID3DPresent *This, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation);
  65.     HRESULT (WINAPI *GetPresentStats)(ID3DPresent *This, D3DPRESENTSTATS *pStats);
  66.     HRESULT (WINAPI *GetCursorPos)(ID3DPresent *This, POINT *pPoint);
  67.     HRESULT (WINAPI *SetCursorPos)(ID3DPresent *This, POINT *pPoint);
  68.     /* Cursor size is always 32x32. pBitmap and pHotspot can be NULL. */
  69.     HRESULT (WINAPI *SetCursor)(ID3DPresent *This, void *pBitmap, POINT *pHotspot, BOOL bShow);
  70.     HRESULT (WINAPI *SetGammaRamp)(ID3DPresent *This, const D3DGAMMARAMP *pRamp, HWND hWndOverride);
  71.     HRESULT (WINAPI *GetWindowInfo)(ID3DPresent *This,  HWND hWnd, int *width, int *height, int *depth);
  72. } ID3DPresentVtbl;
  73.  
  74. struct ID3DPresent
  75. {
  76.     ID3DPresentVtbl *lpVtbl;
  77. };
  78.  
  79. /* IUnknown macros */
  80. #define ID3DPresent_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
  81. #define ID3DPresent_AddRef(p) (p)->lpVtbl->AddRef(p)
  82. #define ID3DPresent_Release(p) (p)->lpVtbl->Release(p)
  83. /* ID3DPresent macros */
  84. #define ID3DPresent_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a)
  85. #define ID3DPresent_SetPresentParameters(p,a,b) (p)->lpVtbl->SetPresentParameters(p,a,b)
  86. #define ID3DPresent_NewD3DWindowBufferFromDmaBuf(p,a,b,c,d,e,f,g) (p)->lpVtbl->NewD3DWindowBufferFromDmaBuf(p,a,b,c,d,e,f,g)
  87. #define ID3DPresent_DestroyD3DWindowBuffer(p,a) (p)->lpVtbl->DestroyD3DWindowBuffer(p,a)
  88. #define ID3DPresent_WaitBufferReleased(p,a) (p)->lpVtbl->WaitBufferReleased(p,a)
  89. #define ID3DPresent_FrontBufferCopy(p,a) (p)->lpVtbl->FrontBufferCopy(p,a)
  90. #define ID3DPresent_PresentBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->PresentBuffer(p,a,b,c,d,e,f)
  91. #define ID3DPresent_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a)
  92. #define ID3DPresent_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b)
  93. #define ID3DPresent_GetPresentStats(p,a) (p)->lpVtbl->GetPresentStats(p,a)
  94. #define ID3DPresent_GetCursorPos(p,a) (p)->lpVtbl->GetCursorPos(p,a)
  95. #define ID3DPresent_SetCursorPos(p,a) (p)->lpVtbl->SetCursorPos(p,a)
  96. #define ID3DPresent_SetCursor(p,a,b,c) (p)->lpVtbl->SetCursor(p,a,b,c)
  97. #define ID3DPresent_SetGammaRamp(p,a,b) (p)->lpVtbl->SetGammaRamp(p,a,b)
  98. #define ID3DPresent_GetWindowInfo(p,a,b,c,d) (p)->lpVtbl->GetWindowSize(p,a,b,c,d)
  99.  
  100. typedef struct ID3DPresentGroupVtbl
  101. {
  102.     /* IUnknown */
  103.     HRESULT (WINAPI *QueryInterface)(ID3DPresentGroup *This, REFIID riid, void **ppvObject);
  104.     ULONG (WINAPI *AddRef)(ID3DPresentGroup *This);
  105.     ULONG (WINAPI *Release)(ID3DPresentGroup *This);
  106.  
  107.     /* ID3DPresentGroup */
  108.     /* When creating a device, it's relevant for the driver to know how many
  109.      * implicit swap chains to create. It has to create one per monitor in a
  110.      * multi-monitor setup */
  111.     UINT (WINAPI *GetMultiheadCount)(ID3DPresentGroup *This);
  112.     /* returns only the implicit present interfaces */
  113.     HRESULT (WINAPI *GetPresent)(ID3DPresentGroup *This, UINT Index, ID3DPresent **ppPresent);
  114.     /* used to create additional presentation interfaces along the way */
  115.     HRESULT (WINAPI *CreateAdditionalPresent)(ID3DPresentGroup *This, D3DPRESENT_PARAMETERS *pPresentationParameters, ID3DPresent **ppPresent);
  116.     void (WINAPI *GetVersion) (ID3DPresentGroup *This, int *major, int *minor);
  117. } ID3DPresentGroupVtbl;
  118.  
  119. struct ID3DPresentGroup
  120. {
  121.     ID3DPresentGroupVtbl *lpVtbl;
  122. };
  123.  
  124. /* IUnknown macros */
  125. #define ID3DPresentGroup_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
  126. #define ID3DPresentGroup_AddRef(p) (p)->lpVtbl->AddRef(p)
  127. #define ID3DPresentGroup_Release(p) (p)->lpVtbl->Release(p)
  128. /* ID3DPresentGroup */
  129. #define ID3DPresentGroup_GetMultiheadCount(p) (p)->lpVtbl->GetMultiheadCount(p)
  130. #define ID3DPresentGroup_GetPresent(p,a,b) (p)->lpVtbl->GetPresent(p,a,b)
  131. #define ID3DPresentGroup_CreateAdditionalPresent(p,a,b) (p)->lpVtbl->CreateAdditionalPresent(p,a,b)
  132. #define ID3DPresentGroup_GetVersion(p,a,b) (p)->lpVtbl->GetVersion(p,a,b)
  133.  
  134. #endif /* __cplusplus */
  135.  
  136. #endif /* _D3DADAPTER_PRESENT_H_ */
  137.