Closed Bug 834654 Opened 11 years ago Closed 5 years ago

WebGL draws point sprites upside down

Categories

(Core :: Graphics: CanvasWebGL, defect)

All
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: thundercat, Unassigned)

References

Details

(Whiteboard: webgl-conformance [apps watch list])

User Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0
Build ID: 20130116073211

Steps to reproduce:

Fails conformance: https://www.khronos.org/registry/webgl/sdk/tests/conformance/glsl/variables/gl-pointcoord.html

Unable to use gpu acceleration (WebGL) to draw sprites.


Actual results:

Draws all sprites upside down. Likely gl_PointCoord in shader has reversed Y axis


Expected results:

Pass conformance, draw sprites right way up
OS: All → Gonk (Firefox OS)
Correct UA:

User Agent: Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0
Checks gl_PointCoord and gl_PointSize
 
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
PASS gl is non-null.
PASS gl.getError() is gl.NO_ERROR
PASS width is height
PASS maxPointSize >= 1 is true
PASS Math.floor(maxPointSize) >= 1 is true
PASS maxPointSize % 1 == 0 is true
PASS gl.getError() is gl.NO_ERROR
 
FAIL pixel 32,32 should be 1,253,0
at (0, 0) expected: 1,253,0 was 2,2,0
FAIL pixel 48,32 should be 65,253,0
at (0, 0) expected: 65,253,0 was 66,2,0
FAIL pixel 64,32 should be 129,253,0
at (0, 0) expected: 129,253,0 was 129,2,0
FAIL pixel 80,32 should be 193,253,0
at (0, 0) expected: 193,253,0 was 193,2,0
FAIL pixel 32,48 should be 1,189,0
at (0, 0) expected: 1,189,0 was 2,66,0
FAIL pixel 48,48 should be 65,189,0
at (0, 0) expected: 65,189,0 was 66,66,0
FAIL pixel 64,48 should be 129,189,0
at (0, 0) expected: 129,189,0 was 129,66,0
FAIL pixel 80,48 should be 193,189,0
at (0, 0) expected: 193,189,0 was 193,66,0
PASS pixel 32,64 should be 1,125,0
PASS pixel 48,64 should be 65,125,0
PASS pixel 64,64 should be 129,125,0
PASS pixel 80,64 should be 193,125,0
FAIL pixel 32,80 should be 1,61,0
at (0, 0) expected: 1,61,0 was 2,193,0
FAIL pixel 48,80 should be 65,61,0
at (0, 0) expected: 65,61,0 was 66,193,0
FAIL pixel 64,80 should be 129,61,0
at (0, 0) expected: 129,61,0 was 129,193,0
FAIL pixel 80,80 should be 193,61,0
at (0, 0) expected: 193,61,0 was 193,193,0
 
FAIL pixel 160,32 should be 1,253,0
at (0, 0) expected: 1,253,0 was 2,2,0
FAIL pixel 176,32 should be 65,253,0
at (0, 0) expected: 65,253,0 was 66,2,0
FAIL pixel 192,32 should be 129,253,0
at (0, 0) expected: 129,253,0 was 129,2,0
FAIL pixel 208,32 should be 193,253,0
at (0, 0) expected: 193,253,0 was 193,2,0
FAIL pixel 160,48 should be 1,189,0
at (0, 0) expected: 1,189,0 was 2,66,0
FAIL pixel 176,48 should be 65,189,0
at (0, 0) expected: 65,189,0 was 66,66,0
FAIL pixel 192,48 should be 129,189,0
at (0, 0) expected: 129,189,0 was 129,66,0
FAIL pixel 208,48 should be 193,189,0
at (0, 0) expected: 193,189,0 was 193,66,0
PASS pixel 160,64 should be 1,125,0
PASS pixel 176,64 should be 65,125,0
PASS pixel 192,64 should be 129,125,0
PASS pixel 208,64 should be 193,125,0
FAIL pixel 160,80 should be 1,61,0
at (0, 0) expected: 1,61,0 was 2,193,0
FAIL pixel 176,80 should be 65,61,0
at (0, 0) expected: 65,61,0 was 66,193,0
FAIL pixel 192,80 should be 129,61,0
at (0, 0) expected: 129,61,0 was 129,193,0
FAIL pixel 208,80 should be 193,61,0
at (0, 0) expected: 193,61,0 was 193,193,0
 
