BsGLSLGpuProgram.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #pragma once
  2. #include "BsGLPrerequisites.h"
  3. #include "BsGpuProgram.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief GPU program compiled from GLSL and usable by OpenGL.
  8. */
  9. class BS_RSGL_EXPORT GLSLGpuProgram : public GpuProgram
  10. {
  11. public:
  12. ~GLSLGpuProgram();
  13. /**
  14. * @copydoc GpuProgram::isSupported
  15. */
  16. bool isSupported() const;
  17. /**
  18. * @copydoc GpuProgram::getLanguage
  19. */
  20. const String& getLanguage() const;
  21. /**
  22. * @brief Gets vertex declaration that determines which input attributes does the GPU
  23. * program expect (and which attributes will it retrieve from the bound vertex buffer).
  24. * Only valid for vertex programs.
  25. */
  26. const VertexDeclaration& getInputAttributes() const { return *mVertexDeclaration; }
  27. /**
  28. * @brief Gets internal OpenGL handle to the program.
  29. */
  30. const GLuint getGLHandle() const { return mGLHandle; }
  31. /**
  32. * @brief Gets an unique index for this GPU program. Each created GPU program is
  33. * assigned a unique index on creation.
  34. */
  35. const UINT32 getProgramID() const { return mProgramID; }
  36. /**
  37. * @copydoc GpuProgram::createParameters
  38. */
  39. GpuParamsPtr createParameters();
  40. private:
  41. friend class GLSLProgramFactory;
  42. GLSLGpuProgram(const String& source, const String& entryPoint, GpuProgramType gptype,
  43. GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool isAdjacencyInfoRequired);
  44. /**
  45. * @copydoc GpuProgram::initialize_internal()
  46. */
  47. void initialize_internal();
  48. /**
  49. * @copydoc GpuProgram::destroy_internal()
  50. */
  51. void destroy_internal();
  52. private:
  53. UINT32 mProgramID;
  54. GLuint mGLHandle;
  55. VertexDeclarationPtr mVertexDeclaration;
  56. static UINT32 mVertexShaderCount;
  57. static UINT32 mFragmentShaderCount;
  58. static UINT32 mGeometryShaderCount;
  59. static UINT32 mHullShaderCount;
  60. static UINT32 mDomainShaderCount;
  61. /************************************************************************/
  62. /* SERIALIZATION */
  63. /************************************************************************/
  64. public:
  65. friend class GLSLGpuProgramRTTI;
  66. static RTTITypeBase* getRTTIStatic();
  67. virtual RTTITypeBase* getRTTI() const;
  68. };
  69. }