BsGLSLGpuProgram.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. private:
  37. friend class GLSLProgramFactory;
  38. GLSLGpuProgram(const String& source, const String& entryPoint, GpuProgramType gptype,
  39. GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool isAdjacencyInfoRequired);
  40. /**
  41. * @copydoc GpuProgram::initialize_internal()
  42. */
  43. void initialize_internal();
  44. /**
  45. * @copydoc GpuProgram::destroy_internal()
  46. */
  47. void destroy_internal();
  48. private:
  49. UINT32 mProgramID;
  50. GLuint mGLHandle;
  51. VertexDeclarationPtr mVertexDeclaration;
  52. static UINT32 mVertexShaderCount;
  53. static UINT32 mFragmentShaderCount;
  54. static UINT32 mGeometryShaderCount;
  55. static UINT32 mHullShaderCount;
  56. static UINT32 mDomainShaderCount;
  57. /************************************************************************/
  58. /* SERIALIZATION */
  59. /************************************************************************/
  60. public:
  61. friend class GLSLGpuProgramRTTI;
  62. static RTTITypeBase* getRTTIStatic();
  63. virtual RTTITypeBase* getRTTI() const;
  64. };
  65. }