Index: third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp |
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp b/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp |
index ccd6d8caaf99ad3548c4e5d3c4e10b6760fbda4e..4eeaa89566d14da3876eb791002d6ed9f2555805 100644 |
--- a/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp |
+++ b/third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp |
@@ -46,6 +46,7 @@ private: |
GLsizei width() const override; |
GLsizei height() const override; |
+ GLsizei depth() const override; |
GLenum format() const override; |
GLenum type() const override; |
bool isCubeComplete() const override; |
@@ -85,6 +86,11 @@ GLsizei WebGLRenderbufferAttachment::height() const |
return m_renderbuffer->height(); |
} |
+GLsizei WebGLRenderbufferAttachment::depth() const |
+{ |
+ return 1; |
+} |
+ |
GLenum WebGLRenderbufferAttachment::format() const |
{ |
GLenum format = m_renderbuffer->internalFormat(); |
@@ -160,6 +166,7 @@ private: |
GLsizei width() const override; |
GLsizei height() const override; |
+ GLsizei depth() const override; |
GLenum format() const override; |
GLenum type() const override; |
bool isCubeComplete() const override; |
@@ -205,6 +212,11 @@ GLsizei WebGLTextureAttachment::height() const |
return m_texture->getHeight(m_target, m_level); |
} |
+GLsizei WebGLTextureAttachment::depth() const |
+{ |
+ return m_texture->getDepth(m_target, m_level); |
+} |
+ |
GLenum WebGLTextureAttachment::format() const |
{ |
return m_texture->getInternalFormat(m_target, m_level); |
@@ -539,7 +551,7 @@ GLenum WebGLFramebuffer::colorBufferFormat() const |
GLenum WebGLFramebuffer::checkStatus(const char** reason) const |
{ |
unsigned count = 0; |
- GLsizei width = 0, height = 0; |
+ GLsizei width = 0, height = 0, depth = 0; |
WebGLAttachment* depthAttachment = nullptr; |
WebGLAttachment* stencilAttachment = nullptr; |
WebGLAttachment* depthStencilAttachment = nullptr; |
@@ -567,15 +579,18 @@ GLenum WebGLFramebuffer::checkStatus(const char** reason) const |
depthStencilAttachment = attachment; |
break; |
} |
- if (!isWebGL2OrHigher) { |
- if (!count) { |
- width = attachment->width(); |
- height = attachment->height(); |
- } else { |
- if (width != attachment->width() || height != attachment->height()) { |
- *reason = "attachments do not have the same dimensions"; |
- return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; |
- } |
+ // Note: In GLES 3, images for a framebuffer need not to have the same dimensions to be framebuffer complete. |
+ // However, in Direct3D 11, on top of which OpenGL ES 3 behavior is emulated in Windows, all render targets |
+ // must have the same size in all dimensions. In order to have consistent WebGL 2 behaviors across platforms, |
+ // we generate FRAMEBUFFER_INCOMPLETE_DIMENSIONS in this situation. |
+ if (!count) { |
+ width = attachment->width(); |
+ height = attachment->height(); |
+ depth = attachment->depth(); |
+ } else { |
+ if (width != attachment->width() || height != attachment->height() || depth != attachment->depth()) { |
+ *reason = "attachments do not have the same dimensions"; |
+ return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; |
} |
} |
++count; |