win32-support ogl 3.2 and oglOld driver choices independently, and fallback to oglOld when ogl3.2 cant initialize
This commit is contained in:
parent
f09aaa3205
commit
98f9f0b64e
|
@ -486,6 +486,7 @@ static void texDeleteCallback(TexCacheItem *item)
|
||||||
_OGLRenderer->DeleteTexture(item);
|
_OGLRenderer->DeleteTexture(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<bool require_profile, bool enable_3_2>
|
||||||
static char OGLInit(void)
|
static char OGLInit(void)
|
||||||
{
|
{
|
||||||
char result = 0;
|
char result = 0;
|
||||||
|
@ -528,10 +529,19 @@ static char OGLInit(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new OpenGL rendering object
|
// Create new OpenGL rendering object
|
||||||
if (OGLLoadEntryPoints_3_2_Func != NULL && OGLCreateRenderer_3_2_Func != NULL)
|
if(enable_3_2)
|
||||||
{
|
{
|
||||||
OGLLoadEntryPoints_3_2_Func();
|
if (OGLLoadEntryPoints_3_2_Func != NULL && OGLCreateRenderer_3_2_Func != NULL)
|
||||||
OGLCreateRenderer_3_2_Func(&_OGLRenderer);
|
{
|
||||||
|
OGLLoadEntryPoints_3_2_Func();
|
||||||
|
OGLLoadEntryPoints_Legacy(); //zero 04-feb-2013 - this seems to be necessary as well
|
||||||
|
OGLCreateRenderer_3_2_Func(&_OGLRenderer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(require_profile)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the renderer doesn't initialize with OpenGL v3.2 or higher, fall back
|
// If the renderer doesn't initialize with OpenGL v3.2 or higher, fall back
|
||||||
|
@ -667,9 +677,32 @@ static void OGLRenderFinish()
|
||||||
ENDGL();
|
ENDGL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//automatically select 3.2 or old profile depending on whether 3.2 is available
|
||||||
GPU3DInterface gpu3Dgl = {
|
GPU3DInterface gpu3Dgl = {
|
||||||
"OpenGL",
|
"OpenGL",
|
||||||
OGLInit,
|
OGLInit<false,false>,
|
||||||
|
OGLReset,
|
||||||
|
OGLClose,
|
||||||
|
OGLRender,
|
||||||
|
OGLRenderFinish,
|
||||||
|
OGLVramReconfigureSignal
|
||||||
|
};
|
||||||
|
|
||||||
|
//forcibly use old profile
|
||||||
|
GPU3DInterface gpu3DglOld = {
|
||||||
|
"OpenGL",
|
||||||
|
OGLInit<true,false>,
|
||||||
|
OGLReset,
|
||||||
|
OGLClose,
|
||||||
|
OGLRender,
|
||||||
|
OGLRenderFinish,
|
||||||
|
OGLVramReconfigureSignal
|
||||||
|
};
|
||||||
|
|
||||||
|
//forcibly use new profile
|
||||||
|
GPU3DInterface gpu3Dgl_3_2 = {
|
||||||
|
"OpenGL 3.2",
|
||||||
|
OGLInit<true,true>,
|
||||||
OGLReset,
|
OGLReset,
|
||||||
OGLClose,
|
OGLClose,
|
||||||
OGLRender,
|
OGLRender,
|
||||||
|
|
|
@ -355,6 +355,8 @@ class TexCacheItem;
|
||||||
class OpenGLRenderer;
|
class OpenGLRenderer;
|
||||||
|
|
||||||
extern GPU3DInterface gpu3Dgl;
|
extern GPU3DInterface gpu3Dgl;
|
||||||
|
extern GPU3DInterface gpu3DglOld;
|
||||||
|
extern GPU3DInterface gpu3Dgl_3_2;
|
||||||
|
|
||||||
//This is called by OGLRender whenever it initializes.
|
//This is called by OGLRender whenever it initializes.
|
||||||
//Platforms, please be sure to set this up.
|
//Platforms, please be sure to set this up.
|
||||||
|
|
|
@ -2768,6 +2768,14 @@
|
||||||
RelativePath="..\OGLRender.h"
|
RelativePath="..\OGLRender.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\OGLRender_3_2.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\OGLRender_3_2.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\path.cpp"
|
RelativePath="..\path.cpp"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="9,00"
|
Version="9.00"
|
||||||
Name="DeSmuME_VS2008"
|
Name="DeSmuME_VS2008"
|
||||||
ProjectGUID="{9F5F72A1-D3A5-4918-B460-E076B16D10A9}"
|
ProjectGUID="{9F5F72A1-D3A5-4918-B460-E076B16D10A9}"
|
||||||
RootNamespace="DeSmuME"
|
RootNamespace="DeSmuME"
|
||||||
|
@ -862,6 +862,14 @@
|
||||||
RelativePath="..\OGLRender.h"
|
RelativePath="..\OGLRender.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\OGLRender_3_2.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\OGLRender_3_2.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\path.cpp"
|
RelativePath="..\path.cpp"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
@ -432,6 +432,7 @@
|
||||||
<ClCompile Include="..\movie.cpp" />
|
<ClCompile Include="..\movie.cpp" />
|
||||||
<ClCompile Include="..\NDSSystem.cpp" />
|
<ClCompile Include="..\NDSSystem.cpp" />
|
||||||
<ClCompile Include="..\OGLRender.cpp" />
|
<ClCompile Include="..\OGLRender.cpp" />
|
||||||
|
<ClCompile Include="..\OGLRender_3_2.cpp" />
|
||||||
<ClCompile Include="..\path.cpp" />
|
<ClCompile Include="..\path.cpp" />
|
||||||
<ClCompile Include="..\rasterize.cpp" />
|
<ClCompile Include="..\rasterize.cpp" />
|
||||||
<ClCompile Include="..\readwrite.cpp" />
|
<ClCompile Include="..\readwrite.cpp" />
|
||||||
|
@ -710,6 +711,7 @@
|
||||||
<ClInclude Include="..\movie.h" />
|
<ClInclude Include="..\movie.h" />
|
||||||
<ClInclude Include="..\NDSSystem.h" />
|
<ClInclude Include="..\NDSSystem.h" />
|
||||||
<ClInclude Include="..\OGLRender.h" />
|
<ClInclude Include="..\OGLRender.h" />
|
||||||
|
<ClInclude Include="..\OGLRender_3_2.h" />
|
||||||
<ClInclude Include="..\path.h" />
|
<ClInclude Include="..\path.h" />
|
||||||
<ClInclude Include="..\rasterize.h" />
|
<ClInclude Include="..\rasterize.h" />
|
||||||
<ClInclude Include="..\readwrite.h" />
|
<ClInclude Include="..\readwrite.h" />
|
||||||
|
|
|
@ -774,6 +774,9 @@
|
||||||
<ClCompile Include="..\utils\AsmJit\x86\x86util.cpp">
|
<ClCompile Include="..\utils\AsmJit\x86\x86util.cpp">
|
||||||
<Filter>Core\utils\AsmJit\x86</Filter>
|
<Filter>Core\utils\AsmJit\x86</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\OGLRender_3_2.cpp">
|
||||||
|
<Filter>Core</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\addons.h">
|
<ClInclude Include="..\addons.h">
|
||||||
|
@ -1494,6 +1497,9 @@
|
||||||
<ClInclude Include="..\utils\AsmJit\x86\x86util.h">
|
<ClInclude Include="..\utils\AsmJit\x86\x86util.h">
|
||||||
<Filter>Core\utils\AsmJit\x86</Filter>
|
<Filter>Core\utils\AsmJit\x86</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\OGLRender_3_2.h">
|
||||||
|
<Filter>Core</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\instruction_tabdef.inc">
|
<None Include="..\instruction_tabdef.inc">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
@ -406,6 +406,7 @@
|
||||||
<ClCompile Include="..\movie.cpp" />
|
<ClCompile Include="..\movie.cpp" />
|
||||||
<ClCompile Include="..\NDSSystem.cpp" />
|
<ClCompile Include="..\NDSSystem.cpp" />
|
||||||
<ClCompile Include="..\OGLRender.cpp" />
|
<ClCompile Include="..\OGLRender.cpp" />
|
||||||
|
<ClCompile Include="..\OGLRender_3_2.cpp" />
|
||||||
<ClCompile Include="..\path.cpp" />
|
<ClCompile Include="..\path.cpp" />
|
||||||
<ClCompile Include="..\rasterize.cpp" />
|
<ClCompile Include="..\rasterize.cpp" />
|
||||||
<ClCompile Include="..\readwrite.cpp" />
|
<ClCompile Include="..\readwrite.cpp" />
|
||||||
|
@ -650,6 +651,7 @@
|
||||||
<ClInclude Include="..\movie.h" />
|
<ClInclude Include="..\movie.h" />
|
||||||
<ClInclude Include="..\NDSSystem.h" />
|
<ClInclude Include="..\NDSSystem.h" />
|
||||||
<ClInclude Include="..\OGLRender.h" />
|
<ClInclude Include="..\OGLRender.h" />
|
||||||
|
<ClInclude Include="..\OGLRender_3_2.h" />
|
||||||
<ClInclude Include="..\path.h" />
|
<ClInclude Include="..\path.h" />
|
||||||
<ClInclude Include="..\rasterize.h" />
|
<ClInclude Include="..\rasterize.h" />
|
||||||
<ClInclude Include="..\readwrite.h" />
|
<ClInclude Include="..\readwrite.h" />
|
||||||
|
|
|
@ -762,6 +762,9 @@
|
||||||
<ClCompile Include="tileView.cpp">
|
<ClCompile Include="tileView.cpp">
|
||||||
<Filter>Windows\tools</Filter>
|
<Filter>Windows\tools</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\OGLRender_3_2.cpp">
|
||||||
|
<Filter>Core</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\addons.h">
|
<ClInclude Include="..\addons.h">
|
||||||
|
@ -1283,6 +1286,9 @@
|
||||||
<ClInclude Include="tileView.h">
|
<ClInclude Include="tileView.h">
|
||||||
<Filter>Windows\tools</Filter>
|
<Filter>Windows\tools</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\OGLRender_3_2.h">
|
||||||
|
<Filter>Core</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\instruction_tabdef.inc">
|
<None Include="..\instruction_tabdef.inc">
|
||||||
|
|
|
@ -451,9 +451,9 @@ void HK_FrameAdvanceKeyDown(int, bool justPressed) { FrameAdvance(true); }
|
||||||
void HK_FrameAdvanceKeyUp(int) { FrameAdvance(false); }
|
void HK_FrameAdvanceKeyUp(int) { FrameAdvance(false); }
|
||||||
|
|
||||||
void HK_ToggleRasterizer(int, bool justPressed) {
|
void HK_ToggleRasterizer(int, bool justPressed) {
|
||||||
if(cur3DCore == GPU3D_OPENGL)
|
if(cur3DCore == GPU3D_OPENGL_OLD || cur3DCore == GPU3D_OPENGL_3_2)
|
||||||
cur3DCore = GPU3D_SWRAST;
|
cur3DCore = GPU3D_SWRAST;
|
||||||
else cur3DCore = GPU3D_OPENGL;
|
else cur3DCore = GPU3D_OPENGL_3_2;
|
||||||
|
|
||||||
Change3DCoreWithFallbackAndSave(cur3DCore);
|
Change3DCoreWithFallbackAndSave(cur3DCore);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#include "../addons.h"
|
#include "../addons.h"
|
||||||
#include "../GPU_osd.h"
|
#include "../GPU_osd.h"
|
||||||
#include "../OGLRender.h"
|
#include "../OGLRender.h"
|
||||||
|
#include "../OGLRender_3_2.h"
|
||||||
#include "../rasterize.h"
|
#include "../rasterize.h"
|
||||||
#include "../gfx3d.h"
|
#include "../gfx3d.h"
|
||||||
#include "../render3D.h"
|
#include "../render3D.h"
|
||||||
|
@ -466,8 +467,9 @@ SoundInterface_struct *SNDCoreList[] = {
|
||||||
|
|
||||||
GPU3DInterface *core3DList[] = {
|
GPU3DInterface *core3DList[] = {
|
||||||
&gpu3DNull,
|
&gpu3DNull,
|
||||||
&gpu3Dgl,
|
&gpu3Dgl_3_2,
|
||||||
&gpu3DRasterize,
|
&gpu3DRasterize,
|
||||||
|
&gpu3DglOld,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2766,6 +2768,11 @@ int _main()
|
||||||
|
|
||||||
dwMainThread = GetCurrentThreadId();
|
dwMainThread = GetCurrentThreadId();
|
||||||
|
|
||||||
|
//enable opengl 3.2 driver in this port
|
||||||
|
OGLLoadEntryPoints_3_2_Func = OGLLoadEntryPoints_3_2;
|
||||||
|
OGLCreateRenderer_3_2_Func = OGLCreateRenderer_3_2;
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_WX
|
#ifdef HAVE_WX
|
||||||
wxInitialize();
|
wxInitialize();
|
||||||
#endif
|
#endif
|
||||||
|
@ -5949,13 +5956,31 @@ DOKEYDOWN:
|
||||||
return DefWindowProc (hwnd, message, wParam, lParam);
|
return DefWindowProc (hwnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Change3DCoreWithFallbackAndSave(int newCore, int fallbackCore)
|
void Change3DCoreWithFallbackAndSave(int newCore)
|
||||||
{
|
{
|
||||||
if(!NDS_3D_ChangeCore(newCore) && newCore != fallbackCore)
|
if(newCore == GPU3D_OPENGL_OLD)
|
||||||
NDS_3D_ChangeCore(fallbackCore);
|
goto TRY_OGL;
|
||||||
|
|
||||||
|
if(newCore == GPU3D_SWRAST)
|
||||||
|
goto TRY_SWRAST;
|
||||||
|
|
||||||
|
if(!NDS_3D_ChangeCore(GPU3D_OPENGL_3_2))
|
||||||
|
goto TRY_OGL;
|
||||||
|
goto DONE;
|
||||||
|
|
||||||
|
TRY_OGL:
|
||||||
|
if(!NDS_3D_ChangeCore(GPU3D_OPENGL_OLD))
|
||||||
|
goto TRY_SWRAST;
|
||||||
|
goto DONE;
|
||||||
|
|
||||||
|
TRY_SWRAST:
|
||||||
|
NDS_3D_ChangeCore(GPU3D_SWRAST);
|
||||||
|
|
||||||
|
DONE:
|
||||||
int gpu3dSaveValue = ((cur3DCore != GPU3D_NULL) ? cur3DCore : GPU3D_NULL_SAVED);
|
int gpu3dSaveValue = ((cur3DCore != GPU3D_NULL) ? cur3DCore : GPU3D_NULL_SAVED);
|
||||||
WritePrivateProfileInt("3D", "Renderer", gpu3dSaveValue, IniName);
|
WritePrivateProfileInt("3D", "Renderer", gpu3dSaveValue, IniName);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK HUDFontSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
|
LRESULT CALLBACK HUDFontSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
|
||||||
{
|
{
|
||||||
switch(msg)
|
switch(msg)
|
||||||
|
|
|
@ -48,8 +48,9 @@ extern bool FpsDisplay;
|
||||||
extern bool ShowLagFrameCounter;
|
extern bool ShowLagFrameCounter;
|
||||||
|
|
||||||
#define GPU3D_NULL 0
|
#define GPU3D_NULL 0
|
||||||
#define GPU3D_OPENGL 1
|
#define GPU3D_OPENGL_3_2 1
|
||||||
#define GPU3D_SWRAST 2
|
#define GPU3D_SWRAST 2
|
||||||
|
#define GPU3D_OPENGL_OLD 3
|
||||||
|
|
||||||
static const int LANGUAGE_ENGLISH = 0;
|
static const int LANGUAGE_ENGLISH = 0;
|
||||||
static const int LANGUAGE_FRENCH = 1;
|
static const int LANGUAGE_FRENCH = 1;
|
||||||
|
@ -60,7 +61,7 @@ static const int LANGUAGE_SPANISH = 6;
|
||||||
static const int LANGUAGE_KOREAN = 7;
|
static const int LANGUAGE_KOREAN = 7;
|
||||||
static const int LANGUAGE_BRAZILIAN = 8;
|
static const int LANGUAGE_BRAZILIAN = 8;
|
||||||
|
|
||||||
extern void Change3DCoreWithFallbackAndSave(int newCore, int fallbackCore=GPU3D_SWRAST);
|
extern void Change3DCoreWithFallbackAndSave(int newCore);
|
||||||
|
|
||||||
extern int backupmemorytype;
|
extern int backupmemorytype;
|
||||||
extern u32 backupmemorysize;
|
extern u32 backupmemorysize;
|
||||||
|
|
Loading…
Reference in New Issue