Merge "Remove C++11 related warning"

This commit is contained in:
Romain Guy
2013-01-03 13:10:06 -08:00
committed by Android (Google) Code Review
3 changed files with 21 additions and 9 deletions

View File

@@ -183,14 +183,7 @@ status_t OpenGLRenderer::prepareDirty(float left, float top, float right, float
updateLayers(); updateLayers();
// If we know that we are going to redraw the entire framebuffer, discardFramebuffer(left, top, right, bottom);
// perform a discard to let the driver know we don't need to preserve
// the back buffer for this frame.
if (mCaches.extensions.hasDiscardFramebuffer() &&
left <= 0.0f && top <= 0.0f && right >= mWidth && bottom >= mHeight) {
const GLenum attachments[] = { getTargetFbo() == 0 ? GL_COLOR_EXT : GL_COLOR_ATTACHMENT0 };
glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, attachments);
}
syncState(); syncState();
@@ -207,6 +200,18 @@ status_t OpenGLRenderer::prepareDirty(float left, float top, float right, float
return clear(left, top, right, bottom, opaque); return clear(left, top, right, bottom, opaque);
} }
void OpenGLRenderer::discardFramebuffer(float left, float top, float right, float bottom) {
// If we know that we are going to redraw the entire framebuffer,
// perform a discard to let the driver know we don't need to preserve
// the back buffer for this frame.
if (mCaches.extensions.hasDiscardFramebuffer() &&
left <= 0.0f && top <= 0.0f && right >= mWidth && bottom >= mHeight) {
const GLenum attachments[] = { getTargetFbo() == 0 ? (const GLenum) GL_COLOR_EXT :
(const GLenum) GL_COLOR_ATTACHMENT0 };
glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, attachments);
}
}
status_t OpenGLRenderer::clear(float left, float top, float right, float bottom, bool opaque) { status_t OpenGLRenderer::clear(float left, float top, float right, float bottom, bool opaque) {
if (!opaque) { if (!opaque) {
mCaches.enableScissor(); mCaches.enableScissor();

View File

@@ -365,6 +365,13 @@ protected:
} }
private: private:
/**
* Discards the content of the framebuffer if supported by the driver.
* This method should be called at the beginning of a frame to optimize
* rendering on some tiler architectures.
*/
void discardFramebuffer(float left, float top, float right, float bottom);
/** /**
* Ensures the state of the renderer is the same as the state of * Ensures the state of the renderer is the same as the state of
* the GL context. * the GL context.

View File

@@ -65,7 +65,7 @@ struct SkiaShader {
virtual void setupProgram(Program* program, const mat4& modelView, const Snapshot& snapshot, virtual void setupProgram(Program* program, const mat4& modelView, const Snapshot& snapshot,
GLuint* textureUnit); GLuint* textureUnit);
inline SkShader *getSkShader() { inline SkShader* getSkShader() {
return mKey; return mKey;
} }