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);
|
||||
}
|
||||
|
||||
template<bool require_profile, bool enable_3_2>
|
||||
static char OGLInit(void)
|
||||
{
|
||||
char result = 0;
|
||||
|
@ -528,11 +529,20 @@ static char OGLInit(void)
|
|||
}
|
||||
|
||||
// Create new OpenGL rendering object
|
||||
if(enable_3_2)
|
||||
{
|
||||
if (OGLLoadEntryPoints_3_2_Func != NULL && OGLCreateRenderer_3_2_Func != NULL)
|
||||
{
|
||||
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
|
||||
// to one of the lower versions.
|
||||
|
@ -667,9 +677,32 @@ static void OGLRenderFinish()
|
|||
ENDGL();
|
||||
}
|
||||
|
||||
//automatically select 3.2 or old profile depending on whether 3.2 is available
|
||||
GPU3DInterface gpu3Dgl = {
|
||||
"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,
|
||||
OGLClose,
|
||||
OGLRender,
|
||||
|
|
|
@ -355,6 +355,8 @@ class TexCacheItem;
|
|||
class OpenGLRenderer;
|
||||
|
||||
extern GPU3DInterface gpu3Dgl;
|
||||
extern GPU3DInterface gpu3DglOld;
|
||||
extern GPU3DInterface gpu3Dgl_3_2;
|
||||
|
||||
//This is called by OGLRender whenever it initializes.
|
||||
//Platforms, please be sure to set this up.
|
||||
|
|
|
@ -2768,6 +2768,14 @@
|
|||
RelativePath="..\OGLRender.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\OGLRender_3_2.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\OGLRender_3_2.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\path.cpp"
|
||||
>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="DeSmuME_VS2008"
|
||||
ProjectGUID="{9F5F72A1-D3A5-4918-B460-E076B16D10A9}"
|
||||
RootNamespace="DeSmuME"
|
||||
|
@ -862,6 +862,14 @@
|
|||
RelativePath="..\OGLRender.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\OGLRender_3_2.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\OGLRender_3_2.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
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">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
|
@ -432,6 +432,7 @@
|
|||
<ClCompile Include="..\movie.cpp" />
|
||||
<ClCompile Include="..\NDSSystem.cpp" />
|
||||
<ClCompile Include="..\OGLRender.cpp" />
|
||||
<ClCompile Include="..\OGLRender_3_2.cpp" />
|
||||
<ClCompile Include="..\path.cpp" />
|
||||
<ClCompile Include="..\rasterize.cpp" />
|
||||
<ClCompile Include="..\readwrite.cpp" />
|
||||
|
@ -710,6 +711,7 @@
|
|||
<ClInclude Include="..\movie.h" />
|
||||
<ClInclude Include="..\NDSSystem.h" />
|
||||
<ClInclude Include="..\OGLRender.h" />
|
||||
<ClInclude Include="..\OGLRender_3_2.h" />
|
||||
<ClInclude Include="..\path.h" />
|
||||
<ClInclude Include="..\rasterize.h" />
|
||||
<ClInclude Include="..\readwrite.h" />
|
||||
|
|
|
@ -774,6 +774,9 @@
|
|||
<ClCompile Include="..\utils\AsmJit\x86\x86util.cpp">
|
||||
<Filter>Core\utils\AsmJit\x86</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\OGLRender_3_2.cpp">
|
||||
<Filter>Core</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\addons.h">
|
||||
|
@ -1494,6 +1497,9 @@
|
|||
<ClInclude Include="..\utils\AsmJit\x86\x86util.h">
|
||||
<Filter>Core\utils\AsmJit\x86</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\OGLRender_3_2.h">
|
||||
<Filter>Core</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<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">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
|
@ -406,6 +406,7 @@
|
|||
<ClCompile Include="..\movie.cpp" />
|
||||
<ClCompile Include="..\NDSSystem.cpp" />
|
||||
<ClCompile Include="..\OGLRender.cpp" />
|
||||
<ClCompile Include="..\OGLRender_3_2.cpp" />
|
||||
<ClCompile Include="..\path.cpp" />
|
||||
<ClCompile Include="..\rasterize.cpp" />
|
||||
<ClCompile Include="..\readwrite.cpp" />
|
||||
|
@ -650,6 +651,7 @@
|
|||
<ClInclude Include="..\movie.h" />
|
||||
<ClInclude Include="..\NDSSystem.h" />
|
||||
<ClInclude Include="..\OGLRender.h" />
|
||||
<ClInclude Include="..\OGLRender_3_2.h" />
|
||||
<ClInclude Include="..\path.h" />
|
||||
<ClInclude Include="..\rasterize.h" />
|
||||
<ClInclude Include="..\readwrite.h" />
|
||||
|
|
|
@ -762,6 +762,9 @@
|
|||
<ClCompile Include="tileView.cpp">
|
||||
<Filter>Windows\tools</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\OGLRender_3_2.cpp">
|
||||
<Filter>Core</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\addons.h">
|
||||
|
@ -1283,6 +1286,9 @@
|
|||
<ClInclude Include="tileView.h">
|
||||
<Filter>Windows\tools</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\OGLRender_3_2.h">
|
||||
<Filter>Core</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<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_ToggleRasterizer(int, bool justPressed) {
|
||||
if(cur3DCore == GPU3D_OPENGL)
|
||||
if(cur3DCore == GPU3D_OPENGL_OLD || cur3DCore == GPU3D_OPENGL_3_2)
|
||||
cur3DCore = GPU3D_SWRAST;
|
||||
else cur3DCore = GPU3D_OPENGL;
|
||||
else cur3DCore = GPU3D_OPENGL_3_2;
|
||||
|
||||
Change3DCoreWithFallbackAndSave(cur3DCore);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "../addons.h"
|
||||
#include "../GPU_osd.h"
|
||||
#include "../OGLRender.h"
|
||||
#include "../OGLRender_3_2.h"
|
||||
#include "../rasterize.h"
|
||||
#include "../gfx3d.h"
|
||||
#include "../render3D.h"
|
||||
|
@ -466,8 +467,9 @@ SoundInterface_struct *SNDCoreList[] = {
|
|||
|
||||
GPU3DInterface *core3DList[] = {
|
||||
&gpu3DNull,
|
||||
&gpu3Dgl,
|
||||
&gpu3Dgl_3_2,
|
||||
&gpu3DRasterize,
|
||||
&gpu3DglOld,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -2766,6 +2768,11 @@ int _main()
|
|||
|
||||
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
|
||||
wxInitialize();
|
||||
#endif
|
||||
|
@ -5949,13 +5956,31 @@ DOKEYDOWN:
|
|||
return DefWindowProc (hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
void Change3DCoreWithFallbackAndSave(int newCore, int fallbackCore)
|
||||
void Change3DCoreWithFallbackAndSave(int newCore)
|
||||
{
|
||||
if(!NDS_3D_ChangeCore(newCore) && newCore != fallbackCore)
|
||||
NDS_3D_ChangeCore(fallbackCore);
|
||||
if(newCore == GPU3D_OPENGL_OLD)
|
||||
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);
|
||||
WritePrivateProfileInt("3D", "Renderer", gpu3dSaveValue, IniName);
|
||||
}
|
||||
|
||||
LRESULT CALLBACK HUDFontSettingsDlgProc(HWND hw, UINT msg, WPARAM wp, LPARAM lp)
|
||||
{
|
||||
switch(msg)
|
||||
|
|
|
@ -48,8 +48,9 @@ extern bool FpsDisplay;
|
|||
extern bool ShowLagFrameCounter;
|
||||
|
||||
#define GPU3D_NULL 0
|
||||
#define GPU3D_OPENGL 1
|
||||
#define GPU3D_OPENGL_3_2 1
|
||||
#define GPU3D_SWRAST 2
|
||||
#define GPU3D_OPENGL_OLD 3
|
||||
|
||||
static const int LANGUAGE_ENGLISH = 0;
|
||||
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_BRAZILIAN = 8;
|
||||
|
||||
extern void Change3DCoreWithFallbackAndSave(int newCore, int fallbackCore=GPU3D_SWRAST);
|
||||
extern void Change3DCoreWithFallbackAndSave(int newCore);
|
||||
|
||||
extern int backupmemorytype;
|
||||
extern u32 backupmemorysize;
|
||||
|
|
Loading…
Reference in New Issue