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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2570823002: Reland [Command buffer]: Generate INVALID_OPERATION if designated attachments in read fb miss image (Closed)
Patch Set: suppress the webgl 2 expectation Created 4 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
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index cd5e0ae996247e99de58fbba309a94b36c480962..06457f1914c7132c1d3504c6b7905cb6b7dd2081 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -7912,6 +7912,10 @@ void GLES2DecoderImpl::DoBlitFramebufferCHROMIUM(
return;
}
+ // Detect that designated read/depth/stencil buffer in read framebuffer miss
+ // image, and the corresponding buffers in draw framebuffer have image.
+ bool read_framebuffer_miss_image = false;
+
// Check whether read framebuffer and draw framebuffer have identical image
// TODO(yunchao): consider doing something like CheckFramebufferStatus().
// We cache the validation results, and if read_framebuffer doesn't change,
@@ -7935,6 +7939,18 @@ void GLES2DecoderImpl::DoBlitFramebufferCHROMIUM(
is_feedback_loop = FeedbackLoopTrue;
} else if (!read_framebuffer || !draw_framebuffer) {
is_feedback_loop = FeedbackLoopFalse;
+ if (read_framebuffer) {
+ if (((mask & GL_COLOR_BUFFER_BIT) != 0 &&
+ !GetBoundReadFramebufferInternalFormat()) ||
+ ((mask & GL_DEPTH_BUFFER_BIT) != 0 &&
+ !read_framebuffer->GetAttachment(GL_DEPTH_ATTACHMENT) &&
+ BoundFramebufferHasDepthAttachment()) ||
+ ((mask & GL_STENCIL_BUFFER_BIT) != 0 &&
+ !read_framebuffer->GetAttachment(GL_STENCIL_ATTACHMENT) &&
+ BoundFramebufferHasStencilAttachment())) {
+ read_framebuffer_miss_image = true;
+ }
+ }
} else {
DCHECK(read_framebuffer && draw_framebuffer);
if ((mask & GL_DEPTH_BUFFER_BIT) != 0) {
@@ -7944,6 +7960,9 @@ void GLES2DecoderImpl::DoBlitFramebufferCHROMIUM(
draw_framebuffer->GetAttachment(GL_DEPTH_ATTACHMENT);
if (!depth_buffer_draw || !depth_buffer_read) {
mask &= ~GL_DEPTH_BUFFER_BIT;
+ if (depth_buffer_draw) {
+ read_framebuffer_miss_image = true;
+ }
} else if (depth_buffer_draw->IsSameAttachment(depth_buffer_read)) {
is_feedback_loop = FeedbackLoopTrue;
}
@@ -7955,11 +7974,14 @@ void GLES2DecoderImpl::DoBlitFramebufferCHROMIUM(
draw_framebuffer->GetAttachment(GL_STENCIL_ATTACHMENT);
if (!stencil_buffer_draw || !stencil_buffer_read) {
mask &= ~GL_STENCIL_BUFFER_BIT;
+ if (stencil_buffer_draw) {
+ read_framebuffer_miss_image = true;
+ }
} else if (stencil_buffer_draw->IsSameAttachment(stencil_buffer_read)) {
is_feedback_loop = FeedbackLoopTrue;
}
}
- if (!mask)
+ if (!mask && !read_framebuffer_miss_image)
return;
}
@@ -7994,6 +8016,9 @@ void GLES2DecoderImpl::DoBlitFramebufferCHROMIUM(
GLenum dst_type = GetBoundColorDrawBufferType(static_cast<GLint>(ii));
if (dst_format == 0)
continue;
+ if (!src_internal_format) {
+ read_framebuffer_miss_image = true;
+ }
if (GetColorEncodingFromInternalFormat(dst_format) == GL_SRGB)
draw_buffers_has_srgb = true;
if (read_buffer_samples > 0 &&
@@ -8033,6 +8058,11 @@ void GLES2DecoderImpl::DoBlitFramebufferCHROMIUM(
"source buffer and destination buffers are identical");
return;
}
+ if (read_framebuffer_miss_image == true) {
+ LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
+ "The designated attachment point(s) in read framebuffer miss image");
+ return;
+ }
if ((mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0) {
if (filter != GL_NEAREST) {

Powered by Google App Engine
This is Rietveld 408576698