[webkit-dev] Compile error in WebGL2RenderingContext.cpp

Salisbury, Mark mark.salisbury at hp.com
Wed Jan 16 20:56:29 PST 2019


Hello,

I'm working on rebasing our downstream webkit port; I just pulled down recent webkit changes (since July '18) and I hit a piece of code that's failing to compile in Visual Studio 2017.  When I look at the code however, I'm not sure how it compiles on any compiler, or if it compiles, how it's safe.

This is from Source/WebCore/html/canvas/WebGL2RenderingContext.cpp -

...
    int numValues = 0;
#if USE(OPENGL_ES)
    m_context->getInternalformativ(target, internalformat, GraphicsContext3D::NUM_SAMPLE_COUNTS, 1, &numValues);

    GC3Dint params[numValues];
    m_context->getInternalformativ(target, internalformat, pname, numValues, params);
#else
    // On desktop OpenGL 4.1 or below we must emulate glGetInternalformativ.

Visual Studio doesn't like it because it won't instantiate an array without a const size.  On the other hand, even if it compiled, passing an array with 0 size doesn't make a lot of sense, to receive parameters back, which appears to be the intent of the code.

The file is associated with WebGL2, but it's added to the build in the ENABLE_WEBGL block in WebCore/CMakeLists.txt.
WEBGL2 is off by default (per WebKitFeatures.cmake) so I assume the code could not be invoked without enabling WEBGL 2.

Am I looking at unfinished code that magically compiles with gcc/llvm/etc. (non Visual Studio)?

Thanks,
Mark




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20190117/cc1746d5/attachment.html>


More information about the webkit-dev mailing list