Don't call functions in asserts, they get compiled out in release...

This commit is contained in:
Henrik Rydgård 2017-10-20 14:45:00 +02:00
parent 45743642a9
commit b9ba525de1
9 changed files with 23 additions and 12 deletions

View file

@ -324,7 +324,8 @@ void PPSSPP_UWPMain::LoadStorageFile(StorageFile ^file) {
UWPGraphicsContext::UWPGraphicsContext(std::shared_ptr<DX::DeviceResources> resources) { UWPGraphicsContext::UWPGraphicsContext(std::shared_ptr<DX::DeviceResources> resources) {
draw_ = Draw::T3DCreateD3D11Context( draw_ = Draw::T3DCreateD3D11Context(
resources->GetD3DDevice(), resources->GetD3DDeviceContext(), resources->GetD3DDevice(), resources->GetD3DDeviceContext(), resources->GetDeviceFeatureLevel(), 0); resources->GetD3DDevice(), resources->GetD3DDeviceContext(), resources->GetD3DDevice(), resources->GetD3DDeviceContext(), resources->GetDeviceFeatureLevel(), 0);
assert(draw_->CreatePresets()); bool success = draw_->CreatePresets();
assert(success);
} }
void UWPGraphicsContext::Shutdown() { void UWPGraphicsContext::Shutdown() {

View file

@ -140,7 +140,8 @@ bool D3D11Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) {
#endif #endif
draw_ = Draw::T3DCreateD3D11Context(device_, context_, device1_, context1_, featureLevel_, hWnd_); 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 width;
int height; int height;

View file

@ -357,7 +357,8 @@ bool WindowsGLContext::Init(HINSTANCE hInst, HWND window, std::string *error_mes
CheckGLExtensions(); CheckGLExtensions();
draw_ = Draw::T3DCreateGLContext(); 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(); CHECK_GL_ERROR_IF_DEBUG();
return true; // Success return true; // Success
} }

View file

@ -203,8 +203,9 @@ bool WindowsVulkanContext::Init(HINSTANCE hInst, HWND hWnd, std::string *error_m
} }
draw_ = Draw::T3DCreateVulkanContext(g_Vulkan); draw_ = Draw::T3DCreateVulkanContext(g_Vulkan);
assert(draw_->CreatePresets()); // Doesn't fail, we include the compiler. bool success = draw_->CreatePresets();
return true; assert(success); // Doesn't fail, we include the compiler.
return success;
} }
void WindowsVulkanContext::Shutdown() { void WindowsVulkanContext::Shutdown() {

View file

@ -133,7 +133,8 @@ bool AndroidEGLGraphicsContext::Init(ANativeWindow *wnd, int backbufferWidth, in
gl->MakeCurrent(); gl->MakeCurrent();
CheckGLExtensions(); CheckGLExtensions();
draw_ = Draw::T3DCreateGLContext(); 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; return true;
} }
@ -158,7 +159,8 @@ public:
AndroidJavaEGLGraphicsContext() { AndroidJavaEGLGraphicsContext() {
CheckGLExtensions(); CheckGLExtensions();
draw_ = Draw::T3DCreateGLContext(); draw_ = Draw::T3DCreateGLContext();
assert(draw_->CreatePresets()); bool success = draw_->CreatePresets();
assert(success);
} }
~AndroidJavaEGLGraphicsContext() { ~AndroidJavaEGLGraphicsContext() {
delete draw_; delete draw_;
@ -312,7 +314,8 @@ bool AndroidVulkanContext::Init(ANativeWindow *wnd, int desiredBackbufferSizeX,
} }
g_Vulkan->InitObjects(true); g_Vulkan->InitObjects(true);
draw_ = Draw::T3DCreateVulkanContext(g_Vulkan); 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; return true;
} }

View file

@ -52,7 +52,8 @@ public:
GLDummyGraphicsContext() { GLDummyGraphicsContext() {
CheckGLExtensions(); CheckGLExtensions();
draw_ = Draw::T3DCreateGLContext(); draw_ = Draw::T3DCreateGLContext();
assert(draw_->CreatePresets()); bool success = draw_->CreatePresets();
assert(success);
} }
~GLDummyGraphicsContext() { delete draw_; } ~GLDummyGraphicsContext() { delete draw_; }

View file

@ -44,7 +44,8 @@ class QtDummyGraphicsContext : public DummyGraphicsContext {
public: public:
QtDummyGraphicsContext() { QtDummyGraphicsContext() {
draw_ = Draw::T3DCreateGLContext(); draw_ = Draw::T3DCreateGLContext();
assert(draw_->CreatePresets()); bool success = draw_->CreatePresets();
assert(success);
} }
~QtDummyGraphicsContext() { ~QtDummyGraphicsContext() {
delete draw_; delete draw_;

View file

@ -55,7 +55,8 @@ public:
GLDummyGraphicsContext() { GLDummyGraphicsContext() {
CheckGLExtensions(); CheckGLExtensions();
draw_ = Draw::T3DCreateGLContext(); draw_ = Draw::T3DCreateGLContext();
assert(draw_->CreatePresets()); bool success = draw_->CreatePresets();
assert(success);
} }
~GLDummyGraphicsContext() { delete draw_; } ~GLDummyGraphicsContext() { delete draw_; }

View file

@ -39,7 +39,8 @@ public:
IOSDummyGraphicsContext() { IOSDummyGraphicsContext() {
CheckGLExtensions(); CheckGLExtensions();
draw_ = Draw::T3DCreateGLContext(); draw_ = Draw::T3DCreateGLContext();
assert(draw_->CreatePresets()); bool success = draw_->CreatePresets();
assert(success);
} }
~IOSDummyGraphicsContext() { ~IOSDummyGraphicsContext() {
delete draw_; delete draw_;