Team Fortress 2 Source Code as on 22/4/2020
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.

118 lines
3.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #ifndef SHADERAPIDX8_H
  9. #define SHADERAPIDX8_H
  10. #include "shaderapibase.h"
  11. #include "shaderapi/ishadershadow.h"
  12. #include "locald3dtypes.h"
  13. //-----------------------------------------------------------------------------
  14. // Vendor-specific defines
  15. //-----------------------------------------------------------------------------
  16. #define ATI_FETCH4_ENABLE MAKEFOURCC('G','E','T','4')
  17. #define ATI_FETCH4_DISABLE MAKEFOURCC('G','E','T','1')
  18. #define ATISAMP_FETCH4 D3DSAMP_MIPMAPLODBIAS
  19. //-----------------------------------------------------------------------------
  20. // Forward declarations
  21. //-----------------------------------------------------------------------------
  22. class CMeshBase;
  23. class CMeshBuilder;
  24. struct ShadowState_t;
  25. class IMaterialInternal;
  26. //-----------------------------------------------------------------------------
  27. // State that matters to buffered meshes... (for debugging only)
  28. //-----------------------------------------------------------------------------
  29. struct BufferedState_t
  30. {
  31. D3DXMATRIX m_Transform[3];
  32. D3DVIEWPORT9 m_Viewport;
  33. int m_BoundTexture[16];
  34. void *m_VertexShader;
  35. void *m_PixelShader;
  36. };
  37. //-----------------------------------------------------------------------------
  38. // The DX8 shader API
  39. //-----------------------------------------------------------------------------
  40. // FIXME: Remove this! Either move them into CShaderAPIBase or CShaderAPIDx8
  41. class IShaderAPIDX8 : public CShaderAPIBase
  42. {
  43. public:
  44. // Draws the mesh
  45. virtual void DrawMesh( CMeshBase *pMesh ) = 0;
  46. // Draw the mesh with the currently bound vertex and index buffers.
  47. virtual void DrawWithVertexAndIndexBuffers( void ) = 0;
  48. // modifies the vertex data when necessary
  49. virtual void ModifyVertexData( ) = 0;
  50. // Gets the current buffered state... (debug only)
  51. virtual void GetBufferedState( BufferedState_t &state ) = 0;
  52. // Gets the current backface cull state....
  53. virtual D3DCULL GetCullMode() const = 0;
  54. // Measures fill rate
  55. virtual void ComputeFillRate() = 0;
  56. // Selection mode methods
  57. virtual bool IsInSelectionMode() const = 0;
  58. // We hit somefin in selection mode
  59. virtual void RegisterSelectionHit( float minz, float maxz ) = 0;
  60. // Get the currently bound material
  61. virtual IMaterialInternal* GetBoundMaterial() = 0;
  62. // These methods are called by the transition table
  63. // They depend on dynamic state so can't exist inside the transition table
  64. virtual void ApplyZBias( const ShadowState_t &shaderState ) = 0;
  65. virtual void ApplyTextureEnable( const ShadowState_t &state, int stage ) = 0;
  66. virtual void ApplyCullEnable( bool bEnable ) = 0;
  67. virtual void SetVertexBlendState( int numBones ) = 0;
  68. virtual void ApplyFogMode( ShaderFogMode_t fogMode, bool bSRGBWritesEnabled, bool bDisableGammaCorrection ) = 0;
  69. virtual int GetActualTextureStageCount() const = 0;
  70. virtual int GetActualSamplerCount() const = 0;
  71. virtual bool IsRenderingMesh() const = 0;
  72. // Fog methods...
  73. virtual void FogMode( MaterialFogMode_t fogMode ) = 0;
  74. virtual int GetCurrentFrameCounter( void ) const = 0;
  75. // Workaround hack for visualization of selection mode
  76. virtual void SetupSelectionModeVisualizationState() = 0;
  77. virtual bool UsingSoftwareVertexProcessing() const = 0;
  78. //notification that the SRGB write state is being changed
  79. virtual void EnabledSRGBWrite( bool bEnabled ) = 0;
  80. // Alpha to coverage
  81. virtual void ApplyAlphaToCoverage( bool bEnable ) = 0;
  82. #if defined( _X360 )
  83. virtual void ApplySRGBReadState( int iTextureStage, bool bSRGBReadEnabled ) = 0; //360 needs to rebind the texture over again instead of setting a sampler state
  84. #endif
  85. virtual void PrintfVA( char *fmt, va_list vargs ) = 0;
  86. virtual void Printf( PRINTF_FORMAT_STRING const char *fmt, ... ) = 0;
  87. virtual float Knob( char *knobname, float *setvalue = NULL ) = 0;
  88. };
  89. #endif // SHADERAPIDX8_H