Clone of mesa.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

present.h 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. #ifndef _D3DADAPTER_PRESENT_H_
  23. #define _D3DADAPTER_PRESENT_H_
  24. #include <d3d9.h>
  25. #ifndef D3DOK_WINDOW_OCCLUDED
  26. #define D3DOK_WINDOW_OCCLUDED MAKE_D3DSTATUS(2531)
  27. #endif /* D3DOK_WINDOW_OCCLUDED */
  28. #ifndef __cplusplus
  29. typedef struct ID3DPresent ID3DPresent;
  30. typedef struct ID3DPresentGroup ID3DPresentGroup;
  31. typedef struct ID3DAdapter9 ID3DAdapter9;
  32. typedef struct D3DWindowBuffer D3DWindowBuffer;
  33. /* Presentation backend for drivers to display their brilliant work */
  34. typedef struct ID3DPresentVtbl
  35. {
  36. /* IUnknown */
  37. HRESULT (WINAPI *QueryInterface)(ID3DPresent *This, REFIID riid, void **ppvObject);
  38. ULONG (WINAPI *AddRef)(ID3DPresent *This);
  39. ULONG (WINAPI *Release)(ID3DPresent *This);
  40. /* ID3DPresent */
  41. /* This function initializes the screen and window provided at creation.
  42. * Hence why this should always be called as the one of first things a new
  43. * swap chain does */
  44. HRESULT (WINAPI *SetPresentParameters)(ID3DPresent *This, D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode);
  45. /* Make a buffer visible to the window system via dma-buf fd.
  46. * For better compatibility, it must be 32bpp and format ARGB/XRGB */
  47. HRESULT (WINAPI *NewD3DWindowBufferFromDmaBuf)(ID3DPresent *This, int dmaBufFd, int width, int height, int stride, int depth, int bpp, D3DWindowBuffer **out);
  48. HRESULT (WINAPI *DestroyD3DWindowBuffer)(ID3DPresent *This, D3DWindowBuffer *buffer);
  49. /* After presenting a buffer to the window system, the buffer
  50. * may be used as is (no copy of the content) by the window system.
  51. * You must not use a non-released buffer, else the user may see undefined content. */
  52. HRESULT (WINAPI *WaitBufferReleased)(ID3DPresent *This, D3DWindowBuffer *buffer);
  53. HRESULT (WINAPI *FrontBufferCopy)(ID3DPresent *This, D3DWindowBuffer *buffer);
  54. /* It is possible to do partial copy, but impossible to do resizing, which must
  55. * be done by the client after checking the front buffer size */
  56. HRESULT (WINAPI *PresentBuffer)(ID3DPresent *This, D3DWindowBuffer *buffer, HWND hWndOverride, const RECT *pSourceRect, const RECT *pDestRect, const RGNDATA *pDirtyRegion, DWORD Flags);
  57. HRESULT (WINAPI *GetRasterStatus)(ID3DPresent *This, D3DRASTER_STATUS *pRasterStatus);
  58. HRESULT (WINAPI *GetDisplayMode)(ID3DPresent *This, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation);
  59. HRESULT (WINAPI *GetPresentStats)(ID3DPresent *This, D3DPRESENTSTATS *pStats);
  60. HRESULT (WINAPI *GetCursorPos)(ID3DPresent *This, POINT *pPoint);
  61. HRESULT (WINAPI *SetCursorPos)(ID3DPresent *This, POINT *pPoint);
  62. /* Cursor size is always 32x32. pBitmap and pHotspot can be NULL. */
  63. HRESULT (WINAPI *SetCursor)(ID3DPresent *This, void *pBitmap, POINT *pHotspot, BOOL bShow);
  64. HRESULT (WINAPI *SetGammaRamp)(ID3DPresent *This, const D3DGAMMARAMP *pRamp, HWND hWndOverride);
  65. HRESULT (WINAPI *GetWindowInfo)(ID3DPresent *This, HWND hWnd, int *width, int *height, int *depth);
  66. /* Available since version 1.1 */
  67. BOOL (WINAPI *GetWindowOccluded)(ID3DPresent *This);
  68. } ID3DPresentVtbl;
  69. struct ID3DPresent
  70. {
  71. ID3DPresentVtbl *lpVtbl;
  72. };
  73. /* IUnknown macros */
  74. #define ID3DPresent_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
  75. #define ID3DPresent_AddRef(p) (p)->lpVtbl->AddRef(p)
  76. #define ID3DPresent_Release(p) (p)->lpVtbl->Release(p)
  77. /* ID3DPresent macros */
  78. #define ID3DPresent_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a)
  79. #define ID3DPresent_SetPresentParameters(p,a,b) (p)->lpVtbl->SetPresentParameters(p,a,b)
  80. #define ID3DPresent_NewD3DWindowBufferFromDmaBuf(p,a,b,c,d,e,f,g) (p)->lpVtbl->NewD3DWindowBufferFromDmaBuf(p,a,b,c,d,e,f,g)
  81. #define ID3DPresent_DestroyD3DWindowBuffer(p,a) (p)->lpVtbl->DestroyD3DWindowBuffer(p,a)
  82. #define ID3DPresent_WaitBufferReleased(p,a) (p)->lpVtbl->WaitBufferReleased(p,a)
  83. #define ID3DPresent_FrontBufferCopy(p,a) (p)->lpVtbl->FrontBufferCopy(p,a)
  84. #define ID3DPresent_PresentBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->PresentBuffer(p,a,b,c,d,e,f)
  85. #define ID3DPresent_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a)
  86. #define ID3DPresent_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b)
  87. #define ID3DPresent_GetPresentStats(p,a) (p)->lpVtbl->GetPresentStats(p,a)
  88. #define ID3DPresent_GetCursorPos(p,a) (p)->lpVtbl->GetCursorPos(p,a)
  89. #define ID3DPresent_SetCursorPos(p,a) (p)->lpVtbl->SetCursorPos(p,a)
  90. #define ID3DPresent_SetCursor(p,a,b,c) (p)->lpVtbl->SetCursor(p,a,b,c)
  91. #define ID3DPresent_SetGammaRamp(p,a,b) (p)->lpVtbl->SetGammaRamp(p,a,b)
  92. #define ID3DPresent_GetWindowInfo(p,a,b,c,d) (p)->lpVtbl->GetWindowSize(p,a,b,c,d)
  93. #define ID3DPresent_GetWindowOccluded(p) (p)->lpVtbl->GetWindowOccluded(p)
  94. typedef struct ID3DPresentGroupVtbl
  95. {
  96. /* IUnknown */
  97. HRESULT (WINAPI *QueryInterface)(ID3DPresentGroup *This, REFIID riid, void **ppvObject);
  98. ULONG (WINAPI *AddRef)(ID3DPresentGroup *This);
  99. ULONG (WINAPI *Release)(ID3DPresentGroup *This);
  100. /* ID3DPresentGroup */
  101. /* When creating a device, it's relevant for the driver to know how many
  102. * implicit swap chains to create. It has to create one per monitor in a
  103. * multi-monitor setup */
  104. UINT (WINAPI *GetMultiheadCount)(ID3DPresentGroup *This);
  105. /* returns only the implicit present interfaces */
  106. HRESULT (WINAPI *GetPresent)(ID3DPresentGroup *This, UINT Index, ID3DPresent **ppPresent);
  107. /* used to create additional presentation interfaces along the way */
  108. HRESULT (WINAPI *CreateAdditionalPresent)(ID3DPresentGroup *This, D3DPRESENT_PARAMETERS *pPresentationParameters, ID3DPresent **ppPresent);
  109. void (WINAPI *GetVersion) (ID3DPresentGroup *This, int *major, int *minor);
  110. } ID3DPresentGroupVtbl;
  111. struct ID3DPresentGroup
  112. {
  113. ID3DPresentGroupVtbl *lpVtbl;
  114. };
  115. /* IUnknown macros */
  116. #define ID3DPresentGroup_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
  117. #define ID3DPresentGroup_AddRef(p) (p)->lpVtbl->AddRef(p)
  118. #define ID3DPresentGroup_Release(p) (p)->lpVtbl->Release(p)
  119. /* ID3DPresentGroup */
  120. #define ID3DPresentGroup_GetMultiheadCount(p) (p)->lpVtbl->GetMultiheadCount(p)
  121. #define ID3DPresentGroup_GetPresent(p,a,b) (p)->lpVtbl->GetPresent(p,a,b)
  122. #define ID3DPresentGroup_CreateAdditionalPresent(p,a,b) (p)->lpVtbl->CreateAdditionalPresent(p,a,b)
  123. #define ID3DPresentGroup_GetVersion(p,a,b) (p)->lpVtbl->GetVersion(p,a,b)
  124. #endif /* __cplusplus */
  125. #endif /* _D3DADAPTER_PRESENT_H_ */