Closed Bug 981240 Opened 11 years ago Closed 11 years ago

GL_DEPTH_ATTACHMENT gets stuck (can't unset it) in WebGL

Categories

(Core :: Graphics: CanvasWebGL, defect)

27 Branch
x86_64
Windows 8.1
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: esenthel, Assigned: jgilbert)

References

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Tablet PC 2.0; ASU2JS; rv:11.0) like Gecko Steps to reproduce: I'm a game engine developer currently using Emscripten to port my engine to web. I've noticed that there's a bug in Firefox (it works on Chrome and Opera) in the following scenario. Setting a depth render buffer makes it stuck, and next call to unset it probably doesn't work, which then causes issue of GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT (when trying to set a color render buffer without the depth buffer). Here's the C++ code: void test() { GLuint FBO, _txtr, _small, _depth; glGenFramebuffers(1, &FBO); glBindFramebuffer(GL_FRAMEBUFFER, FBO); glGenTextures(1, &_txtr); glBindTexture(GL_TEXTURE_2D, _txtr); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 150, 150, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glGenTextures(1, &_small); glBindTexture(GL_TEXTURE_2D, _small); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 75, 75, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glGenRenderbuffers(1, &_depth); glBindRenderbuffer (GL_RENDERBUFFER, _depth); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, 150, 150); if(glGetError()!=GL_NO_ERROR)printf("glGetError\n"); glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D , _txtr, 0); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT , GL_RENDERBUFFER, _depth); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0); if(glGetError()!=GL_NO_ERROR)printf("glGetError\n"); GLenum error =glCheckFramebufferStatus(GL_FRAMEBUFFER); if( error!=GL_FRAMEBUFFER_COMPLETE) { printf("err %d \n", error); } if(glGetError()!=GL_NO_ERROR)printf("glGetError\n"); glBindFramebuffer(GL_FRAMEBUFFER, FBO); glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D , _small, 0); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT , GL_RENDERBUFFER, 0); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0); if(glGetError()!=GL_NO_ERROR)printf("glGetError\n"); error =glCheckFramebufferStatus(GL_FRAMEBUFFER); if( error!=GL_FRAMEBUFFER_COMPLETE) { printf("err %d \n", error); } } Actual results: after trying to set the framebuffer for the 2nd time with GL_DEPTH_ATTACHMENT cleared to 0 I get GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT Expected results: I should get GL_FRAMEBUFFER_COMPLETE This works ok on Chrome/Opera but not on FF
Component: Untriaged → Canvas: WebGL
Product: Firefox → Core
You can see this bug live at this page: http://esenthel.com/site/webgl_test/Project.html (it's a temporary link for the work-in-progress demo that I'm making). You can see that it's working differently on Chrome/Opera and on Firefox due to this bug. On Chrome there's a nice bloom and glow effect, which you can't see on Firefox. the bloom and glow are done by downsampling the graphics to a smaller render target, because on FF it fails to setup the framebuffer, the entire downsampled data is set to zero, resulting in no bloom/glow. Hope this can be resolved quickly, as in a few days I'll be realeasing the Web support for my engine and make the demo public. Wish that Firefox users would have the same experience as Chrome users when trying the demo.
Neat. I'll check.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached file testcase
Assignee: nobody → jgilbert
Yep, this is pretty simple. Fix incoming.
Strangely, this doesn't reproduce on my linux desktop.
I checked Chromium Canary vs Nightly and I could see very little graphical difference.
Attached patch patchSplinter Review
Attachment #8388935 - Flags: review?(dglastonbury)
Comment on attachment 8388935 [details] [diff] [review] patch Review of attachment 8388935 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/canvas/src/WebGLFramebuffer.h @@ +57,5 @@ > bool HasAlpha() const; > bool IsReadableFloat() const; > > void SetTexImage(WebGLTexture* tex, GLenum target, GLint level); > + void SetRenderbuffer(WebGLRenderbuffer* rb); Good!
Attachment #8388935 - Flags: review?(dglastonbury) → review+
Thanks for the progress. I've moved the demo with the issue over here: http://www.esenthel.com/?id=live_demo (in case you need it for tests)
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
I'm going to REOPEN this, since I think it's important we add the testcase here.
Depends on: 1133161
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: