Closed Bug 689136 Opened 13 years ago Closed 13 years ago

gl.depthmask(false) produces unexpected result

Categories

(Core :: Graphics: CanvasWebGL, defect)

7 Branch
x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: trigrou, Unassigned)

References

Details

Attachments

(6 files)

Attached file zbug.zip (deleted) —
User Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/11.10 Chromium/15.0.865.0 Chrome/15.0.865.0 Safari/535.2 Steps to reproduce: using the webpage in the zip Actual results: It display a plane and a green cube on chrome. If you move the mouse to change the camera it looks normal. On firefox I see a green cube but not the plane and when I change the camera with the mouse, there is a kind of z bug Expected results: It should work like in chrome meaning viewing green cube with the plane.
Attached image gl calls to display one frame (deleted) —
This was obtained by editing osg-debug.js to comment out the requestAnimationFrame call to draw only one frame. Firefox renders a gray frame, no green cube.
Chrome renders the scene with the green cube.
generated by: egrep -i draw\|clear\|depth\|buffer firefox-trace-trigrou | egrep -v EXTENSIONS\|glX > firefox-simple
egrep -i draw\|clear\|depth\|buffer chrome-trace-trigrou | egrep -v EXTENSIONS\|glX > chrome-simple
Right at the beginning, Firefox does glClearDepth(1) while Chrome does glClearDepth(0). That would explain it.
Drawingbuffer default values are described here: http://www.khronos.org/registry/webgl/specs/latest/#2.2 Renderbuffer default values are described here: http://www.khronos.org/registry/webgl/specs/latest/#4.1 in both cases, the default value of depth is 1, not 0. -> Chrome bug.
Current WebKit sources look fine, and the script does call clearDepth, so this seems to be a red herring. Still CC'ing Gregg as there might be a performance issue if WebKit is uselessly clearing the depth buffer with zero value.
Further investigation: * the difference between the clear-calls between firefox and chrome comes from the fact that firefox clears the whole drawingbuffer and then remembers that it's cleared and that the clear-values are the default values so that it skips subsequent clear-calls. * reloading the page in firefox makes it work, and putting a alert() before the clear() call also makes it work, so there must be a firefox bug.
Component: General → Graphics
Product: Firefox → Core
QA Contact: general → thebes
Component: Graphics → Canvas: WebGL
QA Contact: thebes → canvas.webgl
Status: UNCONFIRMED → NEW
Ever confirmed: true
Almost certainly a dupe of 677543. Patch coming there. Will dupe when i'm 100% sure.
Depends on: 677543
Any workaround ? I tried to use a gl.clearColor(0.01, 0.01, 0.01, 0.01) and gl.clear(allbits) at the begining of the frame but it does not help. Any hints ?
As discussed with Cedric: he was relying on gl.clear not being affected by gl.depthmask. The GLES 2.0.25 spec page 103 says that gl.clear is affected by the masks.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: