Bug 55534

Summary: Clean up macros in Extensions3DOpenGL.cpp
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: CanvasAssignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: aroben, cmarrin, dino, kbr, mdelaney7
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Attachments:
Description Flags
Patch darin: review+

Description David Kilzer (:ddkilzer) 2011-03-01 17:18:39 PST
Created attachment 84332 [details]
Patch

Reviewed by NOBODY (OOPS!).

Change "#if GL_APPLE_vertex_array_object" macros to check that
GL_APPLE_vertex_array_object is both defined and non-zero.

* platform/graphics/opengl/Extensions3DOpenGL.cpp:
(WebCore::Extensions3DOpenGL::createVertexArrayOES):
(WebCore::Extensions3DOpenGL::deleteVertexArrayOES): Remove
empty #else clause.
(WebCore::Extensions3DOpenGL::isVertexArrayOES):
(WebCore::Extensions3DOpenGL::bindVertexArrayOES): Add early
return check.  Remove #else clause that would never have
compiled (since array is not a WTF::String).
---
 2 files changed, 25 insertions(+), 7 deletions(-)
Comment 1 Darin Adler 2011-03-01 17:31:30 PST
Comment on attachment 84332 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=84332&action=review

> Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp:137
> -#if GL_APPLE_vertex_array_object
> +#if defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object

I think this only works properly in MSVC if you leave off the parentheses.

    #if defined GL_APPLE_vertex_array_object && GL_APPLE_vertex_array_object

I think it would be best to use the syntax that works in MSVC even if that’s not a real issue here.
Comment 2 David Kilzer (:ddkilzer) 2011-03-02 06:46:37 PST
(In reply to comment #1)
> I think it would be best to use the syntax that works in MSVC even if that’s not a real issue here.

Done.
Comment 3 David Kilzer (:ddkilzer) 2011-03-02 06:48:47 PST
Committed r80124: <http://trac.webkit.org/changeset/80124>
Comment 4 Adam Roben (:aroben) 2011-03-02 06:55:35 PST
(In reply to comment #1)
> (From update of attachment 84332 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=84332&action=review
> 
> > Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp:137
> > -#if GL_APPLE_vertex_array_object
> > +#if defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object
> 
> I think this only works properly in MSVC if you leave off the parentheses.
> 
>     #if defined GL_APPLE_vertex_array_object && GL_APPLE_vertex_array_object
> 
> I think it would be best to use the syntax that works in MSVC even if that’s not a real issue here.

I believe MSVC can handle the parentheses in this case just fine. For some reason it doesn't like them if you add them to the definition of the PLATFORM() macro, though; maybe it's something about the ## operator?