Bug 111324 - [WebGL] Mark Extension3D functions as const.
Summary: [WebGL] Mark Extension3D functions as const.
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Kalyan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-04 07:23 PST by Kalyan
Modified: 2024-01-17 00:55 PST (History)
7 users (show)

See Also:


Attachments
patch (16.43 KB, patch)
2013-03-04 16:36 PST, Kalyan
kbr: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kalyan 2013-03-04 07:23:55 PST
Many of the api calls in Extension3D can be marked as const.
Comment 1 Kalyan 2013-03-04 16:36:21 PST
Created attachment 191345 [details]
patch
Comment 2 Kenneth Russell 2013-03-04 16:57:18 PST
Comment on attachment 191345 [details]
patch

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

May I ask what the goal of this patch is? While conceptually some of these methods are const, as you have already found, they may do some mutations internally which are invisible to callers. Neither the ChangeLog nor the bug explains the motivation for the patch.

> Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp:244
> +            const_cast<Extensions3DOpenGLES*>(this)->resolveVAOExtBindings();

Rather than casting away const, these members should be made mutable -- that's what the keyword is for.
Comment 3 Kalyan 2013-03-04 17:40:38 PST
(In reply to comment #2)
> (From update of attachment 191345 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=191345&action=review
> 
> May I ask what the goal of this patch is? While conceptually some of these methods are const, as you have already found, they may do some mutations internally which are invisible to callers. Neither the ChangeLog nor the bug explains the motivation for the patch.

While fixing 109382(https://bugs.webkit.org/show_bug.cgi?id=109382#c8), there was a discussion to make supports work with const or to make isVertexArrayObjectSupported  work without const. For 109382,  isVertexArrayObjectSupported in Extensions3DOpenGL was made to work without const. This work was motivated from that discussion. I will update the patch, if this is something we still want to address.

> > Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp:244
> Rather than casting away const, these members should be made mutable -- that's what the keyword is for.

Yes, will fix that.
Comment 4 Kenneth Russell 2013-03-04 19:00:15 PST
(In reply to comment #3)
> While fixing 109382(https://bugs.webkit.org/show_bug.cgi?id=109382#c8), there was a discussion to make supports work with const or to make isVertexArrayObjectSupported  work without const. For 109382,  isVertexArrayObjectSupported in Extensions3DOpenGL was made to work without const. This work was motivated from that discussion. I will update the patch, if this is something we still want to address.

I'd forgotten about that discussion. No objection if you want to fix this, but it doesn't seem critical to me.
Comment 5 Kalyan 2013-03-05 18:42:33 PST
(In reply to comment #4)
> (In reply to comment #3)
> > While fixing 109382(https://bugs.webkit.org/show_bug.cgi?id=109382#c8), there was a discussion to make supports work with const or to make isVertexArrayObjectSupported  work without const. For 109382,  isVertexArrayObjectSupported in Extensions3DOpenGL was made to work without const. This work was motivated from that discussion. I will update the patch, if this is something we still want to address.
> 
> I'd forgotten about that discussion. No objection if you want to fix this, but it doesn't seem critical to me

k. I am not completely happy to use mutable member variables (or cast). A cleaner way might be to find a suitable place to resolve the bindings than in supportsExtension function. I am currently unable to do any run time testing for GLES related changes. I will come back to this once I am able to test them.