Bug 171359 - Uniform count in one WebGL shader program prevents unrelated shader program from drawing
Summary: Uniform count in one WebGL shader program prevents unrelated shader program f...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: Safari 10
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-04-26 17:49 PDT by Andrea Faulds
Modified: 2019-09-18 13:34 PDT (History)
4 users (show)

See Also:


Attachments
The test case (5.26 KB, text/html)
2017-04-26 17:49 PDT, Andrea Faulds
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrea Faulds 2017-04-26 17:49:26 PDT
Created attachment 308315 [details]
The test case

The test case (attached: minimal.html) is a small WebGL application. It has two shader programs with their own vertex and fragment shaders. It uses drawArrays with one piece of geometry and the first shader program, then uses drawArrays with another piece of geometry and the other shader program.

In Firefox and Chrome (on macOS), and Microsoft Edge (on Windows 10), both draws succeed. You see a black field with 50 small randomly scattered white squares (the first shader program), and a large red square (the second shader program).

In Safari Version 10.1 (12603.1.30.0.34) on macOS Sierra 10.12.4 (16E195) on a MacBook Air (13-inch, Mid 2013), and Safari on iOS 10.3.1 (14E304) on an iPhone 5S (NE433B/A), only the first draw works. You see only a black field with 50 small randomly scattered white squares (the first shader program). There is no large red square (the second shader program).

Removing either or both of these two lines from the first shader program's vertex shader will make the second draw work in Safari:

uniform vec2 uselessUniform1;
uniform float uselessUniform2;

That is, the number of uniforms in the first shader program affects whether the /second/ shader program will render successfully.

Whether or not the uniforms are actually in use seems to have no effect. The original program, from which this is cut down, actually made use of these uniforms, and had more of them.

Whether or not the first shader is rendered (i.e. commenting out its drawArrays call) also has no effect on the second shader not being rendered.
Comment 1 Radar WebKit Bug Importer 2017-04-26 18:24:15 PDT
<rdar://problem/31853372>
Comment 2 Andrea Faulds 2017-04-27 01:54:06 PDT
If there are one or two other bugs in Radar from me yesterday about the same thing, I apologise. The Apple Bug Report website deauthenticated me no less than twice while trying to report it, then refused to function at all afterwards, and so I've no idea if either bug report there got through.
Comment 3 Jon Lee 2017-05-02 10:13:23 PDT
(In reply to Andrea Faulds from comment #2)
> If there are one or two other bugs in Radar from me yesterday about the same
> thing, I apologise. The Apple Bug Report website deauthenticated me no less
> than twice while trying to report it, then refused to function at all
> afterwards, and so I've no idea if either bug report there got through.

Did the report fail to submit, or were you able to see any bug #'s? If not, the reports probably did not go through. Sorry about that.

You can update this bug and we'll see it both here and in the bug cited above.
Comment 4 Andrea Faulds 2017-05-02 11:56:27 PDT
(In reply to Jon Lee from comment #3)
> (In reply to Andrea Faulds from comment #2)
> > If there are one or two other bugs in Radar from me yesterday about the same
> > thing, I apologise. The Apple Bug Report website deauthenticated me no less
> > than twice while trying to report it, then refused to function at all
> > afterwards, and so I've no idea if either bug report there got through.
> 
> Did the report fail to submit, or were you able to see any bug #'s? If not,
> the reports probably did not go through. Sorry about that.
> 
> You can update this bug and we'll see it both here and in the bug cited
> above.

After being able to log in later, I couldn't see any submitted bug, so I assume both failed to submit.

But it doesn't matter, since there's nothing in those bug reports that's missing from this one, I think.
Comment 5 Andrea Faulds 2019-09-18 13:34:35 PDT
My code was actually broken in a way I forgot (I misunderstood some aspect of the OpenGL state machine). It was just luck it “worked” in other browser engines.