Commit d5ccdf12 authored by yunchao.he's avatar yunchao.he Committed by Commit bot

WebGL 2: generate appropriate error for different dimensions of images attached to fbo.

This change fixed the bug in framebuffer-object-attachment.html

BUG=295792
TEST=conformance2/renderbuffers/framebuffer-object-attachment.html

Committed: https://crrev.com/23cf53ece33a651b28a1d87e57f02a14f22d3c3d
Cr-Commit-Position: refs/heads/master@{#367053}

Review URL: https://codereview.chromium.org/1549393002

Cr-Commit-Position: refs/heads/master@{#367132}
parent f9b4b393
...@@ -83,6 +83,7 @@ class WebGL2ConformanceExpectations(WebGLConformanceExpectations): ...@@ -83,6 +83,7 @@ class WebGL2ConformanceExpectations(WebGLConformanceExpectations):
bug=295792) bug=295792)
self.Skip('conformance2/reading/read-pixels-pack-parameters.html', self.Skip('conformance2/reading/read-pixels-pack-parameters.html',
bug=483282) bug=483282)
self.Fail('conformance2/rendering/draw-buffers.html', bug=483282)
self.Fail('conformance2/samplers/sampler-drawing-test.html', bug=483282) self.Fail('conformance2/samplers/sampler-drawing-test.html', bug=483282)
self.Skip('conformance2/textures/webgl_canvas/*', bug=483282) self.Skip('conformance2/textures/webgl_canvas/*', bug=483282)
...@@ -96,8 +97,6 @@ class WebGL2ConformanceExpectations(WebGLConformanceExpectations): ...@@ -96,8 +97,6 @@ class WebGL2ConformanceExpectations(WebGLConformanceExpectations):
['win'], bug=483282) ['win'], bug=483282)
self.Fail('conformance2/renderbuffers/framebuffer-object-attachment.html', self.Fail('conformance2/renderbuffers/framebuffer-object-attachment.html',
['win'], bug=1082) # angle bug ID ['win'], bug=1082) # angle bug ID
self.Fail('conformance2/rendering/draw-buffers.html',
['win'], bug=483282)
self.Fail('conformance2/state/gl-object-get-calls.html', self.Fail('conformance2/state/gl-object-get-calls.html',
['win'], bug=483282) ['win'], bug=483282)
self.Fail('conformance2/textures/canvas/*', ['win'], bug=483282) self.Fail('conformance2/textures/canvas/*', ['win'], bug=483282)
...@@ -229,8 +228,6 @@ class WebGL2ConformanceExpectations(WebGLConformanceExpectations): ...@@ -229,8 +228,6 @@ class WebGL2ConformanceExpectations(WebGLConformanceExpectations):
['linux'], bug=483282) ['linux'], bug=483282)
self.Fail('conformance2/glsl3/vector-dynamic-indexing.html', self.Fail('conformance2/glsl3/vector-dynamic-indexing.html',
['linux'], bug=483282) ['linux'], bug=483282)
self.Fail('conformance2/rendering/draw-buffers.html',
['linux'], bug=483282)
self.Fail('conformance2/renderbuffers/framebuffer-object-attachment.html', self.Fail('conformance2/renderbuffers/framebuffer-object-attachment.html',
['linux'], bug=564020) ['linux'], bug=564020)
self.Fail('conformance2/reading/read-pixels-into-pixel-pack-buffer.html', self.Fail('conformance2/reading/read-pixels-into-pixel-pack-buffer.html',
......
...@@ -46,6 +46,7 @@ private: ...@@ -46,6 +46,7 @@ private:
GLsizei width() const override; GLsizei width() const override;
GLsizei height() const override; GLsizei height() const override;
GLsizei depth() const override;
GLenum format() const override; GLenum format() const override;
GLenum type() const override; GLenum type() const override;
bool isCubeComplete() const override; bool isCubeComplete() const override;
...@@ -85,6 +86,11 @@ GLsizei WebGLRenderbufferAttachment::height() const ...@@ -85,6 +86,11 @@ GLsizei WebGLRenderbufferAttachment::height() const
return m_renderbuffer->height(); return m_renderbuffer->height();
} }
GLsizei WebGLRenderbufferAttachment::depth() const
{
return 1;
}
GLenum WebGLRenderbufferAttachment::format() const GLenum WebGLRenderbufferAttachment::format() const
{ {
GLenum format = m_renderbuffer->internalFormat(); GLenum format = m_renderbuffer->internalFormat();
...@@ -160,6 +166,7 @@ private: ...@@ -160,6 +166,7 @@ private:
GLsizei width() const override; GLsizei width() const override;
GLsizei height() const override; GLsizei height() const override;
GLsizei depth() const override;
GLenum format() const override; GLenum format() const override;
GLenum type() const override; GLenum type() const override;
bool isCubeComplete() const override; bool isCubeComplete() const override;
...@@ -205,6 +212,11 @@ GLsizei WebGLTextureAttachment::height() const ...@@ -205,6 +212,11 @@ GLsizei WebGLTextureAttachment::height() const
return m_texture->getHeight(m_target, m_level); return m_texture->getHeight(m_target, m_level);
} }
GLsizei WebGLTextureAttachment::depth() const
{
return m_texture->getDepth(m_target, m_level);
}
GLenum WebGLTextureAttachment::format() const GLenum WebGLTextureAttachment::format() const
{ {
return m_texture->getInternalFormat(m_target, m_level); return m_texture->getInternalFormat(m_target, m_level);
...@@ -539,7 +551,7 @@ GLenum WebGLFramebuffer::colorBufferFormat() const ...@@ -539,7 +551,7 @@ GLenum WebGLFramebuffer::colorBufferFormat() const
GLenum WebGLFramebuffer::checkStatus(const char** reason) const GLenum WebGLFramebuffer::checkStatus(const char** reason) const
{ {
unsigned count = 0; unsigned count = 0;
GLsizei width = 0, height = 0; GLsizei width = 0, height = 0, depth = 0;
WebGLAttachment* depthAttachment = nullptr; WebGLAttachment* depthAttachment = nullptr;
WebGLAttachment* stencilAttachment = nullptr; WebGLAttachment* stencilAttachment = nullptr;
WebGLAttachment* depthStencilAttachment = nullptr; WebGLAttachment* depthStencilAttachment = nullptr;
...@@ -567,15 +579,18 @@ GLenum WebGLFramebuffer::checkStatus(const char** reason) const ...@@ -567,15 +579,18 @@ GLenum WebGLFramebuffer::checkStatus(const char** reason) const
depthStencilAttachment = attachment; depthStencilAttachment = attachment;
break; break;
} }
if (!isWebGL2OrHigher) { // Note: In GLES 3, images for a framebuffer need not to have the same dimensions to be framebuffer complete.
if (!count) { // However, in Direct3D 11, on top of which OpenGL ES 3 behavior is emulated in Windows, all render targets
width = attachment->width(); // must have the same size in all dimensions. In order to have consistent WebGL 2 behaviors across platforms,
height = attachment->height(); // we generate FRAMEBUFFER_INCOMPLETE_DIMENSIONS in this situation.
} else { if (!count) {
if (width != attachment->width() || height != attachment->height()) { width = attachment->width();
*reason = "attachments do not have the same dimensions"; height = attachment->height();
return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; 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; ++count;
......
...@@ -43,6 +43,7 @@ public: ...@@ -43,6 +43,7 @@ public:
virtual GLsizei width() const = 0; virtual GLsizei width() const = 0;
virtual GLsizei height() const = 0; virtual GLsizei height() const = 0;
virtual GLsizei depth() const = 0;
virtual GLenum format() const = 0; virtual GLenum format() const = 0;
// For texture attachment, type() returns the type of the attached texture. // For texture attachment, type() returns the type of the attached texture.
// For renderbuffer attachment, the type of the renderbuffer may vary with GL implementation. // For renderbuffer attachment, the type of the renderbuffer may vary with GL implementation.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment