-
|
Hello everyone 👋🏻 We are currently in the process of migrating a game from Cocos 3.17 to Axmol v2. Right now, we are working on porting our custom shaders and shader game code to ESSL v310 and the new Axmol APIs. While working on it we asked ourselves, if there is a migration or replacement for the old Our question is now, if we still should cache the program states manually or if they are lightweight enough to be created anew every time? Additionally, we assume that the Node methods Is that assumption true? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
Have you taken a look at For example, you could register shaders with Set Take a look at the
Yes, those are for internal shaders. |
Beta Was this translation helpful? Give feedback.
Have you taken a look at
ProgramManager? There are several ways you can use it, such as registering shaders to get a 64Bit ID that you can later use to load the cachedProgram, or simply try to load the shaders, where theProgramManagerwill automatically compute the 64Bit ID and load the cachedProgramif it exists, otherwise it creates a newProgramand adds it to the cache.For example, you could register shaders with
ProgramManager::registerCustomProgram(), and store the 64Bit ID that it returns for later use. You pass that ID toProgramManager::loadProgram(uint64_t progId)to get the cachedProgram, and then create theProgramStatefrom it, which you can then set viaNode::setProgram…