axmol/core/renderer/backend/ProgramStateRegistry.h

41 lines
931 B
C
Raw Normal View History

2019-11-23 20:27:39 +08:00
#pragma once
#include "Macros.h"
#include "base/CCRef.h"
#include "platform/CCPlatformMacros.h"
#include "Program.h"
#include "ProgramState.h"
#include <string>
#include <unordered_map>
NS_AX_BACKEND_BEGIN
2019-11-23 20:27:39 +08:00
/**
* @addtogroup _backend
* @{
* #todo: Rename to ProgramStateRegistry
*/
2021-12-25 10:04:45 +08:00
class ProgramStateRegistry : public Ref
{
2019-11-23 20:27:39 +08:00
public:
/** returns the shared instance */
static ProgramStateRegistry* getInstance();
/** purges the cache. It releases the retained instance. */
static void destroyInstance();
bool init();
void clearPrograms();
void registerProgram(uint32_t programType, int textureSamplerFlags, Program*);
2019-11-23 20:27:39 +08:00
ProgramState* newProgramState(uint32_t programType, int textureSamplerFlags);
uint32_t getProgramType(uint32_t programType, int textureSamplerFlags);
2019-11-23 20:27:39 +08:00
protected:
std::unordered_map<uint32_t, Program*> _registry;
};
2021-12-25 10:04:45 +08:00
// end of _backend group
2019-11-23 20:27:39 +08:00
/// @}
NS_AX_BACKEND_END