Skip to content

Commit 3418648

Browse files
Romain GuyAndroid (Google) Code Review
authored andcommitted
Merge "Foundation for tiling optimization" into jb-mr1-dev
2 parents 2f2f0d4 + 85ef80d commit 3418648

File tree

3 files changed

+40
-5
lines changed

3 files changed

+40
-5
lines changed

libs/hwui/Caches.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ bool Caches::unbindIndicesBuffer() {
321321
return false;
322322
}
323323

324+
///////////////////////////////////////////////////////////////////////////////
325+
// Meshes and textures
326+
///////////////////////////////////////////////////////////////////////////////
327+
324328
void Caches::bindPositionVertexPointer(bool force, GLuint slot, GLvoid* vertices, GLsizei stride) {
325329
if (force || vertices != mCurrentPositionPointer) {
326330
glVertexAttribPointer(slot, 2, GL_FLOAT, GL_FALSE, stride, vertices);
@@ -366,6 +370,10 @@ void Caches::activeTexture(GLuint textureUnit) {
366370
}
367371
}
368372

373+
///////////////////////////////////////////////////////////////////////////////
374+
// Scissor
375+
///////////////////////////////////////////////////////////////////////////////
376+
369377
bool Caches::setScissor(GLint x, GLint y, GLint width, GLint height) {
370378
if (scissorEnabled && (x != mScissorX || y != mScissorY ||
371379
width != mScissorWidth || height != mScissorHeight)) {
@@ -412,6 +420,26 @@ void Caches::resetScissor() {
412420
mScissorX = mScissorY = mScissorWidth = mScissorHeight = 0;
413421
}
414422

423+
///////////////////////////////////////////////////////////////////////////////
424+
// Tiling
425+
///////////////////////////////////////////////////////////////////////////////
426+
427+
void Caches::startTiling(GLuint x, GLuint y, GLuint width, GLuint height, bool opaque) {
428+
if (extensions.hasTiledRendering()) {
429+
430+
}
431+
}
432+
433+
void Caches::endTiling() {
434+
if (extensions.hasTiledRendering()) {
435+
436+
}
437+
}
438+
439+
///////////////////////////////////////////////////////////////////////////////
440+
// Regions
441+
///////////////////////////////////////////////////////////////////////////////
442+
415443
TextureVertex* Caches::getRegionMesh() {
416444
// Create the mesh, 2 triangles and 4 vertices per rectangle in the region
417445
if (!mRegionMesh) {

libs/hwui/Caches.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ class ANDROID_API Caches: public Singleton<Caches> {
211211
bool disableScissor();
212212
void setScissorEnabled(bool enabled);
213213

214+
void startTiling(GLuint x, GLuint y, GLuint width, GLuint height, bool opaque);
215+
void endTiling();
216+
214217
/**
215218
* Returns the mesh used to draw regions. Calling this method will
216219
* bind a VBO of type GL_ELEMENT_ARRAY_BUFFER that contains the

libs/hwui/Extensions.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,21 @@ class Extensions {
6565
mHasDiscardFramebuffer = hasExtension("GL_EXT_discard_framebuffer");
6666
mHasDebugMarker = hasExtension("GL_EXT_debug_marker");
6767
mHasDebugLabel = hasExtension("GL_EXT_debug_label");
68+
mHasTiledRendering = hasExtension("GL_QCOM_tiled_rendering");
6869

69-
// We don't need to copy the string, the OpenGL ES spec
70-
// guarantees the result of glGetString to point to a
71-
// static string as long as our OpenGL context is valid
72-
mExtensions = buffer;
70+
mExtensions = strdup(buffer);
71+
}
72+
73+
~Extensions() {
74+
free(mExtensions);
7375
}
7476

7577
inline bool hasNPot() const { return mHasNPot; }
7678
inline bool hasFramebufferFetch() const { return mHasFramebufferFetch; }
7779
inline bool hasDiscardFramebuffer() const { return mHasDiscardFramebuffer; }
7880
inline bool hasDebugMarker() const { return mHasDebugMarker; }
7981
inline bool hasDebugLabel() const { return mHasDebugLabel; }
82+
inline bool hasTiledRendering() const { return mHasTiledRendering; }
8083

8184
bool hasExtension(const char* extension) const {
8285
const String8 s(extension);
@@ -90,13 +93,14 @@ class Extensions {
9093
private:
9194
SortedVector<String8> mExtensionList;
9295

93-
const char* mExtensions;
96+
char* mExtensions;
9497

9598
bool mHasNPot;
9699
bool mHasFramebufferFetch;
97100
bool mHasDiscardFramebuffer;
98101
bool mHasDebugMarker;
99102
bool mHasDebugLabel;
103+
bool mHasTiledRendering;
100104
}; // class Extensions
101105

102106
}; // namespace uirenderer

0 commit comments

Comments
 (0)