Introduce PixelBuffer API to enable PBOs
PBOs (Pixel Buffer Objects) can be used on OpenGL ES 3.0 to perform
asynchronous texture uploads to free up the CPU. This change does not
enable the use of PBOs unless a specific property is set (Adreno drivers
have issues with PBOs at the moment, Mali drivers work just fine.)
This change also cleans up Font/FontRenderer a little bit and improves
performance of drop shadows generations by using memcpy() instead of
a manual byte-by-byte copy.
On GL ES 2.0 devices, or when PBOs are disabled, a PixelBuffer instance
behaves like a simple byte array. The extra APIs introduced for PBOs
(map/unmap and bind/unbind) are pretty much no-ops for CPU pixel
buffers and won't introduce any significant overhead.
This change also fixes a bug with text drop shadows: if the drop
shadow is larger than the max texture size, the renderer would leave
the GL context in a bad state and generate 0x501 errors. This change
simply skips drop shadows if they are too large.
Change-Id: I2700aadb0c6093431dc5dee3d587d689190c4e23
diff --git a/libs/hwui/GammaFontRenderer.h b/libs/hwui/GammaFontRenderer.h
index 5c1860e..bbfa66d 100644
--- a/libs/hwui/GammaFontRenderer.h
+++ b/libs/hwui/GammaFontRenderer.h
@@ -40,6 +40,8 @@
virtual void describe(ProgramDescription& description, const SkPaint* paint) const = 0;
virtual void setupProgram(ProgramDescription& description, Program* program) const = 0;
+ virtual void endPrecaching() = 0;
+
static GammaFontRenderer* createRenderer();
protected:
@@ -86,6 +88,8 @@
void describe(ProgramDescription& description, const SkPaint* paint) const;
void setupProgram(ProgramDescription& description, Program* program) const;
+ void endPrecaching();
+
private:
ShaderGammaFontRenderer(bool multiGamma);
@@ -134,6 +138,8 @@
void setupProgram(ProgramDescription& description, Program* program) const {
}
+ void endPrecaching();
+
private:
LookupGammaFontRenderer();
@@ -171,6 +177,8 @@
void setupProgram(ProgramDescription& description, Program* program) const {
}
+ void endPrecaching();
+
private:
Lookup3GammaFontRenderer();