From b9ba525de115be776412c99bf02dc9a6f71658df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 20 Oct 2017 14:45:00 +0200 Subject: [PATCH] Don't call functions in asserts, they get compiled out in release... --- UWP/PPSSPP_UWPMain.cpp | 3 ++- Windows/GPU/D3D11Context.cpp | 3 ++- Windows/GPU/WindowsGLContext.cpp | 3 ++- Windows/GPU/WindowsVulkanContext.cpp | 5 +++-- android/jni/app-android.cpp | 9 ++++++--- ext/native/base/PCMain.cpp | 3 ++- ext/native/base/QtMain.h | 3 ++- headless/SDLHeadlessHost.cpp | 3 ++- ios/ViewController.mm | 3 ++- 9 files changed, 23 insertions(+), 12 deletions(-) diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index 50941a9f45..96d346b819 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -324,7 +324,8 @@ void PPSSPP_UWPMain::LoadStorageFile(StorageFile ^file) { UWPGraphicsContext::UWPGraphicsContext(std::shared_ptr resources) { draw_ = Draw::T3DCreateD3D11Context( resources->GetD3DDevice(), resources->GetD3DDeviceContext(), resources->GetD3DDevice(), resources->GetD3DDeviceContext(), resources->GetDeviceFeatureLevel(), 0); - assert(draw_->CreatePresets()); + bool success = draw_->CreatePresets(); + assert(success); } void UWPGraphicsContext::Shutdown() { diff --git a/Windows/GPU/D3D11Context.cpp b/Windows/GPU/D3D11Context.cpp index 0917faa2f0..bf7765c771 100644 --- a/Windows/GPU/D3D11Context.cpp +++ b/Windows/GPU/D3D11Context.cpp @@ -140,7 +140,8 @@ bool D3D11Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) { #endif draw_ = Draw::T3DCreateD3D11Context(device_, context_, device1_, context1_, featureLevel_, hWnd_); - assert(draw_->CreatePresets()); // If we can run D3D11, there's a compiler installed. I think. + bool success = draw_->CreatePresets(); // If we can run D3D11, there's a compiler installed. I think. + assert(success); int width; int height; diff --git a/Windows/GPU/WindowsGLContext.cpp b/Windows/GPU/WindowsGLContext.cpp index febdcc799f..c73c0cd298 100644 --- a/Windows/GPU/WindowsGLContext.cpp +++ b/Windows/GPU/WindowsGLContext.cpp @@ -357,7 +357,8 @@ bool WindowsGLContext::Init(HINSTANCE hInst, HWND window, std::string *error_mes CheckGLExtensions(); draw_ = Draw::T3DCreateGLContext(); - assert(draw_->CreatePresets()); // if we get this far, there will always be a GLSL compiler capable of compiling these. + bool success = draw_->CreatePresets(); // if we get this far, there will always be a GLSL compiler capable of compiling these. + assert(success); CHECK_GL_ERROR_IF_DEBUG(); return true; // Success } diff --git a/Windows/GPU/WindowsVulkanContext.cpp b/Windows/GPU/WindowsVulkanContext.cpp index a4cda9b9c0..6565ceee6e 100644 --- a/Windows/GPU/WindowsVulkanContext.cpp +++ b/Windows/GPU/WindowsVulkanContext.cpp @@ -203,8 +203,9 @@ bool WindowsVulkanContext::Init(HINSTANCE hInst, HWND hWnd, std::string *error_m } draw_ = Draw::T3DCreateVulkanContext(g_Vulkan); - assert(draw_->CreatePresets()); // Doesn't fail, we include the compiler. - return true; + bool success = draw_->CreatePresets(); + assert(success); // Doesn't fail, we include the compiler. + return success; } void WindowsVulkanContext::Shutdown() { diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 2c18f4fef4..5ed28dbd46 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -133,7 +133,8 @@ bool AndroidEGLGraphicsContext::Init(ANativeWindow *wnd, int backbufferWidth, in gl->MakeCurrent(); CheckGLExtensions(); draw_ = Draw::T3DCreateGLContext(); - assert(draw_->CreatePresets()); // There will always be a GLSL compiler capable of compiling these. + bool success = draw_->CreatePresets(); // There will always be a GLSL compiler capable of compiling these. + assert(success); return true; } @@ -158,7 +159,8 @@ public: AndroidJavaEGLGraphicsContext() { CheckGLExtensions(); draw_ = Draw::T3DCreateGLContext(); - assert(draw_->CreatePresets()); + bool success = draw_->CreatePresets(); + assert(success); } ~AndroidJavaEGLGraphicsContext() { delete draw_; @@ -312,7 +314,8 @@ bool AndroidVulkanContext::Init(ANativeWindow *wnd, int desiredBackbufferSizeX, } g_Vulkan->InitObjects(true); draw_ = Draw::T3DCreateVulkanContext(g_Vulkan); - assert(draw_->CreatePresets()); // Doesn't fail, we ship the compiler. + bool success = draw_->CreatePresets(); // Doesn't fail, we ship the compiler. + assert(success); return true; } diff --git a/ext/native/base/PCMain.cpp b/ext/native/base/PCMain.cpp index 64c6a7c547..ad4244bf1d 100644 --- a/ext/native/base/PCMain.cpp +++ b/ext/native/base/PCMain.cpp @@ -52,7 +52,8 @@ public: GLDummyGraphicsContext() { CheckGLExtensions(); draw_ = Draw::T3DCreateGLContext(); - assert(draw_->CreatePresets()); + bool success = draw_->CreatePresets(); + assert(success); } ~GLDummyGraphicsContext() { delete draw_; } diff --git a/ext/native/base/QtMain.h b/ext/native/base/QtMain.h index a8e947be03..d1bcc87fa9 100644 --- a/ext/native/base/QtMain.h +++ b/ext/native/base/QtMain.h @@ -44,7 +44,8 @@ class QtDummyGraphicsContext : public DummyGraphicsContext { public: QtDummyGraphicsContext() { draw_ = Draw::T3DCreateGLContext(); - assert(draw_->CreatePresets()); + bool success = draw_->CreatePresets(); + assert(success); } ~QtDummyGraphicsContext() { delete draw_; diff --git a/headless/SDLHeadlessHost.cpp b/headless/SDLHeadlessHost.cpp index 5b96f09953..90c05dbc74 100644 --- a/headless/SDLHeadlessHost.cpp +++ b/headless/SDLHeadlessHost.cpp @@ -55,7 +55,8 @@ public: GLDummyGraphicsContext() { CheckGLExtensions(); draw_ = Draw::T3DCreateGLContext(); - assert(draw_->CreatePresets()); + bool success = draw_->CreatePresets(); + assert(success); } ~GLDummyGraphicsContext() { delete draw_; } diff --git a/ios/ViewController.mm b/ios/ViewController.mm index 02a3b343e1..4c81509ec5 100644 --- a/ios/ViewController.mm +++ b/ios/ViewController.mm @@ -39,7 +39,8 @@ public: IOSDummyGraphicsContext() { CheckGLExtensions(); draw_ = Draw::T3DCreateGLContext(); - assert(draw_->CreatePresets()); + bool success = draw_->CreatePresets(); + assert(success); } ~IOSDummyGraphicsContext() { delete draw_;