Changeset 57018 in webkit
- Timestamp:
- Apr 2, 2010 1:03:02 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r57015 r57018 1 2010-04-02 Zhenyao Mo <zmo@google.com> 2 3 Reviewed by Eric Seidel. 4 5 Implement and test new framebuffer object attachment behavior. 6 https://bugs.webkit.org/show_bug.cgi?id=35611 7 8 * fast/canvas/webgl/framebuffer-object-attachment-expected.txt: Added, test framebuffer object attachment behavior. 9 * fast/canvas/webgl/framebuffer-object-attachment.html: Added, framebuffer object attachment behavior. 10 * fast/canvas/webgl/script-tests/gl-object-get-calls.js: DEPTH_COMPONENT is no longer a valid input, use DEPTH_COMPONENT16 instead. 11 * platform/mac-snowleopard/Skipped: The bot does not support EXT_packed_depth_stencil, skip the framebuffer-object-attachment.html test. 12 1 13 2010-04-02 Zhenyao Mo <zmo@google.com> 2 14 -
trunk/LayoutTests/fast/canvas/webgl/script-tests/gl-object-get-calls.js
r51537 r57018 53 53 gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer); 54 54 shouldBe('gl.getError()', '0'); 55 gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT , 2, 2);55 gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, 2, 2); 56 56 shouldBe('gl.getError()', '0'); 57 57 gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, renderbuffer); -
trunk/LayoutTests/platform/mac-snowleopard/Skipped
r56605 r57018 114 114 # Color bitmap fonts not supported on Snow Leopard 115 115 platform/mac/fonts/color-bitmap.html 116 117 # Snow Leopard bot does not support EXT_packed_depth_stencil, which is required by WebGL. 118 # https://bugs.webkit.org/show_bug.cgi?id=36925 119 fast/canvas/webgl/framebuffer-object-attachment.html -
trunk/WebCore/ChangeLog
r57013 r57018 1 2010-04-02 Zhenyao Mo <zmo@google.com> 2 3 Reviewed by Eric Seidel. 4 5 Implement and test new framebuffer object attachment behavior. 6 https://bugs.webkit.org/show_bug.cgi?id=35611 7 8 Test: fast/canvas/webgl/framebuffer-object-attachment.html 9 10 * html/canvas/WebGLFramebuffer.cpp: Keep track of attached stencil/depth renderbuffers in WebGLFramebuffer. 11 (WebCore::WebGLFramebuffer::WebGLFramebuffer): 12 (WebCore::WebGLFramebuffer::setIsAttached): 13 * html/canvas/WebGLFramebuffer.h: Ditto. 14 (WebCore::WebGLFramebuffer::isDepthAttached): 15 (WebCore::WebGLFramebuffer::isStencilAttached): 16 (WebCore::WebGLFramebuffer::isDepthStencilAttached): 17 * html/canvas/WebGLRenderbuffer.cpp: Keep track of internalformat. 18 (WebCore::WebGLRenderbuffer::WebGLRenderbuffer): 19 * html/canvas/WebGLRenderbuffer.h: Ditto. 20 (WebCore::WebGLRenderbuffer::setInternalformat): 21 (WebCore::WebGLRenderbuffer::getInternalformat): 22 * html/canvas/WebGLRenderingContext.cpp: 23 (WebCore::WebGLRenderingContext::framebufferRenderbuffer): Detect stencil/depth buffer conflicts. 24 (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter): Handling DEPTH_STENCIL case. 25 (WebCore::WebGLRenderingContext::getRenderbufferParameter): Get correct WebGL internalformat. 26 (WebCore::WebGLRenderingContext::renderbufferStorage): Detect illegal enums. 27 * html/canvas/WebGLRenderingContext.idl: Add DEPTH_STENCIL enums. 28 * platform/graphics/GraphicsContext3D.h: Add DEPTH_STENCIL enums. 29 (WebCore::GraphicsContext3D::): 30 * platform/graphics/mac/GraphicsContext3DMac.cpp: Map to correct DEPTH_STENCIL format. 31 (WebCore::GraphicsContext3D::framebufferRenderbuffer): 32 (WebCore::GraphicsContext3D::renderbufferStorage): 33 (WebCore::GraphicsContext3D::getFramebufferAttachmentParameteriv): 34 1 35 2010-04-02 Kent Tamura <tkent@chromium.org> 2 36 -
trunk/WebCore/html/canvas/WebGLFramebuffer.cpp
r50725 r57018 40 40 WebGLFramebuffer::WebGLFramebuffer(WebGLRenderingContext* ctx) 41 41 : CanvasObject(ctx) 42 , m_isDepthAttached(false) 43 , m_isStencilAttached(false) 44 , m_isDepthStencilAttached(false) 42 45 { 43 46 setObject(context()->graphicsContext3D()->createFramebuffer()); 47 } 48 49 void WebGLFramebuffer::setIsAttached(unsigned long attachment, bool isAttached) 50 { 51 switch (attachment) { 52 case GraphicsContext3D::DEPTH_ATTACHMENT: 53 m_isDepthAttached = isAttached; 54 break; 55 case GraphicsContext3D::STENCIL_ATTACHMENT: 56 m_isStencilAttached = isAttached; 57 break; 58 case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT: 59 m_isDepthStencilAttached = isAttached; 60 break; 61 } 44 62 } 45 63 -
trunk/WebCore/html/canvas/WebGLFramebuffer.h
r50725 r57018 40 40 static PassRefPtr<WebGLFramebuffer> create(WebGLRenderingContext*); 41 41 42 void setIsAttached(unsigned long attachment, bool isAttached); 43 44 bool isDepthAttached() const { return m_isDepthAttached; } 45 bool isStencilAttached() const { return m_isStencilAttached; } 46 bool isDepthStencilAttached() const { return m_isDepthStencilAttached; } 47 42 48 protected: 43 49 WebGLFramebuffer(WebGLRenderingContext*); 44 50 45 51 virtual void _deleteObject(Platform3DObject); 52 53 private: 54 bool m_isDepthAttached; 55 bool m_isStencilAttached; 56 bool m_isDepthStencilAttached; 46 57 }; 47 58 -
trunk/WebCore/html/canvas/WebGLRenderbuffer.cpp
r51348 r57018 45 45 WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContext* ctx) 46 46 : CanvasObject(ctx) 47 , m_internalformat(GraphicsContext3D::RGBA4) 47 48 { 48 49 setObject(context()->graphicsContext3D()->createRenderbuffer()); … … 51 52 WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContext* ctx, Platform3DObject obj) 52 53 : CanvasObject(ctx) 54 , m_internalformat(GraphicsContext3D::RGBA4) 53 55 { 54 56 setObject(obj, false); -
trunk/WebCore/html/canvas/WebGLRenderbuffer.h
r51348 r57018 44 44 static PassRefPtr<WebGLRenderbuffer> create(WebGLRenderingContext*, Platform3DObject renderbuffer); 45 45 46 void setInternalformat(unsigned long internalformat) { m_internalformat = internalformat; } 47 unsigned long getInternalformat() const { return m_internalformat; } 48 46 49 protected: 47 50 WebGLRenderbuffer(WebGLRenderingContext*); … … 49 52 50 53 virtual void _deleteObject(Platform3DObject); 54 55 private: 56 unsigned long m_internalformat; 51 57 }; 52 58 -
trunk/WebCore/html/canvas/WebGLRenderingContext.cpp
r55514 r57018 791 791 return; 792 792 } 793 if (buffer->object()) { 794 bool isConflicted = false; 795 bool isDepthOrStencil = true; 796 switch (attachment) { 797 case GraphicsContext3D::DEPTH_ATTACHMENT: 798 if (m_framebufferBinding->isDepthStencilAttached() || m_framebufferBinding->isStencilAttached()) 799 isConflicted = true; 800 if (buffer->getInternalformat() != GraphicsContext3D::DEPTH_COMPONENT16) 801 isConflicted = true; 802 break; 803 case GraphicsContext3D::STENCIL_ATTACHMENT: 804 if (m_framebufferBinding->isDepthStencilAttached() || m_framebufferBinding->isDepthAttached()) 805 isConflicted = true; 806 if (buffer->getInternalformat() != GraphicsContext3D::STENCIL_INDEX8) 807 isConflicted = true; 808 break; 809 case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT: 810 if (m_framebufferBinding->isDepthAttached() || m_framebufferBinding->isStencilAttached()) 811 isConflicted = true; 812 if (buffer->getInternalformat() != GraphicsContext3D::DEPTH_STENCIL) 813 isConflicted = true; 814 break; 815 default: 816 isDepthOrStencil = false; 817 } 818 if (isConflicted) { 819 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 820 return; 821 } 822 if (isDepthOrStencil) 823 m_framebufferBinding->setIsAttached(attachment, true); 824 } else { // Detach 825 switch (attachment) { 826 case GraphicsContext3D::DEPTH_ATTACHMENT: 827 case GraphicsContext3D::STENCIL_ATTACHMENT: 828 case GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT: 829 m_framebufferBinding->setIsAttached(attachment, false); 830 } 831 } 793 832 m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer); 794 833 cleanupAfterGraphicsCall(false); … … 898 937 || (attachment != GraphicsContext3D::COLOR_ATTACHMENT0 899 938 && attachment != GraphicsContext3D::DEPTH_ATTACHMENT 900 && attachment != GraphicsContext3D::STENCIL_ATTACHMENT) 939 && attachment != GraphicsContext3D::STENCIL_ATTACHMENT 940 && attachment != GraphicsContext3D::DEPTH_STENCIL_ATTACHMENT) 901 941 || (pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 902 942 && pname != GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME … … 1177 1217 return WebGLGetInfo(static_cast<long>(value)); 1178 1218 case GraphicsContext3D::RENDERBUFFER_INTERNAL_FORMAT: 1179 m_context->getRenderbufferParameteriv(target, pname, &value); 1180 return WebGLGetInfo(static_cast<unsigned long>(value)); 1219 if (!m_renderbufferBinding) { 1220 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 1221 return WebGLGetInfo(); 1222 } 1223 return WebGLGetInfo(m_renderbufferBinding->getInternalformat()); 1181 1224 default: 1182 1225 m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); … … 1560 1603 void WebGLRenderingContext::renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height) 1561 1604 { 1562 m_context->renderbufferStorage(target, internalformat, width, height); 1563 cleanupAfterGraphicsCall(false); 1605 switch (internalformat) { 1606 case GraphicsContext3D::DEPTH_COMPONENT16: 1607 case GraphicsContext3D::RGBA4: 1608 case GraphicsContext3D::RGB5_A1: 1609 case GraphicsContext3D::RGB565: 1610 case GraphicsContext3D::STENCIL_INDEX8: 1611 case GraphicsContext3D::DEPTH_STENCIL: 1612 m_context->renderbufferStorage(target, internalformat, width, height); 1613 if (m_renderbufferBinding) 1614 m_renderbufferBinding->setInternalformat(internalformat); 1615 cleanupAfterGraphicsCall(false); 1616 break; 1617 default: 1618 m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); 1619 } 1564 1620 } 1565 1621 -
trunk/WebCore/html/canvas/WebGLRenderingContext.idl
r53238 r57018 424 424 const unsigned int STENCIL_INDEX = 0x1901; 425 425 const unsigned int STENCIL_INDEX8 = 0x8D48; 426 const unsigned int DEPTH_STENCIL = 0x84F9; 426 427 427 428 const unsigned int RENDERBUFFER_WIDTH = 0x8D42; … … 443 444 const unsigned int DEPTH_ATTACHMENT = 0x8D00; 444 445 const unsigned int STENCIL_ATTACHMENT = 0x8D20; 446 const unsigned int DEPTH_STENCIL_ATTACHMENT = 0x821A; 445 447 446 448 const unsigned int NONE = 0; -
trunk/WebCore/platform/graphics/GraphicsContext3D.h
r56872 r57018 363 363 STENCIL_INDEX = 0x1901, 364 364 STENCIL_INDEX8 = 0x8D48, 365 DEPTH_STENCIL = 0x84F9, 365 366 RENDERBUFFER_WIDTH = 0x8D42, 366 367 RENDERBUFFER_HEIGHT = 0x8D43, … … 379 380 DEPTH_ATTACHMENT = 0x8D00, 380 381 STENCIL_ATTACHMENT = 0x8D20, 382 DEPTH_STENCIL_ATTACHMENT = 0x821A, 381 383 NONE = 0, 382 384 FRAMEBUFFER_COMPLETE = 0x8CD5, -
trunk/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
r56872 r57018 592 592 { 593 593 ensureContext(m_contextObj); 594 ::glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, buffer ? (GLuint) buffer->object() : 0); 594 GLuint renderbuffer = (buffer ? (GLuint) buffer->object() : 0); 595 if (attachment == DEPTH_STENCIL_ATTACHMENT) { 596 ::glFramebufferRenderbufferEXT(target, DEPTH_ATTACHMENT, renderbuffertarget, renderbuffer); 597 ::glFramebufferRenderbufferEXT(target, STENCIL_ATTACHMENT, renderbuffertarget, renderbuffer); 598 } else 599 ::glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer); 595 600 } 596 601 … … 823 828 { 824 829 ensureContext(m_contextObj); 830 if (internalformat == DEPTH_STENCIL) 831 internalformat = GL_DEPTH24_STENCIL8_EXT; 832 else if (internalformat == DEPTH_COMPONENT16) 833 internalformat = GL_DEPTH_COMPONENT; 825 834 ::glRenderbufferStorageEXT(target, internalformat, width, height); 826 835 } … … 1118 1127 { 1119 1128 ensureContext(m_contextObj); 1129 if (attachment == DEPTH_STENCIL_ATTACHMENT) 1130 attachment = DEPTH_ATTACHMENT; // Or STENCIL_ATTACHMENT, either works. 1120 1131 ::glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, value); 1121 1132 } -
trunk/WebKit/chromium/ChangeLog
r57014 r57018 1 2010-04-02 Zhenyao Mo <zmo@google.com> 2 3 Reviewed by Eric Seidel. 4 5 Implement and test new framebuffer object attachment behavior. 6 https://bugs.webkit.org/show_bug.cgi?id=35611 7 8 Test: fast/canvas/webgl/framebuffer-object-attachment.html 9 10 * src/WebGraphicsContext3DDefaultImpl.cpp: Map to correct DEPTH_STENCIL format. 11 (WebKit::WebGraphicsContext3DDefaultImpl::framebufferRenderbuffer): 12 (WebKit::WebGraphicsContext3DDefaultImpl::getFramebufferAttachmentParameteriv): 13 (WebKit::WebGraphicsContext3DDefaultImpl::renderbufferStorage): 14 1 15 2010-04-02 Jay Civelli <jcivelli@chromium.org> 2 16 -
trunk/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
r56880 r57018 886 886 DELEGATE_TO_GL(flush, Flush) 887 887 888 DELEGATE_TO_GL_4(framebufferRenderbuffer, FramebufferRenderbufferEXT, unsigned long, unsigned long, unsigned long, WebGLId) 888 void WebGraphicsContext3DDefaultImpl::framebufferRenderbuffer(unsigned long target, unsigned long attachment, 889 unsigned long renderbuffertarget, WebGLId buffer) 890 { 891 makeContextCurrent(); 892 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { 893 glFramebufferRenderbufferEXT(target, GL_DEPTH_ATTACHMENT, renderbuffertarget, buffer); 894 glFramebufferRenderbufferEXT(target, GL_STENCIL_ATTACHMENT, renderbuffertarget, buffer); 895 } else 896 glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, buffer); 897 } 889 898 890 899 DELEGATE_TO_GL_5(framebufferTexture2D, FramebufferTexture2DEXT, unsigned long, unsigned long, unsigned long, WebGLId, long) … … 986 995 DELEGATE_TO_GL_2(getFloatv, GetFloatv, unsigned long, float*) 987 996 988 DELEGATE_TO_GL_4(getFramebufferAttachmentParameteriv, GetFramebufferAttachmentParameterivEXT, unsigned long, unsigned long, unsigned long, int*) 997 void WebGraphicsContext3DDefaultImpl::getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, 998 unsigned long pname, int* value) 999 { 1000 makeContextCurrent(); 1001 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) 1002 attachment = GL_DEPTH_ATTACHMENT; // Or GL_STENCIL_ATTACHMENT, either works. 1003 glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, value); 1004 } 989 1005 990 1006 DELEGATE_TO_GL_2(getIntegerv, GetIntegerv, unsigned long, int*) … … 1134 1150 } 1135 1151 1136 DELEGATE_TO_GL_4(renderbufferStorage, RenderbufferStorageEXT, unsigned long, unsigned long, unsigned long, unsigned long) 1152 void WebGraphicsContext3DDefaultImpl::renderbufferStorage(unsigned long target, 1153 unsigned long internalformat, 1154 unsigned long width, 1155 unsigned long height) 1156 { 1157 makeContextCurrent(); 1158 if (internalformat == GL_DEPTH_STENCIL) 1159 internalformat = GL_DEPTH24_STENCIL8_EXT; 1160 else if (internalformat == GL_DEPTH_COMPONENT16) 1161 internalformat = GL_DEPTH_COMPONENT; 1162 glRenderbufferStorageEXT(target, internalformat, width, height); 1163 } 1137 1164 1138 1165 DELEGATE_TO_GL_2(sampleCoverage, SampleCoverage, double, bool)
Note: See TracChangeset
for help on using the changeset viewer.