Note: There are a few cases of duplicates in user autocompletion which are being worked on.

Log non-empty shader/program infoLogs as WebGL (JS) warnings

RESOLVED FIXED in mozilla15

Status

()

Core
Canvas: WebGL
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: bjacob, Assigned: bjacob)

Tracking

unspecified
mozilla15
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: webgl-next)

Attachments

(1 attachment, 1 obsolete attachment)

Will become really realistic once bug 743753 is resolved. Would be very helpful. Assumption here is that the infolog is always empty when there is no particular problem i.e. we don't have stupid compilers that write "Success!!!11!" to it.
(Assignee)

Comment 1

5 years ago
Created attachment 626806 [details] [diff] [review]
report shader/program infologs as warnings

Did some renaming of the new variable and constant introduced in bug 743753.

See the comment about how in principle we can't get the shader infologs before glLinkProgram has been called.

I wanted to have only one implementation of getting a shader/program's infolog, as that is a bit nontrivial (a shader infolog may come either from ANGLE or from the driver). Unfortunately GetShaderInfoLog converts to UTF16 which is useless for us here as JS warnings are 8bit strings. So I added overloads of Get{Shader,Program}InfoLog not doing the conversion.

When a shader infolog has been reported, we don't report the program infolog as this is then, in most cases, just a less helpful duplicate of the information already given in the shader infolog.
Attachment #626806 - Flags: review?(jgilbert)
Comment on attachment 626806 [details] [diff] [review]
report shader/program infologs as warnings

Review of attachment 626806 [details] [diff] [review]:
-----------------------------------------------------------------

R- pending explanations.

::: content/canvas/src/WebGLContext.h
@@ +1354,5 @@
>      bool mDrawSinceContextLossTimerSet;
>      ContextStatus mContextStatus;
>      bool mContextLostErrorSet;
>  
> +    static const int sMaxWarningsToGenerate = 32;

Yes this is static, but static+const should probably be 'kMaxWarningsToGenerate'.

::: content/canvas/src/WebGLContextUtils.cpp
@@ +63,2 @@
>              JS_ReportWarning(ccx,
>                  "WebGL: no further warnings will be reported for this WebGL context "

Surely 'no' should be capitalized?

::: content/canvas/src/WebGLContextValidate.cpp
@@ +53,5 @@
>              NS_ABORT_IF_FALSE(loc >= 0, "major oops in managing the attributes of a WebGL program");
>              if (loc < mContext->mGLMaxVertexAttribs) {
>                  mAttribsInUse[loc] = true;
>              } else {
> +                mContext->GenerateWarning("program exceeds MAX_VERTEX_ATTRIBS");

Is this actually not an InvalidOperation?
Attachment #626806 - Flags: review?(jgilbert) → review-
(Assignee)

Comment 3

5 years ago
Created attachment 627212 [details] [diff] [review]
report shader/program infologs as warnings

(In reply to Jeff Gilbert [:jgilbert] from comment #2)
> Comment on attachment 626806 [details] [diff] [review]
> report shader/program infologs as warnings
> 
> Review of attachment 626806 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> R- pending explanations.
> 
> ::: content/canvas/src/WebGLContext.h
> @@ +1354,5 @@
> >      bool mDrawSinceContextLossTimerSet;
> >      ContextStatus mContextStatus;
> >      bool mContextLostErrorSet;
> >  
> > +    static const int sMaxWarningsToGenerate = 32;
> 
> Yes this is static, but static+const should probably be
> 'kMaxWarningsToGenerate'.

Actually, found a way to not even have to name this constant.

> 
> ::: content/canvas/src/WebGLContextUtils.cpp
> @@ +63,2 @@
> >              JS_ReportWarning(ccx,
> >                  "WebGL: no further warnings will be reported for this WebGL context "
> 
> Surely 'no' should be capitalized?

OK.

> 
> ::: content/canvas/src/WebGLContextValidate.cpp
> @@ +53,5 @@
> >              NS_ABORT_IF_FALSE(loc >= 0, "major oops in managing the attributes of a WebGL program");
> >              if (loc < mContext->mGLMaxVertexAttribs) {
> >                  mAttribsInUse[loc] = true;
> >              } else {
> > +                mContext->GenerateWarning("program exceeds MAX_VERTEX_ATTRIBS");
> 
> Is this actually not an InvalidOperation?

I don't think so: this WebGLProgram::UpdateInfo() is called upon program linking, this "program exceeds MAX_VERTEX_ATTRIBS" should simply be a program linking error, and program linking errors aren't GL errors.
Attachment #626806 - Attachment is obsolete: true
Attachment #627212 - Flags: review?(jgilbert)
Comment on attachment 627212 [details] [diff] [review]
report shader/program infologs as warnings

Review of attachment 627212 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/canvas/src/WebGLContext.h
@@ +1357,5 @@
>  
> +    int mAlreadyGeneratedWarnings;
> +
> +    bool ShouldGenerateWarnings() const {
> +        return mAlreadyGeneratedWarnings < 32;

I don't love it, but it'll do.
Attachment #627212 - Flags: review?(jgilbert) → review+
(Assignee)

Comment 5

5 years ago
http://hg.mozilla.org/integration/mozilla-inbound/rev/90292e7ec6fb
Assignee: nobody → bjacob
Target Milestone: --- → mozilla15
(Assignee)

Comment 6

5 years ago
Backed out:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e5ea5a2ba6f1

50465 ERROR TEST-UNEXPECTED-FAIL | /tests/content/canvas/test/webgl/test_webgl_conformance_test_suite.html | [conformance/context/context-lost.html] Test failed - gl.getProgramInfoLog(program) should be null (of type object). Was (of type string).

50468 ERROR TEST-UNEXPECTED-FAIL | /tests/content/canvas/test/webgl/test_webgl_conformance_test_suite.html | [conformance/context/context-lost.html] Test failed - gl.getShaderInfoLog(shader) should be null (of type object). Was (of type string).
(Assignee)

Comment 7

5 years ago
New try:
https://tbpl.mozilla.org/?tree=Try&rev=89d986d02cd4

Apparently, CopyASCIItoUTF16 doesn't preserve string voidness (nullity).
(Assignee)

Comment 8

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/d92215a6eea1

Comment 9

5 years ago
https://hg.mozilla.org/mozilla-central/rev/d92215a6eea1
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.