Fixed OpenGL issues in Windows Vista. I still have to make sure it hasn't

broken support on other platforms.

Updated Visual Studio project to VS 2008 (where parallel compilation
actually works, and uses all cores on a multi-core CPU).

Updated OSX project files.  I'm using Leopard now, and since the 10.2.8
SDK has been removed, it looks like 10.3 is the minimum supported version
(unless someone can suggest a fix).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1390 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-01-20 18:16:42 +00:00
parent 62860e8b81
commit c1dbb4468b
8 changed files with 102 additions and 59 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferGL.cxx,v 1.94 2007-09-28 16:24:44 stephena Exp $
// $Id: FrameBufferGL.cxx,v 1.95 2008-01-20 18:16:41 stephena Exp $
//============================================================================
#ifdef DISPLAY_OPENGL
@ -91,9 +91,9 @@ FrameBufferGL::~FrameBufferGL()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferGL::loadFuncs(const string& library)
bool FrameBufferGL::loadLibrary(const string& library)
{
if(myFuncsLoaded)
if(myLibraryLoaded)
return true;
if(SDL_WasInit(SDL_INIT_VIDEO) == 0)
@ -103,70 +103,80 @@ bool FrameBufferGL::loadFuncs(const string& library)
bool libLoaded = (library != "" && SDL_GL_LoadLibrary(library.c_str()) >= 0);
bool autoLoaded = false;
if(!libLoaded) autoLoaded = (SDL_GL_LoadLibrary(0) >= 0);
if(!libLoaded && !autoLoaded)
return false;
// Otherwise, fill the function pointers for GL functions
// If anything fails, we'll know it immediately, and return false
// Yes, this syntax is ugly, but I can type it out faster than the time
// it takes to figure our macro magic to do it neatly
p_glClear = (void(APIENTRY*)(GLbitfield))
return myLibraryLoaded = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferGL::loadFuncs()
{
if(myLibraryLoaded)
{
// Fill the function pointers for GL functions
// If anything fails, we'll know it immediately, and return false
// Yes, this syntax is ugly, but I can type it out faster than the time
// it takes to figure our macro magic to do it neatly
p_glClear = (void(APIENTRY*)(GLbitfield))
SDL_GL_GetProcAddress("glClear"); if(!p_glClear) return false;
p_glEnable = (void(APIENTRY*)(GLenum))
p_glEnable = (void(APIENTRY*)(GLenum))
SDL_GL_GetProcAddress("glEnable"); if(!p_glEnable) return false;
p_glDisable = (void(APIENTRY*)(GLenum))
p_glDisable = (void(APIENTRY*)(GLenum))
SDL_GL_GetProcAddress("glDisable"); if(!p_glDisable) return false;
p_glPushAttrib = (void(APIENTRY*)(GLbitfield))
p_glPushAttrib = (void(APIENTRY*)(GLbitfield))
SDL_GL_GetProcAddress("glPushAttrib"); if(!p_glPushAttrib) return false;
p_glGetString = (const GLubyte*(APIENTRY*)(GLenum))
p_glGetString = (const GLubyte*(APIENTRY*)(GLenum))
SDL_GL_GetProcAddress("glGetString"); if(!p_glGetString) return false;
p_glHint = (void(APIENTRY*)(GLenum, GLenum))
p_glHint = (void(APIENTRY*)(GLenum, GLenum))
SDL_GL_GetProcAddress("glHint"); if(!p_glHint) return false;
p_glShadeModel = (void(APIENTRY*)(GLenum))
p_glShadeModel = (void(APIENTRY*)(GLenum))
SDL_GL_GetProcAddress("glShadeModel"); if(!p_glShadeModel) return false;
p_glMatrixMode = (void(APIENTRY*)(GLenum))
p_glMatrixMode = (void(APIENTRY*)(GLenum))
SDL_GL_GetProcAddress("glMatrixMode"); if(!p_glMatrixMode) return false;
p_glOrtho = (void(APIENTRY*)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble))
p_glOrtho = (void(APIENTRY*)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble))
SDL_GL_GetProcAddress("glOrtho"); if(!p_glOrtho) return false;
p_glViewport = (void(APIENTRY*)(GLint, GLint, GLsizei, GLsizei))
p_glViewport = (void(APIENTRY*)(GLint, GLint, GLsizei, GLsizei))
SDL_GL_GetProcAddress("glViewport"); if(!p_glViewport) return false;
p_glPushMatrix = (void(APIENTRY*)(void))
p_glPushMatrix = (void(APIENTRY*)(void))
SDL_GL_GetProcAddress("glPushMatrix"); if(!p_glPushMatrix) return false;
p_glLoadIdentity = (void(APIENTRY*)(void))
p_glLoadIdentity = (void(APIENTRY*)(void))
SDL_GL_GetProcAddress("glLoadIdentity"); if(!p_glLoadIdentity) return false;
p_glBegin = (void(APIENTRY*)(GLenum))
p_glBegin = (void(APIENTRY*)(GLenum))
SDL_GL_GetProcAddress("glBegin"); if(!p_glBegin) return false;
p_glEnd = (void(APIENTRY*)(void))
p_glEnd = (void(APIENTRY*)(void))
SDL_GL_GetProcAddress("glEnd"); if(!p_glEnd) return false;
p_glVertex2i = (void(APIENTRY*)(GLint, GLint))
p_glVertex2i = (void(APIENTRY*)(GLint, GLint))
SDL_GL_GetProcAddress("glVertex2i"); if(!p_glVertex2i) return false;
p_glTexCoord2f = (void(APIENTRY*)(GLfloat, GLfloat))
p_glTexCoord2f = (void(APIENTRY*)(GLfloat, GLfloat))
SDL_GL_GetProcAddress("glTexCoord2f"); if(!p_glTexCoord2f) return false;
p_glReadPixels = (void(APIENTRY*)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*))
p_glReadPixels = (void(APIENTRY*)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*))
SDL_GL_GetProcAddress("glReadPixels"); if(!p_glReadPixels) return false;
p_glPixelStorei = (void(APIENTRY*)(GLenum, GLint))
p_glPixelStorei = (void(APIENTRY*)(GLenum, GLint))
SDL_GL_GetProcAddress("glPixelStorei"); if(!p_glPixelStorei) return false;
p_glTexEnvf = (void(APIENTRY*)(GLenum, GLenum, GLfloat))
p_glTexEnvf = (void(APIENTRY*)(GLenum, GLenum, GLfloat))
SDL_GL_GetProcAddress("glTexEnvf"); if(!p_glTexEnvf) return false;
p_glGenTextures = (void(APIENTRY*)(GLsizei, GLuint*))
p_glGenTextures = (void(APIENTRY*)(GLsizei, GLuint*))
SDL_GL_GetProcAddress("glGenTextures"); if(!p_glGenTextures) return false;
p_glDeleteTextures = (void(APIENTRY*)(GLsizei, const GLuint*))
p_glDeleteTextures = (void(APIENTRY*)(GLsizei, const GLuint*))
SDL_GL_GetProcAddress("glDeleteTextures"); if(!p_glDeleteTextures) return false;
p_glBindTexture = (void(APIENTRY*)(GLenum, GLuint))
p_glBindTexture = (void(APIENTRY*)(GLenum, GLuint))
SDL_GL_GetProcAddress("glBindTexture"); if(!p_glBindTexture) return false;
p_glTexImage2D = (void(APIENTRY*)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*))
p_glTexImage2D = (void(APIENTRY*)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*))
SDL_GL_GetProcAddress("glTexImage2D"); if(!p_glTexImage2D) return false;
p_glTexSubImage2D = (void(APIENTRY*)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*))
p_glTexSubImage2D = (void(APIENTRY*)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*))
SDL_GL_GetProcAddress("glTexSubImage2D"); if(!p_glTexSubImage2D) return false;
p_glTexParameteri = (void(APIENTRY*)(GLenum, GLenum, GLint))
p_glTexParameteri = (void(APIENTRY*)(GLenum, GLenum, GLint))
SDL_GL_GetProcAddress("glTexParameteri"); if(!p_glTexParameteri) return false;
}
else
return false;
return myFuncsLoaded = true;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -308,6 +318,11 @@ bool FrameBufferGL::setVidMode(VideoMode mode)
return false;
}
// Reload OpenGL function pointers. This only seems to be needed for Windows
// Vista, but it shouldn't hurt on other systems.
if(!loadFuncs())
return false;
// Check for some extensions that can potentially speed up operation
// Don't use it if we've been instructed not to
if(myOSystem->settings().getBool("gl_texrect"))
@ -720,6 +735,6 @@ GUI::Surface* FrameBufferGL::createSurface(int width, int height) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FrameBufferGL::myFuncsLoaded = false;
bool FrameBufferGL::myLibraryLoaded = false;
#endif // DISPLAY_OPENGL

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FrameBufferGL.hxx,v 1.49 2007-09-28 16:24:44 stephena Exp $
// $Id: FrameBufferGL.hxx,v 1.50 2008-01-20 18:16:41 stephena Exp $
//============================================================================
#ifndef FRAMEBUFFER_GL_HXX
@ -35,7 +35,7 @@ class GUI::Font;
This class implements an SDL OpenGL framebuffer.
@author Stephen Anthony
@version $Id: FrameBufferGL.hxx,v 1.49 2007-09-28 16:24:44 stephena Exp $
@version $Id: FrameBufferGL.hxx,v 1.50 2008-01-20 18:16:41 stephena Exp $
*/
class FrameBufferGL : public FrameBuffer
{
@ -51,13 +51,13 @@ class FrameBufferGL : public FrameBuffer
virtual ~FrameBufferGL();
/**
Check if OpenGL is available on this system and dynamically load
all required GL functions. If any errors occur, we shouldn't attempt
to instantiate a FrameBufferGL object.
Check if OpenGL is available on this system, and then opens it.
If any errors occur, we shouldn't attempt to instantiate a
FrameBufferGL object.
@param library The filename of the OpenGL library
*/
static bool loadFuncs(const string& library);
static bool loadLibrary(const string& library);
//////////////////////////////////////////////////////////////////////
// The following methods are derived from FrameBuffer.hxx
@ -232,6 +232,8 @@ class FrameBufferGL : public FrameBuffer
void enablePhosphor(bool enable, int blend);
private:
bool loadFuncs();
bool createTextures();
inline uInt32 power_of_two(uInt32 input)
@ -283,8 +285,8 @@ class FrameBufferGL : public FrameBuffer
// Indicates that the texture has been modified, and should be redrawn
bool myDirtyFlag;
// Indicates if the OpenGL functions have been properly loaded
static bool myFuncsLoaded;
// Indicates if the OpenGL library has been properly loaded
static bool myLibraryLoaded;
};
#endif // DISPLAY_OPENGL

