| 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 f954189ff66863873048905935d0d0bac811a09c..f14058d33bfa45b4aab5661df113a9d941e52e5b 100644
|
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| @@ -937,7 +937,14 @@ class GLES2DecoderImpl : public GLES2Decoder,
|
| GLsizei height);
|
|
|
| void DoProduceTextureCHROMIUM(GLenum target, const GLbyte* key);
|
| + void DoProduceTextureDirectCHROMIUM(GLuint texture, GLenum target,
|
| + const GLbyte* key);
|
| + void ProduceTextureRef(std::string func_name, TextureRef* texture_ref,
|
| + GLenum target, const GLbyte* data);
|
| +
|
| void DoConsumeTextureCHROMIUM(GLenum target, const GLbyte* key);
|
| + void DoCreateAndConsumeTextureCHROMIUM(GLenum target, const GLbyte* key,
|
| + GLuint client_id);
|
|
|
| void DoBindTexImage2DCHROMIUM(
|
| GLenum target,
|
| @@ -10197,25 +10204,44 @@ void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target,
|
| "context", logger_.GetLogPrefix(),
|
| "mailbox[0]", static_cast<unsigned char>(data[0]));
|
|
|
| + TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget(
|
| + &state_, target);
|
| + ProduceTextureRef("glProduceTextureCHROMIUM", texture_ref, target, data);
|
| +}
|
| +
|
| +void GLES2DecoderImpl::DoProduceTextureDirectCHROMIUM(GLuint client_id,
|
| + GLenum target, const GLbyte* data) {
|
| + TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureDirectCHROMIUM",
|
| + "context", logger_.GetLogPrefix(),
|
| + "mailbox[0]", static_cast<unsigned char>(data[0]));
|
| +
|
| + ProduceTextureRef("glProduceTextureDirectCHROMIUM", GetTexture(client_id),
|
| + target, data);
|
| +}
|
| +
|
| +void GLES2DecoderImpl::ProduceTextureRef(std::string func_name,
|
| + TextureRef* texture_ref, GLenum target, const GLbyte* data) {
|
| const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data);
|
| - DLOG_IF(ERROR, !mailbox.Verify()) << "ProduceTextureCHROMIUM was passed a "
|
| + DLOG_IF(ERROR, !mailbox.Verify()) << func_name << " was passed a "
|
| "mailbox that was not generated by "
|
| "GenMailboxCHROMIUM.";
|
|
|
| - TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget(
|
| - &state_, target);
|
| if (!texture_ref) {
|
| LOCAL_SET_GL_ERROR(
|
| - GL_INVALID_OPERATION,
|
| - "glProduceTextureCHROMIUM", "unknown texture for target");
|
| + GL_INVALID_OPERATION, func_name.c_str(), "unknown texture for target");
|
| return;
|
| }
|
|
|
| Texture* produced = texture_manager()->Produce(texture_ref);
|
| if (!produced) {
|
| LOCAL_SET_GL_ERROR(
|
| - GL_INVALID_OPERATION,
|
| - "glProduceTextureCHROMIUM", "invalid texture");
|
| + GL_INVALID_OPERATION, func_name.c_str(), "invalid texture");
|
| + return;
|
| + }
|
| +
|
| + if (produced->target() != target) {
|
| + LOCAL_SET_GL_ERROR(
|
| + GL_INVALID_OPERATION, func_name.c_str(), "invalid target");
|
| return;
|
| }
|
|
|
| @@ -10286,6 +10312,70 @@ void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target,
|
| }
|
| }
|
|
|
| +error::Error GLES2DecoderImpl::HandleCreateAndConsumeTextureCHROMIUMImmediate(
|
| + uint32_t immediate_data_size,
|
| + const gles2::cmds::CreateAndConsumeTextureCHROMIUMImmediate& c) {
|
| + GLenum target = static_cast<GLenum>(c.target);
|
| + uint32_t data_size;
|
| + if (!ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) {
|
| + return error::kOutOfBounds;
|
| + }
|
| + if (data_size > immediate_data_size) {
|
| + return error::kOutOfBounds;
|
| + }
|
| + const GLbyte* mailbox =
|
| + GetImmediateDataAs<const GLbyte*>(c, data_size, immediate_data_size);
|
| + if (!validators_->texture_bind_target.IsValid(target)) {
|
| + LOCAL_SET_GL_ERROR_INVALID_ENUM(
|
| + "glCreateAndConsumeTextureCHROMIUM", target, "target");
|
| + return error::kNoError;
|
| + }
|
| + if (mailbox == NULL) {
|
| + return error::kOutOfBounds;
|
| + }
|
| + uint32_t client_id = c.client_id;
|
| + DoCreateAndConsumeTextureCHROMIUM(target, mailbox, client_id);
|
| + return error::kNoError;
|
| +}
|
| +
|
| +void GLES2DecoderImpl::DoCreateAndConsumeTextureCHROMIUM(GLenum target,
|
| + const GLbyte* data, GLuint client_id) {
|
| + TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoCreateAndConsumeTextureCHROMIUM",
|
| + "context", logger_.GetLogPrefix(),
|
| + "mailbox[0]", static_cast<unsigned char>(data[0]));
|
| + const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data);
|
| + DLOG_IF(ERROR, !mailbox.Verify()) << "CreateAndConsumeTextureCHROMIUM was "
|
| + "passed a mailbox that was not "
|
| + "generated by GenMailboxCHROMIUM.";
|
| +
|
| + TextureRef* texture_ref = GetTexture(client_id);
|
| + if (texture_ref) {
|
| + LOCAL_SET_GL_ERROR(
|
| + GL_INVALID_OPERATION,
|
| + "glCreateAndConsumeTextureCHROMIUM", "client id already in use");
|
| + return;
|
| + }
|
| + Texture* texture = group_->mailbox_manager()->ConsumeTexture(target, mailbox);
|
| + if (!texture) {
|
| + LOCAL_SET_GL_ERROR(
|
| + GL_INVALID_OPERATION,
|
| + "glCreateAndConsumeTextureCHROMIUM", "invalid mailbox name");
|
| + return;
|
| + }
|
| + if (texture->target() != target) {
|
| + LOCAL_SET_GL_ERROR(
|
| + GL_INVALID_OPERATION,
|
| + "glCreateAndConsumeTextureCHROMIUM", "invalid target");
|
| + return;
|
| + }
|
| +
|
| + IdAllocatorInterface* id_allocator =
|
| + group_->GetIdAllocator(id_namespaces::kTextures);
|
| + id_allocator->MarkAsUsed(client_id);
|
| +
|
| + texture_ref = texture_manager()->Consume(client_id, texture);
|
| +}
|
| +
|
| void GLES2DecoderImpl::DoInsertEventMarkerEXT(
|
| GLsizei length, const GLchar* marker) {
|
| if (!marker) {
|
|
|