Skip to content

Commit

Permalink
Validating cmd decoder check if all color buffer has same number of b…
Browse files Browse the repository at this point in the history
…itplanes in webgl 1

https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_draw_buffers.txt
ES 2.0 requires that all color buffers attached to application-created framebuffer objects must have the same number of bitplanes (Chapter 4 overview p91).

Bug: 972876
Change-Id: If923efb1c43946968e9b581f488b110a96c30361
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1663374
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Cr-Commit-Position: refs/heads/master@{#670171}
  • Loading branch information
shrekshao authored and Commit Bot committed Jun 18, 2019
1 parent 0434314 commit c65ba5f
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions gpu/command_buffer/service/framebuffer_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,8 @@ GLenum Framebuffer::IsPossiblyComplete(const FeatureInfo* feature_info) const {
GLsizei width = -1;
GLsizei height = -1;
GLsizei samples = -1;
uint32_t colorbufferSize = 0;
bool colorbufferSizeValid = false;
const bool kSamplesMustMatch = feature_info->IsWebGLContext() ||
!feature_info->feature_flags().chromium_framebuffer_mixed_samples;

Expand Down Expand Up @@ -751,10 +753,26 @@ GLenum Framebuffer::IsPossiblyComplete(const FeatureInfo* feature_info) const {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}

// Attaching an image to more than one color attachment point should return
// FRAMEBUFFER_UNSUPPORTED.
if (it->first >= GL_COLOR_ATTACHMENT0 &&
it->first < GL_COLOR_ATTACHMENT0 + manager_->max_color_attachments_) {
// in GLES 2.0, all color attachments attachments must have the same
// number of bitplanes.
// in GLES 3.0, there is no such restriction.
if (feature_info->context_type() == CONTEXT_TYPE_WEBGL1) {
if (colorbufferSizeValid) {
if (colorbufferSize !=
GLES2Util::GetGLTypeSizeForTextures(attachment->texture_type())) {
return GL_FRAMEBUFFER_UNSUPPORTED;
}
} else {
colorbufferSize =
GLES2Util::GetGLTypeSizeForTextures(attachment->texture_type());
colorbufferSizeValid = true;
}
}

// Attaching an image to more than one color attachment point should
// return FRAMEBUFFER_UNSUPPORTED.
for (GLenum i = it->first + 1;
i < GL_COLOR_ATTACHMENT0 + manager_->max_color_attachments_; i++) {
const Attachment* other = GetAttachment(i);
Expand Down

0 comments on commit c65ba5f

Please sign in to comment.