CmD3D11RenderSystem.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #pragma once
  2. #include "CmD3D11Prerequisites.h"
  3. #include "CmRenderSystem.h"
  4. namespace CamelotEngine
  5. {
  6. class CM_D3D11_EXPORT D3D11RenderSystem : public RenderSystem
  7. {
  8. public:
  9. ~D3D11RenderSystem();
  10. const String& getName() const;
  11. void setBlendState(const BlendState& blendState);
  12. void setRasterizerState(const RasterizerState& rasterizerState);
  13. void setDepthStencilState(const DepthStencilState& depthStencilState);
  14. void setSamplerState(GpuProgramType gptype, UINT16 texUnit, const SamplerState& samplerState);
  15. void setTexture(GpuProgramType gptype, UINT16 unit, bool enabled, const TexturePtr &texPtr);
  16. void disableTextureUnit(GpuProgramType gptype, UINT16 texUnit);
  17. void setStencilRefValue(UINT32 refValue);
  18. void beginFrame();
  19. void endFrame();
  20. void clearFrameBuffer(unsigned int buffers, const Color& color = Color::Black, float depth = 1.0f, unsigned short stencil = 0);
  21. void setRenderTarget(RenderTarget* target);
  22. void setViewport(const Viewport& vp);
  23. void setScissorRect(UINT32 left = 0, UINT32 top = 0, UINT32 right = 800, UINT32 bottom = 600);
  24. void setVertexDeclaration(VertexDeclarationPtr decl);
  25. void setVertexBufferBinding(VertexBufferBinding* binding);
  26. void bindGpuProgram(GpuProgramHandle prg);
  27. void unbindGpuProgram(GpuProgramType gptype);
  28. /**
  29. * @copydoc RenderSystem::bindGpuParams()
  30. */
  31. void bindGpuParams(GpuProgramType gptype, GpuParamsPtr params);
  32. void setClipPlanesImpl(const PlaneList& clipPlanes);
  33. RenderSystemCapabilities* createRenderSystemCapabilities() const;
  34. void initialiseFromRenderSystemCapabilities(RenderSystemCapabilities* caps);
  35. String getErrorDescription(long errorNumber) const;
  36. void convertProjectionMatrix(const Matrix4& matrix, Matrix4& dest, bool forGpuProgram = false);
  37. VertexElementType getColorVertexElementType() const;
  38. float getHorizontalTexelOffset();
  39. float getVerticalTexelOffset();
  40. float getMinimumDepthInputValue();
  41. float getMaximumDepthInputValue();
  42. /************************************************************************/
  43. /* Internal use by DX11 RenderSystem only */
  44. /************************************************************************/
  45. void determineFSAASettings(UINT32 fsaa, const String& fsaaHint, DXGI_FORMAT format, DXGI_SAMPLE_DESC* outFSAASettings);
  46. bool checkTextureFilteringSupported(TextureType ttype, PixelFormat format, int usage);
  47. IDXGIFactory* getDXGIFactory() const { return mDXGIFactory; }
  48. D3D11Device& getPrimaryDevice() const { return *mDevice; }
  49. protected:
  50. friend class D3D11RenderSystemFactory;
  51. D3D11RenderSystem();
  52. /**
  53. * @copydoc RenderSystem::initialize_internal().
  54. */
  55. void initialize_internal();
  56. /**
  57. * @copydoc RenderSystem::destroy_internal().
  58. */
  59. void destroy_internal();
  60. private:
  61. IDXGIFactory* mDXGIFactory;
  62. D3D11Device* mDevice;
  63. D3D11DriverList* mDriverList;
  64. D3D11Driver* mActiveD3DDriver;
  65. D3D_FEATURE_LEVEL mFeatureLevel;
  66. D3D11HLSLProgramFactory* mHLSLFactory;
  67. };
  68. }