#include "Vector.h"
#include "VertexBuffer.h"
+#if DEBUG_DETAILED_EVENTS
+ #define EVENT_LOGD(...) eventMarkDEBUG(__VA_ARGS__)
+#else
+ #define EVENT_LOGD(...)
+#endif
+
namespace android {
namespace uirenderer {
// Debug
///////////////////////////////////////////////////////////////////////////////
+void OpenGLRenderer::eventMarkDEBUG(const char* fmt, ...) const {
+#if DEBUG_DETAILED_EVENTS
+ const int BUFFER_SIZE = 256;
+ va_list ap;
+ char buf[BUFFER_SIZE];
+
+ va_start(ap, fmt);
+ vsnprintf(buf, BUFFER_SIZE, fmt, ap);
+ va_end(ap);
+
+ eventMark(buf);
+#endif
+}
+
+
void OpenGLRenderer::eventMark(const char* name) const {
mCaches.eventMark(0, name);
}
}
void OpenGLRenderer::composeLayerRect(Layer* layer, const Rect& rect, bool swap) {
- if (!layer->isTextureLayer()) {
+ if (layer->isTextureLayer()) {
+ EVENT_LOGD("composeTextureLayerRect");
+ resetDrawTextureTexCoords(0.0f, 1.0f, 1.0f, 0.0f);
+ drawTextureLayer(layer, rect);
+ resetDrawTextureTexCoords(0.0f, 0.0f, 1.0f, 1.0f);
+ } else {
+ EVENT_LOGD("composeHardwareLayerRect");
const Rect& texCoords = layer->texCoords;
resetDrawTextureTexCoords(texCoords.left, texCoords.top,
texCoords.right, texCoords.bottom);
GL_TRIANGLE_STRIP, gMeshCount, swap, swap || simpleTransform);
resetDrawTextureTexCoords(0.0f, 0.0f, 1.0f, 1.0f);
- } else {
- resetDrawTextureTexCoords(0.0f, 1.0f, 1.0f, 0.0f);
- drawTextureLayer(layer, rect);
- resetDrawTextureTexCoords(0.0f, 0.0f, 1.0f, 1.0f);
}
}
return;
}
+ EVENT_LOGD("composeLayerRegion");
// standard Region based draw
size_t count;
const android::Rect* rects;
if (count == 0) return;
if (!currentSnapshot()->isIgnored()) {
+ EVENT_LOGD("clearLayerRegions");
// Doing several glScissor/glClear here can negatively impact
// GPUs with a tiler architecture, instead we draw quads with
// the Clear blending mode
void OpenGLRenderer::setStencilFromClip() {
if (!mCaches.debugOverdraw) {
if (!currentSnapshot()->clipRegion->isEmpty()) {
+ EVENT_LOGD("setStencilFromClip - enabling");
+
// NOTE: The order here is important, we must set dirtyClip to false
// before any draw call to avoid calling back into this method
mDirtyClip = false;
drawRegionRects(*(currentSnapshot()->clipRegion), paint);
}
} else {
+ EVENT_LOGD("setStencilFromClip - disabling");
mCaches.stencil.disable();
}
}
// Drawing commands
///////////////////////////////////////////////////////////////////////////////
-void OpenGLRenderer::setupDraw(bool clear) {
+void OpenGLRenderer::setupDraw(bool clearLayer) {
// TODO: It would be best if we could do this before quickRejectSetupScissor()
// changes the scissor test state
- if (clear) clearLayerRegions();
+ if (clearLayer) clearLayerRegions();
// Make sure setScissor & setStencil happen at the beginning of
// this method
if (mDirtyClip) {
if (mCaches.scissorEnabled) {
setScissorFromClip();
}
- setStencilFromClip();
+
+ if (clearLayer) {
+ setStencilFromClip();
+ } else {
+ // While clearing layer, force disable stencil buffer, since
+ // it's invalid to stencil-clip *during* the layer clear
+ mCaches.stencil.disable();
+ }
}
mDescription.reset();
return DrawGlInfo::kStatusDone;
}
+ EVENT_LOGD("drawLayer," RECT_STRING ", clipRequired %d", x, y,
+ x + layer->layer.getWidth(), y + layer->layer.getHeight(), clipRequired);
+
updateLayer(layer, true);
mCaches.setScissorEnabled(mScissorOptimizationDisabled || clipRequired);