| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #pragma once
- #include "BsGLPrerequisites.h"
- namespace BansheeEngine
- {
- /**
- * @brief Wrapper around OpenGL pipeline object.
- */
- struct GLSLProgramPipeline
- {
- GLuint glHandle;
- };
- /**
- * @brief Managed OpenGL pipeline objects that are used for binding a certain combination
- * of GPU programs to the render system.
- *
- * @note In OpenGL you cannot bind GPU programs to the pipeline manually. Instead as a preprocessing step
- * you create a pipeline object containing the programs you plan on using, and then later you bind the
- * previously created pipeline object.
- */
- class GLSLProgramPipelineManager
- {
- public:
- ~GLSLProgramPipelineManager();
- /**
- * @brief Creates or returns an existing pipeline that uses the provided combination of GPU programs. Provide
- * null for unused programs.
- */
- const GLSLProgramPipeline* getPipeline(GLSLGpuProgramCore* vertexProgram, GLSLGpuProgramCore* fragmentProgram,
- GLSLGpuProgramCore* geometryProgram, GLSLGpuProgramCore* hullProgram, GLSLGpuProgramCore* domainProgram);
- private:
- /**
- * @brief Key that uniquely identifies a pipeline object.
- */
- struct ProgramPipelineKey
- {
- UINT32 vertexProgKey;
- UINT32 fragmentProgKey;
- UINT32 geometryProgKey;
- UINT32 hullProgKey;
- UINT32 domainProgKey;
- };
- /**
- * @brief Used for calculating a hash code from pipeline object key.
- */
- class ProgramPipelineKeyHashFunction
- {
- public:
- ::std::size_t operator()(const ProgramPipelineKey &key) const;
- };
- /**
- * @brief Used for comparing two pipeline objects for equality.
- */
- class ProgramPipelineKeyEqual
- {
- public:
- bool operator()(const ProgramPipelineKey &a, const ProgramPipelineKey &b) const;
- };
- typedef UnorderedMap<ProgramPipelineKey, GLSLProgramPipeline, ProgramPipelineKeyHashFunction, ProgramPipelineKeyEqual> ProgramPipelineMap;
- ProgramPipelineMap mPipelines;
- };
- }
|