View File

@ -124,10 +124,8 @@ uInt8 CartridgeSB::peek(uInt16 address)
break;
}
}
else
{
return 0;
}
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: MediaFactory.cxx,v 1.10 2007-09-11 19:46:16 stephena Exp $
// $Id: MediaFactory.cxx,v 1.11 2008-01-20 18:16:42 stephena Exp $
//============================================================================
////////////////////////////////////////////////////////////////////
@ -58,7 +58,7 @@ FrameBuffer* MediaFactory::createVideo(OSystem* osystem)
if(osystem->settings().getString("video") == "gl")
{
const string& gl_lib = osystem->settings().getString("gl_lib");
if(FrameBufferGL::loadFuncs(gl_lib))
if(FrameBufferGL::loadLibrary(gl_lib))
fb = new FrameBufferGL(osystem);
else
cerr << "ERROR: Couldn't dynamically load OpenGL library ...\n";

View File

@ -1,4 +1,4 @@
SDKROOT_ppc = /Developer/SDKs/MacOSX10.2.8.sdk
SDKROOT_ppc = /Developer/SDKs/MacOSX10.3.9.sdk
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk
GCC_VERSION_ppc = 3.3
GCC_VERSION_i386 = 4.0

View File

@ -271,6 +271,10 @@
2DEFB40C09C3386F00754289 /* Cart.icns in Resources */ = {isa = PBXBuildFile; fileRef = 2DEFB40B09C3386F00754289 /* Cart.icns */; };
DC07A3C80CAD738A009B4BC9 /* StateManager.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC07A3C60CAD738A009B4BC9 /* StateManager.cxx */; };
DC07A3C90CAD738A009B4BC9 /* StateManager.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC07A3C70CAD738A009B4BC9 /* StateManager.hxx */; };
DC09847B0D3983A80073C852 /* TrackBall22.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC0984790D3983A80073C852 /* TrackBall22.cxx */; };
DC09847C0D3983A80073C852 /* TrackBall22.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC09847A0D3983A80073C852 /* TrackBall22.hxx */; };
DC0984850D3985160073C852 /* CartSB.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC0984830D3985160073C852 /* CartSB.cxx */; };
DC0984860D3985160073C852 /* CartSB.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC0984840D3985160073C852 /* CartSB.hxx */; };
DC47455509C34BFA00EDDA3A /* BankRomCheat.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC47454A09C34BFA00EDDA3A /* BankRomCheat.cxx */; };
DC47455609C34BFA00EDDA3A /* BankRomCheat.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC47454B09C34BFA00EDDA3A /* BankRomCheat.hxx */; };
DC47455709C34BFA00EDDA3A /* Cheat.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC47454C09C34BFA00EDDA3A /* Cheat.hxx */; };
@ -616,6 +620,10 @@
B2F367C504C7ADC700A80002 /* SDLMain.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = SDLMain.nib; sourceTree = "<group>"; };
DC07A3C60CAD738A009B4BC9 /* StateManager.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = StateManager.cxx; path = ../emucore/StateManager.cxx; sourceTree = SOURCE_ROOT; };
DC07A3C70CAD738A009B4BC9 /* StateManager.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = StateManager.hxx; path = ../emucore/StateManager.hxx; sourceTree = SOURCE_ROOT; };
DC0984790D3983A80073C852 /* TrackBall22.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TrackBall22.cxx; path = ../emucore/TrackBall22.cxx; sourceTree = SOURCE_ROOT; };
DC09847A0D3983A80073C852 /* TrackBall22.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = TrackBall22.hxx; path = ../emucore/TrackBall22.hxx; sourceTree = SOURCE_ROOT; };
DC0984830D3985160073C852 /* CartSB.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CartSB.cxx; path = ../emucore/CartSB.cxx; sourceTree = SOURCE_ROOT; };
DC0984840D3985160073C852 /* CartSB.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CartSB.hxx; path = ../emucore/CartSB.hxx; sourceTree = SOURCE_ROOT; };
DC47454A09C34BFA00EDDA3A /* BankRomCheat.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = BankRomCheat.cxx; path = ../cheat/BankRomCheat.cxx; sourceTree = SOURCE_ROOT; };
DC47454B09C34BFA00EDDA3A /* BankRomCheat.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = BankRomCheat.hxx; path = ../cheat/BankRomCheat.hxx; sourceTree = SOURCE_ROOT; };
DC47454C09C34BFA00EDDA3A /* Cheat.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Cheat.hxx; path = ../cheat/Cheat.hxx; sourceTree = SOURCE_ROOT; };
@ -839,6 +847,10 @@
2D6050CC0898776500C6DE89 /* emucore */ = {
isa = PBXGroup;
children = (
DC0984830D3985160073C852 /* CartSB.cxx */,
DC0984840D3985160073C852 /* CartSB.hxx */,
DC0984790D3983A80073C852 /* TrackBall22.cxx */,
DC09847A0D3983A80073C852 /* TrackBall22.hxx */,
DC07A3C60CAD738A009B4BC9 /* StateManager.cxx */,
DC07A3C70CAD738A009B4BC9 /* StateManager.hxx */,
DCEECE540B5E5E540021D754 /* Cart0840.cxx */,
@ -1253,6 +1265,8 @@
DCE3BBFC0C95CEDC00A671DF /* Surface.hxx in Headers */,
DC07A3C90CAD738A009B4BC9 /* StateManager.hxx in Headers */,
DC8211550CAD74FF00511571 /* VideoModeList.hxx in Headers */,
DC09847C0D3983A80073C852 /* TrackBall22.hxx in Headers */,
DC0984860D3985160073C852 /* CartSB.hxx in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1291,9 +1305,11 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 2D91752109BA903B0026E9FF /* Build configuration list for PBXProject "stella" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 29B97314FDCFA39411CA2CEA /* «PROJECTNAMEASXML» */;
projectDirPath = "";
projectRoot = "";
targets = (
2D9173C809BA90380026E9FF /* StellaOSX */,
);
@ -1486,6 +1502,8 @@
DCE3BBF90C95CEDC00A671DF /* RomInfoWidget.cxx in Sources */,
DCE3BBFB0C95CEDC00A671DF /* Surface.cxx in Sources */,
DC07A3C80CAD738A009B4BC9 /* StateManager.cxx in Sources */,
DC09847B0D3983A80073C852 /* TrackBall22.cxx in Sources */,
DC0984850D3985160073C852 /* CartSB.cxx in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1700,6 +1718,7 @@
);
GCC_ENABLE_CPP_RTTI = NO;
GCC_OPTIMIZATION_LEVEL = 3;
SDKROOT_ppc = /Developer/SDKs/MacOSX10.3.9.sdk;
};
name = Deployment;
};

View File

@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Stella", "Stella.vcproj", "{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}"
EndProject
Global

View File

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="9.00"
Name="Stella"
ProjectGUID="{D7FCEC7F-33E1-49DD-A4B0-D5FC222250AD}"
RootNamespace="Stella"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
@ -69,6 +70,8 @@
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/Stella.pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
@ -89,9 +92,6 @@
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
@ -121,6 +121,8 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/MP"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\yacc;..\emucore\m6502\src\bspf\src;..\emucore\m6502\src;..\emucore;..\common;..\gui;..\debugger\gui;..\debugger;..\win32;..\cheat"
PreprocessorDefinitions="BSPF_WIN32;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;DISPLAY_OPENGL;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT"
RuntimeLibrary="2"
@ -147,6 +149,8 @@
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
@ -167,9 +171,6 @@
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
@ -322,6 +323,10 @@
RelativePath="..\emucore\CartMC.cxx"
>
</File>
<File
RelativePath="..\emucore\CartSB.cxx"
>
</File>
<File
RelativePath="..\emucore\CartUA.cxx"
>
@ -884,6 +889,10 @@
RelativePath="..\emucore\CartMC.hxx"
>
</File>
<File
RelativePath="..\emucore\CartSB.hxx"
>
</File>
<File
RelativePath="..\emucore\CartUA.hxx"
>