Skip to content

Commit f9139d4

Browse files
committed
Test ABI cookie for all plugins
1 parent 80d7b98 commit f9139d4

File tree

14 files changed

+65
-12
lines changed

14 files changed

+65
-12
lines changed

OgreMain/include/OgrePlugin.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ namespace Ogre
3838
/** \addtogroup General
3939
* @{
4040
*/
41+
42+
struct AbiCookie;
43+
4144
/** Class defining a generic OGRE plugin.
4245
@remarks
4346
OGRE is very plugin-oriented and you can customise much of its behaviour
@@ -128,6 +131,9 @@ namespace Ogre
128131
should have been sorted out in the 'shutdown' method.
129132
*/
130133
virtual void uninstall() = 0;
134+
135+
/// Outputs an ABI cookie generated by generateAbiCookie
136+
virtual void getAbiCookie( AbiCookie &outAbiCookie ) = 0;
131137
};
132138
/** @} */
133139
/** @} */

OgreMain/src/OgreRoot.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ namespace Ogre
150150
mIsBlendIndicesGpuRedundant( true ),
151151
mIsBlendWeightsGpuRedundant( true )
152152
{
153-
154153
// superclass will do singleton checking
155154
String msg;
156155

@@ -1416,16 +1415,26 @@ namespace Ogre
14161415
{
14171416
LogManager::getSingleton().logMessage( "Installing plugin: " + plugin->getName() );
14181417

1419-
mPlugins.push_back( plugin );
1420-
plugin->install();
1418+
AbiCookie abiCookie;
1419+
plugin->getAbiCookie( abiCookie );
14211420

1422-
// if rendersystem is already initialised, call rendersystem init too
1423-
if( mIsInitialised )
1421+
if( testAbiCookie( abiCookie, false ) )
14241422
{
1425-
plugin->initialise();
1426-
}
1423+
mPlugins.push_back( plugin );
1424+
plugin->install();
1425+
1426+
// if rendersystem is already initialised, call rendersystem init too
1427+
if( mIsInitialised )
1428+
{
1429+
plugin->initialise();
1430+
}
14271431

1428-
LogManager::getSingleton().logMessage( "Plugin successfully installed" );
1432+
LogManager::getSingleton().logMessage( "Plugin successfully installed" );
1433+
}
1434+
else
1435+
{
1436+
LogManager::getSingleton().logMessage( "Plugin failed ABI test" );
1437+
}
14291438
}
14301439
//---------------------------------------------------------------------
14311440
void Root::uninstallPlugin( Plugin *plugin )

PlugIns/ParticleFX/include/OgreParticleFXPlugin.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ namespace Ogre
5555
/// @copydoc Plugin::uninstall
5656
void uninstall() override;
5757

58+
/// @copydoc Plugin::getAbiCookie
59+
void getAbiCookie( AbiCookie &outAbiCookie ) override;
60+
5861
protected:
5962
vector<ParticleEmitterFactory *>::type mEmitterFactories;
6063
vector<ParticleAffectorFactory *>::type mAffectorFactories;

PlugIns/ParticleFX/src/OgreParticleFXPlugin.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ THE SOFTWARE.
2828

2929
#include "OgreParticleFXPlugin.h"
3030

31+
#include "OgreAbiUtils.h"
3132
#include "OgreParticleSystemManager.h"
3233
#include "OgreRoot.h"
3334

@@ -112,7 +113,6 @@ namespace Ogre
112113
pAffFact = OGRE_NEW ColourImageAffectorFactory();
113114
ParticleSystemManager::getSingleton().addAffectorFactory( pAffFact );
114115
mAffectorFactories.push_back( pAffFact );
115-
116116
// ColourInterpolatorAffector
117117
pAffFact = OGRE_NEW ColourInterpolatorAffectorFactory();
118118
ParticleSystemManager::getSingleton().addAffectorFactory( pAffFact );
@@ -165,5 +165,10 @@ namespace Ogre
165165
OGRE_DELETE( *ai );
166166
}
167167
}
168+
//---------------------------------------------------------------------
169+
void ParticleFXPlugin::getAbiCookie( AbiCookie &outAbiCookie )
170+
{
171+
outAbiCookie = generateAbiCookie();
172+
}
168173

169174
} // namespace Ogre

RenderSystems/Direct3D11/include/OgreD3D11Plugin.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ namespace Ogre
5454
/// @copydoc Plugin::uninstall
5555
void uninstall() override;
5656

57+
/// @copydoc Plugin::getAbiCookie
58+
void getAbiCookie( AbiCookie &outAbiCookie ) override;
59+
5760
protected:
5861
D3D11RenderSystem *mRenderSystem;
5962
};

RenderSystems/Direct3D11/src/OgreD3D11Plugin.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ THE SOFTWARE.
2727
*/
2828
#include "OgreD3D11Plugin.h"
2929

30+
#include "OgreAbiUtils.h"
3031
#include "OgreRoot.h"
3132

