Add call sites for OpenGL's debug label extension
Change-Id: I9c689127e8166cbef92c935f8aa07217ab806dda
This commit is contained in:
@ -48,25 +48,9 @@ namespace uirenderer {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Caches::Caches(): Singleton<Caches>(), mInitialized(false) {
|
||||
GLint maxTextureUnits;
|
||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
|
||||
if (maxTextureUnits < REQUIRED_TEXTURE_UNITS_COUNT) {
|
||||
ALOGW("At least %d texture units are required!", REQUIRED_TEXTURE_UNITS_COUNT);
|
||||
}
|
||||
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
|
||||
|
||||
if (extensions.hasDebugMarker()) {
|
||||
eventMark = glInsertEventMarkerEXT;
|
||||
startMark = glPushGroupMarkerEXT;
|
||||
endMark = glPopGroupMarkerEXT;
|
||||
} else {
|
||||
eventMark = eventMarkNull;
|
||||
startMark = startMarkNull;
|
||||
endMark = endMarkNull;
|
||||
}
|
||||
|
||||
init();
|
||||
initExtensions();
|
||||
initConstraints();
|
||||
|
||||
mDebugLevel = readDebugLevel();
|
||||
ALOGD("Enabling debug mode %d", mDebugLevel);
|
||||
@ -105,6 +89,36 @@ void Caches::init() {
|
||||
mInitialized = true;
|
||||
}
|
||||
|
||||
void Caches::initExtensions() {
|
||||
if (extensions.hasDebugMarker()) {
|
||||
eventMark = glInsertEventMarkerEXT;
|
||||
startMark = glPushGroupMarkerEXT;
|
||||
endMark = glPopGroupMarkerEXT;
|
||||
} else {
|
||||
eventMark = eventMarkNull;
|
||||
startMark = startMarkNull;
|
||||
endMark = endMarkNull;
|
||||
}
|
||||
|
||||
if (extensions.hasDebugLabel()) {
|
||||
setLabel = glLabelObjectEXT;
|
||||
getLabel = glGetObjectLabelEXT;
|
||||
} else {
|
||||
setLabel = setLabelNull;
|
||||
getLabel = getLabelNull;
|
||||
}
|
||||
}
|
||||
|
||||
void Caches::initConstraints() {
|
||||
GLint maxTextureUnits;
|
||||
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
|
||||
if (maxTextureUnits < REQUIRED_TEXTURE_UNITS_COUNT) {
|
||||
ALOGW("At least %d texture units are required!", REQUIRED_TEXTURE_UNITS_COUNT);
|
||||
}
|
||||
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
|
||||
}
|
||||
|
||||
void Caches::terminate() {
|
||||
if (!mInitialized) return;
|
||||
|
||||
|
@ -107,7 +107,7 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the cache.
|
||||
* Initialize caches.
|
||||
*/
|
||||
void init();
|
||||
|
||||
@ -247,15 +247,30 @@ public:
|
||||
GammaFontRenderer fontRenderer;
|
||||
ResourceCache resourceCache;
|
||||
|
||||
// Debug methods
|
||||
PFNGLINSERTEVENTMARKEREXTPROC eventMark;
|
||||
PFNGLPUSHGROUPMARKEREXTPROC startMark;
|
||||
PFNGLPOPGROUPMARKEREXTPROC endMark;
|
||||
|
||||
PFNGLLABELOBJECTEXTPROC setLabel;
|
||||
PFNGLGETOBJECTLABELEXTPROC getLabel;
|
||||
|
||||
private:
|
||||
static void eventMarkNull(GLsizei length, const GLchar *marker) { }
|
||||
static void startMarkNull(GLsizei length, const GLchar *marker) { }
|
||||
void initExtensions();
|
||||
void initConstraints();
|
||||
|
||||
static void eventMarkNull(GLsizei length, const GLchar* marker) { }
|
||||
static void startMarkNull(GLsizei length, const GLchar* marker) { }
|
||||
static void endMarkNull() { }
|
||||
|
||||
static void setLabelNull(GLenum type, uint object, GLsizei length,
|
||||
const char* label) { }
|
||||
static void getLabelNull(GLenum type, uint object, GLsizei bufferSize,
|
||||
GLsizei* length, char* label) {
|
||||
if (length) *length = 0;
|
||||
if (label) *label = '\0';
|
||||
}
|
||||
|
||||
GLuint mCurrentBuffer;
|
||||
GLuint mCurrentIndicesBuffer;
|
||||
void* mCurrentPositionPointer;
|
||||
|
@ -40,7 +40,6 @@ namespace uirenderer {
|
||||
#endif
|
||||
|
||||
// Vendor strings
|
||||
|
||||
#define VENDOR_IMG "Imagination Technologies"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -68,6 +67,7 @@ public:
|
||||
mHasFramebufferFetch = hasExtension("GL_NV_shader_framebuffer_fetch");
|
||||
mHasDiscardFramebuffer = hasExtension("GL_EXT_discard_framebuffer");
|
||||
mHasDebugMarker = hasExtension("GL_EXT_debug_marker");
|
||||
mHasDebugLabel = hasExtension("GL_EXT_debug_label");
|
||||
|
||||
const char* vendor = (const char*) glGetString(GL_VENDOR);
|
||||
EXT_LOGD("Vendor: %s", vendor);
|
||||
@ -84,6 +84,7 @@ public:
|
||||
inline bool needsHighpTexCoords() const { return mNeedsHighpTexCoords; }
|
||||
inline bool hasDiscardFramebuffer() const { return mHasDiscardFramebuffer; }
|
||||
inline bool hasDebugMarker() const { return mHasDebugMarker; }
|
||||
inline bool hasDebugLabel() const { return mHasDebugLabel; }
|
||||
|
||||
bool hasExtension(const char* extension) const {
|
||||
const String8 s(extension);
|
||||
@ -104,6 +105,7 @@ private:
|
||||
bool mHasFramebufferFetch;
|
||||
bool mHasDiscardFramebuffer;
|
||||
bool mHasDebugMarker;
|
||||
bool mHasDebugLabel;
|
||||
}; // class Extensions
|
||||
|
||||
}; // namespace uirenderer
|
||||
|
Reference in New Issue
Block a user