DXGL r116 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r115
|
r116
|
r117
>
Date:
00:00, 8 March 2012
Author:
admin
Status:
new
Tags:
Comment:
Fix D3D object shutdown
Fix D3D memory leaks
Modified paths:
/ddraw/glDirect3DDevice.cpp
(modified) (
history
)
/ddraw/glDirectDraw.cpp
(modified) (
history
)
/ddraw/shadergen.cpp
(modified) (
history
)
/ddraw/shadergen.h
(modified) (
history
)
/ddraw/shaders.cpp
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/glDirect3DDevice.cpp
—
—
@@ -172,6 +172,9 @@
173
173
}
174
174
glDirect3DDevice7::~glDirect3DDevice7()
175
175
{
176
+ for(int i = 0; i < lightsmax; i++)
177
+ if(lights[i]) delete lights[i];
178
+ delete lights;
176
179
glD3D7->Release();
177
180
glDDS7->Release();
178
181
}
Index: ddraw/glDirectDraw.cpp
—
—
@@ -650,7 +650,6 @@
651
651
if(riid == IID_IDirect3D7)
652
652
{
653
653
#ifdef _DEBUG
654
- this->AddRef();
655
654
*ppvObj = new glDirect3D7(this);
656
655
return DD_OK;
657
656
#else
Index: ddraw/shadergen.cpp
—
—
@@ -101,6 +101,23 @@
102
102
isbuiltin = true;
103
103
}
104
104
105
+void ClearShaders()
106
+{
107
+ for(int i = 0; i < shadercount; i++)
108
+ {
109
+ genshaders[i].id = 0;
110
+ ZeroMemory(genshaders[i].texids,8*sizeof(__int64));
111
+ if(genshaders[i].shader.prog) glDeleteProgram(genshaders[i].shader.prog);
112
+ if(genshaders[i].shader.fs) glDeleteShader(genshaders[i].shader.fs);
113
+ if(genshaders[i].shader.vs) glDeleteShader(genshaders[i].shader.vs);
114
+ if(genshaders[i].shader.fsrc) delete genshaders[i].shader.fsrc;
115
+ if(genshaders[i].shader.vsrc) delete genshaders[i].shader.vsrc;
116
+ ZeroMemory(&genshaders[i].shader,sizeof(_GENSHADER));
117
+ }
118
+ shadercount = 0;
119
+ genindex = 0;
120
+}
121
+
105
122
void SetShader(__int64 id, TexState *texstate, bool builtin)
106
123
{
107
124
int shaderindex = -1;
Index: ddraw/shadergen.h
—
—
@@ -30,6 +30,7 @@
31
31
__int64 TEX7;
32
32
} TexState;
33
33
34
+void ClearShaders();
34
35
void SetShader(__int64 id, TexState *texstate, bool builtin);
35
36
GLuint GetProgram();
36
37
void ZeroShaderArray();
Index: ddraw/shaders.cpp
—
—
@@ -177,4 +177,5 @@
178
178
shaders[i].fs = 0;
179
179
}
180
180
}
181
+ ClearShaders();
181
182
}
\ No newline at end of file
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version