Counter Strike : Global Offensive Source Code
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.

83 lines
2.3 KiB

  1. //============ Copyright (c) Valve Corporation, All rights reserved. ============
  2. //
  3. // cglmquery.h
  4. // GLMgr queries
  5. //
  6. //===============================================================================
  7. #ifndef CGLMQUERY_H
  8. #define CGLMQUERY_H
  9. #pragma once
  10. #ifdef OSX
  11. #include "glmgr/glmgrbasics.h"
  12. #endif
  13. //===============================================================================
  14. // forward declarations
  15. class GLMContext;
  16. class CGLMQuery;
  17. //===============================================================================
  18. enum EGLMQueryType
  19. {
  20. EOcclusion,
  21. EFence,
  22. EGLMQueryCount
  23. };
  24. struct GLMQueryParams
  25. {
  26. EGLMQueryType m_type;
  27. };
  28. class CGLMQuery
  29. {
  30. // leave everything public til it's running
  31. public:
  32. friend class GLMContext; // only GLMContext can make CGLMTex objects
  33. friend class IDirect3DDevice9;
  34. friend class IDirect3DQuery9;
  35. GLMContext *m_ctx; // link back to parent context
  36. GLMQueryParams m_params; // params created with
  37. GLuint m_name; // name of the query object per se - could be fence, could be query object
  38. bool m_started;
  39. bool m_stopped;
  40. bool m_done;
  41. bool m_nullQuery; // was gl_nullqueries true at Start time - if so, continue to act like a null query through Stop/IsDone/Complete time
  42. // restated - only Start should examine the convar.
  43. CGLMQuery( GLMContext *ctx, GLMQueryParams *params );
  44. ~CGLMQuery( );
  45. // for an occlusion query:
  46. // Start = BeginQuery query-start goes into stream
  47. // Stop = EndQuery query-end goes into stream - a fence is also set so we can probe for completion
  48. // IsDone = TestFence use the added fence to ask if query-end has passed (i.e. will Complete block?)
  49. // Complete = GetQueryObjectuivARB(uint id, enum pname, uint *params) - extract the sample count
  50. // for a fence query:
  51. // Start = SetFence fence goes into command stream
  52. // Stop = NOP fences are self finishing - no need to call Stop on a fence
  53. // IsDone = TestFence ask if fence passed
  54. // Complete = FinishFence
  55. void Start ( void );
  56. void Stop ( void );
  57. bool IsDone ( void );
  58. void Complete ( uint *result );
  59. // accessors for the started/stopped state
  60. bool IsStarted ( void );
  61. bool IsStopped ( void );
  62. };
  63. #endif