| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 9987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9998 texture->SetImmutable(true); | 9998 texture->SetImmutable(true); |
| 9999 } | 9999 } |
| 10000 } | 10000 } |
| 10001 | 10001 |
| 10002 error::Error GLES2DecoderImpl::HandleGenMailboxCHROMIUM( | 10002 error::Error GLES2DecoderImpl::HandleGenMailboxCHROMIUM( |
| 10003 uint32 immediate_data_size, const cmds::GenMailboxCHROMIUM& c) { | 10003 uint32 immediate_data_size, const cmds::GenMailboxCHROMIUM& c) { |
| 10004 return error::kUnknownCommand; | 10004 return error::kUnknownCommand; |
| 10005 } | 10005 } |
| 10006 | 10006 |
| 10007 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, | 10007 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, |
| 10008 const GLbyte* mailbox) { | 10008 const GLbyte* data) { |
| 10009 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM", | 10009 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM", |
| 10010 "context", logger_.GetLogPrefix(), | 10010 "context", logger_.GetLogPrefix(), |
| 10011 "mailbox[0]", static_cast<unsigned char>(mailbox[0])); | 10011 "mailbox[0]", static_cast<unsigned char>(data[0])); |
| 10012 |
| 10013 const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); |
| 10014 DLOG_IF(ERROR, !mailbox.Verify()) << "ProduceTextureCHROMIUM was passed a " |
| 10015 "mailbox that was not generated by " |
| 10016 "GenMailboxCHROMIUM."; |
| 10012 | 10017 |
| 10013 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( | 10018 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( |
| 10014 &state_, target); | 10019 &state_, target); |
| 10015 if (!texture_ref) { | 10020 if (!texture_ref) { |
| 10016 LOCAL_SET_GL_ERROR( | 10021 LOCAL_SET_GL_ERROR( |
| 10017 GL_INVALID_OPERATION, | 10022 GL_INVALID_OPERATION, |
| 10018 "glProduceTextureCHROMIUM", "unknown texture for target"); | 10023 "glProduceTextureCHROMIUM", "unknown texture for target"); |
| 10019 return; | 10024 return; |
| 10020 } | 10025 } |
| 10021 | 10026 |
| 10022 Texture* produced = texture_manager()->Produce(texture_ref); | 10027 Texture* produced = texture_manager()->Produce(texture_ref); |
| 10023 if (!produced) { | 10028 if (!produced) { |
| 10024 LOCAL_SET_GL_ERROR( | 10029 LOCAL_SET_GL_ERROR( |
| 10025 GL_INVALID_OPERATION, | 10030 GL_INVALID_OPERATION, |
| 10026 "glProduceTextureCHROMIUM", "invalid texture"); | 10031 "glProduceTextureCHROMIUM", "invalid texture"); |
| 10027 return; | 10032 return; |
| 10028 } | 10033 } |
| 10029 | 10034 |
| 10030 group_->mailbox_manager()->ProduceTexture( | 10035 group_->mailbox_manager()->ProduceTexture(target, mailbox, produced); |
| 10031 target, | |
| 10032 *reinterpret_cast<const Mailbox*>(mailbox), | |
| 10033 produced); | |
| 10034 } | 10036 } |
| 10035 | 10037 |
| 10036 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, | 10038 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, |
| 10037 const GLbyte* mailbox) { | 10039 const GLbyte* data) { |
| 10038 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoConsumeTextureCHROMIUM", | 10040 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoConsumeTextureCHROMIUM", |
| 10039 "context", logger_.GetLogPrefix(), | 10041 "context", logger_.GetLogPrefix(), |
| 10040 "mailbox[0]", static_cast<unsigned char>(mailbox[0])); | 10042 "mailbox[0]", static_cast<unsigned char>(data[0])); |
| 10043 const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); |
| 10044 DLOG_IF(ERROR, !mailbox.Verify()) << "ConsumeTextureCHROMIUM was passed a " |
| 10045 "mailbox that was not generated by " |
| 10046 "GenMailboxCHROMIUM."; |
| 10041 | 10047 |
| 10042 scoped_refptr<TextureRef> texture_ref = | 10048 scoped_refptr<TextureRef> texture_ref = |
| 10043 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); | 10049 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); |
| 10044 if (!texture_ref.get()) { | 10050 if (!texture_ref.get()) { |
| 10045 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, | 10051 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
| 10046 "glConsumeTextureCHROMIUM", | 10052 "glConsumeTextureCHROMIUM", |
| 10047 "unknown texture for target"); | 10053 "unknown texture for target"); |
| 10048 return; | 10054 return; |
| 10049 } | 10055 } |
| 10050 GLuint client_id = texture_ref->client_id(); | 10056 GLuint client_id = texture_ref->client_id(); |
| 10051 if (!client_id) { | 10057 if (!client_id) { |
| 10052 LOCAL_SET_GL_ERROR( | 10058 LOCAL_SET_GL_ERROR( |
| 10053 GL_INVALID_OPERATION, | 10059 GL_INVALID_OPERATION, |
| 10054 "glConsumeTextureCHROMIUM", "unknown texture for target"); | 10060 "glConsumeTextureCHROMIUM", "unknown texture for target"); |
| 10055 return; | 10061 return; |
| 10056 } | 10062 } |
| 10057 Texture* texture = | 10063 Texture* texture = group_->mailbox_manager()->ConsumeTexture(target, mailbox); |
| 10058 group_->mailbox_manager()->ConsumeTexture( | |
| 10059 target, | |
| 10060 *reinterpret_cast<const Mailbox*>(mailbox)); | |
| 10061 if (!texture) { | 10064 if (!texture) { |
| 10062 LOCAL_SET_GL_ERROR( | 10065 LOCAL_SET_GL_ERROR( |
| 10063 GL_INVALID_OPERATION, | 10066 GL_INVALID_OPERATION, |
| 10064 "glConsumeTextureCHROMIUM", "invalid mailbox name"); | 10067 "glConsumeTextureCHROMIUM", "invalid mailbox name"); |
| 10065 return; | 10068 return; |
| 10066 } | 10069 } |
| 10067 if (texture->target() != target) { | 10070 if (texture->target() != target) { |
| 10068 LOCAL_SET_GL_ERROR( | 10071 LOCAL_SET_GL_ERROR( |
| 10069 GL_INVALID_OPERATION, | 10072 GL_INVALID_OPERATION, |
| 10070 "glConsumeTextureCHROMIUM", "invalid target"); | 10073 "glConsumeTextureCHROMIUM", "invalid target"); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10537 DoDidUseTexImageIfNeeded(texture, texture->target()); | 10540 DoDidUseTexImageIfNeeded(texture, texture->target()); |
| 10538 } | 10541 } |
| 10539 | 10542 |
| 10540 // Include the auto-generated part of this file. We split this because it means | 10543 // Include the auto-generated part of this file. We split this because it means |
| 10541 // we can easily edit the non-auto generated parts right here in this file | 10544 // we can easily edit the non-auto generated parts right here in this file |
| 10542 // instead of having to edit some template or the code generator. | 10545 // instead of having to edit some template or the code generator. |
| 10543 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10546 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 10544 | 10547 |
| 10545 } // namespace gles2 | 10548 } // namespace gles2 |
| 10546 } // namespace gpu | 10549 } // namespace gpu |
| OLD | NEW |