- Parameters
-
T | The ShaderImplementation to define a factory for. It can have scope qualification if required. |
P | A reference to the WorkspacePlugin instance this ShaderImplementation belongs to. See ShaderImplementationFactory::getPlugin() for more details. |
N | The name to use for the ShaderImplementation T. This will be seen by users and will also be used to uniquely identify the ShaderImplementation within the specified plugin, P. See ShaderImplementationFactory::getType() for more details. |
- Note
- Normally, this macro would not be used directly unless T was not a suitable name for the ShaderImplementation. In most instances, N will be the same as T and the DEFINE_SHADERIMPLEMENTATION_NAMED macro would be easier to use.
This macro defines the explicit specializations of the functions in ShaderImplementationFactoryTraits for the type T. They are defined as forwarding functions to their corresponding equivalents in TypedShaderImplementationFactory<T>. This technique ensures that the function implementations for ShaderImplementationFactoryTraits are only ever defined in the one place. Specifically, it ensures that T shaderimpls are always allocated and deleted in the same file when performed through the ShaderImplementationFactoryTraits class.
The macro also takes care of explicitly instantiating TypedShaderImplementationFactory<T>.
- Warning
- Never use this macro in a header. It should only ever be used in an implementation file so that other compilation units do not see the implementation of each of the TypedShaderImplementationFactory member functions. This prevents compilers from inlining the creation and deletion of ShaderImplementation's, which is the whole point of the macro. The normal usage of this macro is to put it at the end of the implementation file defining the implementation of T, outside of any namespace(s).
- See also
- DECLARE_SHADERIMPLEMENTATION_FACTORY