RenderContext.h 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. ===========================================================================
  3. Doom 3 BFG Edition GPL Source Code
  4. Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
  6. Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #ifndef __RENDERCONTEXT_H__
  21. #define __RENDERCONTEXT_H__
  22. // This is for "official" HDMI 3D support with with the left eye above the right and a guard band in the middle
  23. // Some displays which don't support this can still do stereo 3D by packing 2 eyes into a single (mono-sized) buffer
  24. enum hdmi3DState_t {
  25. HDMI3D_NOT_SUPPORTED, // The TV doesn't support it
  26. HDMI3D_NOT_ENABLED, // The TV supports it, but the user disabled it
  27. HDMI3D_NOT_ACTIVE, // The TV supports it, and the user enabled it, but it's not active
  28. HDMI3D_ACTIVE
  29. };
  30. //================================================================================================
  31. // class idRenderContext
  32. //================================================================================================
  33. class idRenderContext {
  34. public:
  35. idRenderContext() : depthHackValue( 0.0f ), weaponDepthHackValue( 1.0f ) {}
  36. virtual ~idRenderContext() {};
  37. void InitContext();
  38. void Shutdown();
  39. void PrepareSwap();
  40. void SwapBuffers( bool forceVsync = false );
  41. void SetGamma( unsigned short red[256], unsigned short green[256], unsigned short blue[256] );
  42. hdmi3DState_t GetHDMI3DState();
  43. void EnableHDMI3D( const bool enable );
  44. // Back End Rendering
  45. void ExecuteBackendCommands( const emptyCommand_t *cmds );
  46. void Clear( float r, float g, float b, float a );
  47. void InitGraphicsAPIWrapper();
  48. // Debug Tools
  49. void RenderDebugTools( drawSurf_t **drawSurfs, int numDrawSurfs );
  50. void SetWrapperContext( const wrapperContext_t & context );
  51. void SetWrapperConfig( const wrapperConfig_t & config );
  52. // Texture Resolves
  53. void ResolveTargetColor( idImage* image );
  54. void ResolveTargetDepth( idImage* image );
  55. void ResolveTargetColor( idImage* image, int srcMinX, int srcMinY, int srcMaxX, int srcMaxY, int dstX, int dstY );
  56. void ResolveTargetDepth( idImage* image, int srcMinX, int srcMinY, int srcMaxX, int srcMaxY, int dstX, int dstY );
  57. void SetDepthHackValue( float depth ) { depthHackValue = depth; }
  58. float GetDepthHackValue() const { return depthHackValue; }
  59. void SetWeaponDepthHackValue( float depth ) { weaponDepthHackValue = depth; }
  60. float GetWeaponDepthHackValue() const { return weaponDepthHackValue; }
  61. uint64 GetGPUFrameMicroSec() const { return GPUFrameMicroSec; }
  62. private:
  63. float depthHackValue;
  64. float weaponDepthHackValue;
  65. uint64 GPUFrameMicroSec;
  66. };
  67. extern idRenderContext rRenderContext;
  68. #endif // !__RENDERCONTEXT_H__