Imagination PowerVR SDK Blog

why doesn't Effect::LoadEffectFile() support custom semantics?


#1

It’s a real pain using custom semantics the way it was designed. To use custom semantics I can no longer simply do:
m_pEffect = new Effect(effectFilename);
m_pEffect->LoadEffectFile();

Instead I need to do these steps:
m_pEffectParser = new CPVRTPFXParser;
m_pEffectParser->ParseFromFile(effectFileName.c_str(), …
// manage my own array of effects
m_pEffectArray = new CPVRTPFXEffect[m_pEffectParser->GetNumberEffects()];
// for each effect, register the custom semantics, load the effect, create a texture manager, load the textures…
for (int j = 0; j < m_pEffectParser->GetNumberEffects(); ++j) {
// register custom semantics
m_pEffectArray[j].RegisterUniformSemantic(c_sCustomSemantics, sizeof(c_sCustomSemantics) / sizeof(c_sCustomSemantics[0]), &error) != PVR_SUCCESS);

}

Basically I have to reproduce everything in Effect::LoadEffectFile(), the only difference is I need to also insert the calls to register the custom semantics.
I really don’t care to restrict the custom semantics to some effects, which would be even messier. Is that the reason there is no way to pass custom semantics into Effect::LoadEffectFile()? As long as they all see the same custom semantics that’s fine. They all see the same regular semantics anyway.
It’s much simpler to just add my custom effects to the master list in PVRTPFXSemantics.cpp/h. It’s not the way designed but it serves the same purpose and is so much simpler.


#2

Hi Adrienne,



We agree the usage of custom semantics in the current release aren’t as user-friendly as they could be. We’re investigating improving this for the 3.5 release of the PowerVR SDK.



Thank you kindly for your feedback.

PaulL.