2019-11-23 20:27:39 +08:00
|
|
|
#pragma once
|
|
|
|
#include "Macros.h"
|
2023-06-11 13:08:08 +08:00
|
|
|
#include "base/Ref.h"
|
|
|
|
#include "platform/PlatformMacros.h"
|
2019-11-23 20:27:39 +08:00
|
|
|
#include "Program.h"
|
|
|
|
#include "ProgramState.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
NS_AX_BACKEND_BEGIN
|
2022-10-12 19:44:31 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
/**
|
|
|
|
* @addtogroup _backend
|
|
|
|
* @{
|
|
|
|
* #todo: Rename to ProgramStateRegistry
|
|
|
|
*/
|
2022-10-12 19:44:31 +08:00
|
|
|
class AX_DLL ProgramStateRegistry : public Ref
|
2021-12-25 10:04:45 +08:00
|
|
|
{
|
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();
|
|
|
|
|
2023-09-01 01:07:15 +08:00
|
|
|
void registerProgram(uint32_t programType, int textureSamplerFlags, uint32_t builtinProgramType);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-06-27 20:58:50 +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:
|
2023-09-01 01:07:15 +08:00
|
|
|
std::unordered_map<uint32_t, uint32_t> _registry;
|
2019-11-23 20:27:39 +08:00
|
|
|
};
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
// end of _backend group
|
2019-11-23 20:27:39 +08:00
|
|
|
/// @}
|
2022-07-11 17:50:21 +08:00
|
|
|
NS_AX_BACKEND_END
|