FAIL pixel 32,160 should be 1,253,0
at (0, 0) expected: 1,253,0 was 2,2,0
FAIL pixel 48,160 should be 65,253,0
at (0, 0) expected: 65,253,0 was 66,2,0
FAIL pixel 64,160 should be 129,253,0
at (0, 0) expected: 129,253,0 was 129,2,0
FAIL pixel 80,160 should be 193,253,0
at (0, 0) expected: 193,253,0 was 193,2,0
FAIL pixel 32,176 should be 1,189,0
at (0, 0) expected: 1,189,0 was 2,66,0
FAIL pixel 48,176 should be 65,189,0
at (0, 0) expected: 65,189,0 was 66,66,0
FAIL pixel 64,176 should be 129,189,0
at (0, 0) expected: 129,189,0 was 129,66,0
FAIL pixel 80,176 should be 193,189,0
at (0, 0) expected: 193,189,0 was 193,66,0
PASS pixel 32,192 should be 1,125,0
PASS pixel 48,192 should be 65,125,0
PASS pixel 64,192 should be 129,125,0
PASS pixel 80,192 should be 193,125,0
FAIL pixel 32,208 should be 1,61,0
at (0, 0) expected: 1,61,0 was 2,193,0
FAIL pixel 48,208 should be 65,61,0
at (0, 0) expected: 65,61,0 was 66,193,0
FAIL pixel 64,208 should be 129,61,0
at (0, 0) expected: 129,61,0 was 129,193,0
FAIL pixel 80,208 should be 193,61,0
at (0, 0) expected: 193,61,0 was 193,193,0
 
FAIL pixel 160,160 should be 1,253,0
at (0, 0) expected: 1,253,0 was 2,2,0
FAIL pixel 176,160 should be 65,253,0
at (0, 0) expected: 65,253,0 was 66,2,0
FAIL pixel 192,160 should be 129,253,0
at (0, 0) expected: 129,253,0 was 129,2,0
FAIL pixel 208,160 should be 193,253,0
at (0, 0) expected: 193,253,0 was 193,2,0
FAIL pixel 160,176 should be 1,189,0
at (0, 0) expected: 1,189,0 was 2,66,0
FAIL pixel 176,176 should be 65,189,0
at (0, 0) expected: 65,189,0 was 66,66,0
FAIL pixel 192,176 should be 129,189,0
at (0, 0) expected: 129,189,0 was 129,66,0
FAIL pixel 208,176 should be 193,189,0
at (0, 0) expected: 193,189,0 was 193,66,0
PASS pixel 160,192 should be 1,125,0
PASS pixel 176,192 should be 65,125,0
PASS pixel 192,192 should be 129,125,0
PASS pixel 208,192 should be 193,125,0
FAIL pixel 160,208 should be 1,61,0
at (0, 0) expected: 1,61,0 was 2,193,0
FAIL pixel 176,208 should be 65,61,0
at (0, 0) expected: 65,61,0 was 66,193,0
FAIL pixel 192,208 should be 129,61,0
at (0, 0) expected: 129,61,0 was 129,193,0
FAIL pixel 208,208 should be 193,61,0
at (0, 0) expected: 193,61,0 was 193,193,0
PASS successfullyParsed is true
 
TEST COMPLET
Component: General → Canvas: WebGL
Product: Boot2Gecko → Core
Version: unspecified → Trunk
OS: XP x86 SP3
Video: onboard ATI Radeon 3000
Browser: Aurora 20.0a2 (2013-02-01), Cometbird 11(Firefox derivate)

Right, I did some mucking around with this issue and have traced the problem to the option 'webgl.prefer-native-gl:true'. I somewhat suspect it to be an issue with faulty ATI opengl drivers. It wouldn't be the first time they mess up.

I will do further testing with other browsers, maybe update drivers to see if that clears anything and report back.
Interesting -- we've seen this bug with ATI drivers on MacOS X, but I don't think we've ever seen it with Windows.  Bug 769812 has code that can probably be turned on for the broken ATI drivers on windows as well.
Depends on: 769812
OS: Gonk (Firefox OS) → Windows XP
Ah, doh, because we never test prefer-native-gl: true on windows (we really should start, if we can!), we never saw this there.  Looks like this is a general ATI driver bug.  I wonder how that bug has been in their drivers for this long?!  I guess they can't change it maybe because content will stop working that's working around it?  Ugh.
This is a multi-OS issue:

