BsGLSLGpuProgram.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 override;
  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. 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. UINT32 getProgramID() const { return mProgramID; }
  32. private:
  33. friend class GLSLProgramFactory;
  34. GLSLGpuProgramCore(const String& source, const String& entryPoint, GpuProgramType gptype,
  35. GpuProgramProfile profile, bool isAdjacencyInfoRequired);
  36. /**
  37. * @copydoc GpuProgramCore::initialize
  38. */
  39. void initialize() override;
  40. private:
  41. UINT32 mProgramID;
  42. GLuint mGLHandle;
  43. SPtr<VertexDeclarationCore> mVertexDeclaration;
  44. static UINT32 mVertexShaderCount;
  45. static UINT32 mFragmentShaderCount;
  46. static UINT32 mGeometryShaderCount;
  47. static UINT32 mHullShaderCount;
  48. static UINT32 mDomainShaderCount;
  49. };
  50. }