Bug 119515 (refactor) - [WebGL] Vertex attribute binding validation method
Summary: [WebGL] Vertex attribute binding validation method
Status: RESOLVED FIXED
Alias: refactor
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-06 02:43 PDT by Przemyslaw Szymanski
Modified: 2013-08-16 00:16 PDT (History)
6 users (show)

See Also:


Attachments
Vertex attribute binding validation method (2.90 KB, patch)
2013-08-06 02:50 PDT, Przemyslaw Szymanski
no flags Details | Formatted Diff | Diff
Vertex attribute binding validation method (2.89 KB, patch)
2013-08-12 02:21 PDT, Przemyslaw Szymanski
dino: review-
Details | Formatted Diff | Diff
Vertex attribute binding validation method (2.87 KB, patch)
2013-08-13 00:49 PDT, Przemyslaw Szymanski
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Przemyslaw Szymanski 2013-08-06 02:43:43 PDT
validateVertexAttributes method can has a little code refactoring. We can move some calculations to a separate methods.
This also can be usable in other parts of the code. So less code and easy to reuse now.
Comment 1 Przemyslaw Szymanski 2013-08-06 02:50:30 PDT
Created attachment 208178 [details]
Vertex attribute binding validation method
Comment 2 Kalyan 2013-08-06 03:50:50 PDT
Comment on attachment 208178 [details]
Vertex attribute binding validation method

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

> Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.h:62
> +        inline bool validateBinding() const { return !enabled || (enabled && isBound()); }

Second check should be enough here.
Comment 3 Przemyslaw Szymanski 2013-08-06 04:23:48 PDT
I can't agreed. Two reasons:
1) I tested only the second check and it was not work well
2) Vertex attribute can be disabled (and then check should be true, it is ok) or enabled but bound. It can't be enabled and not bound.

So there must be two checks
Comment 4 Kalyan 2013-08-06 05:09:47 PDT
(In reply to comment #3)
> I can't agreed. Two reasons:
> 1) I tested only the second check and it was not work well
> 2) Vertex attribute can be disabled (and then check should be true, it is ok) or enabled but bound. It can't be enabled and not bound.
> 
> So there must be two checks

sorry, I missed that you moved the enabled check too.
Comment 5 zalan 2013-08-09 07:55:09 PDT
Comment on attachment 208178 [details]
Vertex attribute binding validation method

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

>> Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.h:62
>> +        inline bool validateBinding() const { return !enabled || (enabled && isBound()); }
> 
> Second check should be enough here.

Do you need the second enabled? (if enabled is false, the second part of the condition does not get evaluated, while if enabled is true, then it doesnt bring much value to the second part of the condition)
Comment 6 Przemyslaw Szymanski 2013-08-12 02:21:55 PDT
Created attachment 208519 [details]
Vertex attribute binding validation method

update after review
Comment 7 Przemyslaw Szymanski 2013-08-12 02:24:08 PDT
(In reply to comment #5)
> (From update of attachment 208178 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=208178&action=review
> 
> >> Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.h:62
> >> +        inline bool validateBinding() const { return !enabled || (enabled && isBound()); }
> > 
> > Second check should be enough here.
> 
> Do you need the second enabled? (if enabled is false, the second part of the condition does not get evaluated, while if enabled is true, then it doesnt bring much value to the second part of the condition)

Good point. Thank you. I updated this code. Review again please.
Comment 8 Chris Dumez 2013-08-12 10:30:44 PDT
Comment on attachment 208519 [details]
Vertex attribute binding validation method

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

> Source/WebCore/ChangeLog:6
> +        This patch refactors WebGLRenderingContext code by move a vertex

"by moving"

> Source/WebCore/ChangeLog:7
> +        attribute binding validation to the separate method. It is now

"to a separate"

> Source/WebCore/ChangeLog:9
> +        code is more readable and more clear now. 

"more readable and more clear": pretty much means the same. Probably one is enough.

> Source/WebCore/ChangeLog:13
> +        No new tests. Covered by existing tests.

There is no behavior change, right? If so, it is a good idea to say so in the Changelog.

> Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.h:61
> +        inline bool isBound() const { return bufferBinding && bufferBinding->object(); }

inline is redundant here.

> Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.h:62
> +        inline bool validateBinding() const { return !enabled || isBound(); }

Ditto.
Comment 9 Chris Dumez 2013-08-12 10:31:35 PDT
Comment on attachment 208519 [details]
Vertex attribute binding validation method

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

>> Source/WebCore/ChangeLog:6
>> +        This patch refactors WebGLRenderingContext code by move a vertex
> 
> "by moving"

"by moving the" actually
Comment 10 Dean Jackson 2013-08-12 12:59:49 PDT
Comment on attachment 208519 [details]
Vertex attribute binding validation method

Another +1 to Christophe's review. Just minor changes needed before r+
Comment 11 Przemyslaw Szymanski 2013-08-13 00:49:36 PDT
Created attachment 208605 [details]
Vertex attribute binding validation method
Comment 12 Przemyslaw Szymanski 2013-08-13 00:51:59 PDT
Christophe, thank you very much for review. Changes applied.
Comment 13 Chris Dumez 2013-08-13 00:53:08 PDT
Comment on attachment 208605 [details]
Vertex attribute binding validation method

Looks like a nice refactoring. r=me but please let Dean take a final look before landing as he was reviewing this as well.
Comment 14 Przemyslaw Szymanski 2013-08-14 03:57:45 PDT
Dean Jackson, could you do a final review for this patch? Thank you.
Comment 15 Chris Dumez 2013-08-15 23:42:01 PDT
(In reply to comment #14)
> Dean Jackson, could you do a final review for this patch? Thank you.

Dean seems busy. Feel free to land the patch.
Comment 16 WebKit Commit Bot 2013-08-16 00:16:00 PDT
Comment on attachment 208605 [details]
Vertex attribute binding validation method

Clearing flags on attachment: 208605

Committed r154166: <http://trac.webkit.org/changeset/154166>
Comment 17 WebKit Commit Bot 2013-08-16 00:16:03 PDT
All reviewed patches have been landed.  Closing bug.