more logging to investigate crash on dmd x86_64 release build

This commit is contained in:
Vadim Lopatin 2015-04-10 10:50:00 +03:00
parent 77a1793761
commit 6411f2adde
5 changed files with 35 additions and 13 deletions

View File

@ -72,7 +72,7 @@
<debuglevel>0</debuglevel>
<debugids>DebugFocus FontResources</debugids>
<versionlevel>0</versionlevel>
<versionids>EmbedStandardResources Unicode USE_FREETYPE USE_OPENGL USE_SDL</versionids>
<versionids>EmbedStandardResources Unicode USE_FREETYPE USE_OPENGL</versionids>
<dump_source>0</dump_source>
<mapverbosity>0</mapverbosity>
<createImplib>1</createImplib>

View File

@ -173,7 +173,7 @@
<debuglevel>0</debuglevel>
<debugids />
<versionlevel>0</versionlevel>
<versionids>Unicode USE_FREETYPE USE_SDL</versionids>
<versionids>Unicode USE_FREETYPE</versionids>
<dump_source>0</dump_source>
<mapverbosity>0</mapverbosity>
<createImplib>0</createImplib>

View File

@ -187,6 +187,10 @@ enum : int {
/// entry point for dlangui based application
extern (C) int UIAppMain(string[] args) {
// always use trace, even for release builds
Log.setLogLevel(LogLevel.Trace);
// resource directory search paths
// not required if only embedded resources are used
//string[] resourceDirs = [

View File

@ -164,14 +164,21 @@ class GLProgram {
Log.d("Program compiled successfully");
//glDetachShader(program, vertexShader);
//glDetachShader(program, fragmentShader);
Log.v("trying glUseProgram(0)");
glUseProgram(0);
Log.v("before useProgram");
glUseProgram(program);
checkError("glUseProgram " ~ to!string(program));
Log.v("after useProgram");
if (!initLocations()) {
Log.e("some of locations were not found");
error = true;
}
initialized = true;
return true;
Log.v("Program is initialized successfully");
glUseProgram(0);
checkError("glUseProgram " ~ to!string(program));
return !error;
}
bool initLocations() {
return true;
@ -605,27 +612,34 @@ class GLSupport {
}
bool initShaders() {
if (_solidFillProgram is null) {
Log.v("Compiling solid fill program");
_solidFillProgram = new SolidFillProgram();
if (!_solidFillProgram.compile())
return false;
}
if (_textureProgram is null) {
Log.v("Compiling texture program");
_textureProgram = new TextureProgram();
if (!_textureProgram.compile())
return false;
}
if (_fontProgram is null) {
Log.v("Compiling font program");
_fontProgram = new FontProgram();
if (!_fontProgram.compile())
return false;
}
if (_solidFillProgram is null) {
_solidFillProgram = new SolidFillProgram();
if (!_solidFillProgram.compile())
return false;
}
Log.d("Shaders compiled successfully");
return true;
}
bool uninitShaders() {
Log.d("Uniniting shaders");
if (_solidFillProgram !is null) {
destroy(_solidFillProgram);
_solidFillProgram = null;
}
if (_textureProgram !is null) {
destroy(_textureProgram);
_textureProgram = null;
@ -634,10 +648,6 @@ class GLSupport {
destroy(_fontProgram);
_fontProgram = null;
}
if (_solidFillProgram !is null) {
destroy(_solidFillProgram);
_solidFillProgram = null;
}
return true;
}

View File

@ -222,14 +222,20 @@ class Win32Window : Window {
version (USE_OPENGL) {
//_gl = new GLSupport();
if (!_glSupport)
if (!_glSupport) {
Log.v("Creating OpenGL support");
_glSupport = new GLSupport();
Log.v("OpenGL support created");
}
}
// successful
Log.v("initializing shaders");
if (glSupport.valid || glSupport.initShaders()) {
Log.v("shaders are ok");
setOpenglEnabled();
useOpengl = true;
Log.v("OpenGL is initialized ok");
} else {
Log.e("Failed to compile shaders");
}
@ -773,10 +779,12 @@ class Win32Platform : Platform {
private Win32Window[ulong] _windowMap;
/// add window to window map
void onWindowCreated(HWND hwnd, Win32Window window) {
Log.v("created window, adding to map");
_windowMap[cast(ulong)hwnd] = window;
}
/// remove window from window map, returns true if there are some more windows left in map
bool onWindowDestroyed(HWND hwnd, Win32Window window) {
Log.v("destroyed window, removing from map");
Win32Window wnd = getWindow(hwnd);
if (wnd) {
_windowMap.remove(cast(ulong)hwnd);