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.

133 lines
4.7 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $Header: $
  6. // $NoKeywords: $
  7. // An interface that should not ever be accessed directly from shaders
  8. // but instead is visible only to shaderlib.
  9. //===========================================================================//
  10. #ifndef ISHADERSYSTEM_H
  11. #define ISHADERSYSTEM_H
  12. #ifdef _WIN32
  13. #pragma once
  14. #endif
  15. #include "interface.h"
  16. #include <materialsystem/IShader.h>
  17. #include <materialsystem/ishadersystem_declarations.h>
  18. #include "shaderlib/shadercombosemantics.h"
  19. //-----------------------------------------------------------------------------
  20. // Forward declarations
  21. //-----------------------------------------------------------------------------
  22. enum Sampler_t;
  23. class ITexture;
  24. class IShader;
  25. struct ShaderComboSemantics_t;
  26. //-----------------------------------------------------------------------------
  27. // The Shader system interface version
  28. //-----------------------------------------------------------------------------
  29. #define SHADERSYSTEM_INTERFACE_VERSION "ShaderSystem002"
  30. //-----------------------------------------------------------------------------
  31. // The shader system (a singleton)
  32. //-----------------------------------------------------------------------------
  33. abstract_class IShaderSystem
  34. {
  35. public:
  36. virtual ShaderAPITextureHandle_t GetShaderAPITextureBindHandle( ITexture *pTexture, int nFrameVar, int nTextureChannel = 0 ) =0;
  37. // Binds a texture
  38. virtual void BindTexture( Sampler_t sampler1, TextureBindFlags_t nBindFlags, ITexture *pTexture, int nFrameVar = 0 ) = 0;
  39. virtual void BindTexture( Sampler_t sampler1, Sampler_t sampler2, TextureBindFlags_t nBindFlags, ITexture *pTexture, int nFrameVar = 0 ) = 0;
  40. // Takes a snapshot
  41. virtual void TakeSnapshot( ) = 0;
  42. // Draws a snapshot
  43. virtual void DrawSnapshot( const unsigned char *pInstanceCommandBuffer, bool bMakeActualDrawCall = true ) = 0;
  44. // Are we using graphics?
  45. virtual bool IsUsingGraphics() const = 0;
  46. // Are editor materials enabled?
  47. virtual bool CanUseEditorMaterials() const = 0;
  48. // Bind vertex texture
  49. virtual void BindVertexTexture( VertexTextureSampler_t vtSampler, ITexture *pTexture, int nFrameVar = 0 ) = 0;
  50. virtual void AddShaderComboInformation( const ShaderComboSemantics_t *pSemantics ) = 0;
  51. };
  52. //-----------------------------------------------------------------------------
  53. // The Shader plug-in DLL interface version
  54. //-----------------------------------------------------------------------------
  55. #define SHADER_DLL_INTERFACE_VERSION "ShaderDLL004"
  56. //-----------------------------------------------------------------------------
  57. // The Shader interface versions
  58. //-----------------------------------------------------------------------------
  59. abstract_class IShaderDLLInternal
  60. {
  61. public:
  62. // Here's where the app systems get to learn about each other
  63. virtual bool Connect( CreateInterfaceFn factory, bool bIsMaterialSystem ) = 0;
  64. virtual void Disconnect( bool bIsMaterialSystem ) = 0;
  65. // Returns the number of shaders defined in this DLL
  66. virtual int ShaderCount() const = 0;
  67. // Returns information about each shader defined in this DLL
  68. virtual IShader *GetShader( int nShader ) = 0;
  69. // Deals with all of the shader combo semantics from inc files.
  70. virtual int ShaderComboSemanticsCount() const = 0;
  71. virtual const ShaderComboSemantics_t *GetComboSemantics( int n ) = 0;
  72. };
  73. //-----------------------------------------------------------------------------
  74. // Singleton interface
  75. //-----------------------------------------------------------------------------
  76. IShaderDLLInternal *GetShaderDLLInternal();
  77. #ifdef _PS3
  78. //////////////////////////////////////////////////////////////////////////
  79. //
  80. // PS3 non-virtual implementation proxy
  81. //
  82. // cat ishadersystem.h | nonvirtualscript.pl > shadersystem_ps3nonvirt.inl
  83. struct CPs3NonVirt_IShaderSystem
  84. {
  85. //NONVIRTUALSCRIPTBEGIN
  86. //NONVIRTUALSCRIPT/PROXY/CPs3NonVirt_IShaderSystem
  87. //NONVIRTUALSCRIPT/DELEGATE/s_ShaderSystem.CShaderSystem::
  88. //
  89. // IShaderSystem
  90. //
  91. static ShaderAPITextureHandle_t GetShaderAPITextureBindHandle( ITexture *pTexture, int nFrameVar, int nTextureChannel = 0 );
  92. static void BindTexture( Sampler_t sampler1, TextureBindFlags_t nBindFlags, ITexture *pTexture, int nFrameVar = 0 );
  93. static void BindTexture( Sampler_t sampler1, Sampler_t sampler2, TextureBindFlags_t nBindFlags, ITexture *pTexture, int nFrameVar = 0 );
  94. static void TakeSnapshot();
  95. static void DrawSnapshot( const unsigned char *pInstanceCommandBuffer, bool bMakeActualDrawCall = true );
  96. static bool IsUsingGraphics();
  97. static bool CanUseEditorMaterials();
  98. static void BindVertexTexture( VertexTextureSampler_t vtSampler, ITexture *pTexture, int nFrameVar = 0 );
  99. //NONVIRTUALSCRIPTEND
  100. };
  101. #endif
  102. #endif // ISHADERSYSTEM_H