Changeset 52164 in webkit
- Timestamp:
- Dec 15, 2009 11:08:14 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r52159 r52164 1 2009-12-15 Kenneth Russell <kbr@google.com> 2 3 Reviewed by Darin Fisher. 4 5 Don't allow default framebuffer to be mutated 6 https://bugs.webkit.org/show_bug.cgi?id=32391 7 8 * fast/canvas/webgl/error-reporting-expected.txt: 9 * fast/canvas/webgl/null-object-behaviour-expected.txt: 10 * fast/canvas/webgl/script-tests/error-reporting.js: 11 * fast/canvas/webgl/script-tests/null-object-behaviour.js: 12 1 13 2009-12-15 Chris Fleizach <cfleizach@apple.com> 2 14 -
trunk/LayoutTests/fast/canvas/webgl/error-reporting-expected.txt
r51970 r52164 18 18 PASS context.getError() is context.INVALID_VALUE 19 19 PASS context.getError() is context.NO_ERROR 20 Testing attempts to manipulate the default framebuffer 21 PASS context.bindFramebuffer(context.FRAMEBUFFER, 0) is undefined. 22 PASS context.getError() is context.NO_ERROR 23 PASS context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0) is undefined. 24 PASS context.getError() is context.INVALID_OPERATION 25 PASS context.getError() is context.NO_ERROR 26 PASS context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0) is undefined. 27 PASS context.getError() is context.INVALID_OPERATION 28 PASS context.getError() is context.NO_ERROR 20 29 PASS successfullyParsed is true 21 30 -
trunk/LayoutTests/fast/canvas/webgl/null-object-behaviour-expected.txt
r51970 r52164 17 17 PASS context.bindRenderbuffer(context.RENDERBUFFER, 0) is undefined. 18 18 PASS context.bindTexture(context.TEXTURE_2D, 0) is undefined. 19 PASS context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0) threw exception GL error 1282 in framebufferRenderbuffer. 20 PASS context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0) threw exception GL error 1282 in framebufferTexture2D. 19 21 PASS context.getProgramParameter(undefined, 0) threw exception GL error 1282 in getProgramParameter. 20 22 PASS context.getProgramInfoLog(undefined, 0) threw exception GL error 1282 in getProgramInfoLog. -
trunk/LayoutTests/fast/canvas/webgl/script-tests/error-reporting.js
r51970 r52164 37 37 shouldBe("context.getError()", "context.NO_ERROR"); 38 38 39 // FIXME: the following tests don't work properly yet 40 // https://bugs.webkit.org/show_bug.cgi?id=32391 41 // debug("Testing attempts to manipulate the default framebuffer"); 42 // shouldBeUndefined("context.bindFramebuffer(context.FRAMEBUFFER, 0)"); 43 // shouldBe("context.getError()", "context.NO_ERROR"); 44 // shouldBeUndefined("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0)"); 45 // // Synthetic OpenGL error 46 // shouldBe("context.getError()", "context.INVALID_OPERATION"); 47 // // Error state should be clear by this point 48 // shouldBe("context.getError()", "context.NO_ERROR"); 49 // shouldBeUndefined("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0)"); 50 // // Synthetic OpenGL error 51 // shouldBe("context.getError()", "context.INVALID_OPERATION"); 52 // // Error state should be clear by this point 53 // shouldBe("context.getError()", "context.NO_ERROR"); 39 debug("Testing attempts to manipulate the default framebuffer"); 40 shouldBeUndefined("context.bindFramebuffer(context.FRAMEBUFFER, 0)"); 41 shouldBe("context.getError()", "context.NO_ERROR"); 42 shouldBeUndefined("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0)"); 43 // Synthetic OpenGL error 44 shouldBe("context.getError()", "context.INVALID_OPERATION"); 45 // Error state should be clear by this point 46 shouldBe("context.getError()", "context.NO_ERROR"); 47 shouldBeUndefined("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0)"); 48 // Synthetic OpenGL error 49 shouldBe("context.getError()", "context.INVALID_OPERATION"); 50 // Error state should be clear by this point 51 shouldBe("context.getError()", "context.NO_ERROR"); 54 52 55 53 successfullyParsed = true; -
trunk/LayoutTests/fast/canvas/webgl/script-tests/null-object-behaviour.js
r51970 r52164 19 19 shouldBeUndefined("context.bindRenderbuffer(context.RENDERBUFFER, 0)"); 20 20 shouldBeUndefined("context.bindTexture(context.TEXTURE_2D, 0)"); 21 // FIXME: the following two tests should state shouldThrow, not shouldBeUndefined 22 // https://bugs.webkit.org/show_bug.cgi?id=32391 23 // shouldBeUndefined("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0)"); 24 // shouldBeUndefined("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0)"); 21 // The following two throw exceptions because conceptually no 22 // framebuffer is bound at this point. In reality the WebGL 23 // implementation's internal framebuffer is bound, but we can't allow 24 // user code to manipulate it. 25 shouldThrow("context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0)"); 26 shouldThrow("context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0)"); 25 27 shouldThrow("context.getProgramParameter(undefined, 0)"); 26 28 shouldThrow("context.getProgramInfoLog(undefined, 0)"); -
trunk/WebCore/ChangeLog
r52163 r52164 1 2009-12-15 Kenneth Russell <kbr@google.com> 2 3 Reviewed by Darin Fisher. 4 5 Don't allow default framebuffer to be mutated 6 https://bugs.webkit.org/show_bug.cgi?id=32391 7 8 * html/canvas/WebGLRenderingContext.cpp: 9 (WebCore::WebGLRenderingContext::framebufferRenderbuffer): 10 (WebCore::WebGLRenderingContext::framebufferTexture2D): 11 * platform/graphics/mac/GraphicsContext3DMac.cpp: 12 (WebCore::GraphicsContext3D::bindFramebuffer): 13 1 14 2009-12-15 Zoltan Horvath <zoltan@webkit.org> 2 15 -
trunk/WebCore/html/canvas/WebGLRenderingContext.cpp
r51970 r52164 711 711 return; 712 712 } 713 // Don't allow the default framebuffer to be mutated; all current 714 // implementations use an FBO internally in place of the default 715 // FBO. 716 if (!m_framebufferBinding || !m_framebufferBinding->object()) { 717 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 718 return; 719 } 713 720 m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer); 714 721 cleanupAfterGraphicsCall(false); … … 719 726 UNUSED_PARAM(ec); 720 727 if (texture && texture->context() != this) { 728 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 729 return; 730 } 731 // Don't allow the default framebuffer to be mutated; all current 732 // implementations use an FBO internally in place of the default 733 // FBO. 734 if (!m_framebufferBinding || !m_framebufferBinding->object()) { 721 735 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 722 736 return; -
trunk/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
r51970 r52164 263 263 { 264 264 ensureContext(m_contextObj); 265 ::glBindFramebufferEXT(target, buffer? (GLuint) buffer->object() : m_fbo);265 ::glBindFramebufferEXT(target, (buffer && buffer->object()) ? (GLuint) buffer->object() : m_fbo); 266 266 } 267 267 -
trunk/WebKit/chromium/ChangeLog
r52161 r52164 1 2009-12-15 Kenneth Russell <kbr@google.com> 2 3 Reviewed by Darin Fisher. 4 5 Don't allow default framebuffer to be mutated 6 https://bugs.webkit.org/show_bug.cgi?id=32391 7 8 * src/GraphicsContext3D.cpp: 9 (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal): 10 (WebCore::GraphicsContext3DInternal::reshape): 11 (WebCore::GraphicsContext3DInternal::beginPaint): 12 (WebCore::GraphicsContext3DInternal::bindFramebuffer): 13 (WebCore::GraphicsContext3D::bindFramebuffer): 14 1 15 2009-12-15 Dimitri Glazkov <dglazkov@chromium.org> 2 16 -
trunk/WebKit/chromium/src/GraphicsContext3D.cpp
r51970 r52164 117 117 void bindBuffer(unsigned long target, 118 118 WebGLBuffer* buffer); 119 void bindFramebuffer(unsigned long target, 120 WebGLFramebuffer* framebuffer); 119 121 void bindTexture(unsigned long target, 120 122 WebGLTexture* texture); … … 134 136 unsigned int m_depthBuffer; 135 137 unsigned int m_cachedWidth, m_cachedHeight; 138 139 // For tracking which FBO is bound 140 unsigned int m_boundFBO; 136 141 137 142 #ifdef FLIP_FRAMEBUFFER_VERTICALLY … … 235 240 , m_fbo(0) 236 241 , m_depthBuffer(0) 242 , m_boundFBO(0) 237 243 #ifdef FLIP_FRAMEBUFFER_VERTICALLY 238 244 , m_scanline(0) … … 595 601 596 602 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); 603 m_boundFBO = m_fbo; 597 604 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_depthBuffer); 598 605 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width, height); … … 682 689 ImageBuffer* imageBuffer = canvas->buffer(); 683 690 unsigned char* pixels = 0; 691 bool mustRestoreFBO = (m_boundFBO != m_fbo); 692 if (mustRestoreFBO) 693 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); 684 694 #if PLATFORM(SKIA) 685 695 const SkBitmap* canvasBitmap = imageBuffer->context()->platformContext()->bitmap(); … … 731 741 #endif 732 742 743 if (mustRestoreFBO) 744 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); 745 733 746 #ifdef FLIP_FRAMEBUFFER_VERTICALLY 734 747 if (pixels) … … 787 800 m_boundArrayBuffer = bufID; 788 801 glBindBuffer(target, bufID); 802 } 803 804 void GraphicsContext3DInternal::bindFramebuffer(unsigned long target, 805 WebGLFramebuffer* framebuffer) 806 { 807 makeContextCurrent(); 808 GLuint id = EXTRACT(framebuffer); 809 if (!id) 810 id = m_fbo; 811 glBindFramebufferEXT(target, id); 812 m_boundFBO = id; 789 813 } 790 814 … … 1191 1215 } 1192 1216 1193 GL_SAME_METHOD_2_X2(BindFramebufferEXT, bindFramebuffer, unsigned long, WebGLFramebuffer*) 1217 void GraphicsContext3D::bindFramebuffer(unsigned long target, WebGLFramebuffer* framebuffer) 1218 { 1219 m_internal->bindFramebuffer(target, framebuffer); 1220 } 1194 1221 1195 1222 GL_SAME_METHOD_2_X2(BindRenderbufferEXT, bindRenderbuffer, unsigned long, WebGLRenderbuffer*)
Note: See TracChangeset
for help on using the changeset viewer.