mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-19 02:36:27 +01:00
Make Cg conditional on those platforms for which it is available.
Of course, this doesn't do much good without another shader compiler.. WIP of OS X application bundle building. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5961 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
7828a689e7
commit
53f5bc682d
14
SConstruct
14
SConstruct
@ -86,6 +86,7 @@ ccFlags = [
|
|||||||
'-fPIC',
|
'-fPIC',
|
||||||
'-fno-exceptions',
|
'-fno-exceptions',
|
||||||
'-fno-strict-aliasing',
|
'-fno-strict-aliasing',
|
||||||
|
'-fvisibility=hidden',
|
||||||
'-msse2',
|
'-msse2',
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -200,21 +201,14 @@ env['RPATH'] = []
|
|||||||
# OS X specifics
|
# OS X specifics
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
gccflags = ['-arch', 'x86_64', '-arch', 'i386', '-mmacosx-version-min=10.5']
|
gccflags = ['-arch', 'x86_64', '-arch', 'i386', '-mmacosx-version-min=10.5']
|
||||||
gccflags += ['-Wnewline-eof']
|
|
||||||
#gccflags += ['-fvisibility=hidden']
|
|
||||||
env['CCFLAGS'] += gccflags
|
env['CCFLAGS'] += gccflags
|
||||||
env['CCFLAGS'] += ['-Wnewline-eof']
|
env['CCFLAGS'] += ['-Wextra-tokens', '-Wnewline-eof']
|
||||||
env['CC'] = "gcc-4.2"
|
env['CC'] = "gcc-4.2 -ObjC"
|
||||||
env['CFLAGS'] += ['-x', 'objective-c']
|
env['CXX'] = "g++-4.2 -ObjC++"
|
||||||
env['CXX'] = "g++-4.2"
|
|
||||||
env['CXXFLAGS'] += ['-x', 'objective-c++']
|
|
||||||
#env['CXXFLAGS'] += ['-D_GLIBCXX_DEBUG']
|
|
||||||
#env['CXXFLAGS'] += ['-D_GLIBCXX_FULLY_DYNAMIC_STRING']
|
|
||||||
env['FRAMEWORKS'] += ['AppKit', 'CoreFoundation', 'CoreServices']
|
env['FRAMEWORKS'] += ['AppKit', 'CoreFoundation', 'CoreServices']
|
||||||
env['FRAMEWORKS'] += ['AudioUnit', 'CoreAudio']
|
env['FRAMEWORKS'] += ['AudioUnit', 'CoreAudio']
|
||||||
env['FRAMEWORKS'] += ['IOBluetooth', 'IOKit', 'OpenGL']
|
env['FRAMEWORKS'] += ['IOBluetooth', 'IOKit', 'OpenGL']
|
||||||
env['LIBS'] += ['iconv']
|
env['LIBS'] += ['iconv']
|
||||||
#env['LIBS'] += ['libstdc++-static']
|
|
||||||
env['LINKFLAGS'] += gccflags
|
env['LINKFLAGS'] += gccflags
|
||||||
env['LINKFLAGS'] += ['-Z', '-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib',
|
env['LINKFLAGS'] += ['-Z', '-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib',
|
||||||
'-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks',
|
'-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks',
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
#define CREG_EAX(ctx) (ctx)->gregs[REG_EAX]
|
#define CREG_EAX(ctx) (ctx)->gregs[REG_EAX]
|
||||||
#define CREG_EIP(ctx) (ctx)->gregs[REG_EIP]
|
#define CREG_EIP(ctx) (ctx)->gregs[REG_EIP]
|
||||||
#elif defined __NetBSD__
|
#elif defined __NetBSD__
|
||||||
#include <sys/siginfo.h>
|
|
||||||
#define CREG_RAX(ctx) (ctx)->__gregs[_REG_RAX]
|
#define CREG_RAX(ctx) (ctx)->__gregs[_REG_RAX]
|
||||||
#define CREG_RIP(ctx) (ctx)->__gregs[_REG_RIP]
|
#define CREG_RIP(ctx) (ctx)->__gregs[_REG_RIP]
|
||||||
#define CREG_EAX(ctx) (ctx)->__gregs[_REG_EAX]
|
#define CREG_EAX(ctx) (ctx)->__gregs[_REG_EAX]
|
||||||
|
@ -554,12 +554,15 @@ void CGameListCtrl::ScanForISOs()
|
|||||||
sprintf(tempstring,"Scanning %s", FileName.c_str());
|
sprintf(tempstring,"Scanning %s", FileName.c_str());
|
||||||
msg = wxString(tempstring, *wxConvCurrent);
|
msg = wxString(tempstring, *wxConvCurrent);
|
||||||
|
|
||||||
|
// With wxWidgets 2.9.1, each Update() sleeps for several seconds
|
||||||
|
#ifndef __APPLE__
|
||||||
// Update with the progress (i) and the message (msg)
|
// Update with the progress (i) and the message (msg)
|
||||||
bool Cont = dialog.Update(i, msg);
|
bool Cont = dialog.Update(i, msg);
|
||||||
if (!Cont)
|
if (!Cont)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
GameListItem ISOFile(rFilenames[i]);
|
GameListItem ISOFile(rFilenames[i]);
|
||||||
if (ISOFile.IsValid())
|
if (ISOFile.IsValid())
|
||||||
{
|
{
|
||||||
|
@ -57,18 +57,23 @@ elif sys.platform == 'darwin' and not env['HAVE_WX']:
|
|||||||
files += [ 'cocoaApp.m' ]
|
files += [ 'cocoaApp.m' ]
|
||||||
exeNoGUI = env['binary_dir'] + 'DolphinNoGUI'
|
exeNoGUI = env['binary_dir'] + 'DolphinNoGUI'
|
||||||
elif sys.platform == 'darwin' and env['HAVE_WX']:
|
elif sys.platform == 'darwin' and env['HAVE_WX']:
|
||||||
exeGUI = env['binary_dir'] + 'Dolphin.app/Contents/MacOS/Dolphin'
|
exeGUI = 'Dolphin'
|
||||||
|
exeGUIdist = env['binary_dir'] + 'Dolphin.app/Contents/MacOS/Dolphin'
|
||||||
|
|
||||||
env.Install(env['binary_dir'] + 'Dolphin.app/Contents/' +
|
env.Install(env['binary_dir'] + 'Dolphin.app/Contents/' +
|
||||||
'Library/Frameworks/Cg.framework',
|
'Library/Frameworks/Cg.framework',
|
||||||
'#Externals/Cg/Cg.framework/Cg')
|
'#Externals/Cg/Cg.framework/Cg')
|
||||||
|
|
||||||
env.Install(env['binary_dir'] + 'Dolphin.app/Contents/Resources/',
|
env.Install(env['data_dir'],
|
||||||
'#Source/Core/DolphinWX/resources/Dolphin.icns')
|
'#Source/Core/DolphinWX/resources/Dolphin.icns')
|
||||||
|
|
||||||
env.Plist(
|
from plistlib import writePlist
|
||||||
env['binary_dir'] + 'Dolphin.app/Contents/Info.plist',
|
def createPlist(target, source, env):
|
||||||
Value(dict(
|
for srcNode in source:
|
||||||
|
writePlist(srcNode.value, str(target[0]))
|
||||||
|
env.Append(BUILDERS = {'Plist' : Builder(action = createPlist)})
|
||||||
|
env.Plist(env['binary_dir'] + 'Dolphin.app/Contents/Info.plist', Value(
|
||||||
|
dict(
|
||||||
CFBundleExecutable = 'Dolphin',
|
CFBundleExecutable = 'Dolphin',
|
||||||
CFBundleIconFile = 'Dolphin.icns',
|
CFBundleIconFile = 'Dolphin.icns',
|
||||||
CFBundleIdentifier = 'com.dolphin-emu.dolphin',
|
CFBundleIdentifier = 'com.dolphin-emu.dolphin',
|
||||||
@ -78,8 +83,14 @@ elif sys.platform == 'darwin' and env['HAVE_WX']:
|
|||||||
CFBundleVersion = '2.0',
|
CFBundleVersion = '2.0',
|
||||||
LSMinimumSystemVersion = '10.5.0',
|
LSMinimumSystemVersion = '10.5.0',
|
||||||
LSRequiresCarbon = True,
|
LSRequiresCarbon = True,
|
||||||
))
|
)))
|
||||||
)
|
|
||||||
|
def Fixup(target, source, env):
|
||||||
|
os.link(str(source[0]), str(target[0]))
|
||||||
|
env.Append(BUILDERS = {'Fixup' : Builder(action = Fixup)})
|
||||||
|
env.Depends(exeGUIdist, env['plugin_dir'])
|
||||||
|
if env['CPPDEFINES'].count('WXUSINGDLL'):
|
||||||
|
env.Fixup(exeGUIdist, exeGUI)
|
||||||
else:
|
else:
|
||||||
files += [ 'X11Utils.cpp' ]
|
files += [ 'X11Utils.cpp' ]
|
||||||
libs += [ 'SDL' ]
|
libs += [ 'SDL' ]
|
||||||
|
@ -133,10 +133,12 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
|
|||||||
#define GL_REPORT_ERRORD()
|
#define GL_REPORT_ERRORD()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined __APPLE__ || defined __linux__ || defined _WIN32
|
||||||
#include <Cg/cg.h>
|
#include <Cg/cg.h>
|
||||||
#include <Cg/cgGL.h>
|
#include <Cg/cgGL.h>
|
||||||
|
#define HAVE_CG 1
|
||||||
extern CGcontext g_cgcontext;
|
extern CGcontext g_cgcontext;
|
||||||
extern CGprofile g_cgvProf, g_cgfProf;
|
extern CGprofile g_cgvProf, g_cgfProf;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // _GLINIT_H_
|
#endif // _GLINIT_H_
|
||||||
|
@ -20,9 +20,6 @@
|
|||||||
|
|
||||||
#include "GLUtil.h"
|
#include "GLUtil.h"
|
||||||
|
|
||||||
#include <Cg/cg.h>
|
|
||||||
#include <Cg/cgGL.h>
|
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "Statistics.h"
|
#include "Statistics.h"
|
||||||
@ -248,6 +245,7 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr
|
|||||||
ERROR_LOG(VIDEO, "glError %08x before PS!", err);
|
ERROR_LOG(VIDEO, "glError %08x before PS!", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined HAVE_CG && HAVE_CG
|
||||||
char stropt[128];
|
char stropt[128];
|
||||||
sprintf(stropt, "MaxLocalParams=32,NumInstructionSlots=%d", s_nMaxPixelInstructions);
|
sprintf(stropt, "MaxLocalParams=32,NumInstructionSlots=%d", s_nMaxPixelInstructions);
|
||||||
const char *opts[] = {"-profileopts", stropt, "-O2", "-q", NULL};
|
const char *opts[] = {"-profileopts", stropt, "-O2", "-q", NULL};
|
||||||
@ -305,6 +303,7 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr
|
|||||||
}
|
}
|
||||||
|
|
||||||
cgDestroyProgram(tempprog);
|
cgDestroyProgram(tempprog);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||||
ps.strprog = pstrprogram;
|
ps.strprog = pstrprogram;
|
||||||
|
@ -26,9 +26,6 @@
|
|||||||
|
|
||||||
#include "GLUtil.h"
|
#include "GLUtil.h"
|
||||||
|
|
||||||
#include <Cg/cg.h>
|
|
||||||
#include <Cg/cgGL.h>
|
|
||||||
|
|
||||||
#include "FileUtil.h"
|
#include "FileUtil.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -76,9 +73,11 @@
|
|||||||
// ----------------------------
|
// ----------------------------
|
||||||
int s_fps=0;
|
int s_fps=0;
|
||||||
|
|
||||||
|
#if defined HAVE_CG && HAVE_CG
|
||||||
CGcontext g_cgcontext;
|
CGcontext g_cgcontext;
|
||||||
CGprofile g_cgvProf;
|
CGprofile g_cgvProf;
|
||||||
CGprofile g_cgfProf;
|
CGprofile g_cgfProf;
|
||||||
|
#endif
|
||||||
|
|
||||||
RasterFont* s_pfont = NULL;
|
RasterFont* s_pfont = NULL;
|
||||||
|
|
||||||
@ -208,6 +207,7 @@ void SetDefaultRectTexParams()
|
|||||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined HAVE_CG && HAVE_CG
|
||||||
void HandleCgError(CGcontext ctx, CGerror err, void* appdata)
|
void HandleCgError(CGcontext ctx, CGerror err, void* appdata)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(VIDEO, "Cg error: %s", cgGetErrorString(err));
|
DEBUG_LOG(VIDEO, "Cg error: %s", cgGetErrorString(err));
|
||||||
@ -216,6 +216,7 @@ void HandleCgError(CGcontext ctx, CGerror err, void* appdata)
|
|||||||
DEBUG_LOG(VIDEO, " last listing: %s", listing);
|
DEBUG_LOG(VIDEO, " last listing: %s", listing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
void VideoConfig::UpdateProjectionHack()
|
void VideoConfig::UpdateProjectionHack()
|
||||||
@ -231,6 +232,8 @@ bool Renderer::Init()
|
|||||||
bool bSuccess = true;
|
bool bSuccess = true;
|
||||||
s_blendMode = 0;
|
s_blendMode = 0;
|
||||||
s_MSAACoverageSamples = 0;
|
s_MSAACoverageSamples = 0;
|
||||||
|
GLint numvertexattribs = 0;
|
||||||
|
|
||||||
switch (g_ActiveConfig.iMultisampleMode)
|
switch (g_ActiveConfig.iMultisampleMode)
|
||||||
{
|
{
|
||||||
case MULTISAMPLE_OFF: s_MSAASamples = 1; break;
|
case MULTISAMPLE_OFF: s_MSAASamples = 1; break;
|
||||||
@ -244,11 +247,12 @@ bool Renderer::Init()
|
|||||||
default:
|
default:
|
||||||
s_MSAASamples = 1;
|
s_MSAASamples = 1;
|
||||||
}
|
}
|
||||||
GLint numvertexattribs = 0;
|
|
||||||
g_cgcontext = cgCreateContext();
|
|
||||||
|
|
||||||
|
#if defined HAVE_CG && HAVE_CG
|
||||||
|
g_cgcontext = cgCreateContext();
|
||||||
cgGetError();
|
cgGetError();
|
||||||
cgSetErrorHandler(HandleCgError, NULL);
|
cgSetErrorHandler(HandleCgError, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Look for required extensions.
|
// Look for required extensions.
|
||||||
const char *ptoken = (const char*)glGetString(GL_EXTENSIONS);
|
const char *ptoken = (const char*)glGetString(GL_EXTENSIONS);
|
||||||
@ -388,6 +392,7 @@ bool Renderer::Init()
|
|||||||
|
|
||||||
s_pfont = new RasterFont();
|
s_pfont = new RasterFont();
|
||||||
|
|
||||||
|
#if defined HAVE_CG && HAVE_CG
|
||||||
// load the effect, find the best profiles (if any)
|
// load the effect, find the best profiles (if any)
|
||||||
if (cgGLIsProfileSupported(CG_PROFILE_ARBVP1) != CG_TRUE) {
|
if (cgGLIsProfileSupported(CG_PROFILE_ARBVP1) != CG_TRUE) {
|
||||||
ERROR_LOG(VIDEO, "arbvp1 not supported");
|
ERROR_LOG(VIDEO, "arbvp1 not supported");
|
||||||
@ -415,8 +420,8 @@ bool Renderer::Init()
|
|||||||
cgGLSetOptimalOptions(g_cgvProf);
|
cgGLSetOptimalOptions(g_cgvProf);
|
||||||
cgGLSetOptimalOptions(g_cgfProf);
|
cgGLSetOptimalOptions(g_cgfProf);
|
||||||
#endif
|
#endif
|
||||||
|
#endif // HAVE_CG
|
||||||
|
|
||||||
INFO_LOG(VIDEO, "Max buffer sizes: %d %d", cgGetProgramBufferMaxSize(g_cgvProf), cgGetProgramBufferMaxSize(g_cgfProf));
|
|
||||||
int nenvvertparams, nenvfragparams, naddrregisters[2];
|
int nenvvertparams, nenvfragparams, naddrregisters[2];
|
||||||
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, (GLint *)&nenvvertparams);
|
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, (GLint *)&nenvvertparams);
|
||||||
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, (GLint *)&nenvfragparams);
|
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, (GLint *)&nenvfragparams);
|
||||||
@ -428,8 +433,13 @@ bool Renderer::Init()
|
|||||||
if (nenvvertparams < 238)
|
if (nenvvertparams < 238)
|
||||||
ERROR_LOG(VIDEO, "Not enough vertex shader environment constants!!");
|
ERROR_LOG(VIDEO, "Not enough vertex shader environment constants!!");
|
||||||
|
|
||||||
|
#if defined HAVE_CG && HAVE_CG
|
||||||
|
INFO_LOG(VIDEO, "Max buffer sizes: %d %d",
|
||||||
|
cgGetProgramBufferMaxSize(g_cgvProf),
|
||||||
|
cgGetProgramBufferMaxSize(g_cgfProf));
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
cgGLSetDebugMode(GL_FALSE);
|
cgGLSetDebugMode(GL_FALSE);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
glStencilFunc(GL_ALWAYS, 0, 0);
|
glStencilFunc(GL_ALWAYS, 0, 0);
|
||||||
@ -479,10 +489,12 @@ void Renderer::Shutdown(void)
|
|||||||
delete s_pfont;
|
delete s_pfont;
|
||||||
s_pfont = 0;
|
s_pfont = 0;
|
||||||
|
|
||||||
|
#if defined HAVE_CG && HAVE_CG
|
||||||
if (g_cgcontext) {
|
if (g_cgcontext) {
|
||||||
cgDestroyContext(g_cgcontext);
|
cgDestroyContext(g_cgcontext);
|
||||||
g_cgcontext = 0;
|
g_cgcontext = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
g_framebufferManager.Shutdown();
|
g_framebufferManager.Shutdown();
|
||||||
|
|
||||||
|
@ -125,8 +125,7 @@ FRAGMENTSHADER &GetOrCreateEncodingShader(u32 format)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!PixelShaderCache::CompilePixelShader(s_encodingPrograms[format], shader)) {
|
if (!PixelShaderCache::CompilePixelShader(s_encodingPrograms[format], shader)) {
|
||||||
const char* error = cgGetLastListing(g_cgcontext);
|
ERROR_LOG(VIDEO, "Failed to create encoding fragment program");
|
||||||
ERROR_LOG(VIDEO, "Failed to create encoding fragment program:\n%s", error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,6 @@
|
|||||||
|
|
||||||
#include "GLUtil.h"
|
#include "GLUtil.h"
|
||||||
|
|
||||||
#include <Cg/cg.h>
|
|
||||||
#include <Cg/cgGL.h>
|
|
||||||
|
|
||||||
#include "Render.h"
|
#include "Render.h"
|
||||||
#include "VertexShaderGen.h"
|
#include "VertexShaderGen.h"
|
||||||
#include "VertexShaderManager.h"
|
#include "VertexShaderManager.h"
|
||||||
@ -187,6 +184,7 @@ bool VertexShaderCache::CompileVertexShader(VERTEXSHADER& vs, const char* pstrpr
|
|||||||
ERROR_LOG(VIDEO, "glError %08x before VS!", err);
|
ERROR_LOG(VIDEO, "glError %08x before VS!", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined HAVE_CG && HAVE_CG
|
||||||
char stropt[64];
|
char stropt[64];
|
||||||
sprintf(stropt, "MaxLocalParams=256,MaxInstructions=%d", s_nMaxVertexInstructions);
|
sprintf(stropt, "MaxLocalParams=256,MaxInstructions=%d", s_nMaxVertexInstructions);
|
||||||
const char *opts[] = {"-profileopts", stropt, "-O2", "-q", NULL};
|
const char *opts[] = {"-profileopts", stropt, "-O2", "-q", NULL};
|
||||||
@ -228,6 +226,7 @@ bool VertexShaderCache::CompileVertexShader(VERTEXSHADER& vs, const char* pstrpr
|
|||||||
}
|
}
|
||||||
|
|
||||||
cgDestroyProgram(tempprog);
|
cgDestroyProgram(tempprog);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||||
vs.strprog = pstrprogram;
|
vs.strprog = pstrprogram;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user