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

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

Issue 656613002: Generate INVALID_OPERATION if feedback loops exist in CopyTex{Sub}Image2D. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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 1213e616f2e1638adbfe653b2200607b04e69860..87bd43ace90e3b8f2911a749ea41a70ff014d699 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1181,6 +1181,10 @@ class GLES2DecoderImpl : public GLES2Decoder,
// attached. Generates GL error if not.
bool CheckBoundReadFramebufferColorAttachment(const char* func_name);
+ // Check that the currently bound read framebuffer's color image
+ // isn't the target texture of the glCopyTex{Sub}Image2D.
+ bool FormsTextureCopyingFeedbackLoop(TextureRef* texture, GLint level);
+
// Check if a framebuffer meets our requirements.
bool CheckFramebufferValid(
Framebuffer* framebuffer,
@@ -3232,6 +3236,20 @@ bool GLES2DecoderImpl::CheckBoundReadFramebufferColorAttachment(
return true;
}
+bool GLES2DecoderImpl::FormsTextureCopyingFeedbackLoop(
+ TextureRef* texture, GLint level) {
+ Framebuffer* framebuffer = features().chromium_framebuffer_multisample ?
+ framebuffer_state_.bound_read_framebuffer.get() :
+ framebuffer_state_.bound_draw_framebuffer.get();
+ if (!framebuffer)
+ return false;
+ const Framebuffer::Attachment* attachment = framebuffer->GetAttachment(
+ GL_COLOR_ATTACHMENT0);
+ if (!attachment)
+ return false;
+ return attachment->FormsFeedbackLoop(texture, level);
+}
+
gfx::Size GLES2DecoderImpl::GetBoundReadFrameBufferSize() {
Framebuffer* framebuffer =
GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER_EXT);
@@ -8595,6 +8613,13 @@ void GLES2DecoderImpl::DoCopyTexImage2D(
return;
}
+ if (FormsTextureCopyingFeedbackLoop(texture_ref, level)) {
+ LOCAL_SET_GL_ERROR(
+ GL_INVALID_OPERATION,
+ "glCopyTexImage2D", "source and destination textures are the same");
+ return;
+ }
+
if (!CheckBoundFramebuffersValid("glCopyTexImage2D")) {
return;
}
@@ -8713,6 +8738,13 @@ void GLES2DecoderImpl::DoCopyTexSubImage2D(
return;
}
+ if (FormsTextureCopyingFeedbackLoop(texture_ref, level)) {
+ LOCAL_SET_GL_ERROR(
+ GL_INVALID_OPERATION,
+ "glCopyTexSubImage2D", "source and destination textures are the same");
+ return;
+ }
+
if (!CheckBoundFramebuffersValid("glCopyTexSubImage2D")) {
return;
}

Powered by Google App Engine
This is Rietveld 408576698