CmD3D11RenderSystem.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 setSamplerState(UINT16 texUnit, const SamplerState& samplerState);
  12. void setBlendState(const BlendState& blendState);
  13. void setRasterizerState(const RasterizerState& rasterizerState);
  14. void setDepthStencilState(const DepthStencilState& depthStencilState);
  15. void setTexture(UINT16 unit, bool enabled, const TexturePtr &texPtr );
  16. void disableTextureUnit(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. void bindGpuProgramParameters(GpuProgramType gptype, GpuProgramParametersSharedPtr params, UINT16 variabilityMask);
  29. void setClipPlanesImpl(const PlaneList& clipPlanes);
  30. RenderSystemCapabilities* createRenderSystemCapabilities() const;
  31. void initialiseFromRenderSystemCapabilities(RenderSystemCapabilities* caps);
  32. String getErrorDescription(long errorNumber) const;
  33. void convertProjectionMatrix(const Matrix4& matrix, Matrix4& dest, bool forGpuProgram = false);
  34. VertexElementType getColorVertexElementType() const;
  35. float getHorizontalTexelOffset();
  36. float getVerticalTexelOffset();
  37. float getMinimumDepthInputValue();
  38. float getMaximumDepthInputValue();
  39. /************************************************************************/
  40. /* Internal use by DX11 RenderSystem only */
  41. /************************************************************************/
  42. void determineFSAASettings(UINT32 fsaa, const String& fsaaHint, DXGI_FORMAT format, DXGI_SAMPLE_DESC* outFSAASettings);
  43. bool checkTextureFilteringSupported(TextureType ttype, PixelFormat format, int usage);
  44. IDXGIFactory* getDXGIFactory() const { return mDXGIFactory; }
  45. D3D11Device& getPrimaryDevice() const { return *mDevice; }
  46. protected:
  47. friend class D3D11RenderSystemFactory;
  48. D3D11RenderSystem();
  49. /**
  50. * @copydoc RenderSystem::initialize_internal().
  51. */
  52. void initialize_internal();
  53. /**
  54. * @copydoc RenderSystem::destroy_internal().
  55. */
  56. void destroy_internal();
  57. private:
  58. IDXGIFactory* mDXGIFactory;
  59. D3D11Device* mDevice;
  60. D3D11DriverList* mDriverList;
  61. D3D11Driver* mActiveD3DDriver;
  62. D3D_FEATURE_LEVEL mFeatureLevel;
  63. D3D11HLSLProgramFactory* mHLSLFactory;
  64. };
  65. }