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):
bug=295792)
self.Skip('conformance2/reading/read-pixels-pack-parameters.html',
bug=483282)
self.Fail('conformance2/rendering/draw-buffers.html', bug=483282)
self.Fail('conformance2/samplers/sampler-drawing-test.html', bug=483282)
self.Skip('conformance2/textures/webgl_canvas/*', bug=483282)
......@@ -96,8 +97,6 @@ class WebGL2ConformanceExpectations(WebGLConformanceExpectations):
['win'], bug=483282)
self.Fail('conformance2/renderbuffers/framebuffer-object-attachment.html',
['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',
['win'], bug=483282)
self.Fail('conformance2/textures/canvas/*', ['win'], bug=483282)
......@@ -229,8 +228,6 @@ class WebGL2ConformanceExpectations(WebGLConformanceExpectations):
['linux'], bug=483282)
self.Fail('conformance2/glsl3/vector-dynamic-indexing.html',
['linux'], bug=483282)
self.Fail('conformance2/rendering/draw-buffers.html',
['linux'], bug=483282)
self.Fail('conformance2/renderbuffers/framebuffer-object-attachment.html',
['linux'], bug=564020)
self.Fail('conformance2/reading/read-pixels-into-pixel-pack-buffer.html',
......
......@@ -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;
......
......@@ -43,6 +43,7 @@ public:
virtual GLsizei width() const = 0;
virtual GLsizei height() const = 0;
virtual GLsizei depth() const = 0;
virtual GLenum format() const = 0;
// For texture attachment, type() returns the type of the attached texture.
// 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