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.

89 lines
3.1 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: devlock.h
  3. *
  4. * Created: 12-Apr-1994 19:45:42
  5. * Author: Gilman Wong [gilmanw]
  6. *
  7. * Copyright (c) 1994 Microsoft Corporation
  8. \**************************************************************************/
  9. // Engine helper functions to grab/release display semaphore and to
  10. // teardown/restore the cursor.
  11. extern BOOL APIENTRY glsrvGrabLock(__GLGENcontext *gengc);
  12. extern VOID APIENTRY glsrvReleaseLock(__GLGENcontext *gengc);
  13. extern BOOL APIENTRY glsrvGrabSurfaces(__GLGENcontext *gengc,
  14. GLGENwindow *pwnd,
  15. FSHORT surfBits);
  16. extern VOID APIENTRY glsrvReleaseSurfaces(__GLGENcontext *gengc,
  17. GLGENwindow *pwnd,
  18. FSHORT surfBits);
  19. extern void APIENTRY glsrvSynchronizeWithGdi(__GLGENcontext *gengc,
  20. GLGENwindow *pwnd,
  21. FSHORT surfBits);
  22. extern void APIENTRY glsrvDecoupleFromGdi(__GLGENcontext *gengc,
  23. GLGENwindow *pwnd,
  24. FSHORT surfBits);
  25. /******************************Public*Routine******************************\
  26. *
  27. * glsrvLazyGrabSurfaces
  28. *
  29. * Indicates a need for all surfaces whose bits are set in the flags
  30. * word. If the locking code determined that a lock was needed for
  31. * that surface and the lock isn't currently held, the lock is taken.
  32. *
  33. * History:
  34. * Fri May 30 18:17:27 1997 -by- Gilman Wong [gilmanw]
  35. * Created
  36. *
  37. \**************************************************************************/
  38. __inline BOOL glsrvLazyGrabSurfaces(__GLGENcontext *gengc,
  39. FSHORT surfBits)
  40. {
  41. BOOL bRet = TRUE;
  42. if (((gengc->fsGenLocks ^ gengc->fsLocks) & surfBits) != 0)
  43. {
  44. bRet = glsrvGrabSurfaces(gengc, gengc->pwndLocked, surfBits);
  45. }
  46. return bRet;
  47. }
  48. //
  49. // Provide wrappers for DirectDraw surface locking and unlocking so
  50. // that lock tracking can be done on debug builds.
  51. //
  52. // #define VERBOSE_DDSLOCK
  53. #if !defined(DBG) || !defined(VERBOSE_DDSLOCK)
  54. #define DDSLOCK(pdds, pddsd, flags, prect) \
  55. ((pdds)->lpVtbl->Lock((pdds), (prect), (pddsd), (flags), NULL))
  56. #define DDSUNLOCK(pdds, ptr) \
  57. ((pdds)->lpVtbl->Unlock((pdds), (ptr)))
  58. #else
  59. HRESULT dbgDdsLock(LPDIRECTDRAWSURFACE pdds, DDSURFACEDESC *pddsd,
  60. DWORD flags, char *file, int line);
  61. HRESULT dbgDdsUnlock(LPDIRECTDRAWSURFACE pdds, void *ptr,
  62. char *file, int line);
  63. #define DDSLOCK(pdds, pddsd, flags, prect) \
  64. dbgDdsLock(pdds, pddsd, flags, __FILE__, __LINE__)
  65. #define DDSUNLOCK(pdds, ptr) \
  66. dbgDdsUnlock(pdds, ptr, __FILE__, __LINE__)
  67. #endif
  68. extern DWORD gcmsOpenGLTimer;
  69. //#define BATCH_LOCK_TICKMAX 99
  70. //#define TICK_RANGE_LO 60
  71. //#define TICK_RANGE_HI 100
  72. extern DWORD BATCH_LOCK_TICKMAX;
  73. extern DWORD TICK_RANGE_LO;
  74. extern DWORD TICK_RANGE_HI;
  75. #define GENERIC_BACKBUFFER_ONLY(gc) \
  76. ( ((gc)->state.raster.drawBuffer == GL_BACK ) &&\
  77. ((gc)->state.pixel.readBuffer == GL_BACK ) )