BsRenderStateManager.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #pragma once
  2. #include "BsCorePrerequisites.h"
  3. #include "BsModule.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Handles creation of various render states.
  8. */
  9. class BS_CORE_EXPORT RenderStateManager : public Module<RenderStateManager>
  10. {
  11. public:
  12. /**
  13. * @brief Creates and initializes a new SamplerState.
  14. */
  15. SamplerStatePtr createSamplerState(const SAMPLER_STATE_DESC& desc) const;
  16. /**
  17. * @brief Creates and initializes a new DepthStencilState.
  18. */
  19. DepthStencilStatePtr createDepthStencilState(const DEPTH_STENCIL_STATE_DESC& desc) const;
  20. /**
  21. * @brief Creates and initializes a new RasterizerState.
  22. */
  23. RasterizerStatePtr createRasterizerState(const RASTERIZER_STATE_DESC& desc) const;
  24. /**
  25. * @brief Creates and initializes a new BlendState.
  26. */
  27. BlendStatePtr createBlendState(const BLEND_STATE_DESC& desc) const;
  28. /**
  29. * @brief Creates a completely empty and uninitialized SamplerState.
  30. * Should only be used for VERY specific purposes, like deserialization,
  31. * as it requires additional manual initialization that is not required normally.
  32. */
  33. SamplerStatePtr createEmptySamplerState() const;
  34. /**
  35. * @brief Creates a completely empty and uninitialized DepthStencilState.
  36. * Should only be used for VERY specific purposes, like deserialization,
  37. * as it requires additional manual initialization that is not required normally.
  38. */
  39. DepthStencilStatePtr createEmptyDepthStencilState() const;
  40. /**
  41. * @brief Creates a completely empty and uninitialized RasterizerState.
  42. * Should only be used for VERY specific purposes, like deserialization,
  43. * as it requires additional manual initialization that is not required normally.
  44. */
  45. RasterizerStatePtr createEmptyRasterizerState() const;
  46. /**
  47. * @brief Creates a completely empty and uninitialized BlendState.
  48. * Should only be used for VERY specific purposes, like deserialization,
  49. * as it requires additional manual initialization that is not required normally.
  50. */
  51. BlendStatePtr createEmptyBlendState() const;
  52. /**
  53. * @brief Gets a sampler state initialized with default options.
  54. */
  55. const SamplerStatePtr& getDefaultSamplerState() const;
  56. /**
  57. * @brief Gets a blend state initialized with default options.
  58. */
  59. const BlendStatePtr& getDefaultBlendState() const;
  60. /**
  61. * @brief Gets a rasterizer state initialized with default options.
  62. */
  63. const RasterizerStatePtr& getDefaultRasterizerState() const;
  64. /**
  65. * @brief Gets a depth stencil state initialized with default options.
  66. */
  67. const DepthStencilStatePtr& getDefaultDepthStencilState() const;
  68. protected:
  69. /**
  70. * @copydoc createSamplerState
  71. */
  72. virtual SamplerStatePtr createSamplerStateImpl() const;
  73. /**
  74. * @copydoc createBlendState
  75. */
  76. virtual BlendStatePtr createBlendStateImpl() const;
  77. /**
  78. * @copydoc createRasterizerState
  79. */
  80. virtual RasterizerStatePtr createRasterizerStateImpl() const;
  81. /**
  82. * @copydoc createDepthStencilState
  83. */
  84. virtual DepthStencilStatePtr createDepthStencilStateImpl() const;
  85. private:
  86. mutable SamplerStatePtr mDefaultSamplerState;
  87. mutable BlendStatePtr mDefaultBlendState;
  88. mutable RasterizerStatePtr mDefaultRasterizerState;
  89. mutable DepthStencilStatePtr mDefaultDepthStencilState;
  90. };
  91. }