| 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 1916e7d2008d64b32dc71cc81d7211411e281237..4c148e9081cd22c2079fbd19c1e6198b16f5739c 100644
|
| --- a/gpu/command_buffer/client/gles2_implementation.cc
|
| +++ b/gpu/command_buffer/client/gles2_implementation.cc
|
| @@ -2314,7 +2314,7 @@ void GLES2Implementation::GenValuebuffersCHROMIUMHelper(
|
| // the old model but possibly not true in the new model if another context has
|
| // deleted the resource.
|
|
|
| -bool GLES2Implementation::BindBufferHelper(
|
| +void GLES2Implementation::BindBufferHelper(
|
| GLenum target, GLuint buffer_id) {
|
| // TODO(gman): See note #1 above.
|
| bool changed = false;
|
| @@ -2340,11 +2340,19 @@ 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);
|
| - return changed;
|
| + if (changed) {
|
| + GetIdHandler(id_namespaces::kBuffers)->MarkAsUsedForBind(
|
| + this, target, buffer_id, &GLES2Implementation::BindBufferStub);
|
| + }
|
| +}
|
| +
|
| +void GLES2Implementation::BindBufferStub(GLenum target, GLuint buffer) {
|
| + helper_->BindBuffer(target, buffer);
|
| + if (share_group_->bind_generates_resource())
|
| + helper_->CommandBufferHelper::Flush();
|
| }
|
|
|
| -bool GLES2Implementation::BindFramebufferHelper(
|
| +void GLES2Implementation::BindFramebufferHelper(
|
| GLenum target, GLuint framebuffer) {
|
| // TODO(gman): See note #1 above.
|
| bool changed = false;
|
| @@ -2360,7 +2368,7 @@ bool GLES2Implementation::BindFramebufferHelper(
|
| case GL_READ_FRAMEBUFFER:
|
| if (!IsChromiumFramebufferMultisampleAvailable()) {
|
| SetGLErrorInvalidEnum("glBindFramebuffer", target, "target");
|
| - return false;
|
| + return;
|
| }
|
| if (bound_read_framebuffer_ != framebuffer) {
|
| bound_read_framebuffer_ = framebuffer;
|
| @@ -2370,7 +2378,7 @@ bool GLES2Implementation::BindFramebufferHelper(
|
| case GL_DRAW_FRAMEBUFFER:
|
| if (!IsChromiumFramebufferMultisampleAvailable()) {
|
| SetGLErrorInvalidEnum("glBindFramebuffer", target, "target");
|
| - return false;
|
| + return;
|
| }
|
| if (bound_framebuffer_ != framebuffer) {
|
| bound_framebuffer_ = framebuffer;
|
| @@ -2379,13 +2387,23 @@ bool GLES2Implementation::BindFramebufferHelper(
|
| break;
|
| default:
|
| SetGLErrorInvalidEnum("glBindFramebuffer", target, "target");
|
| - return false;
|
| + return;
|
| }
|
| - GetIdHandler(id_namespaces::kFramebuffers)->MarkAsUsedForBind(framebuffer);
|
| - return changed;
|
| +
|
| + if (changed) {
|
| + GetIdHandler(id_namespaces::kFramebuffers)->MarkAsUsedForBind(
|
| + this, target, framebuffer, &GLES2Implementation::BindFramebufferStub);
|
| + }
|
| +}
|
| +
|
| +void GLES2Implementation::BindFramebufferStub(GLenum target,
|
| + GLuint framebuffer) {
|
| + helper_->BindFramebuffer(target, framebuffer);
|
| + if (share_group_->bind_generates_resource())
|
| + helper_->CommandBufferHelper::Flush();
|
| }
|
|
|
| -bool GLES2Implementation::BindRenderbufferHelper(
|
| +void GLES2Implementation::BindRenderbufferHelper(
|
| GLenum target, GLuint renderbuffer) {
|
| // TODO(gman): See note #1 above.
|
| bool changed = false;
|
| @@ -2402,11 +2420,21 @@ 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);
|
| - return changed;
|
| + if (changed) {
|
| + GetIdHandler(id_namespaces::kRenderbuffers)->MarkAsUsedForBind(
|
| + this, target, renderbuffer,
|
| + &GLES2Implementation::BindRenderbufferStub);
|
| + }
|
| }
|
|
|
| -bool GLES2Implementation::BindTextureHelper(GLenum target, GLuint texture) {
|
| +void GLES2Implementation::BindRenderbufferStub(GLenum target,
|
| + GLuint renderbuffer) {
|
| + helper_->BindRenderbuffer(target, renderbuffer);
|
| + if (share_group_->bind_generates_resource())
|
| + helper_->CommandBufferHelper::Flush();
|
| +}
|
| +
|
| +void GLES2Implementation::BindTextureHelper(GLenum target, GLuint texture) {
|
| // TODO(gman): See note #1 above.
|
| // TODO(gman): Change this to false once we figure out why it's failing
|
| // on daisy.
|
| @@ -2437,26 +2465,37 @@ 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);
|
| - return changed;
|
| + if (changed) {
|
| + GetIdHandler(id_namespaces::kTextures)->MarkAsUsedForBind(
|
| + this, target, texture, &GLES2Implementation::BindTextureStub);
|
| + }
|
| +}
|
| +
|
| +void GLES2Implementation::BindTextureStub(GLenum target, GLuint texture) {
|
| + helper_->BindTexture(target, texture);
|
| + if (share_group_->bind_generates_resource())
|
| + helper_->CommandBufferHelper::Flush();
|
| }
|
|
|
| -bool GLES2Implementation::BindVertexArrayOESHelper(GLuint array) {
|
| +void GLES2Implementation::BindVertexArrayOESHelper(GLuint array) {
|
| // TODO(gman): See note #1 above.
|
| bool changed = false;
|
| - if (!vertex_array_object_manager_->BindVertexArray(array, &changed)) {
|
| + if (vertex_array_object_manager_->BindVertexArray(array, &changed)) {
|
| + if (changed) {
|
| + // Unlike other BindXXXHelpers we don't call MarkAsUsedForBind
|
| + // because unlike other resources VertexArrayObject ids must
|
| + // be generated by GenVertexArrays. A random id to Bind will not
|
| + // generate a new object.
|
| + helper_->BindVertexArrayOES(array);
|
| + }
|
| + } else {
|
| SetGLError(
|
| GL_INVALID_OPERATION, "glBindVertexArrayOES",
|
| "id was not generated with glGenVertexArrayOES");
|
| }
|
| - // Unlike other BindXXXHelpers we don't call MarkAsUsedForBind
|
| - // because unlike other resources VertexArrayObject ids must
|
| - // be generated by GenVertexArrays. A random id to Bind will not
|
| - // generate a new object.
|
| - return changed;
|
| }
|
|
|
| -bool GLES2Implementation::BindValuebufferCHROMIUMHelper(GLenum target,
|
| +void GLES2Implementation::BindValuebufferCHROMIUMHelper(GLenum target,
|
| GLuint valuebuffer) {
|
| bool changed = false;
|
| switch (target) {
|
| @@ -2472,17 +2511,25 @@ bool GLES2Implementation::BindValuebufferCHROMIUMHelper(GLenum target,
|
| }
|
| // 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::kValuebuffers)->MarkAsUsedForBind(valuebuffer);
|
| - return changed;
|
| + if (changed) {
|
| + GetIdHandler(id_namespaces::kValuebuffers)->MarkAsUsedForBind(
|
| + this, target, valuebuffer,
|
| + &GLES2Implementation::BindValuebufferCHROMIUMStub);
|
| + }
|
| }
|
|
|
| -bool GLES2Implementation::UseProgramHelper(GLuint program) {
|
| - bool changed = false;
|
| +void GLES2Implementation::BindValuebufferCHROMIUMStub(GLenum target,
|
| + GLuint valuebuffer) {
|
| + helper_->BindValuebufferCHROMIUM(target, valuebuffer);
|
| + if (share_group_->bind_generates_resource())
|
| + helper_->CommandBufferHelper::Flush();
|
| +}
|
| +
|
| +void GLES2Implementation::UseProgramHelper(GLuint program) {
|
| if (current_program_ != program) {
|
| current_program_ = program;
|
| - changed = true;
|
| + helper_->UseProgram(program);
|
| }
|
| - return changed;
|
| }
|
|
|
| bool GLES2Implementation::IsBufferReservedId(GLuint id) {
|
|
|