Revert "[ios] Improved safety of present calls"

This commit is contained in:
Roman Kuznetsov 2016-03-24 13:41:53 +03:00
parent 76cb6e84ab
commit 55f2a67e95
10 changed files with 5 additions and 45 deletions

View file

@ -1473,7 +1473,9 @@ void FrontendRenderer::Routine::Do()
while (availableTime > 0);
}
context->present();
if (m_renderer.IsRenderingEnabled())
context->present();
frameTime = timer.ElapsedSeconds();
timer.Reset();

View file

@ -28,6 +28,5 @@ namespace dp
- (CGPoint)viewPoint2GlobalPoint:(CGPoint)pt;
- (CGPoint)globalPoint2ViewPoint:(CGPoint)pt;
- (void)initialize;
- (void)setPresentAvailable:(BOOL)available;
@end

View file

@ -173,9 +173,4 @@ double getExactDPI(double contentScaleFactor)
return CGPointMake(ptP.x / scaleFactor, ptP.y / scaleFactor);
}
- (void)setPresentAvailable:(BOOL)available
{
static_cast<iosOGLContextFactory*>(m_factory.get())->setPresentAvailable(available);
}
@end

View file

@ -21,8 +21,6 @@ namespace search { struct AddressInfo; }
- (void)onTerminate;
- (void)onEnterForeground;
- (void)onEnterBackground;
- (void)onGetFocus;
- (void)onLoseFocus;
- (void)setMapStyle:(MapStyle)mapStyle;

View file

@ -362,16 +362,6 @@ NSString * const kReportSegue = @"Map2ReportSegue";
GetFramework().EnterForeground();
}
- (void)onGetFocus
{
[(EAGLView *)self.view setPresentAvailable:YES];
}
- (void)onLoseFocus
{
[(EAGLView *)self.view setPresentAvailable:NO];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];

View file

@ -559,7 +559,6 @@ using namespace osm_auth_ios;
- (void)applicationWillResignActive:(UIApplication *)application
{
[self.mapViewController onLoseFocus];
[self.mapViewController.appWallAd close];
[RouteState save];
GetFramework().SetRenderingEnabled(false);
@ -586,7 +585,6 @@ using namespace osm_auth_ios;
{
if (application.applicationState == UIApplicationStateBackground)
return;
[self.mapViewController onGetFocus];
[self handleURLs];
[self restoreRouteState];
[[Statistics instance] applicationDidBecomeActive];

View file

@ -6,8 +6,6 @@
#import <OpenGLES/ES2/gl.h>
#import <OpenGLES/ES2/glext.h>
#include "std/atomic.hpp"
class iosOGLContext : public dp::OGLContext
{
public:
@ -18,8 +16,6 @@ public:
virtual void present();
virtual void setDefaultFramebuffer();
virtual void resize(int w, int h);
void setPresentAvailable(bool available);
private:
CAEAGLLayer * m_layer;
@ -36,6 +32,4 @@ private:
GLuint m_depthBufferId;
GLuint m_frameBufferId;
//@} buffers
atomic<bool> m_presentAvailable;
};

View file

@ -12,7 +12,6 @@ iosOGLContext::iosOGLContext(CAEAGLLayer * layer, iosOGLContext * contextToShare
, m_renderBufferId(0)
, m_depthBufferId(0)
, m_frameBufferId(0)
, m_presentAvailable(true)
{
if (contextToShareWith != NULL)
{
@ -37,23 +36,16 @@ void iosOGLContext::makeCurrent()
initBuffers();
}
void iosOGLContext::setPresentAvailable(bool available)
{
m_presentAvailable = available;
}
void iosOGLContext::present()
{
ASSERT(m_nativeContext != NULL, ());
ASSERT(m_renderBufferId, ());
GLenum const discards[] = { GL_DEPTH_ATTACHMENT, GL_COLOR_ATTACHMENT0 };
GLCHECK(glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards));
glBindRenderbuffer(GL_RENDERBUFFER, m_renderBufferId);
if (m_presentAvailable)
[m_nativeContext presentRenderbuffer: GL_RENDERBUFFER];
[m_nativeContext presentRenderbuffer: GL_RENDERBUFFER];
GLCHECK(glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards + 1));
}

View file

@ -14,8 +14,6 @@ public:
virtual bool isDrawContextCreated() const;
virtual bool isUploadContextCreated() const;
void setPresentAvailable(bool available);
private:
CAEAGLLayer * m_layer;

View file

@ -35,9 +35,3 @@ bool iosOGLContextFactory::isUploadContextCreated() const
{
return m_uploadContext != nullptr;
}
void iosOGLContextFactory::setPresentAvailable(bool available)
{
if (m_drawContext != nullptr)
m_drawContext->setPresentAvailable(available);
}