Bug 41381 - Need to track texture completeness
Summary: Need to track texture completeness
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Zhenyao Mo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-29 16:24 PDT by Zhenyao Mo
Modified: 2010-07-13 15:54 PDT (History)
7 users (show)

See Also:


Attachments
patch (25.93 KB, patch)
2010-07-04 20:07 PDT, Zhenyao Mo
fishd: review+
zmo: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zhenyao Mo 2010-06-29 16:24:55 PDT
In theory we don't have to (GL and GLES defines the same behavior), but seems like there is a driver bug in Mac, instead of falling back to (0, 0, 0, 1) texture, it falls back to (0, 0, 0, 0).

Thus, we have to do full tracking as in Chrome command buffer implementation.  Partial tracking (as in NPOT patch, whcih only deals with the difference between GL and GLES) won't work.
Comment 1 Zhenyao Mo 2010-07-04 20:07:34 PDT
Created attachment 60490 [details]
patch
Comment 2 Oliver Hunt 2010-07-04 20:09:16 PDT
Comment on attachment 60490 [details]
patch

What is meant by texture completeness? -- there should be some description in the changelog
Comment 3 WebKit Review Bot 2010-07-04 20:10:06 PDT
Attachment 60490 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1
WebCore/html/canvas/WebGLTexture.cpp:200:  WebGLTexture::_deleteObject is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Total errors found: 1 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Zhenyao Mo 2010-07-04 20:32:32 PDT
(In reply to comment #3)
> Attachment 60490 [details] did not pass style-queue:
> 
> Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1
> WebCore/html/canvas/WebGLTexture.cpp:200:  WebGLTexture::_deleteObject is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
> Total errors found: 1 in 8 files
> 
> 
> If any of these errors are false positives, please file a bug against check-webkit-style.

I didn't touch the _deleteObject() function, besides, it's in all WebGL object classes.  So I won't fix this style issue in this patch.
Comment 5 Adam Barth 2010-07-04 21:08:26 PDT
Can you fix the names in a follow up patch?  This is new code.  It shouldn't be out of style.  (How did it get past the Not the first time?)
Comment 6 Zhenyao Mo 2010-07-04 22:05:51 PDT
(In reply to comment #2)
> (From update of attachment 60490 [details])
> What is meant by texture completeness? -- there should be some description in the changelog

It's well defined in ES spec 2.0.24 Section 3.7.l0.  I could add this reference to the log.
Comment 7 Zhenyao Mo 2010-07-04 22:08:11 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > Attachment 60490 [details] [details] did not pass style-queue:
> > 
> > Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1
> > WebCore/html/canvas/WebGLTexture.cpp:200:  WebGLTexture::_deleteObject is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
> > Total errors found: 1 in 8 files
> > 
> > 
> > If any of these errors are false positives, please file a bug against check-webkit-style.
> 
> I didn't touch the _deleteObject() function, besides, it's in all WebGL object classes.  So I won't fix this style issue in this patch.

(In reply to comment #5)
> Can you fix the names in a follow up patch?  This is new code.  It shouldn't be out of style.  (How did it get past the Not the first time?)

The bug has already been created by kbr: https://bugs.webkit.org/show_bug.cgi?id=38761
Comment 8 Kenneth Russell 2010-07-07 18:50:14 PDT
Comment on attachment 60490 [details]
patch

Looks good overall. I didn't compare the logic side-by-side with the command buffer implementation so my review is relying on the fact that this is more or less a straight port. If this test isn't part of the conformance suite, it should be added. One comment:

WebCore/html/canvas/WebGLTexture.cpp:162
 +              height = std::max(1, height >> 1);
These look wrong. Should these be "width >> level" and "height >> level"? (Actually, I just checked the command buffer code and the same issue is there.) If so, and these errors weren't caught by a test, can we add a test for them?
Comment 9 Kenneth Russell 2010-07-07 18:52:40 PDT
Comment on attachment 60490 [details]
patch

WebCore/html/canvas/WebGLTexture.cpp:162
 +              height = std::max(1, height >> 1);
From what I can see, the same error is here (and in the command buffer code as well).
Comment 10 Kenneth Russell 2010-07-07 18:53:19 PDT
Comment on attachment 60490 [details]
patch

WebCore/html/canvas/WebGLTexture.cpp:291
 +                  height = std::max(1, height >> 1);
Oops; I meant here.
Comment 11 Zhenyao Mo 2010-07-10 09:55:30 PDT
(In reply to comment #8)
> (From update of attachment 60490 [details])
> Looks good overall. I didn't compare the logic side-by-side with the command buffer implementation so my review is relying on the fact that this is more or less a straight port. If this test isn't part of the conformance suite, it should be added. One comment:
> 
> WebCore/html/canvas/WebGLTexture.cpp:162
>  +              height = std::max(1, height >> 1);
> These look wrong. Should these be "width >> level" and "height >> level"? (Actually, I just checked the command buffer code and the same issue is there.) If so, and these errors weren't caught by a test, can we add a test for them?

Actually the original code is correct.  This is because we update the width/height at each level, so at level k+1, the width/height is already the width/height for level k, not level 0, so shifting 1 bit right is the correct thing to do.
Comment 12 Kenneth Russell 2010-07-12 17:10:00 PDT
(In reply to comment #11)
> (In reply to comment #8)
> > (From update of attachment 60490 [details] [details])
> > Looks good overall. I didn't compare the logic side-by-side with the command buffer implementation so my review is relying on the fact that this is more or less a straight port. If this test isn't part of the conformance suite, it should be added. One comment:
> > 
> > WebCore/html/canvas/WebGLTexture.cpp:162
> >  +              height = std::max(1, height >> 1);
> > These look wrong. Should these be "width >> level" and "height >> level"? (Actually, I just checked the command buffer code and the same issue is there.) If so, and these errors weren't caught by a test, can we add a test for them?
> 
> Actually the original code is correct.  This is because we update the width/height at each level, so at level k+1, the width/height is already the width/height for level k, not level 0, so shifting 1 bit right is the correct thing to do.

I see. Sorry for not realizing that. Looks good to me.
Comment 13 Darin Fisher (:fishd, Google) 2010-07-12 20:19:27 PDT
Comment on attachment 60490 [details]
patch

WebCore/html/canvas/WebGLRenderingContext.cpp:1072
 +      RefPtr<WebGLTexture> tex = 0;
nit: no need to explicitly initialize a RefPtr.  the default ctor
initializes it to a null value.

WebCore/html/canvas/WebGLTexture.h:63
 +          static bool isNPOT(unsigned, unsigned);
note: the NPOT acronym was a mystery to me.  webkit encourages
minimizing the use of acronyms unless they are commonly known
or pertaining to the name of a protocol, etc.  That said,
"site:khronos.org NPOT" told me what I need to know.
isNotPowerOfTwo would probably be a better function name.

R=me
Comment 14 Zhenyao Mo 2010-07-13 08:27:57 PDT
(In reply to comment #13)
> (From update of attachment 60490 [details])
> WebCore/html/canvas/WebGLRenderingContext.cpp:1072
>  +      RefPtr<WebGLTexture> tex = 0;
> nit: no need to explicitly initialize a RefPtr.  the default ctor
> initializes it to a null value.

Will fix in the landing patch.

> 
> WebCore/html/canvas/WebGLTexture.h:63
>  +          static bool isNPOT(unsigned, unsigned);
> note: the NPOT acronym was a mystery to me.  webkit encourages
> minimizing the use of acronyms unless they are commonly known
> or pertaining to the name of a protocol, etc.  That said,
> "site:khronos.org NPOT" told me what I need to know.
> isNotPowerOfTwo would probably be a better function name.

I'll add a comment in the function declaration to explain NPOT.

> 
> R=me
Comment 15 Zhenyao Mo 2010-07-13 15:54:34 PDT
Committed r63253: <http://trac.webkit.org/changeset/63253>