Bug 143964

Summary: OpenGLShims appears to have a dead store if GLES2
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: WebGLAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: hausmann, joepeck, jturcotte, kkinnunen, noam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description Joseph Pecoraro 2015-04-20 14:08:28 PDT
* SUMMARY
Bug 95556 / r127874 introduced some GLES2 handling. It looks like it would cause a dead store. The code should be cleaned up in some way, or there is an actual bug.

Currently the code looks like:
https://trac.webkit.org/browser/trunk/Source/WebCore/platform/graphics/OpenGLShims.cpp#L64

    static void* lookupOpenGLFunctionAddress(const char* functionName, bool* success = 0)
    {
        ...
        fullFunctionName = functionName;
        fullFunctionName.append("EXT");
        target = getProcAddress(fullFunctionName.utf8().data());

    #if defined(GL_ES_VERSION_2_0)
        fullFunctionName = functionName;
        fullFunctionName.append("ANGLE");
        target = getProcAddress(fullFunctionName.utf8().data());
        if (target)
            return target;

        fullFunctionName = functionName;
        fullFunctionName.append("APPLE");
        target = getProcAddress(fullFunctionName.utf8().data());
    #endif

        // A null address is still a failure case.
        if (!target && success)
            *success = false;

        return target;
    }

Note that the target assignment for "EXT" will just immediately get overwritten by the "ANGLE"/"APPLE" case if GL_ES_VERSION_2_0.

So either there is a bug and the "EXT" case should be getting used, or there is not a bug and this is unnecessary work and the "EXT" case should just be an #else.
Comment 1 Joseph Pecoraro 2015-04-20 14:11:05 PDT
My guess is there should be an:

    if (target)
        return target;

But I don't know how to test.