Merge "Add logging to the new layers API." into honeycomb
This commit is contained in:
@@ -44,4 +44,7 @@
|
|||||||
// Turn on to display debug info about textures
|
// Turn on to display debug info about textures
|
||||||
#define DEBUG_TEXTURES 0
|
#define DEBUG_TEXTURES 0
|
||||||
|
|
||||||
|
// Turn on to display debug info about the layer renderer
|
||||||
|
#define DEBUG_LAYER_RENDERER 0
|
||||||
|
|
||||||
#endif // ANDROID_HWUI_DEBUG_H
|
#endif // ANDROID_HWUI_DEBUG_H
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#define LOG_TAG "OpenGLRenderer"
|
#define LOG_TAG "OpenGLRenderer"
|
||||||
|
|
||||||
#include "LayerRenderer.h"
|
#include "LayerRenderer.h"
|
||||||
|
#include "Properties.h"
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
namespace uirenderer {
|
namespace uirenderer {
|
||||||
@@ -26,14 +27,19 @@ namespace uirenderer {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void LayerRenderer::prepare(bool opaque) {
|
void LayerRenderer::prepare(bool opaque) {
|
||||||
|
LAYER_RENDERER_LOGD("Rendering into layer, fbo = %d", mFbo);
|
||||||
|
|
||||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*) &mPreviousFbo);
|
glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*) &mPreviousFbo);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, mFbo);
|
glBindFramebuffer(GL_FRAMEBUFFER, mFbo);
|
||||||
|
|
||||||
OpenGLRenderer::prepare(opaque);
|
OpenGLRenderer::prepare(opaque);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerRenderer::finish() {
|
void LayerRenderer::finish() {
|
||||||
OpenGLRenderer::finish();
|
OpenGLRenderer::finish();
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, mPreviousFbo);
|
glBindFramebuffer(GL_FRAMEBUFFER, mPreviousFbo);
|
||||||
|
|
||||||
|
LAYER_RENDERER_LOGD("Finished rendering into layer, fbo = %d", mFbo);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -42,6 +48,8 @@ void LayerRenderer::finish() {
|
|||||||
|
|
||||||
GLuint LayerRenderer::createLayer(uint32_t width, uint32_t height,
|
GLuint LayerRenderer::createLayer(uint32_t width, uint32_t height,
|
||||||
uint32_t* layerWidth, uint32_t* layerHeight, GLuint* texture) {
|
uint32_t* layerWidth, uint32_t* layerHeight, GLuint* texture) {
|
||||||
|
LAYER_RENDERER_LOGD("Creating new layer %dx%d", width, height);
|
||||||
|
|
||||||
GLuint previousFbo;
|
GLuint previousFbo;
|
||||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*) &previousFbo);
|
glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*) &previousFbo);
|
||||||
|
|
||||||
@@ -49,6 +57,12 @@ GLuint LayerRenderer::createLayer(uint32_t width, uint32_t height,
|
|||||||
glGenFramebuffers(1, &fbo);
|
glGenFramebuffers(1, &fbo);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||||
|
|
||||||
|
if (glGetError() != GL_NO_ERROR) {
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, previousFbo);
|
||||||
|
glDeleteBuffers(1, &fbo);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glGenTextures(1, texture);
|
glGenTextures(1, texture);
|
||||||
glBindTexture(GL_TEXTURE_2D, *texture);
|
glBindTexture(GL_TEXTURE_2D, *texture);
|
||||||
@@ -65,9 +79,9 @@ GLuint LayerRenderer::createLayer(uint32_t width, uint32_t height,
|
|||||||
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||||
|
|
||||||
if (glGetError() != GL_NO_ERROR) {
|
if (glGetError() != GL_NO_ERROR) {
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, previousFbo);
|
||||||
glDeleteBuffers(1, &fbo);
|
glDeleteBuffers(1, &fbo);
|
||||||
glDeleteTextures(1, texture);
|
glDeleteTextures(1, texture);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, previousFbo);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,9 +89,9 @@ GLuint LayerRenderer::createLayer(uint32_t width, uint32_t height,
|
|||||||
*texture, 0);
|
*texture, 0);
|
||||||
|
|
||||||
if (glGetError() != GL_NO_ERROR) {
|
if (glGetError() != GL_NO_ERROR) {
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, previousFbo);
|
||||||
glDeleteBuffers(1, &fbo);
|
glDeleteBuffers(1, &fbo);
|
||||||
glDeleteTextures(1, texture);
|
glDeleteTextures(1, texture);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, previousFbo);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,6 +105,8 @@ GLuint LayerRenderer::createLayer(uint32_t width, uint32_t height,
|
|||||||
|
|
||||||
void LayerRenderer::resizeLayer(GLuint fbo, GLuint texture, uint32_t width, uint32_t height,
|
void LayerRenderer::resizeLayer(GLuint fbo, GLuint texture, uint32_t width, uint32_t height,
|
||||||
uint32_t* layerWidth, uint32_t* layerHeight) {
|
uint32_t* layerWidth, uint32_t* layerHeight) {
|
||||||
|
LAYER_RENDERER_LOGD("Resizing layer fbo = %d to %dx%d", fbo, width, height);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, texture);
|
glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
|
|
||||||
@@ -112,11 +128,15 @@ void LayerRenderer::resizeLayer(GLuint fbo, GLuint texture, uint32_t width, uint
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LayerRenderer::destroyLayer(GLuint fbo, GLuint texture) {
|
void LayerRenderer::destroyLayer(GLuint fbo, GLuint texture) {
|
||||||
|
LAYER_RENDERER_LOGD("Destroying layer, fbo = %d", fbo);
|
||||||
|
|
||||||
if (fbo) glDeleteFramebuffers(1, &fbo);
|
if (fbo) glDeleteFramebuffers(1, &fbo);
|
||||||
if (texture) glDeleteTextures(1, &texture);
|
if (texture) glDeleteTextures(1, &texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerRenderer::destroyLayerDeferred(GLuint fbo, GLuint texture) {
|
void LayerRenderer::destroyLayerDeferred(GLuint fbo, GLuint texture) {
|
||||||
|
LAYER_RENDERER_LOGD("Deferring layer destruction, fbo = %d", fbo);
|
||||||
|
|
||||||
Caches& caches = Caches::getInstance();
|
Caches& caches = Caches::getInstance();
|
||||||
if (fbo) caches.deleteFboDeferred(fbo);
|
if (fbo) caches.deleteFboDeferred(fbo);
|
||||||
if (texture) caches.deleteTextureDeferred(texture);
|
if (texture) caches.deleteTextureDeferred(texture);
|
||||||
|
|||||||
@@ -22,6 +22,17 @@
|
|||||||
namespace android {
|
namespace android {
|
||||||
namespace uirenderer {
|
namespace uirenderer {
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Defines
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Debug
|
||||||
|
#if DEBUG_LAYER_RENDERER
|
||||||
|
#define LAYER_RENDERER_LOGD(...) LOGD(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define LAYER_RENDERER_LOGD(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Renderer
|
// Renderer
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user