| 1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
| 2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
| 3 | #pragma once |
| 4 | |
| 5 | #include "BsGLPrerequisites.h" |
| 6 | #include "RenderAPI/BsGpuProgram.h" |
| 7 | |
| 8 | namespace bs { namespace ct |
| 9 | { |
| 10 | /** @addtogroup GL |
| 11 | * @{ |
| 12 | */ |
| 13 | |
| 14 | /** GPU program compiled from GLSL and usable by OpenGL. */ |
| 15 | class GLSLGpuProgram : public GpuProgram |
| 16 | { |
| 17 | public: |
| 18 | ~GLSLGpuProgram(); |
| 19 | |
| 20 | /** @copydoc GpuProgram::isSupported */ |
| 21 | bool isSupported() const override; |
| 22 | |
| 23 | /** Gets internal OpenGL handle to the program. */ |
| 24 | GLuint getGLHandle() const { return mGLHandle; } |
| 25 | |
| 26 | /** Gets an unique index for this GPU program. Each created GPU program is assigned a unique index on creation. */ |
| 27 | UINT32 getProgramID() const { return mProgramID; } |
| 28 | |
| 29 | private: |
| 30 | friend class GLSLProgramFactory; |
| 31 | |
| 32 | GLSLGpuProgram(const GPU_PROGRAM_DESC& desc, GpuDeviceFlags deviceMask); |
| 33 | |
| 34 | /** @copydoc GpuProgram::initialize */ |
| 35 | void initialize() override; |
| 36 | |
| 37 | private: |
| 38 | UINT32 mProgramID = 0; |
| 39 | GLuint mGLHandle = 0; |
| 40 | |
| 41 | static UINT32 sVertexShaderCount; |
| 42 | static UINT32 sFragmentShaderCount; |
| 43 | static UINT32 sGeometryShaderCount; |
| 44 | static UINT32 sHullShaderCount; |
| 45 | static UINT32 sDomainShaderCount; |
| 46 | static UINT32 sComputeShaderCount; |
| 47 | }; |
| 48 | |
| 49 | /** Identifier of the compiler used for compiling OpenGL GPU programs. */ |
| 50 | static constexpr const char* OPENGL_COMPILER_ID = "OpenGL" ; |
| 51 | |
| 52 | /** @} */ |
| 53 | }} |
| 54 | |