mirror of
https://github.com/libretro/ppsspp.git
synced 2025-03-03 06:06:35 +00:00
Better error checking in D3D9 init
This commit is contained in:
parent
9e162f30ab
commit
80d610998d
@ -41,6 +41,11 @@
|
||||
#include "UI/DevScreens.h"
|
||||
#include "UI/GameSettingsScreen.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
// Want to avoid including the full header here as it includes d3dx.h
|
||||
int GetD3DXVersion();
|
||||
#endif
|
||||
|
||||
static const char *logLevelList[] = {
|
||||
"Notice",
|
||||
"Error",
|
||||
@ -330,6 +335,9 @@ void SystemInfoScreen::CreateViews() {
|
||||
deviceSpecs->Add(new InfoItem("Model", thin3d->GetInfoString(T3DInfo::RENDERER)));
|
||||
#ifdef _WIN32
|
||||
deviceSpecs->Add(new InfoItem("Driver Version", System_GetProperty(SYSPROP_GPUDRIVER_VERSION)));
|
||||
if (g_Config.iGPUBackend == GPU_BACKEND_DIRECT3D9) {
|
||||
deviceSpecs->Add(new InfoItem("D3DX Version", StringFromFormat("%d", GetD3DXVersion())));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Windows/D3D9Base.h"
|
||||
#include "Windows/W32Util/Misc.h"
|
||||
#include "thin3d/thin3d.h"
|
||||
#include "thin3d/d3dx9_loader.h"
|
||||
|
||||
@ -68,29 +69,34 @@ bool D3D9_Init(HWND wnd, bool windowed, std::string *error_message) {
|
||||
DIRECT3DCREATE9EX g_pfnCreate9ex;
|
||||
|
||||
HMODULE hD3D9 = LoadLibrary(TEXT("d3d9.dll"));
|
||||
|
||||
if (!hD3D9) {
|
||||
ELOG("Missing d3d9.dll");
|
||||
*error_message = "D3D9.dll missing";
|
||||
*error_message = "D3D9.dll missing - try reinstalling DirectX.";
|
||||
return false;
|
||||
}
|
||||
|
||||
int d3dx_version = LoadD3DX9Dynamic();
|
||||
if (!d3dx_version) {
|
||||
*error_message = "D3DX DLL not found! Try reinstalling DirectX.";
|
||||
return false;
|
||||
}
|
||||
|
||||
g_pfnCreate9ex = (DIRECT3DCREATE9EX)GetProcAddress(hD3D9, "Direct3DCreate9Ex");
|
||||
has9Ex = (g_pfnCreate9ex != NULL);
|
||||
has9Ex = (g_pfnCreate9ex != NULL) && IsVistaOrHigher();
|
||||
|
||||
if (has9Ex) {
|
||||
HRESULT result = g_pfnCreate9ex(D3D_SDK_VERSION, &d3dEx);
|
||||
d3d = d3dEx;
|
||||
if (FAILED(result)) {
|
||||
FreeLibrary(hD3D9);
|
||||
*error_message = "D3D9Ex available but context creation failed";
|
||||
*error_message = "D3D9Ex available but context creation failed. Try reinstalling DirectX.";
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
d3d = Direct3DCreate9(D3D_SDK_VERSION);
|
||||
if (!d3d) {
|
||||
FreeLibrary(hD3D9);
|
||||
*error_message = "Failed to create D3D9 context";
|
||||
*error_message = "Failed to create D3D9 context. Try reinstalling DirectX.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -170,8 +176,6 @@ bool D3D9_Init(HWND wnd, bool windowed, std::string *error_message) {
|
||||
DX9::pD3Ddevice = device;
|
||||
DX9::pD3DdeviceEx = deviceEx;
|
||||
|
||||
LoadD3DX9Dynamic();
|
||||
|
||||
if (!DX9::CompileShaders(*error_message)) {
|
||||
*error_message = "Unable to compile shaders: " + *error_message;
|
||||
device->EndScene();
|
||||
|
2
native
2
native
@ -1 +1 @@
|
||||
Subproject commit 04515e403153472a56f5db826c1dfd060e785411
|
||||
Subproject commit 91ab27110183969167c05055ea6624933b70eeca
|
Loading…
x
Reference in New Issue
Block a user