CmD3D11GpuProgram.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #pragma once
  2. #include "CmD3D11Prerequisites.h"
  3. #include "CmGpuProgram.h"
  4. namespace CamelotEngine
  5. {
  6. /** Direct3D implementation of a few things common to low-level vertex & fragment programs. */
  7. class D3D11GpuProgram : public GpuProgram
  8. {
  9. public:
  10. D3D11GpuProgram(GpuProgramType type, GpuProgramProfile profile);
  11. protected:
  12. void loadImpl(void);
  13. /**
  14. * @brief Loads shader from source. Not used as DX11 doesn't support
  15. * assembly shaders.
  16. */
  17. void loadFromSource(void);
  18. /**
  19. * @brief Loads shader from microcode.
  20. */
  21. virtual void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode) = 0;
  22. };
  23. /** Direct3D implementation of low-level vertex programs. */
  24. class D3D11GpuVertexProgram : public D3D11GpuProgram
  25. {
  26. protected:
  27. ID3D11VertexShader* mVertexShader;
  28. public:
  29. D3D11GpuVertexProgram(GpuProgramProfile profile);
  30. ~D3D11GpuVertexProgram();
  31. /// Gets the vertex shader
  32. ID3D11VertexShader* getVertexShader(void) const;
  33. protected:
  34. void unloadImpl(void);
  35. void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
  36. };
  37. /** Direct3D implementation of low-level fragment programs. */
  38. class D3D11GpuFragmentProgram : public D3D11GpuProgram
  39. {
  40. protected:
  41. ID3D11PixelShader* mPixelShader;
  42. public:
  43. D3D11GpuFragmentProgram(GpuProgramProfile profile);
  44. ~D3D11GpuFragmentProgram();
  45. /// Gets the pixel shader
  46. ID3D11PixelShader* getPixelShader(void) const;
  47. protected:
  48. /** @copydoc Resource::unloadImpl */
  49. void unloadImpl(void);
  50. void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
  51. };
  52. /** Direct3D implementation of low-level vertex programs. */
  53. class D3D11GpuDomainProgram : public D3D11GpuProgram
  54. {
  55. protected:
  56. ID3D11DomainShader* mDomainShader;
  57. public:
  58. D3D11GpuDomainProgram(GpuProgramProfile profile);
  59. ~D3D11GpuDomainProgram();
  60. /// Gets the vertex shader
  61. ID3D11DomainShader* getDomainShader(void) const;
  62. protected:
  63. void unloadImpl(void);
  64. void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
  65. };
  66. /** Direct3D implementation of low-level vertex programs. */
  67. class D3D11GpuHullProgram : public D3D11GpuProgram
  68. {
  69. protected:
  70. ID3D11HullShader* mHullShader;
  71. public:
  72. D3D11GpuHullProgram(GpuProgramProfile profile);
  73. ~D3D11GpuHullProgram();
  74. /// Gets the vertex shader
  75. ID3D11HullShader* getHullShader() const;
  76. protected:
  77. void unloadImpl(void);
  78. void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
  79. };
  80. /**
  81. Direct3D implementation of low-level geometry programs.
  82. Added due to need to accept geometry programs came from other profiles (nvgp4, for example)
  83. */
  84. class D3D11GpuGeometryProgram : public D3D11GpuProgram
  85. {
  86. protected:
  87. ID3D11GeometryShader* mGeometryShader;
  88. public:
  89. D3D11GpuGeometryProgram(GpuProgramProfile profile);
  90. ~D3D11GpuGeometryProgram();
  91. /// Gets the geometry shader
  92. ID3D11GeometryShader* getGeometryShader(void) const;
  93. protected:
  94. void unloadImpl(void);
  95. void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
  96. };
  97. }