Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(898)

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.cpp

Issue 1549393002: (reland)WebGL 2: generate appropriate error for different dimensions of images attached to fbo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed zmo@'s feedback: mark draw-buffers.html as failed, will update the test expectation later Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698