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 3562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3573 } | 3573 } |
3574 if (!offscreen_saved_color_texture_info_.get()) { | 3574 if (!offscreen_saved_color_texture_info_.get()) { |
3575 GLuint service_id = offscreen_saved_color_texture_->id(); | 3575 GLuint service_id = offscreen_saved_color_texture_->id(); |
3576 offscreen_saved_color_texture_info_ = TextureRef::Create( | 3576 offscreen_saved_color_texture_info_ = TextureRef::Create( |
3577 texture_manager(), 0, service_id); | 3577 texture_manager(), 0, service_id); |
3578 texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(), | 3578 texture_manager()->SetTarget(offscreen_saved_color_texture_info_.get(), |
3579 GL_TEXTURE_2D); | 3579 GL_TEXTURE_2D); |
3580 UpdateParentTextureInfo(); | 3580 UpdateParentTextureInfo(); |
3581 } | 3581 } |
3582 mailbox_manager()->ProduceTexture( | 3582 mailbox_manager()->ProduceTexture( |
3583 GL_TEXTURE_2D, mailbox, offscreen_saved_color_texture_info_->texture()); | 3583 mailbox, offscreen_saved_color_texture_info_->texture()); |
3584 } | 3584 } |
3585 | 3585 |
3586 bool GLES2DecoderImpl::ResizeOffscreenFrameBuffer(const gfx::Size& size) { | 3586 bool GLES2DecoderImpl::ResizeOffscreenFrameBuffer(const gfx::Size& size) { |
3587 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); | 3587 bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
3588 if (!is_offscreen) { | 3588 if (!is_offscreen) { |
3589 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer called " | 3589 LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer called " |
3590 << " with an onscreen framebuffer."; | 3590 << " with an onscreen framebuffer."; |
3591 return false; | 3591 return false; |
3592 } | 3592 } |
3593 | 3593 |
(...skipping 6945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10539 GL_INVALID_OPERATION, func_name.c_str(), "invalid texture"); | 10539 GL_INVALID_OPERATION, func_name.c_str(), "invalid texture"); |
10540 return; | 10540 return; |
10541 } | 10541 } |
10542 | 10542 |
10543 if (produced->target() != target) { | 10543 if (produced->target() != target) { |
10544 LOCAL_SET_GL_ERROR( | 10544 LOCAL_SET_GL_ERROR( |
10545 GL_INVALID_OPERATION, func_name.c_str(), "invalid target"); | 10545 GL_INVALID_OPERATION, func_name.c_str(), "invalid target"); |
10546 return; | 10546 return; |
10547 } | 10547 } |
10548 | 10548 |
10549 group_->mailbox_manager()->ProduceTexture(target, mailbox, produced); | 10549 group_->mailbox_manager()->ProduceTexture(mailbox, produced); |
10550 } | 10550 } |
10551 | 10551 |
10552 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, | 10552 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, |
10553 const GLbyte* data) { | 10553 const GLbyte* data) { |
10554 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoConsumeTextureCHROMIUM", | 10554 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoConsumeTextureCHROMIUM", |
10555 "context", logger_.GetLogPrefix(), | 10555 "context", logger_.GetLogPrefix(), |
10556 "mailbox[0]", static_cast<unsigned char>(data[0])); | 10556 "mailbox[0]", static_cast<unsigned char>(data[0])); |
10557 const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); | 10557 const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); |
10558 DLOG_IF(ERROR, !mailbox.Verify()) << "ConsumeTextureCHROMIUM was passed a " | 10558 DLOG_IF(ERROR, !mailbox.Verify()) << "ConsumeTextureCHROMIUM was passed a " |
10559 "mailbox that was not generated by " | 10559 "mailbox that was not generated by " |
10560 "GenMailboxCHROMIUM."; | 10560 "GenMailboxCHROMIUM."; |
10561 | 10561 |
10562 scoped_refptr<TextureRef> texture_ref = | 10562 scoped_refptr<TextureRef> texture_ref = |
10563 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); | 10563 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); |
10564 if (!texture_ref.get()) { | 10564 if (!texture_ref.get()) { |
10565 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, | 10565 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
10566 "glConsumeTextureCHROMIUM", | 10566 "glConsumeTextureCHROMIUM", |
10567 "unknown texture for target"); | 10567 "unknown texture for target"); |
10568 return; | 10568 return; |
10569 } | 10569 } |
10570 GLuint client_id = texture_ref->client_id(); | 10570 GLuint client_id = texture_ref->client_id(); |
10571 if (!client_id) { | 10571 if (!client_id) { |
10572 LOCAL_SET_GL_ERROR( | 10572 LOCAL_SET_GL_ERROR( |
10573 GL_INVALID_OPERATION, | 10573 GL_INVALID_OPERATION, |
10574 "glConsumeTextureCHROMIUM", "unknown texture for target"); | 10574 "glConsumeTextureCHROMIUM", "unknown texture for target"); |
10575 return; | 10575 return; |
10576 } | 10576 } |
10577 Texture* texture = group_->mailbox_manager()->ConsumeTexture(target, mailbox); | 10577 Texture* texture = group_->mailbox_manager()->ConsumeTexture(mailbox); |
10578 if (!texture) { | 10578 if (!texture) { |
10579 LOCAL_SET_GL_ERROR( | 10579 LOCAL_SET_GL_ERROR( |
10580 GL_INVALID_OPERATION, | 10580 GL_INVALID_OPERATION, |
10581 "glConsumeTextureCHROMIUM", "invalid mailbox name"); | 10581 "glConsumeTextureCHROMIUM", "invalid mailbox name"); |
10582 return; | 10582 return; |
10583 } | 10583 } |
10584 if (texture->target() != target) { | 10584 if (texture->target() != target) { |
10585 LOCAL_SET_GL_ERROR( | 10585 LOCAL_SET_GL_ERROR( |
10586 GL_INVALID_OPERATION, | 10586 GL_INVALID_OPERATION, |
10587 "glConsumeTextureCHROMIUM", "invalid target"); | 10587 "glConsumeTextureCHROMIUM", "invalid target"); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10653 "passed a mailbox that was not " | 10653 "passed a mailbox that was not " |
10654 "generated by GenMailboxCHROMIUM."; | 10654 "generated by GenMailboxCHROMIUM."; |
10655 | 10655 |
10656 TextureRef* texture_ref = GetTexture(client_id); | 10656 TextureRef* texture_ref = GetTexture(client_id); |
10657 if (texture_ref) { | 10657 if (texture_ref) { |
10658 LOCAL_SET_GL_ERROR( | 10658 LOCAL_SET_GL_ERROR( |
10659 GL_INVALID_OPERATION, | 10659 GL_INVALID_OPERATION, |
10660 "glCreateAndConsumeTextureCHROMIUM", "client id already in use"); | 10660 "glCreateAndConsumeTextureCHROMIUM", "client id already in use"); |
10661 return; | 10661 return; |
10662 } | 10662 } |
10663 Texture* texture = group_->mailbox_manager()->ConsumeTexture(target, mailbox); | 10663 Texture* texture = group_->mailbox_manager()->ConsumeTexture(mailbox); |
10664 if (!texture) { | 10664 if (!texture) { |
10665 LOCAL_SET_GL_ERROR( | 10665 LOCAL_SET_GL_ERROR( |
10666 GL_INVALID_OPERATION, | 10666 GL_INVALID_OPERATION, |
10667 "glCreateAndConsumeTextureCHROMIUM", "invalid mailbox name"); | 10667 "glCreateAndConsumeTextureCHROMIUM", "invalid mailbox name"); |
10668 return; | 10668 return; |
10669 } | 10669 } |
10670 if (texture->target() != target) { | 10670 if (texture->target() != target) { |
10671 LOCAL_SET_GL_ERROR( | 10671 LOCAL_SET_GL_ERROR( |
10672 GL_INVALID_OPERATION, | 10672 GL_INVALID_OPERATION, |
10673 "glCreateAndConsumeTextureCHROMIUM", "invalid target"); | 10673 "glCreateAndConsumeTextureCHROMIUM", "invalid target"); |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11232 } | 11232 } |
11233 } | 11233 } |
11234 | 11234 |
11235 // Include the auto-generated part of this file. We split this because it means | 11235 // Include the auto-generated part of this file. We split this because it means |
11236 // we can easily edit the non-auto generated parts right here in this file | 11236 // we can easily edit the non-auto generated parts right here in this file |
11237 // instead of having to edit some template or the code generator. | 11237 // instead of having to edit some template or the code generator. |
11238 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11238 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
11239 | 11239 |
11240 } // namespace gles2 | 11240 } // namespace gles2 |
11241 } // namespace gpu | 11241 } // namespace gpu |
OLD | NEW |