| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 virtual GLES2Util* GetGLES2Util() { return &util_; } | 514 virtual GLES2Util* GetGLES2Util() { return &util_; } |
| 515 virtual gfx::GLContext* GetGLContext() { return context_.get(); } | 515 virtual gfx::GLContext* GetGLContext() { return context_.get(); } |
| 516 virtual gfx::GLSurface* GetGLSurface() { return surface_.get(); } | 516 virtual gfx::GLSurface* GetGLSurface() { return surface_.get(); } |
| 517 virtual ContextGroup* GetContextGroup() { return group_.get(); } | 517 virtual ContextGroup* GetContextGroup() { return group_.get(); } |
| 518 | 518 |
| 519 virtual void SetGLError(GLenum error, const char* msg); | 519 virtual void SetGLError(GLenum error, const char* msg); |
| 520 virtual void SetResizeCallback( | 520 virtual void SetResizeCallback( |
| 521 const base::Callback<void(gfx::Size)>& callback); | 521 const base::Callback<void(gfx::Size)>& callback); |
| 522 | 522 |
| 523 virtual void SetSwapBuffersCallback(const base::Closure& callback); | 523 virtual void SetSwapBuffersCallback(const base::Closure& callback); |
| 524 virtual void SetMsgCallback(const MsgCallback& callback); |
| 524 | 525 |
| 525 virtual void SetStreamTextureManager(StreamTextureManager* manager); | 526 virtual void SetStreamTextureManager(StreamTextureManager* manager); |
| 526 virtual bool GetServiceTextureId(uint32 client_texture_id, | 527 virtual bool GetServiceTextureId(uint32 client_texture_id, |
| 527 uint32* service_texture_id); | 528 uint32* service_texture_id); |
| 528 | 529 |
| 529 // Restores the current state to the user's settings. | 530 // Restores the current state to the user's settings. |
| 530 void RestoreCurrentFramebufferBindings(); | 531 void RestoreCurrentFramebufferBindings(); |
| 531 void RestoreCurrentRenderbufferBindings(); | 532 void RestoreCurrentRenderbufferBindings(); |
| 532 void RestoreCurrentTexture2DBindings(); | 533 void RestoreCurrentTexture2DBindings(); |
| 533 | 534 |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 scoped_ptr<Texture> offscreen_saved_color_texture_; | 1418 scoped_ptr<Texture> offscreen_saved_color_texture_; |
| 1418 | 1419 |
| 1419 // The copy that is used as the destination for multi-sample resolves. | 1420 // The copy that is used as the destination for multi-sample resolves. |
| 1420 scoped_ptr<FrameBuffer> offscreen_resolved_frame_buffer_; | 1421 scoped_ptr<FrameBuffer> offscreen_resolved_frame_buffer_; |
| 1421 scoped_ptr<Texture> offscreen_resolved_color_texture_; | 1422 scoped_ptr<Texture> offscreen_resolved_color_texture_; |
| 1422 GLenum offscreen_saved_color_format_; | 1423 GLenum offscreen_saved_color_format_; |
| 1423 | 1424 |
| 1424 base::Callback<void(gfx::Size)> resize_callback_; | 1425 base::Callback<void(gfx::Size)> resize_callback_; |
| 1425 | 1426 |
| 1426 base::Closure swap_buffers_callback_; | 1427 base::Closure swap_buffers_callback_; |
| 1428 MsgCallback msg_callback_; |
| 1427 | 1429 |
| 1428 StreamTextureManager* stream_texture_manager_; | 1430 StreamTextureManager* stream_texture_manager_; |
| 1429 | 1431 |
| 1430 // The format of the back buffer_ | 1432 // The format of the back buffer_ |
| 1431 GLenum back_buffer_color_format_; | 1433 GLenum back_buffer_color_format_; |
| 1432 bool back_buffer_has_depth_; | 1434 bool back_buffer_has_depth_; |
| 1433 bool back_buffer_has_stencil_; | 1435 bool back_buffer_has_stencil_; |
| 1434 | 1436 |
| 1435 bool teximage2d_faster_than_texsubimage2d_; | 1437 bool teximage2d_faster_than_texsubimage2d_; |
| 1436 bool bufferdata_faster_than_buffersubdata_; | 1438 bool bufferdata_faster_than_buffersubdata_; |
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2586 | 2588 |
| 2587 void GLES2DecoderImpl::SetResizeCallback( | 2589 void GLES2DecoderImpl::SetResizeCallback( |
| 2588 const base::Callback<void(gfx::Size)>& callback) { | 2590 const base::Callback<void(gfx::Size)>& callback) { |
| 2589 resize_callback_ = callback; | 2591 resize_callback_ = callback; |
| 2590 } | 2592 } |
| 2591 | 2593 |
| 2592 void GLES2DecoderImpl::SetSwapBuffersCallback(const base::Closure& callback) { | 2594 void GLES2DecoderImpl::SetSwapBuffersCallback(const base::Closure& callback) { |
| 2593 swap_buffers_callback_ = callback; | 2595 swap_buffers_callback_ = callback; |
| 2594 } | 2596 } |
| 2595 | 2597 |
| 2598 void GLES2DecoderImpl::SetMsgCallback(const MsgCallback& callback) { |
| 2599 msg_callback_ = callback; |
| 2600 } |
| 2601 |
| 2596 void GLES2DecoderImpl::SetStreamTextureManager(StreamTextureManager* manager) { | 2602 void GLES2DecoderImpl::SetStreamTextureManager(StreamTextureManager* manager) { |
| 2597 stream_texture_manager_ = manager; | 2603 stream_texture_manager_ = manager; |
| 2598 } | 2604 } |
| 2599 | 2605 |
| 2600 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, | 2606 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, |
| 2601 uint32* service_texture_id) { | 2607 uint32* service_texture_id) { |
| 2602 TextureManager::TextureInfo* texture = | 2608 TextureManager::TextureInfo* texture = |
| 2603 texture_manager()->GetTextureInfo(client_texture_id); | 2609 texture_manager()->GetTextureInfo(client_texture_id); |
| 2604 if (texture) { | 2610 if (texture) { |
| 2605 *service_texture_id = texture->service_id(); | 2611 *service_texture_id = texture->service_id(); |
| (...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4561 if (error != GL_NO_ERROR) { | 4567 if (error != GL_NO_ERROR) { |
| 4562 SetGLError(error, ""); | 4568 SetGLError(error, ""); |
| 4563 } | 4569 } |
| 4564 return error; | 4570 return error; |
| 4565 } | 4571 } |
| 4566 | 4572 |
| 4567 void GLES2DecoderImpl::SetGLError(GLenum error, const char* msg) { | 4573 void GLES2DecoderImpl::SetGLError(GLenum error, const char* msg) { |
| 4568 if (msg) { | 4574 if (msg) { |
| 4569 last_error_ = msg; | 4575 last_error_ = msg; |
| 4570 LOG(ERROR) << last_error_; | 4576 LOG(ERROR) << last_error_; |
| 4577 if (!msg_callback_.is_null()) { |
| 4578 msg_callback_.Run(0, GLES2Util::GetStringEnum(error) + " : " + msg); |
| 4579 } |
| 4571 } | 4580 } |
| 4572 error_bits_ |= GLES2Util::GLErrorToErrorBit(error); | 4581 error_bits_ |= GLES2Util::GLErrorToErrorBit(error); |
| 4573 } | 4582 } |
| 4574 | 4583 |
| 4575 void GLES2DecoderImpl::CopyRealGLErrorsToWrapper() { | 4584 void GLES2DecoderImpl::CopyRealGLErrorsToWrapper() { |
| 4576 GLenum error; | 4585 GLenum error; |
| 4577 while ((error = glGetError()) != GL_NO_ERROR) { | 4586 while ((error = glGetError()) != GL_NO_ERROR) { |
| 4578 SetGLError(error, NULL); | 4587 SetGLError(error, NULL); |
| 4579 } | 4588 } |
| 4580 } | 4589 } |
| (...skipping 3260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7841 | 7850 |
| 7842 } | 7851 } |
| 7843 | 7852 |
| 7844 // Include the auto-generated part of this file. We split this because it means | 7853 // Include the auto-generated part of this file. We split this because it means |
| 7845 // we can easily edit the non-auto generated parts right here in this file | 7854 // we can easily edit the non-auto generated parts right here in this file |
| 7846 // instead of having to edit some template or the code generator. | 7855 // instead of having to edit some template or the code generator. |
| 7847 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 7856 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 7848 | 7857 |
| 7849 } // namespace gles2 | 7858 } // namespace gles2 |
| 7850 } // namespace gpu | 7859 } // namespace gpu |
| OLD | NEW |