| 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 9997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10008 texture->SetImmutable(true); | 10008 texture->SetImmutable(true); |
| 10009 } | 10009 } |
| 10010 } | 10010 } |
| 10011 | 10011 |
| 10012 error::Error GLES2DecoderImpl::HandleGenMailboxCHROMIUM( | 10012 error::Error GLES2DecoderImpl::HandleGenMailboxCHROMIUM( |
| 10013 uint32 immediate_data_size, const cmds::GenMailboxCHROMIUM& c) { | 10013 uint32 immediate_data_size, const cmds::GenMailboxCHROMIUM& c) { |
| 10014 return error::kUnknownCommand; | 10014 return error::kUnknownCommand; |
| 10015 } | 10015 } |
| 10016 | 10016 |
| 10017 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, | 10017 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, |
| 10018 const GLbyte* mailbox) { | 10018 const GLbyte* data) { |
| 10019 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM", | 10019 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM", |
| 10020 "context", logger_.GetLogPrefix(), | 10020 "context", logger_.GetLogPrefix(), |
| 10021 "mailbox[0]", static_cast<unsigned char>(mailbox[0])); | 10021 "mailbox[0]", static_cast<unsigned char>(data[0])); |
| 10022 |
| 10023 const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); |
| 10024 DLOG_IF(ERROR, !mailbox.Verify()) << "ProduceTextureCHROMIUM was passed a " |
| 10025 "mailbox that was not generated by " |
| 10026 "GenMailboxCHROMIUM."; |
| 10022 | 10027 |
| 10023 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( | 10028 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( |
| 10024 &state_, target); | 10029 &state_, target); |
| 10025 if (!texture_ref) { | 10030 if (!texture_ref) { |
| 10026 LOCAL_SET_GL_ERROR( | 10031 LOCAL_SET_GL_ERROR( |
| 10027 GL_INVALID_OPERATION, | 10032 GL_INVALID_OPERATION, |
| 10028 "glProduceTextureCHROMIUM", "unknown texture for target"); | 10033 "glProduceTextureCHROMIUM", "unknown texture for target"); |
| 10029 return; | 10034 return; |
| 10030 } | 10035 } |
| 10031 | 10036 |
| 10032 Texture* produced = texture_manager()->Produce(texture_ref); | 10037 Texture* produced = texture_manager()->Produce(texture_ref); |
| 10033 if (!produced) { | 10038 if (!produced) { |
| 10034 LOCAL_SET_GL_ERROR( | 10039 LOCAL_SET_GL_ERROR( |
| 10035 GL_INVALID_OPERATION, | 10040 GL_INVALID_OPERATION, |
| 10036 "glProduceTextureCHROMIUM", "invalid texture"); | 10041 "glProduceTextureCHROMIUM", "invalid texture"); |
| 10037 return; | 10042 return; |
| 10038 } | 10043 } |
| 10039 | 10044 |
| 10040 group_->mailbox_manager()->ProduceTexture( | 10045 group_->mailbox_manager()->ProduceTexture(target, mailbox, produced); |
| 10041 target, | |
| 10042 *reinterpret_cast<const Mailbox*>(mailbox), | |
| 10043 produced); | |
| 10044 } | 10046 } |
| 10045 | 10047 |
| 10046 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, | 10048 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, |
| 10047 const GLbyte* mailbox) { | 10049 const GLbyte* data) { |
| 10048 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoConsumeTextureCHROMIUM", | 10050 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoConsumeTextureCHROMIUM", |
| 10049 "context", logger_.GetLogPrefix(), | 10051 "context", logger_.GetLogPrefix(), |
| 10050 "mailbox[0]", static_cast<unsigned char>(mailbox[0])); | 10052 "mailbox[0]", static_cast<unsigned char>(data[0])); |
| 10053 const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); |
| 10054 DLOG_IF(ERROR, !mailbox.Verify()) << "ConsumeTextureCHROMIUM was passed a " |
| 10055 "mailbox that was not generated by " |
| 10056 "GenMailboxCHROMIUM."; |
| 10051 | 10057 |
| 10052 scoped_refptr<TextureRef> texture_ref = | 10058 scoped_refptr<TextureRef> texture_ref = |
| 10053 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); | 10059 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); |
| 10054 if (!texture_ref.get()) { | 10060 if (!texture_ref.get()) { |
| 10055 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, | 10061 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
| 10056 "glConsumeTextureCHROMIUM", | 10062 "glConsumeTextureCHROMIUM", |
| 10057 "unknown texture for target"); | 10063 "unknown texture for target"); |
| 10058 return; | 10064 return; |
| 10059 } | 10065 } |
| 10060 GLuint client_id = texture_ref->client_id(); | 10066 GLuint client_id = texture_ref->client_id(); |
| 10061 if (!client_id) { | 10067 if (!client_id) { |
| 10062 LOCAL_SET_GL_ERROR( | 10068 LOCAL_SET_GL_ERROR( |
| 10063 GL_INVALID_OPERATION, | 10069 GL_INVALID_OPERATION, |
| 10064 "glConsumeTextureCHROMIUM", "unknown texture for target"); | 10070 "glConsumeTextureCHROMIUM", "unknown texture for target"); |
| 10065 return; | 10071 return; |
| 10066 } | 10072 } |
| 10067 Texture* texture = | 10073 Texture* texture = group_->mailbox_manager()->ConsumeTexture(target, mailbox); |
| 10068 group_->mailbox_manager()->ConsumeTexture( | |
| 10069 target, | |
| 10070 *reinterpret_cast<const Mailbox*>(mailbox)); | |
| 10071 if (!texture) { | 10074 if (!texture) { |
| 10072 LOCAL_SET_GL_ERROR( | 10075 LOCAL_SET_GL_ERROR( |
| 10073 GL_INVALID_OPERATION, | 10076 GL_INVALID_OPERATION, |
| 10074 "glConsumeTextureCHROMIUM", "invalid mailbox name"); | 10077 "glConsumeTextureCHROMIUM", "invalid mailbox name"); |
| 10075 return; | 10078 return; |
| 10076 } | 10079 } |
| 10077 if (texture->target() != target) { | 10080 if (texture->target() != target) { |
| 10078 LOCAL_SET_GL_ERROR( | 10081 LOCAL_SET_GL_ERROR( |
| 10079 GL_INVALID_OPERATION, | 10082 GL_INVALID_OPERATION, |
| 10080 "glConsumeTextureCHROMIUM", "invalid target"); | 10083 "glConsumeTextureCHROMIUM", "invalid target"); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10547 DoDidUseTexImageIfNeeded(texture, texture->target()); | 10550 DoDidUseTexImageIfNeeded(texture, texture->target()); |
| 10548 } | 10551 } |
| 10549 | 10552 |
| 10550 // Include the auto-generated part of this file. We split this because it means | 10553 // Include the auto-generated part of this file. We split this because it means |
| 10551 // we can easily edit the non-auto generated parts right here in this file | 10554 // we can easily edit the non-auto generated parts right here in this file |
| 10552 // instead of having to edit some template or the code generator. | 10555 // instead of having to edit some template or the code generator. |
| 10553 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10556 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 10554 | 10557 |
| 10555 } // namespace gles2 | 10558 } // namespace gles2 |
| 10556 } // namespace gpu | 10559 } // namespace gpu |
| OLD | NEW |