Occurs on Firefox OS Test Drivers phone (Boot to Gecko)
Also occurs on some MacOS X (though this may be dealt with by Bug 769812)
Also Linux (though not most) - sorry don't have exact details of drivers/gpu :(

Doesn't occur on HTC One X in Firefox as a browser.

Can anyone confirm if it happens on the release version of the FirefoxOS phone? Here its quite an issue as it gives quite a dramatic boost in performance; but drawing the sprites upside down takes most of that experience away.
Windows and Mac are separate bugs (different drivers). I'd rather have only Windows discussed here and a separate bug filed for each other affected OS.

*** Windows ***

Could you please indicate which version of the ATI driver you're using? As shown in about:support, Graphics section.

See this code:
http://hg.mozilla.org/mozilla-central/file/tip/content/canvas/src/WebGLContextValidate.cpp#l974

In order to have point sprites correctly working we need to call glEnable(GL_POINT_SPRITE) but we don't do it at the moment on ATI cards on Windows because that used to crash.

Please do the following to see if it fixes it: go to about:config and set gfx.work-around-driver-bugs to false. Then restart Firefox and retry. If that works (and doesnt crash) then we'll know that your driver version doesn't need this work-around anymore and we'll just do the 
glEnable(GL_POINT_SPRITE) call on driver versions >= it.

If that doesn't fix it, it could  be that your ATI Windows driver has the same bug as we observed on Mac (see below) in which case the same work-around would probably work.

*** Mac ***

Please indicate your precise Mac OS version.

See this code:
http://hg.mozilla.org/mozilla-central/file/tip/content/canvas/src/WebGLContextValidate.cpp#l992

There we are working around a bug: the Mac ATI driver is drawing point sprites upside-down, so we work around it by intentionally telling it to draw them upside-down (so that they end up in the correct orientation). It could be that your Mac ATI driver doesn't need this work-around. Again, you can test this by going to about:config and setting gfx.work-around-driver-bugs to false. Then restart Firefox and retry.
Summary: WebGL draws point sprites upside down → WebGL draws point sprites upside down (ATI)
Whiteboard: webgl-conformance
I originally raised this bug as a Firefox OS (mobile) bug, and it has since evolved, should I re-raise a bug for that OS then?
Yes, please file a separate bug for each OS.
Summary: WebGL draws point sprites upside down (ATI) → WebGL draws point sprites upside down
Whiteboard: webgl-conformance → webgl-conformance [apps watch list]
Hi.  Should this bug be closed?  Is there a corresponding one that Tech Evangelism should be tracking.
Flags: needinfo?(thundercat)
Mark - Do you have input on how important this is and if it needs to be moved forward with a higher priority?  Should it be changed from 'unconfirmed' status?
Flags: needinfo?(mcoggins)
This bug prevents this popular, well-reviewed desktop game:

https://marketplace.firefox.com/app/illyriad

from moving to Firefox OS.

Here's the community website for the app:

http://www.illyriad.co.uk/

It would be nice to have it on the platform.
Flags: needinfo?(mcoggins)
This needs to get resolved.  In bug 769812, we worked around this issue on ATI MacOS X drivers.  It looks like there's further work to be done:

- The issue may be fixed with some newer versions of drivers on OSX.

- The issue may exist on Windows + ATI/AMD, for some version of drivers.

- The issue may exist on mobile with Adreno gfx (formerly ATI), again for some version of drivers.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Is this bug still valid?
Flags: needinfo?(thundercat) → needinfo?(vladimir)
Flags: needinfo?(vladimir)
I no longer have a working environment to reproduce this (have to rebuild Firefox phone) however the conformance test should be able to reproduce it for you if it is still incorrect: https://www.khronos.org/registry/webgl/sdk/tests/conformance/glsl/variables/gl-pointcoord.html

We have moved away from using point sprites to using triangle quads for several reasons, so am happy if marked as can't reproduce. However it may be worth trying the conformance test first on a Firefox OS device.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.