BsGLSLGpuProgram.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. /**
  45. * @copydoc GpuProgramCore::destroy
  46. */
  47. void destroy();
  48. private:
  49. UINT32 mProgramID;
  50. GLuint mGLHandle;
  51. SPtr<VertexDeclarationCore> mVertexDeclaration;
  52. static UINT32 mVertexShaderCount;
  53. static UINT32 mFragmentShaderCount;
  54. static UINT32 mGeometryShaderCount;
  55. static UINT32 mHullShaderCount;
  56. static UINT32 mDomainShaderCount;
  57. };
  58. }