Index: gpu/command_buffer/client/gles2_implementation.cc |
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc |
index 51c63707421276e368442b4ba22fe6761b64bf9c..86577ecc224264d2370550507ea2000b672432c3 100644 |
--- a/gpu/command_buffer/client/gles2_implementation.cc |
+++ b/gpu/command_buffer/client/gles2_implementation.cc |
@@ -2321,6 +2321,15 @@ bool GLES2Implementation::BindBufferHelper( |
// TODO(gman): There's a bug here. If the target is invalid the ID will not be |
// used even though it's marked it as used here. |
GetIdHandler(id_namespaces::kBuffers)->MarkAsUsedForBind(buffer_id); |
+ |
+ // In Pepper, BindBuffer() may need generate resource in GPU process, so we |
+ // have to flush command buffer to make the BindBuffer() being executed in |
+ // GPU process before any DeleteBuffer() which are issused in future from |
+ // other contexts. |
+ // TODO(penghuang): Get ride of the Flush(). |
Nike
2014/12/01 12:09:16
Get rid
Peng
2014/12/01 14:38:12
Done
|
+ if (changed && share_group_->bind_generates_resource()) |
Nike
2014/12/01 12:09:16
Would it be possible to create common FlushIfChang
Peng
2014/12/01 14:38:12
The code for deciding if changed is different for
|
+ helper_->CommandBufferHelper::Flush(); |
+ |
return changed; |
} |
@@ -2361,7 +2370,17 @@ bool GLES2Implementation::BindFramebufferHelper( |
SetGLErrorInvalidEnum("glBindFramebuffer", target, "target"); |
return false; |
} |
+ |
GetIdHandler(id_namespaces::kFramebuffers)->MarkAsUsedForBind(framebuffer); |
+ |
+ // In Pepper, BindFramebuffer() may need generate resource in GPU process, |
+ // so we have to flush command buffer to make the BindFramebuffer() being |
+ // executed in GPU process before any DeleteFramebuffer() which are issused in |
+ // future from other contexts. |
+ // TODO(penghuang): Get ride of the Flush(). |
+ if (changed && share_group_->bind_generates_resource()) |
+ helper_->CommandBufferHelper::Flush(); |
+ |
return changed; |
} |
@@ -2383,6 +2402,15 @@ bool GLES2Implementation::BindRenderbufferHelper( |
// TODO(gman): There's a bug here. If the target is invalid the ID will not be |
// used even though it's marked it as used here. |
GetIdHandler(id_namespaces::kRenderbuffers)->MarkAsUsedForBind(renderbuffer); |
+ |
+ // In Pepper, BindRenderbuffer() may need generate resource in GPU process, |
+ // so we have to flush command buffer to make the BindRenderbuffer() being |
+ // executed in GPU process before any DeleteRenderbuffer() which are issused |
+ // in future from other contexts. |
+ // TODO(penghuang): Get ride of the Flush(). |
+ if (changed && share_group_->bind_generates_resource()) |
+ helper_->CommandBufferHelper::Flush(); |
+ |
return changed; |
} |
@@ -2418,6 +2446,15 @@ bool GLES2Implementation::BindTextureHelper(GLenum target, GLuint texture) { |
// TODO(gman): There's a bug here. If the target is invalid the ID will not be |
// used. even though it's marked it as used here. |
GetIdHandler(id_namespaces::kTextures)->MarkAsUsedForBind(texture); |
+ |
+ // In Pepper, BindTexture() may need generate resource in GPU process, so we |
+ // have to flush command buffer to make the BindTexture() being executed in |
+ // GPU process before any DeleteTexture() which are issused in future from |
+ // other contexts. |
+ // TODO(penghuang): Get ride of the Flush(). |
+ if (changed && share_group_->bind_generates_resource()) |
+ helper_->CommandBufferHelper::Flush(); |
+ |
return changed; |
} |