From c2ae2e8d588223d34571e96071ae3a64a43ea926 Mon Sep 17 00:00:00 2001 From: "XTra.KrazzY" Date: Mon, 12 Oct 2009 16:29:32 +0000 Subject: [PATCH] Started fixing SW video compilation for linux, must go home now git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4410 8ced0084-cf51-0410-be5f-012b33b47a6e --- SConstruct | 1 + .../Plugin_VideoSoftware/Src/GLUtil.cpp | 2 +- .../Plugin_VideoSoftware/Src/HwRasterizer.cpp | 4 +- .../Plugin_VideoSoftware/Src/HwRasterizer.h | 6 +- .../Src/NativeVertexFormat.h | 8 +- .../Plugin_VideoSoftware/Src/Rasterizer.cpp | 4 +- .../Plugin_VideoSoftware/Src/Renderer.h | 4 +- .../Plugin_VideoSoftware/Src/SConscript | 118 ++++++++++++++++++ .../Src/TextureSampler.cpp | 6 +- .../Plugins/Plugin_VideoSoftware/Src/main.h | 2 +- 10 files changed, 139 insertions(+), 16 deletions(-) create mode 100644 Source/Plugins/Plugin_VideoSoftware/Src/SConscript diff --git a/SConstruct b/SConstruct index fef7f91753..6dda1356d5 100644 --- a/SConstruct +++ b/SConstruct @@ -78,6 +78,7 @@ dirs = [ 'Source/Core/DSPCore/Src', 'Source/DSPTool/Src', 'Source/Plugins/Plugin_VideoOGL/Src', + 'Source/Plugins/Plugin_VideoSoftware/Src', 'Source/Plugins/Plugin_DSP_HLE/Src', 'Source/Plugins/Plugin_DSP_LLE/Src', 'Source/Plugins/Plugin_PadSimple/Src', diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp index cd85612e13..ab5b2e0879 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp @@ -339,7 +339,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_DEPTH_SIZE, 24, - GLX_SAMPLE_BUFFERS_ARB, g_Config.iMultisampleMode, GLX_SAMPLES_ARB, 1, None }; + GLX_SAMPLE_BUFFERS_ARB, GLX_SAMPLES_ARB, 1, None }; GLWin.dpy = XOpenDisplay(0); g_VideoInitialize.pWindowHandle = (HWND)GLWin.dpy; GLWin.screen = DefaultScreen(GLWin.dpy); diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp index 4adb6fcd8b..ab70b0fa96 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.cpp @@ -18,9 +18,9 @@ #include "Common.h" #include "MemoryUtil.h" -#include +#include -#include "BpMemLoader.h" +#include "BPMemLoader.h" #include "HwRasterizer.h" #include "GLUtil.h" #include "NativeVertexFormat.h" diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.h b/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.h index fd37460d7f..25888c4d22 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.h +++ b/Source/Plugins/Plugin_VideoSoftware/Src/HwRasterizer.h @@ -20,8 +20,8 @@ #include -#include "BpMemLoader.h" -#include "GlUtil.h" +#include "BPMemLoader.h" +#include "GLUtil.h" struct OutputVertexData; @@ -57,4 +57,4 @@ namespace HwRasterizer static TextureCache textures; } -#endif \ No newline at end of file +#endif diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/NativeVertexFormat.h b/Source/Plugins/Plugin_VideoSoftware/Src/NativeVertexFormat.h index 71a134206d..befc048f37 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/NativeVertexFormat.h +++ b/Source/Plugins/Plugin_VideoSoftware/Src/NativeVertexFormat.h @@ -18,8 +18,12 @@ #ifndef _NATIVEVERTEXFORMAT_H #define _NATIVEVERTEXFORMAT_H - +#ifdef WIN32 #define LOADERDECL __cdecl +#else +#define LOADERDECL +#endif + typedef void (LOADERDECL *TPipelineFunction)(); struct InputVertexData @@ -80,4 +84,4 @@ struct OutputVertexData } }; -#endif \ No newline at end of file +#endif diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp index 95428d776c..38964088a7 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp @@ -313,9 +313,9 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer } } } - + } -} \ No newline at end of file +} diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Renderer.h b/Source/Plugins/Plugin_VideoSoftware/Src/Renderer.h index 40199d278c..33304a6b90 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Renderer.h +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Renderer.h @@ -18,7 +18,7 @@ #ifndef _RENDERER_H_ #define _RENDERER_H_ -#include "PluginSpecs_Video.h" +#include "pluginspecs_video.h" namespace Renderer { @@ -34,4 +34,4 @@ namespace Renderer void SwapBuffer(); } -#endif \ No newline at end of file +#endif diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SConscript b/Source/Plugins/Plugin_VideoSoftware/Src/SConscript new file mode 100644 index 0000000000..cf538d6acb --- /dev/null +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SConscript @@ -0,0 +1,118 @@ +# -*- python -*- + +Import('env') +# can we import path in one place? +import sys +sys.path.append(env['base_dir']+'SconsTests') +import utils +import platform + +name = "Plugin_VideoSoftware" + +files = [ + 'BPMemLoader.cpp', + 'Clipper.cpp', + 'CommandProcessor.cpp', + 'CPMemLoader.cpp', + 'DebugUtil.cpp', + 'EfbCopy.cpp', + 'EfbInterface.cpp', + 'GLUtil.cpp', + 'HwRasterizer.cpp', + 'main.cpp', + 'OpcodeDecoder.cpp', + 'PixelEngine.cpp', + 'Rasterizer.cpp', + 'Renderer.cpp', + 'SetupUnit.cpp', + 'Statistics.cpp', + 'Tev.cpp', + 'TextureEncoder.cpp', + 'TextureSampler.cpp', + 'TransformUnit.cpp', + 'VertexFormatConverter.cpp', + 'VertexLoader.cpp', + 'VideoConfig.cpp', + 'XFMemLoader.cpp', + ] +compileFlags = [ + '-fPIC', + ] +linkFlags = [ + ] +libs = [ + 'videocommon', 'soil', 'common' + ] + +gfxenv = env.Clone() + +files += [ + 'main.cpp', + 'GLUtil.cpp', + ] + +if sys.platform == 'win32': + files += [ 'Win32.cpp' ] + +tests = {'CheckPKG' : utils.CheckPKG} +conf = gfxenv.Configure(custom_tests = tests, + config_h=env['base_dir']+"Source/Core/Common/Src/Config.h") + +if sys.platform == 'darwin': + gfxenv['FRAMEWORKS'] = ['CoreFoundation', 'System', 'OpenGL', 'Cocoa', 'Cg'] + + conf.CheckPKG('OpenGL') + if not conf.CheckPKG('Cg'): + print name + " must have Cg framework from nvidia to be build" + Return() + +elif sys.platform == 'win32': + print name + " is assuming that you have opengl, glu, cg, and cggl" +else: + if not (conf.CheckPKG('GL') and conf.CheckPKG('GLU')): + print name + " must have opengl and glu to be build" + Return() + + if not conf.CheckPKG('Cg') or not conf.CheckPKG('CgGL'): + print name + " must have cg and cggl to be build" + Return() +if sys.platform == 'win32': + print name + " is assuming that you have glew" +else: + if not conf.CheckPKG('GLEW'): + print name + " must have glew to be build" + Return() + + +if sys.platform == 'win32': + files += [ + 'Win32.cpp' + ] + libs += [ + env['base_dir'] + '/Externals/Cg/' + ] + gfxenv['CPPPATH'] += libs + + +# check for xxf86vm + +gfxenv['HAVE_XXF86VM'] = gfxenv['HAVE_X11'] and conf.CheckPKG('xxf86vm') + +conf.Define('HAVE_XXF86VM', gfxenv['HAVE_XXF86VM']) + +conf.Finish() + +# Sanity check +if gfxenv['USE_WX'] and not gfxenv['HAVE_WX']: + print "Must have wx to use wxgl" + Return() +gfxenv.Append( + CXXFLAGS = compileFlags, + LINKFLAGS = linkFlags, + ) + +gfxenv.SharedLibrary( + env['plugin_dir']+name, + files, + LIBS = libs + gfxenv['LIBS'] + ) diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp index 0ac592ac74..dbbb0e3a87 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp @@ -16,7 +16,7 @@ #include "TextureSampler.h" -#include "Main.h" +#include "main.h" #include "BPMemLoader.h" #include "../../../Core/VideoCommon/Src/TextureDecoder.h" @@ -30,7 +30,7 @@ inline int iround(float x) { int t; - __asm + __asm volatile { fld x fistp t @@ -147,4 +147,4 @@ void Sample(float s, float t, float lod, u8 texmap, u8 *sample) } } -} \ No newline at end of file +} diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/main.h b/Source/Plugins/Plugin_VideoSoftware/Src/main.h index c3cb99be3e..e2da80d973 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/main.h +++ b/Source/Plugins/Plugin_VideoSoftware/Src/main.h @@ -18,7 +18,7 @@ #ifndef MAIN_H #define MAIN_H -#include "PluginSpecs_Video.h" +#include "pluginspecs_video.h" extern SVideoInitialize g_VideoInitialize;