Closed Bug 746740 Opened 12 years ago Closed 12 years ago

Should GetProgramInfoLog throw if fGetProgramiv returns a -1?

Categories

(Core :: Graphics: CanvasWebGL, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla15

People

(Reporter: bzbarsky, Assigned: jgilbert)

Details

(Whiteboard: webgl-conformance)

Attachments

(1 file, 1 obsolete file)

2684     GLint k = -1;
2685     gl->fGetProgramiv(progname, LOCAL_GL_INFO_LOG_LENGTH, &k);
2686     if (k == -1)
2687         return NS_ERROR_FAILURE; // XXX GL error? shouldn't happen!
Whiteboard: webgl-conformance
GL_INFO_LOG_LENGTH should return the (positive) length or 0, unless there is a GL error, in which case the contents of the param are guaranteed to not be changed.

GL_INVALID_ENUM: if pname is not an accepted value. (not relevant here)
GL_INVALID_VALUE: if program is not a value generated by OpenGL.
GL_INVALID_OPERATION: if program does not refer to a program object.

WebGL is almost certainly similar, so we should just propagate the error, which I believe is automatic. I think standard procedure is to return NS_OK and be sure we didn't touch the output.
Attached patch Patch (obsolete) — Splinter Review
Assignee: nobody → jgilbert
Status: NEW → ASSIGNED
Attachment #616347 - Flags: review?(bjacob)
(In reply to Jeff Gilbert [:jgilbert] from comment #2)
> Created attachment 616347 [details] [diff] [review]
> Patch

Wouldn't this patch make the function return "undefined" to JavaScript?

This should be null, or preferably empty string imho (I'll open a thread on the WebGL mailing list about this).
> Wouldn't this patch make the function return "undefined" to JavaScript?

It would make the function return emptystring.  There is no way for this function to return undefined.
Comment on attachment 616347 [details] [diff] [review]
Patch

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

::: content/canvas/src/WebGLContextGL.cpp
@@ +2683,5 @@
>  
>      GLint k = -1;
>      gl->fGetProgramiv(progname, LOCAL_GL_INFO_LOG_LENGTH, &k);
>      if (k == -1)
> +        return NS_OK; // GL error occurred, so bail before we do anything.

I would keep the ? from the comment: it is mysterious why this would ever happen.
Attachment #616347 - Flags: review?(bjacob) → review+
(In reply to Benoit Jacob [:bjacob] from comment #5)
> Comment on attachment 616347 [details] [diff] [review]
> Patch
> 
> Review of attachment 616347 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: content/canvas/src/WebGLContextGL.cpp
> @@ +2683,5 @@
> >  
> >      GLint k = -1;
> >      gl->fGetProgramiv(progname, LOCAL_GL_INFO_LOG_LENGTH, &k);
> >      if (k == -1)
> > +        return NS_OK; // GL error occurred, so bail before we do anything.
> 
> I would keep the ? from the comment: it is mysterious why this would ever
> happen.

If we shouldn't ever get this, we should at least crash out here on debug.
Attachment #616347 - Flags: feedback?(jgilbert)
Jeff, can you close the loop on this one? Trying to reduce the list of open conformance bugs.
Comment on attachment 616347 [details] [diff] [review]
Patch

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

::: content/canvas/src/WebGLContextGL.cpp
@@ +2683,5 @@
>  
>      GLint k = -1;
>      gl->fGetProgramiv(progname, LOCAL_GL_INFO_LOG_LENGTH, &k);
>      if (k == -1)
> +        return NS_OK; // GL error occurred, so bail before we do anything.

This needs to set retval to null with |retval.SetIsVoid(true)| before returning.
Attachment #616347 - Flags: feedback?(jgilbert) → feedback-
Attached patch patchSplinter Review
Attachment #616347 - Attachment is obsolete: true
Attachment #628468 - Flags: review?(bjacob)
Attachment #628468 - Flags: review?(bjacob) → review+
https://hg.mozilla.org/mozilla-central/rev/869482fb63a0
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: