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.

85 lines
2.2 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #ifndef SHADERRENDERBASE_H
  9. #define SHADERRENDERBASE_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "togl/rendermechanism.h"
  14. #include "shaderapi/ishaderapi.h"
  15. #include "shaderapi_global.h"
  16. #include "locald3dtypes.h"
  17. // Colors for PIX graphs
  18. #define PIX_VALVE_ORANGE 0xFFF5940F
  19. //-----------------------------------------------------------------------------
  20. // The Base implementation of the shader rendering interface
  21. //-----------------------------------------------------------------------------
  22. class CShaderAPIBase : public IShaderAPI
  23. {
  24. public:
  25. // constructor, destructor
  26. CShaderAPIBase();
  27. virtual ~CShaderAPIBase();
  28. // Called when the device is initializing or shutting down
  29. virtual bool OnDeviceInit() = 0;
  30. virtual void OnDeviceShutdown() = 0;
  31. // Pix events
  32. virtual void BeginPIXEvent( unsigned long color, const char *szName ) = 0;
  33. virtual void EndPIXEvent() = 0;
  34. virtual void AdvancePIXFrame() = 0;
  35. // Release, reacquire objects
  36. virtual void ReleaseShaderObjects( bool bReleaseManagedResources = true ) = 0;
  37. virtual void RestoreShaderObjects() = 0;
  38. // Resets the render state to its well defined initial value
  39. virtual void ResetRenderState( bool bFullReset = true ) = 0;
  40. // Returns a d3d texture associated with a texture handle
  41. virtual IDirect3DBaseTexture* GetD3DTexture( ShaderAPITextureHandle_t hTexture ) = 0;
  42. // Queues a non-full reset of render state next BeginFrame.
  43. virtual void QueueResetRenderState() = 0;
  44. // Methods of IShaderDynamicAPI
  45. public:
  46. virtual void GetCurrentColorCorrection( ShaderColorCorrectionInfo_t* pInfo );
  47. protected:
  48. };
  49. //-----------------------------------------------------------------------------
  50. // Pix measurement class
  51. //-----------------------------------------------------------------------------
  52. class CPixEvent
  53. {
  54. public:
  55. CPixEvent( unsigned long color, const char *szName )
  56. {
  57. if ( g_pShaderAPI )
  58. g_pShaderAPI->BeginPIXEvent( color, szName );
  59. }
  60. ~CPixEvent()
  61. {
  62. if ( g_pShaderAPI )
  63. g_pShaderAPI->EndPIXEvent();
  64. }
  65. };
  66. #endif // SHADERRENDERBASE_H