Mem leak fixed in d3d RTT code identified by vitek. Some redundant code removed and OpenGL shader materials fixed for changing number of textures.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@807 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
03df110fc6
commit
b41385a3ff
|
@ -256,6 +256,7 @@ void* CD3D8Texture::lock()
|
|||
return 0;
|
||||
}
|
||||
hr = Device->CopyRects(surface, NULL, 0, RTTSurface, NULL);
|
||||
surface->Release();
|
||||
if(FAILED(hr))
|
||||
{
|
||||
os::Printer::log("Could not lock DIRECT3D8 Texture.", ELL_ERROR);
|
||||
|
|
|
@ -458,6 +458,7 @@ void* CD3D9Texture::lock()
|
|||
return 0;
|
||||
}
|
||||
hr = Device->GetRenderTargetData(surface, RTTSurface);
|
||||
surface->Release();
|
||||
if(FAILED(hr))
|
||||
{
|
||||
os::Printer::log("Could not lock DIRECT3D9 Texture.", ELL_ERROR);
|
||||
|
|
|
@ -625,8 +625,6 @@ void CGUIEditBox::draw()
|
|||
if (!skin)
|
||||
return;
|
||||
|
||||
irr::video::IVideoDriver* driver = Environment->getVideoDriver();
|
||||
|
||||
frameRect = AbsoluteRect;
|
||||
|
||||
// draw the border
|
||||
|
|
|
@ -291,7 +291,6 @@ void CGUIFont::readPositions32bit(video::IImage* image, s32& lowerRightPositions
|
|||
s32 colorLowerRight = *(p+1);
|
||||
s32 colorBackGround = *(p+2);
|
||||
s32 colorBackGroundTransparent = 0; // 0x00FFFFFF & colorBackGround;
|
||||
s32 colorFont = 0xFFFFFFFF;
|
||||
|
||||
*(p+1) = colorBackGround;
|
||||
|
||||
|
@ -375,7 +374,6 @@ void CGUIFont::readPositions16bit(video::IImage* image, s32& lowerRightPositions
|
|||
s16 colorLowerRight = *(p+1);
|
||||
s16 colorBackGround = *(p+2);
|
||||
s16 colorBackGroundTransparent = 0; // 0x7FFF & colorBackGround;
|
||||
u16 colorFont = 0xFFFF;
|
||||
|
||||
*(p+1) = colorBackGround;
|
||||
|
||||
|
|
|
@ -156,9 +156,8 @@ bool COpenGLDriver::initDriver(const core::dimension2d<s32>& screenSize,
|
|||
COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize, bool fullscreen, bool stencilBuffer, CIrrDeviceMacOSX *device, io::IFileSystem* io, bool vsync, bool antiAlias)
|
||||
: CNullDriver(io, screenSize), COpenGLExtensionHandler(),
|
||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), Transformation3DChanged(true),
|
||||
AntiAlias(antiAlias),
|
||||
LastSetLight(-1), RenderTargetTexture(0), ClockwiseWinding(true),
|
||||
CurrentRendertargetSize(0,0), _device(device)
|
||||
AntiAlias(antiAlias), RenderTargetTexture(0), LastSetLight(-1),
|
||||
CurrentRendertargetSize(0,0), ClockwiseWinding(true), _device(device)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COpenGLDriver");
|
||||
|
@ -175,10 +174,10 @@ COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize, bool full
|
|||
//! Linux constructor and init code
|
||||
COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize, bool fullscreen, bool stencilBuffer, io::IFileSystem* io, bool vsync, bool antiAlias)
|
||||
: CNullDriver(io, screenSize), COpenGLExtensionHandler(),
|
||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), Transformation3DChanged(true),
|
||||
AntiAlias(antiAlias),
|
||||
LastSetLight(-1), RenderTargetTexture(0), ClockwiseWinding(true),
|
||||
CurrentRendertargetSize(0,0)
|
||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
|
||||
Transformation3DChanged(true), AntiAlias(antiAlias),
|
||||
RenderTargetTexture(0), LastSetLight(-1), CurrentRendertargetSize(0,0),
|
||||
ClockwiseWinding(true)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COpenGLDriver");
|
||||
|
@ -211,10 +210,10 @@ COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize, bool full
|
|||
//! SDL constructor and init code
|
||||
COpenGLDriver::COpenGLDriver(const core::dimension2d<s32>& screenSize, bool fullscreen, bool stencilBuffer, io::IFileSystem* io, bool vsync, bool antiAlias)
|
||||
: CNullDriver(io, screenSize), COpenGLExtensionHandler(),
|
||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), Transformation3DChanged(true),
|
||||
AntiAlias(antiAlias),
|
||||
LastSetLight(-1), RenderTargetTexture(0), ClockwiseWinding(true),
|
||||
CurrentRendertargetSize(0,0)
|
||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
|
||||
Transformation3DChanged(true), AntiAlias(antiAlias),
|
||||
RenderTargetTexture(0), LastSetLight(-1), CurrentRendertargetSize(0,0),
|
||||
ClockwiseWinding(true)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COpenGLDriver");
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace video
|
|||
|
||||
// Irrlicht Engine OpenGL render path normal map vertex shader
|
||||
// I guess it could be optimized a lot, because I wrote it in D3D ASM and
|
||||
// transfered it 1:1 to OpenGL
|
||||
// transferred it 1:1 to OpenGL
|
||||
const char OPENGL_NORMAL_MAP_VSH[] =
|
||||
"!!ARBvp1.0\n"\
|
||||
"#input\n"\
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace video
|
|||
|
||||
// Irrlicht Engine OpenGL render path parallax map vertex shader
|
||||
// I guess it could be optimized a lot, because I wrote it in D3D ASM and
|
||||
// transfered it 1:1 to OpenGL
|
||||
// transferred it 1:1 to OpenGL
|
||||
const char OPENGL_PARALLAX_MAP_VSH[] =
|
||||
"!!ARBvp1.0\n"\
|
||||
"#input\n"\
|
||||
|
|
|
@ -132,13 +132,6 @@ void COpenGLSLMaterialRenderer::OnSetMaterial(video::SMaterial& material,
|
|||
bool resetAllRenderstates,
|
||||
video::IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->setTexture(3, material.Textures[3]);
|
||||
Driver->setTexture(2, material.Textures[2]);
|
||||
Driver->setTexture(1, material.Textures[1]);
|
||||
Driver->setTexture(0, material.Textures[0]);
|
||||
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
{
|
||||
if(Program)
|
||||
|
@ -148,7 +141,9 @@ void COpenGLSLMaterialRenderer::OnSetMaterial(video::SMaterial& material,
|
|||
BaseMaterial->OnSetMaterial(material, material, true, this);
|
||||
}
|
||||
|
||||
setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
Driver->setTexture(i, material.Textures[i]);
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -97,13 +97,6 @@ bool COpenGLShaderMaterialRenderer::OnRender(IMaterialRendererServices* service,
|
|||
void COpenGLShaderMaterialRenderer::OnSetMaterial(video::SMaterial& material, const video::SMaterial& lastMaterial,
|
||||
bool resetAllRenderstates, video::IMaterialRendererServices* services)
|
||||
{
|
||||
Driver->setTexture(3, material.Textures[3]);
|
||||
Driver->setTexture(2, material.Textures[2]);
|
||||
Driver->setTexture(1, material.Textures[1]);
|
||||
Driver->setTexture(0, material.Textures[0]);
|
||||
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
|
||||
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
|
||||
{
|
||||
#ifdef GL_ARB_vertex_program
|
||||
|
@ -127,6 +120,10 @@ void COpenGLShaderMaterialRenderer::OnSetMaterial(video::SMaterial& material, co
|
|||
if (BaseMaterial)
|
||||
BaseMaterial->OnSetMaterial(material, material, true, services);
|
||||
}
|
||||
|
||||
for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
|
||||
Driver->setTexture(i, material.Textures[i]);
|
||||
Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue