Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

187 lines
6.1 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: glp.h
  3. *
  4. * GL system routines shared between the front and back end
  5. *
  6. * Created: 12-Nov-1993 17:36:00
  7. * Author: Gilman Wong [gilmanw]
  8. *
  9. * Copyright (c) 1992-1995 Microsoft Corporation
  10. *
  11. \**************************************************************************/
  12. #ifndef _glp_
  13. #define _glp_
  14. // Calls into the back end
  15. typedef struct GLGENwindowRec GLGENwindow;
  16. // Fake object type for DirectDraw. BITMAP is used because it
  17. // shouldn't come up in the places we use GetObjectType.
  18. #define OBJ_DDRAW OBJ_BITMAP
  19. // Surface flags
  20. // HDC available
  21. #define GLSURF_HDC 0x00000001
  22. // DirectDraw surfaces available
  23. #define GLSURF_DIRECTDRAW 0x00000002
  24. // Metafile-based
  25. #define GLSURF_METAFILE 0x00000004
  26. // Direct memory access possible
  27. #define GLSURF_DIRECT_ACCESS 0x00000008
  28. // Screen surface, only set for HDC surfaces
  29. #define GLSURF_SCREEN 0x00000010
  30. // Direct DC surface
  31. #define GLSURF_DIRECTDC 0x00000020
  32. // Surface is in video memory
  33. #define GLSURF_VIDEO_MEMORY 0x00000040
  34. // Special surface types
  35. // Memory DC
  36. #define GLSURF_IS_MEMDC(dwFlags) \
  37. (((dwFlags) & (GLSURF_HDC | GLSURF_DIRECTDC | GLSURF_METAFILE)) == \
  38. GLSURF_HDC)
  39. // Non-memory, non-info DC
  40. #define GLSURF_IS_DIRECTDC(dwFlags) \
  41. (((dwFlags) & (GLSURF_HDC | GLSURF_DIRECTDC | GLSURF_METAFILE)) == \
  42. (GLSURF_HDC | GLSURF_DIRECTDC))
  43. // Direct DC for the screen
  44. #define GLSURF_IS_SCREENDC(dwFlags) \
  45. (((dwFlags) & (GLSURF_HDC | GLSURF_DIRECTDC | GLSURF_METAFILE | \
  46. GLSURF_SCREEN)) == \
  47. (GLSURF_HDC | GLSURF_DIRECTDC | GLSURF_SCREEN))
  48. typedef struct IDirectDrawSurface *LPDIRECTDRAWSURFACE;
  49. typedef struct _GLDDSURF
  50. {
  51. LPDIRECTDRAWSURFACE pdds;
  52. DDSURFACEDESC ddsd;
  53. DWORD dwBitDepth;
  54. } GLDDSURF;
  55. typedef struct _GLDDSURFACES
  56. {
  57. GLDDSURF gddsFront;
  58. GLDDSURF gddsZ;
  59. } GLDDSURFACES;
  60. typedef struct _GLSURF
  61. {
  62. DWORD dwFlags;
  63. int iLayer;
  64. int ipfd;
  65. PIXELFORMATDESCRIPTOR pfd;
  66. // Needed for ExtEscape calls for hardware even for surfaces, like
  67. // DirectDraw surfaces, which don't need a DC for access
  68. HDC hdc;
  69. // Source-specific fields
  70. union
  71. {
  72. HWND hwnd;
  73. GLDDSURFACES dd;
  74. };
  75. } GLSURF;
  76. DWORD APIENTRY DdbdToCount(DWORD ddbd);
  77. // The documentation says that depths returned in DDPIXELFORMATs are
  78. // DDBD_ constants, but they seem to be real numbers. Hide the conversion
  79. // necessary in case it needs to change.
  80. #define DdPixDepthToCount(ddpd) (ddpd)
  81. BYTE APIENTRY DdPixelDepth(DDSURFACEDESC *pddsd);
  82. void APIENTRY MaskToBitsAndShift(DWORD dwMask, BYTE *pbBits, BYTE *pbShift);
  83. BOOL APIENTRY InitDeviceSurface(HDC hdc, int ipfd, int iLayer,
  84. DWORD dwObjectType, BOOL bUpdatePfd,
  85. GLSURF *pgsurf);
  86. BOOL APIENTRY IsDirectDrawDevice(HDC hdc);
  87. BOOL APIENTRY glsrvAttention(PVOID, PVOID, PVOID, HANDLE);
  88. PVOID APIENTRY glsrvCreateContext(struct _GLWINDOWID *, GLSURF *);
  89. BOOL APIENTRY glsrvMakeCurrent(struct _GLWINDOWID *, PVOID, GLGENwindow *);
  90. VOID APIENTRY glsrvLoseCurrent(PVOID);
  91. BOOL APIENTRY glsrvDeleteContext(PVOID);
  92. BOOL APIENTRY glsrvSwapBuffers(HDC, GLGENwindow *);
  93. VOID APIENTRY glsrvThreadExit(void);
  94. VOID APIENTRY glsrvCleanupWindow(PVOID, GLGENwindow *);
  95. ULONG APIENTRY glsrvShareLists(PVOID, PVOID);
  96. BOOL APIENTRY glsrvCopyContext(PVOID, PVOID, UINT);
  97. BOOL APIENTRY glsrvBindDirectDrawTexture(struct __GLcontextRec *, int,
  98. LPDIRECTDRAWSURFACE *,
  99. DDSURFACEDESC *, ULONG);
  100. void APIENTRY glsrvUnbindDirectDrawTexture(struct __GLcontextRec *);
  101. BOOL APIENTRY __wglGetBitfieldColorFormat(HDC hdc, UINT cColorBits,
  102. PIXELFORMATDESCRIPTOR *ppfd,
  103. BOOL bDescribeSurf);
  104. BOOL APIENTRY wglIsDirectDevice(HDC hdc);
  105. // Cleans up any orphaned window information
  106. VOID APIENTRY wglValidateWindows(void);
  107. // GL metafile support function
  108. DWORD APIENTRY wglObjectType(HDC hdc);
  109. // Find pixel format counts
  110. VOID APIENTRY wglNumHardwareFormats(HDC hdc, DWORD dwType,
  111. int *piMcd, int *piIcd);
  112. // Calls from the back end to the front end
  113. int WINAPI __DrvDescribePixelFormat(HDC hdc, int ipfd, UINT cjpfd,
  114. LPPIXELFORMATDESCRIPTOR ppfd);
  115. BOOL WINAPI __DrvSetPixelFormat(HDC hdc, int ipfd, PVOID *pwnd);
  116. BOOL WINAPI __DrvSwapBuffers(HDC hdc, BOOL bFinish);
  117. extern CRITICAL_SECTION gcsPixelFormat;
  118. extern CRITICAL_SECTION gcsPaletteWatcher;
  119. extern DWORD tidPaletteWatcherThread;
  120. extern ULONG ulPaletteWatcherCount;
  121. extern HWND hwndPaletteWatcher;
  122. extern DWORD dwPlatformId;
  123. #define NT_PLATFORM ( dwPlatformId == VER_PLATFORM_WIN32_NT )
  124. #define WIN95_PLATFORM ( dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
  125. extern LONG lThreadsAttached;
  126. typedef HRESULT (WINAPI *PFN_GETSURFACEFROMDC)(HDC, LPDIRECTDRAWSURFACE *,
  127. HDC *);
  128. extern PFN_GETSURFACEFROMDC pfnGetSurfaceFromDC;
  129. #ifdef GL_METAFILE
  130. // OpenGL metafile support routines in GDI, dynamically linked
  131. // so the DLL can be run on platforms without metafile support
  132. extern BOOL (APIENTRY *pfnGdiAddGlsRecord)(HDC hdc, DWORD cb, BYTE *pb,
  133. LPRECTL prclBounds);
  134. extern BOOL (APIENTRY *pfnGdiAddGlsBounds)(HDC hdc, LPRECTL prclBounds);
  135. extern BOOL (APIENTRY *pfnGdiIsMetaPrintDC)(HDC hdc);
  136. #if DBG
  137. // Use NULL-checking thunks in debug mode to check erroneous DLL usage
  138. BOOL APIENTRY GlGdiAddGlsRecord(HDC hdc, DWORD cb, BYTE *pb,
  139. LPRECTL prclBounds);
  140. BOOL APIENTRY GlGdiAddGlsBounds(HDC hdc, LPRECTL prclBounds);
  141. BOOL APIENTRY GlGdiIsMetaPrintDC(HDC hdc);
  142. #else
  143. // Call directly through points in retail builds
  144. #define GlGdiAddGlsRecord(hdc, cb, pb, prcl) \
  145. pfnGdiAddGlsRecord(hdc, cb, pb, prcl)
  146. #define GlGdiAddGlsBounds(hdc, prcl) \
  147. pfnGdiAddGlsBounds(hdc, prcl)
  148. #define GlGdiIsMetaPrintDC(hdc) \
  149. pfnGdiIsMetaPrintDC(hdc)
  150. #endif
  151. #endif
  152. #include <alloc.h>
  153. #include <debug.h>
  154. #endif // _glp_