BsGLSLGpuProgram.h 2.4 KB

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