BsGLSLGpuProgram.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 GLSLGpuProgramCore : public GpuProgramCore
  10. {
  11. public:
  12. ~GLSLGpuProgramCore();
  13. /**
  14. * @copydoc GpuProgramCore::isSupported
  15. */
  16. bool isSupported() const;
  17. /**
  18. * @brief Gets vertex declaration that determines which input attributes does the GPU
  19. * program expect (and which attributes will it retrieve from the bound vertex buffer).
  20. * Only valid for vertex programs.
  21. */
  22. const VertexDeclarationCore& getInputAttributes() const { return *mVertexDeclaration; }
  23. /**
  24. * @brief Gets internal OpenGL handle to the program.
  25. */
  26. const GLuint getGLHandle() const { return mGLHandle; }
  27. /**
  28. * @brief Gets an unique index for this GPU program. Each created GPU program is
  29. * assigned a unique index on creation.
  30. */
  31. const UINT32 getProgramID() const { return mProgramID; }
  32. /**
  33. * @copydoc GpuProgramCore::hasColumnMajorMatrices
  34. */
  35. bool hasColumnMajorMatrices() const { return true; }
  36. private:
  37. friend class GLSLProgramFactory;
  38. GLSLGpuProgramCore(const String& source, const String& entryPoint, GpuProgramType gptype,
  39. GpuProgramProfile profile, bool isAdjacencyInfoRequired);
  40. /**
  41. * @copydoc GpuProgramCore::initialize
  42. */
  43. void initialize();
  44. private:
  45. UINT32 mProgramID;
  46. GLuint mGLHandle;
  47. SPtr<VertexDeclarationCore> mVertexDeclaration;
  48. static UINT32 mVertexShaderCount;
  49. static UINT32 mFragmentShaderCount;
  50. static UINT32 mGeometryShaderCount;
  51. static UINT32 mHullShaderCount;
  52. static UINT32 mDomainShaderCount;
  53. };
  54. }