From e2ecbb7a4ddab2c83fe9d6ca3552d5944a36e6e9 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Fri, 22 Aug 2014 20:48:35 +0200 Subject: [PATCH] Convert more UI code to Thin3D --- Core/Config.cpp | 4 +--- GPU/Directx9/helper/fbo.cpp | 11 +++++++++-- UI/DevScreens.cpp | 18 +++++++++++------- UI/MiscScreens.cpp | 2 ++ Windows/D3D9Base.cpp | 6 +++--- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index c493a5cd44..7a3ef803e6 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -384,8 +384,8 @@ static int DefaultAndroidHwScale() { } static ConfigSetting graphicsSettings[] = { - ReportedConfigSetting("GPUBackend", &g_Config.iGPUBackend, 0), ConfigSetting("ShowFPSCounter", &g_Config.iShowFPSCounter, 0), + ReportedConfigSetting("GPUBackend", &g_Config.iGPUBackend, 0), ReportedConfigSetting("RenderingMode", &g_Config.iRenderingMode, &DefaultRenderingMode), ConfigSetting("SoftwareRendering", &g_Config.bSoftwareRendering, false), ReportedConfigSetting("HardwareTransform", &g_Config.bHardwareTransform, true), @@ -816,8 +816,6 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) { } CleanRecent(); - - iGPUBackend = 0; } void Config::Save() { diff --git a/GPU/Directx9/helper/fbo.cpp b/GPU/Directx9/helper/fbo.cpp index 8b1dad31bf..21608f2e90 100644 --- a/GPU/Directx9/helper/fbo.cpp +++ b/GPU/Directx9/helper/fbo.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "base/logging.h" #include "fbo.h" namespace DX9 { @@ -60,8 +61,14 @@ FBO *fbo_create(int width, int height, int num_color_textures, bool z_stencil, F pD3Ddevice->CreateRenderTarget(fbo->width/FB_DIV, fbo->height/FB_DIV, D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, 0, FALSE, &workingRtt, NULL); } #else - pD3Ddevice->CreateRenderTarget(fbo->width/4, fbo->height/4, D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, 0, FALSE, &fbo->surf, NULL); - pD3Ddevice->CreateDepthStencilSurface(fbo->width, fbo->height, D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0, FALSE, &fbo->depthstencil, NULL); + HRESULT rtResult = pD3Ddevice->CreateRenderTarget(fbo->width/4, fbo->height/4, D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, 0, FALSE, &fbo->surf, NULL); + if (FAILED(rtResult)) { + ELOG("Failed to create render target"); + } + HRESULT dsResult = pD3Ddevice->CreateDepthStencilSurface(fbo->width, fbo->height, D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0, FALSE, &fbo->depthstencil, NULL); + if (FAILED(dsResult)) { + ELOG("Failed to create depth buffer"); + } #endif fbo->stencil_buffer = 8; diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 4e1dc5db3d..161c100ec6 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -231,16 +231,20 @@ void SystemInfoScreen::CreateViews() { deviceSpecs->Add(new InfoItem("Threads", cores)); #endif deviceSpecs->Add(new ItemHeader("GPU Information")); - deviceSpecs->Add(new InfoItem("Vendor", (char *)glGetString(GL_VENDOR))); - deviceSpecs->Add(new InfoItem("Model", (char *)glGetString(GL_RENDERER))); + + Thin3DContext *thin3d = screenManager()->getThin3DContext(); + + deviceSpecs->Add(new InfoItem("3D API", thin3d->GetInfoString(T3DInfo::APINAME))); + deviceSpecs->Add(new InfoItem("Vendor", thin3d->GetInfoString(T3DInfo::VENDOR))); + deviceSpecs->Add(new InfoItem("Model", thin3d->GetInfoString(T3DInfo::RENDERER))); #ifdef _WIN32 deviceSpecs->Add(new InfoItem("Driver Version", System_GetProperty(SYSPROP_GPUDRIVER_VERSION))); #endif - deviceSpecs->Add(new ItemHeader("OpenGL Version Information")); - std::string openGL = (char *)glGetString(GL_VERSION); - openGL.resize(30); - deviceSpecs->Add(new InfoItem("OpenGL", openGL)); - deviceSpecs->Add(new InfoItem("GLSL", (char *)glGetString(GL_SHADING_LANGUAGE_VERSION))); + deviceSpecs->Add(new ItemHeader("Version Information")); + std::string apiVersion = thin3d->GetInfoString(T3DInfo::APIVERSION); + apiVersion.resize(30); + deviceSpecs->Add(new InfoItem("API Version", apiVersion)); + deviceSpecs->Add(new InfoItem("Shading Language", thin3d->GetInfoString(T3DInfo::SHADELANGVERSION))); #ifdef ANDROID char temp[256]; diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index cf201e740a..58b2ebc0ad 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -432,6 +432,8 @@ void LogoScreen::render() { ui_draw2d.DrawTextShadow(UBUNTU24, boot_filename.c_str(), bounds.centerX(), bounds.centerY() + 180, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); } + dc.DrawText(screenManager()->getThin3DContext()->GetInfoString(T3DInfo::APINAME), bounds.centerX(), bounds.y2() - 100, colorAlpha(0xFFFFFFFF, alphaText), ALIGN_CENTER); + dc.End(); dc.Flush(); } diff --git a/Windows/D3D9Base.cpp b/Windows/D3D9Base.cpp index 5a042bc019..49abb30be5 100644 --- a/Windows/D3D9Base.cpp +++ b/Windows/D3D9Base.cpp @@ -102,9 +102,9 @@ bool D3D9_Init(HWND hWnd, bool windowed, std::string *error_message) { DX9::pD3Ddevice = device; LoadD3DX9Dynamic(); - - DX9::CompileShaders(); - DX9::fbo_init(); + + DX9::CompileShaders(); + DX9::fbo_init(); return true; }