Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9561f52 authored by Romain Guy's avatar Romain Guy Committed by Android Git Automerger
Browse files

am ce8b9c33: am 15e84399: Merge "Add call sites for OpenGL\'s debug label extension" into jb-dev

* commit 'ce8b9c33':
  Add call sites for OpenGL's debug label extension
parents 96db7444 ce8b9c33
Loading
Loading
Loading
Loading
+32 −18
Original line number Diff line number Diff line
@@ -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;

+18 −3
Original line number Diff line number Diff line
@@ -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:
    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;
+3 −1
Original line number Diff line number Diff line
@@ -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