Memory cleanup fix by Luong Cong Dan
git-svn-id: http://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4517 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
c49575276e
commit
81b873e2c6
@ -288,7 +288,6 @@ namespace video
|
|||||||
delete MaterialRenderer2D;
|
delete MaterialRenderer2D;
|
||||||
deleteAllTextures();
|
deleteAllTextures();
|
||||||
|
|
||||||
if (BridgeCalls)
|
|
||||||
delete BridgeCalls;
|
delete BridgeCalls;
|
||||||
|
|
||||||
#if defined(EGL_VERSION_1_0)
|
#if defined(EGL_VERSION_1_0)
|
||||||
@ -406,7 +405,7 @@ namespace video
|
|||||||
|
|
||||||
void COGLES2Driver::createMaterialRenderers()
|
void COGLES2Driver::createMaterialRenderers()
|
||||||
{
|
{
|
||||||
// Load shaders from files (in future shaders will be merged with source code).
|
// Load shaders from files
|
||||||
|
|
||||||
// Fixed pipeline.
|
// Fixed pipeline.
|
||||||
|
|
||||||
@ -446,10 +445,30 @@ namespace video
|
|||||||
|
|
||||||
if (FPVSFile)
|
if (FPVSFile)
|
||||||
FPVSFile->drop();
|
FPVSFile->drop();
|
||||||
|
|
||||||
if (FPFSFile)
|
if (FPFSFile)
|
||||||
FPFSFile->drop();
|
FPFSFile->drop();
|
||||||
|
|
||||||
|
// Create fixed pipeline materials.
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_SOLID, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_SOLID_2_LAYER, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_LIGHTMAP, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_LIGHTMAP_ADD, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_LIGHTMAP_M2, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_LIGHTMAP_M4, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_LIGHTMAP_LIGHTING, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_LIGHTMAP_LIGHTING_M2, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_LIGHTMAP_LIGHTING_M4, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_DETAIL_MAP, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_SPHERE_MAP, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_REFLECTION_2_LAYER, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_TRANSPARENT_ADD_COLOR, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_TRANSPARENT_ALPHA_CHANNEL, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_TRANSPARENT_ALPHA_CHANNEL_REF, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_TRANSPARENT_VERTEX_ALPHA, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_TRANSPARENT_REFLECTION_2_LAYER, this));
|
||||||
|
// do not remove FPFSData here, we need it later on for
|
||||||
|
// ONE_TEXTURE_BLEND material
|
||||||
|
|
||||||
// Normal Mapping.
|
// Normal Mapping.
|
||||||
|
|
||||||
core::stringc NMVSPath = IRR_OGLES2_SHADER_PATH;
|
core::stringc NMVSPath = IRR_OGLES2_SHADER_PATH;
|
||||||
@ -488,10 +507,16 @@ namespace video
|
|||||||
|
|
||||||
if (NMVSFile)
|
if (NMVSFile)
|
||||||
NMVSFile->drop();
|
NMVSFile->drop();
|
||||||
|
|
||||||
if (NMFSFile)
|
if (NMFSFile)
|
||||||
NMFSFile->drop();
|
NMFSFile->drop();
|
||||||
|
|
||||||
|
addAndDropMaterialRenderer(new COGLES2NormalMapRenderer(NMVSData, NMFSData, EMT_NORMAL_MAP_SOLID, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2NormalMapRenderer(NMVSData, NMFSData, EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR, this));
|
||||||
|
addAndDropMaterialRenderer(new COGLES2NormalMapRenderer(NMVSData, NMFSData, EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA, this));
|
||||||
|
|
||||||
|
delete NMVSData;
|
||||||
|
delete NMFSData;
|
||||||
|
|
||||||
// Parallax Mapping.
|
// Parallax Mapping.
|
||||||
|
|
||||||
core::stringc PMVSPath = IRR_OGLES2_SHADER_PATH;
|
core::stringc PMVSPath = IRR_OGLES2_SHADER_PATH;
|
||||||
@ -530,40 +555,21 @@ namespace video
|
|||||||
|
|
||||||
if (PMVSFile)
|
if (PMVSFile)
|
||||||
PMVSFile->drop();
|
PMVSFile->drop();
|
||||||
|
|
||||||
if (PMFSFile)
|
if (PMFSFile)
|
||||||
PMFSFile->drop();
|
PMFSFile->drop();
|
||||||
|
|
||||||
// Create materials.
|
|
||||||
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_SOLID, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_SOLID_2_LAYER, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_LIGHTMAP, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_LIGHTMAP_ADD, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_LIGHTMAP_M2, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_LIGHTMAP_M4, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_LIGHTMAP_LIGHTING, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_LIGHTMAP_LIGHTING_M2, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_LIGHTMAP_LIGHTING_M4, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_DETAIL_MAP, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_SPHERE_MAP, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_REFLECTION_2_LAYER, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_TRANSPARENT_ADD_COLOR, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_TRANSPARENT_ALPHA_CHANNEL, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_TRANSPARENT_ALPHA_CHANNEL_REF, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_TRANSPARENT_VERTEX_ALPHA, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_TRANSPARENT_REFLECTION_2_LAYER, this));
|
|
||||||
|
|
||||||
addAndDropMaterialRenderer(new COGLES2NormalMapRenderer(NMVSData, NMFSData, EMT_NORMAL_MAP_SOLID, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2NormalMapRenderer(NMVSData, NMFSData, EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR, this));
|
|
||||||
addAndDropMaterialRenderer(new COGLES2NormalMapRenderer(NMVSData, NMFSData, EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA, this));
|
|
||||||
|
|
||||||
addAndDropMaterialRenderer(new COGLES2ParallaxMapRenderer(PMVSData, PMFSData, EMT_PARALLAX_MAP_SOLID, this));
|
addAndDropMaterialRenderer(new COGLES2ParallaxMapRenderer(PMVSData, PMFSData, EMT_PARALLAX_MAP_SOLID, this));
|
||||||
addAndDropMaterialRenderer(new COGLES2ParallaxMapRenderer(PMVSData, PMFSData, EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR, this));
|
addAndDropMaterialRenderer(new COGLES2ParallaxMapRenderer(PMVSData, PMFSData, EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR, this));
|
||||||
addAndDropMaterialRenderer(new COGLES2ParallaxMapRenderer(PMVSData, PMFSData, EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA, this));
|
addAndDropMaterialRenderer(new COGLES2ParallaxMapRenderer(PMVSData, PMFSData, EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA, this));
|
||||||
|
|
||||||
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_ONETEXTURE_BLEND, this));
|
addAndDropMaterialRenderer(new COGLES2FixedPipelineRenderer(FPVSData, FPFSData, EMT_ONETEXTURE_BLEND, this));
|
||||||
|
|
||||||
|
delete PMVSData;
|
||||||
|
delete PMFSData;
|
||||||
|
// now also remove the fixed pipeline data
|
||||||
|
delete FPVSData;
|
||||||
|
delete FPFSData;
|
||||||
|
|
||||||
// Create 2D material renderer.
|
// Create 2D material renderer.
|
||||||
|
|
||||||
core::stringc R2DVSPath = IRR_OGLES2_SHADER_PATH;
|
core::stringc R2DVSPath = IRR_OGLES2_SHADER_PATH;
|
||||||
@ -607,6 +613,8 @@ namespace video
|
|||||||
R2DFSFile->drop();
|
R2DFSFile->drop();
|
||||||
|
|
||||||
MaterialRenderer2D = new COGLES2Renderer2D(R2DVSData, R2DFSData, this);
|
MaterialRenderer2D = new COGLES2Renderer2D(R2DVSData, R2DFSData, this);
|
||||||
|
delete R2DVSData;
|
||||||
|
delete R2DFSData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user