Loading libs/hwui/Caches.cpp +18 −1 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ void Caches::init() { debugLayersUpdates = false; debugOverdraw = false; debugStencilClip = kStencilHide; mInitialized = true; } Loading Loading @@ -132,6 +133,7 @@ void Caches::initConstraints() { bool Caches::initProperties() { bool prevDebugLayersUpdates = debugLayersUpdates; bool prevDebugOverdraw = debugOverdraw; StencilClipDebug prevDebugStencilClip = debugStencilClip; char property[PROPERTY_VALUE_MAX]; if (property_get(PROPERTY_DEBUG_LAYERS_UPDATES, property, NULL) > 0) { Loading @@ -148,8 +150,23 @@ bool Caches::initProperties() { debugOverdraw = false; } // See Properties.h for valid values if (property_get(PROPERTY_DEBUG_STENCIL_CLIP, property, NULL) > 0) { INIT_LOGD(" Stencil clip debug enabled: %s", property); if (!strcmp(property, "hide")) { debugStencilClip = kStencilHide; } else if (!strcmp(property, "highlight")) { debugStencilClip = kStencilShowHighlight; } else if (!strcmp(property, "region")) { debugStencilClip = kStencilShowRegion; } } else { debugStencilClip = kStencilHide; } return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw); (prevDebugOverdraw != debugOverdraw) || (prevDebugStencilClip != debugStencilClip); } void Caches::terminate() { Loading libs/hwui/Caches.h +9 −0 Original line number Diff line number Diff line Loading @@ -245,9 +245,18 @@ public: // Misc GLint maxTextureSize; // Debugging bool debugLayersUpdates; bool debugOverdraw; enum StencilClipDebug { kStencilHide, kStencilShowHighlight, kStencilShowRegion }; StencilClipDebug debugStencilClip; TextureCache textureCache; LayerCache layerCache; RenderBufferCache renderBufferCache; Loading libs/hwui/Debug.h +1 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ #define DEBUG_RENDER_BUFFERS 0 // Turn on to make stencil operations easier to debug // (writes 255 instead of 1 in the buffer, forces 8 bit stencil) #define DEBUG_STENCIL 0 // Turn on to display debug info about 9patch objects Loading libs/hwui/OpenGLRenderer.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -1368,6 +1368,12 @@ void OpenGLRenderer::setStencilFromClip() { drawRegionRects(*mSnapshot->clipRegion, 0xff000000, SkXfermode::kSrc_Mode, false); mCaches.stencil.enableTest(); // Draw the region used to generate the stencil if the appropriate debug // mode is enabled if (mCaches.debugStencilClip == Caches::kStencilShowRegion) { drawRegionRects(*mSnapshot->clipRegion, 0x7f0000ff, SkXfermode::kSrcOver_Mode); } } else { mCaches.stencil.disable(); } Loading Loading @@ -1515,12 +1521,20 @@ void OpenGLRenderer::setupDraw(bool clear) { } setStencilFromClip(); } mDescription.reset(); mSetShaderColor = false; mColorSet = false; mColorA = mColorR = mColorG = mColorB = 0.0f; mTextureUnit = 0; mTrackDirtyRegions = true; // Enable debug highlight when what we're about to draw is tested against // the stencil buffer and if stencil highlight debugging is on mDescription.hasDebugHighlight = !mCaches.debugOverdraw && mCaches.debugStencilClip == Caches::kStencilShowHighlight && mCaches.stencil.isTestEnabled(); } void OpenGLRenderer::setupDrawWithTexture(bool isAlpha8) { Loading libs/hwui/Program.h +7 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,8 @@ namespace uirenderer { #define PROGRAM_HAS_COLORS 42 #define PROGRAM_HAS_DEBUG_HIGHLIGHT 43 /////////////////////////////////////////////////////////////////////////////// // Types /////////////////////////////////////////////////////////////////////////////// Loading Loading @@ -159,6 +161,8 @@ struct ProgramDescription { bool hasGammaCorrection; float gamma; bool hasDebugHighlight; /** * Resets this description. All fields are reset back to the default * values they hold after building a new instance. Loading Loading @@ -199,6 +203,8 @@ struct ProgramDescription { hasGammaCorrection = false; gamma = 2.2f; hasDebugHighlight = false; } /** Loading Loading @@ -267,6 +273,7 @@ struct ProgramDescription { if (hasGammaCorrection) key |= programid(0x1) << PROGRAM_HAS_GAMMA_CORRECTION; if (isSimpleGradient) key |= programid(0x1) << PROGRAM_IS_SIMPLE_GRADIENT; if (hasColors) key |= programid(0x1) << PROGRAM_HAS_COLORS; if (hasDebugHighlight) key |= programid(0x1) << PROGRAM_HAS_DEBUG_HIGHLIGHT; return key; } Loading Loading
libs/hwui/Caches.cpp +18 −1 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ void Caches::init() { debugLayersUpdates = false; debugOverdraw = false; debugStencilClip = kStencilHide; mInitialized = true; } Loading Loading @@ -132,6 +133,7 @@ void Caches::initConstraints() { bool Caches::initProperties() { bool prevDebugLayersUpdates = debugLayersUpdates; bool prevDebugOverdraw = debugOverdraw; StencilClipDebug prevDebugStencilClip = debugStencilClip; char property[PROPERTY_VALUE_MAX]; if (property_get(PROPERTY_DEBUG_LAYERS_UPDATES, property, NULL) > 0) { Loading @@ -148,8 +150,23 @@ bool Caches::initProperties() { debugOverdraw = false; } // See Properties.h for valid values if (property_get(PROPERTY_DEBUG_STENCIL_CLIP, property, NULL) > 0) { INIT_LOGD(" Stencil clip debug enabled: %s", property); if (!strcmp(property, "hide")) { debugStencilClip = kStencilHide; } else if (!strcmp(property, "highlight")) { debugStencilClip = kStencilShowHighlight; } else if (!strcmp(property, "region")) { debugStencilClip = kStencilShowRegion; } } else { debugStencilClip = kStencilHide; } return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw); (prevDebugOverdraw != debugOverdraw) || (prevDebugStencilClip != debugStencilClip); } void Caches::terminate() { Loading
libs/hwui/Caches.h +9 −0 Original line number Diff line number Diff line Loading @@ -245,9 +245,18 @@ public: // Misc GLint maxTextureSize; // Debugging bool debugLayersUpdates; bool debugOverdraw; enum StencilClipDebug { kStencilHide, kStencilShowHighlight, kStencilShowRegion }; StencilClipDebug debugStencilClip; TextureCache textureCache; LayerCache layerCache; RenderBufferCache renderBufferCache; Loading
libs/hwui/Debug.h +1 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ #define DEBUG_RENDER_BUFFERS 0 // Turn on to make stencil operations easier to debug // (writes 255 instead of 1 in the buffer, forces 8 bit stencil) #define DEBUG_STENCIL 0 // Turn on to display debug info about 9patch objects Loading
libs/hwui/OpenGLRenderer.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -1368,6 +1368,12 @@ void OpenGLRenderer::setStencilFromClip() { drawRegionRects(*mSnapshot->clipRegion, 0xff000000, SkXfermode::kSrc_Mode, false); mCaches.stencil.enableTest(); // Draw the region used to generate the stencil if the appropriate debug // mode is enabled if (mCaches.debugStencilClip == Caches::kStencilShowRegion) { drawRegionRects(*mSnapshot->clipRegion, 0x7f0000ff, SkXfermode::kSrcOver_Mode); } } else { mCaches.stencil.disable(); } Loading Loading @@ -1515,12 +1521,20 @@ void OpenGLRenderer::setupDraw(bool clear) { } setStencilFromClip(); } mDescription.reset(); mSetShaderColor = false; mColorSet = false; mColorA = mColorR = mColorG = mColorB = 0.0f; mTextureUnit = 0; mTrackDirtyRegions = true; // Enable debug highlight when what we're about to draw is tested against // the stencil buffer and if stencil highlight debugging is on mDescription.hasDebugHighlight = !mCaches.debugOverdraw && mCaches.debugStencilClip == Caches::kStencilShowHighlight && mCaches.stencil.isTestEnabled(); } void OpenGLRenderer::setupDrawWithTexture(bool isAlpha8) { Loading
libs/hwui/Program.h +7 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,8 @@ namespace uirenderer { #define PROGRAM_HAS_COLORS 42 #define PROGRAM_HAS_DEBUG_HIGHLIGHT 43 /////////////////////////////////////////////////////////////////////////////// // Types /////////////////////////////////////////////////////////////////////////////// Loading Loading @@ -159,6 +161,8 @@ struct ProgramDescription { bool hasGammaCorrection; float gamma; bool hasDebugHighlight; /** * Resets this description. All fields are reset back to the default * values they hold after building a new instance. Loading Loading @@ -199,6 +203,8 @@ struct ProgramDescription { hasGammaCorrection = false; gamma = 2.2f; hasDebugHighlight = false; } /** Loading Loading @@ -267,6 +273,7 @@ struct ProgramDescription { if (hasGammaCorrection) key |= programid(0x1) << PROGRAM_HAS_GAMMA_CORRECTION; if (isSimpleGradient) key |= programid(0x1) << PROGRAM_IS_SIMPLE_GRADIENT; if (hasColors) key |= programid(0x1) << PROGRAM_HAS_COLORS; if (hasDebugHighlight) key |= programid(0x1) << PROGRAM_HAS_DEBUG_HIGHLIGHT; return key; } Loading