3233
namespace Ogre
@@ -60,5 +61,6 @@ namespace Ogre
6061
delete mRenderSystem;
6162
mRenderSystem = 0;
6263
}
63-
64+
//---------------------------------------------------------------------
65+
void D3D11Plugin::getAbiCookie( AbiCookie &outAbiCookie ) { outAbiCookie = generateAbiCookie(); }
6466
} // namespace Ogre

RenderSystems/GL3Plus/include/OgreGL3PlusPlugin.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ namespace Ogre
5454
/// @copydoc Plugin::uninstall
5555
void uninstall() override;
5656

57+
/// @copydoc Plugin::getAbiCookie
58+
void getAbiCookie( AbiCookie &outAbiCookie ) override;
59+
5760
protected:
5861
GL3PlusRenderSystem *mRenderSystem;
5962
};

RenderSystems/GL3Plus/src/OgreGL3PlusPlugin.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Copyright (c) 2000-2014 Torus Knot Software Ltd
2727
*/
2828

2929
#include "OgreGL3PlusPlugin.h"
30+
31+
#include "OgreAbiUtils.h"
3032
#include "OgreRoot.h"
3133

3234
namespace Ogre
@@ -59,5 +61,6 @@ namespace Ogre
5961
OGRE_DELETE mRenderSystem;
6062
mRenderSystem = 0;
6163
}
62-
64+
//---------------------------------------------------------------------
65+
void GL3PlusPlugin::getAbiCookie( AbiCookie &outAbiCookie ) { outAbiCookie = generateAbiCookie(); }
6366
} // namespace Ogre

RenderSystems/Metal/include/OgreMetalPlugin.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ namespace Ogre
5757
/// @copydoc Plugin::uninstall
5858
void uninstall() override;
5959

60+
/// @copydoc Plugin::getAbiCookie
61+
void getAbiCookie( AbiCookie &outAbiCookie ) override;
62+
6063
protected:
6164
MetalRenderSystem *mRenderSystem;
6265
};

RenderSystems/Metal/src/OgreMetalPlugin.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ of this software and associated documentation files (the "Software"), to deal
2828

2929
#include "OgreMetalPlugin.h"
3030

31+
#include "OgreAbiUtils.h"
3132
#include "OgreMetalRenderSystem.h"
3233
#include "OgreRoot.h"
3334

@@ -65,4 +66,6 @@ of this software and associated documentation files (the "Software"), to deal
6566
OGRE_DELETE mRenderSystem;
6667
mRenderSystem = 0;
6768
}
69+
//---------------------------------------------------------------------
70+
void MetalPlugin::getAbiCookie( AbiCookie &outAbiCookie ) { outAbiCookie = generateAbiCookie(); }
6871
}

RenderSystems/NULL/include/OgreNULLPlugin.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ namespace Ogre
5555
/// @copydoc Plugin::uninstall
5656
void uninstall() override;
5757

58+
/// @copydoc Plugin::getAbiCookie
59+
void getAbiCookie( AbiCookie &outAbiCookie ) override;
60+
5861
protected:
5962
NULLRenderSystem *mRenderSystem;
6063
};

RenderSystems/NULL/src/OgreNULLPlugin.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Copyright (c) 2000-2014 Torus Knot Software Ltd
2828

2929
#include "OgreNULLPlugin.h"
3030

31+
#include "OgreAbiUtils.h"
3132
#include "OgreRoot.h"
3233

3334
namespace Ogre
@@ -60,4 +61,6 @@ namespace Ogre
6061
OGRE_DELETE mRenderSystem;
6162
mRenderSystem = 0;
6263
}
64+
//---------------------------------------------------------------------
65+
void NULLPlugin::getAbiCookie( AbiCookie &outAbiCookie ) { outAbiCookie = generateAbiCookie(); }
6366
} // namespace Ogre

RenderSystems/Vulkan/include/OgreVulkanPlugin.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ THE SOFTWARE.
3434
namespace Ogre
3535
{
3636
/** Plugin instance for Vulkan Manager */
37-
class VulkanPlugin final : public Plugin
37+
class _OgreVulkanExport VulkanPlugin final : public Plugin
3838
{
3939
public:
4040
VulkanPlugin();
@@ -54,6 +54,9 @@ namespace Ogre
5454
/// @copydoc Plugin::uninstall
5555
void uninstall() override;
5656

57+
/// @copydoc Plugin::getAbiCookie
58+
void getAbiCookie( AbiCookie &outAbiCookie ) override;
59+
5760
protected:
5861
VulkanRenderSystem *mRenderSystem;
5962
};

RenderSystems/Vulkan/src/OgreVulkanPlugin.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Copyright (c) 2000-2014 Torus Knot Software Ltd
2727
*/
2828

2929
#include "OgreVulkanPlugin.h"
30+
31+
#include "OgreAbiUtils.h"
3032
#include "OgreRoot.h"
3133

3234
namespace Ogre
@@ -59,4 +61,6 @@ namespace Ogre
5961
OGRE_DELETE mRenderSystem;
6062
mRenderSystem = 0;
6163
}
64+
//---------------------------------------------------------------------
65+
void VulkanPlugin::getAbiCookie( AbiCookie &outAbiCookie ) { outAbiCookie = generateAbiCookie(); }
6266
} // namespace Ogre

0 commit comments

Comments
 (0)