Commit fc8bf66f authored by hybrid's avatar hybrid

Fix driver attribute setting in all other drivers.

Fix wrong destruction calls, due to missing drop ion the attribute. Was a cyclic dependency on the video driver.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3413 dfc29bdd-3216-0410-991c-e03cc46cb475
parent a7eb327b
...@@ -391,15 +391,15 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize, ...@@ -391,15 +391,15 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
MaxTextureUnits = core::min_((u32)Caps.MaxSimultaneousTextures, MATERIAL_MAX_TEXTURES); MaxTextureUnits = core::min_((u32)Caps.MaxSimultaneousTextures, MATERIAL_MAX_TEXTURES);
MaxUserClipPlanes = (u32)Caps.MaxUserClipPlanes; MaxUserClipPlanes = (u32)Caps.MaxUserClipPlanes;
DriverAttributes->addInt("MaxTextures", MaxTextureUnits); DriverAttributes->setAttribute("MaxTextures", (s32)MaxTextureUnits);
DriverAttributes->addInt("MaxSupportedTextures", Caps.MaxSimultaneousTextures); DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Caps.MaxSimultaneousTextures);
DriverAttributes->addInt("MaxAnisotropy", Caps.MaxAnisotropy); DriverAttributes->setAttribute("MaxAnisotropy", (s32)Caps.MaxAnisotropy);
DriverAttributes->addInt("MaxUserClipPlanes", Caps.MaxUserClipPlanes); DriverAttributes->setAttribute("MaxUserClipPlanes", (s32)Caps.MaxUserClipPlanes);
DriverAttributes->addInt("MaxIndices", Caps.MaxVertexIndex); DriverAttributes->setAttribute("MaxIndices", (s32)Caps.MaxVertexIndex);
DriverAttributes->addInt("MaxTextureSize", core::min_(Caps.MaxTextureHeight,Caps.MaxTextureWidth)); DriverAttributes->setAttribute("MaxTextureSize", (s32)core::min_(Caps.MaxTextureHeight,Caps.MaxTextureWidth));
DriverAttributes->addFloat("MaxTextureLODBias", 16.f); DriverAttributes->setAttribute("MaxTextureLODBias", 16.f);
DriverAttributes->addInt("Version", 901); DriverAttributes->setAttribute("Version", 800);
DriverAttributes->addInt("ShaderLanguageVersion", Caps.VertexShaderVersion*100); DriverAttributes->setAttribute("ShaderLanguageVersion", (s32)Caps.VertexShaderVersion*100);
// set the renderstates // set the renderstates
setRenderStates3DMode(); setRenderStates3DMode();
......
...@@ -79,7 +79,6 @@ IImageWriter* createImageWriterPNG(); ...@@ -79,7 +79,6 @@ IImageWriter* createImageWriterPNG();
//! creates a writer which is able to save ppm images //! creates a writer which is able to save ppm images
IImageWriter* createImageWriterPPM(); IImageWriter* createImageWriterPPM();
//! constructor //! constructor
CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize) CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize)
: FileSystem(io), MeshManipulator(0), ViewPort(0,0,0,0), ScreenSize(screenSize), : FileSystem(io), MeshManipulator(0), ViewPort(0,0,0,0), ScreenSize(screenSize),
...@@ -90,14 +89,14 @@ CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& scre ...@@ -90,14 +89,14 @@ CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& scre
setDebugName("CNullDriver"); setDebugName("CNullDriver");
#endif #endif
DriverAttributes = new io::CAttributes(this); DriverAttributes = new io::CAttributes();
DriverAttributes->addInt("MaxTextures", _IRR_MATERIAL_MAX_TEXTURES_); DriverAttributes->addInt("MaxTextures", _IRR_MATERIAL_MAX_TEXTURES_);
DriverAttributes->addInt("MaxSupportedTextures", _IRR_MATERIAL_MAX_TEXTURES_); DriverAttributes->addInt("MaxSupportedTextures", _IRR_MATERIAL_MAX_TEXTURES_);
DriverAttributes->addInt("MaxLights", getMaximalDynamicLightAmount()); DriverAttributes->addInt("MaxLights", getMaximalDynamicLightAmount());
DriverAttributes->addInt("MaxAnisotropy", 1); DriverAttributes->addInt("MaxAnisotropy", 1);
// DriverAttributes->addInt("MaxUserClipPlanes", 0); // DriverAttributes->addInt("MaxUserClipPlanes", 0);
// DriverAttributes->addInt("MaxAuxBuffers", 0); // DriverAttributes->addInt("MaxAuxBuffers", 0);
// DriverAttributes->addInt("MaxMultipleRenderTargets", 0); DriverAttributes->addInt("MaxMultipleRenderTargets", 1);
DriverAttributes->addInt("MaxIndices", -1); DriverAttributes->addInt("MaxIndices", -1);
DriverAttributes->addInt("MaxTextureSize", -1); DriverAttributes->addInt("MaxTextureSize", -1);
// DriverAttributes->addInt("MaxGeometryVerticesOut", 0); // DriverAttributes->addInt("MaxGeometryVerticesOut", 0);
...@@ -203,6 +202,9 @@ CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& scre ...@@ -203,6 +202,9 @@ CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& scre
//! destructor //! destructor
CNullDriver::~CNullDriver() CNullDriver::~CNullDriver()
{ {
if (DriverAttributes)
DriverAttributes->drop();
if (FileSystem) if (FileSystem)
FileSystem->drop(); FileSystem->drop();
...@@ -222,7 +224,6 @@ CNullDriver::~CNullDriver() ...@@ -222,7 +224,6 @@ CNullDriver::~CNullDriver()
// delete hardware mesh buffers // delete hardware mesh buffers
removeAllHardwareBuffers(); removeAllHardwareBuffers();
DriverAttributes->drop();
} }
......
...@@ -649,19 +649,19 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d<u32>& screenSize, ...@@ -649,19 +649,19 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d<u32>& screenSize,
} }
else else
os::Printer::log("GLSL not available.", ELL_INFORMATION); os::Printer::log("GLSL not available.", ELL_INFORMATION);
DriverAttributes->addInt("MaxTextures", MaxTextureUnits); DriverAttributes->setAttribute("MaxTextures", MaxTextureUnits);
DriverAttributes->addInt("MaxSupportedTextures", MaxSupportedTextures); DriverAttributes->setAttribute("MaxSupportedTextures", MaxSupportedTextures);
// DriverAttributes->addInt("MaxLights", MaxLights); // DriverAttributes->setAttribute("MaxLights", MaxLights);
DriverAttributes->addInt("MaxAnisotropy", MaxAnisotropy); DriverAttributes->setAttribute("MaxAnisotropy", MaxAnisotropy);
DriverAttributes->addInt("MaxUserClipPlanes", MaxUserClipPlanes); DriverAttributes->setAttribute("MaxUserClipPlanes", MaxUserClipPlanes);
DriverAttributes->addInt("MaxAuxBuffers", MaxAuxBuffers); DriverAttributes->setAttribute("MaxAuxBuffers", MaxAuxBuffers);
DriverAttributes->addInt("MaxMultipleRenderTargets", MaxMultipleRenderTargets); DriverAttributes->setAttribute("MaxMultipleRenderTargets", MaxMultipleRenderTargets);
DriverAttributes->addInt("MaxIndices", MaxIndices); DriverAttributes->setAttribute("MaxIndices", (s32)MaxIndices);
DriverAttributes->addInt("MaxTextureSize", MaxTextureSize); DriverAttributes->setAttribute("MaxTextureSize", (s32)MaxTextureSize);
DriverAttributes->addInt("MaxGeometryVerticesOut", MaxGeometryVerticesOut); DriverAttributes->setAttribute("MaxGeometryVerticesOut", (s32)MaxGeometryVerticesOut);
DriverAttributes->addFloat("MaxTextureLODBias", MaxTextureLODBias); DriverAttributes->setAttribute("MaxTextureLODBias", MaxTextureLODBias);
DriverAttributes->addInt("Version", Version); DriverAttributes->setAttribute("Version", Version);
DriverAttributes->addInt("ShaderLanguageVersion", ShaderLanguageVersion); DriverAttributes->setAttribute("ShaderLanguageVersion", ShaderLanguageVersion);
glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_ALIGNMENT, 1);
......
...@@ -291,6 +291,12 @@ CSceneManager::~CSceneManager() ...@@ -291,6 +291,12 @@ CSceneManager::~CSceneManager()
{ {
clearDeletionList(); clearDeletionList();
//! force to remove hardwareTextures from the driver
//! because Scenes may hold internally data bounded to sceneNodes
//! which may be destroyed twice
if (Driver)
Driver->removeAllHardwareBuffers ();
if (FileSystem) if (FileSystem)
FileSystem->drop(); FileSystem->drop();
...@@ -324,12 +330,6 @@ CSceneManager::~CSceneManager() ...@@ -324,12 +330,6 @@ CSceneManager::~CSceneManager()
for (i=0; i<SceneNodeAnimatorFactoryList.size(); ++i) for (i=0; i<SceneNodeAnimatorFactoryList.size(); ++i)
SceneNodeAnimatorFactoryList[i]->drop(); SceneNodeAnimatorFactoryList[i]->drop();
//! force to remove hardwareTextures from the driver
//! because Scenes may hold internally data bounded to sceneNodes
//! which may be destroyed twice
if (Driver)
Driver->removeAllHardwareBuffers ();
if(LightManager) if(LightManager)
LightManager->drop(); LightManager->drop();
......
...@@ -38,10 +38,10 @@ CSoftwareDriver::CSoftwareDriver(const core::dimension2d<u32>& windowSize, bool ...@@ -38,10 +38,10 @@ CSoftwareDriver::CSoftwareDriver(const core::dimension2d<u32>& windowSize, bool
ZBuffer = video::createZBuffer(BackBuffer->getDimension()); ZBuffer = video::createZBuffer(BackBuffer->getDimension());
} }
DriverAttributes->addInt("MaxTextures", 1); DriverAttributes->setAttribute("MaxTextures", 1);
DriverAttributes->addInt("MaxIndices", 1<<16); DriverAttributes->setAttribute("MaxIndices", 1<<16);
DriverAttributes->addInt("MaxTextureSize", 1024); DriverAttributes->setAttribute("MaxTextureSize", 1024);
DriverAttributes->addInt("Version", 1); DriverAttributes->setAttribute("Version", 1);
// create triangle renderers // create triangle renderers
......
...@@ -357,11 +357,11 @@ CBurningVideoDriver::CBurningVideoDriver(const irr::SIrrlichtCreationParameters& ...@@ -357,11 +357,11 @@ CBurningVideoDriver::CBurningVideoDriver(const irr::SIrrlichtCreationParameters&
StencilBuffer = video::createStencilBuffer(BackBuffer->getDimension()); StencilBuffer = video::createStencilBuffer(BackBuffer->getDimension());
} }
DriverAttributes->addInt("MaxTextures", 2); DriverAttributes->setAttribute("MaxTextures", 2);
DriverAttributes->addInt("MaxIndices", 1<<16); DriverAttributes->setAttribute("MaxIndices", 1<<16);
DriverAttributes->addInt("MaxTextureSize", 1024); DriverAttributes->setAttribute("MaxTextureSize", 1024);
DriverAttributes->addFloat("MaxTextureLODBias", 16.f); DriverAttributes->setAttribute("MaxTextureLODBias", 16.f);
DriverAttributes->addInt("Version", 45); DriverAttributes->setAttribute("Version", 45);
// create triangle renderers // create triangle renderers
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment