OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
670 GLES2Decoder* parent, | 670 GLES2Decoder* parent, |
671 uint32 parent_client_texture_id); | 671 uint32 parent_client_texture_id); |
672 virtual void Destroy(); | 672 virtual void Destroy(); |
673 virtual void ResizeOffscreenFrameBuffer(const gfx::Size& size); | 673 virtual void ResizeOffscreenFrameBuffer(const gfx::Size& size); |
674 virtual bool UpdateOffscreenFrameBufferSize(); | 674 virtual bool UpdateOffscreenFrameBufferSize(); |
675 virtual bool MakeCurrent(); | 675 virtual bool MakeCurrent(); |
676 virtual GLES2Util* GetGLES2Util() { return &util_; } | 676 virtual GLES2Util* GetGLES2Util() { return &util_; } |
677 virtual gfx::GLContext* GetGLContext() { return context_.get(); } | 677 virtual gfx::GLContext* GetGLContext() { return context_.get(); } |
678 virtual ContextGroup* GetContextGroup() { return group_.get(); } | 678 virtual ContextGroup* GetContextGroup() { return group_.get(); } |
679 | 679 |
680 virtual void SetResizeCallback(Callback1<gfx::Size>::Type* callback); | |
680 virtual void SetSwapBuffersCallback(Callback0::Type* callback); | 681 virtual void SetSwapBuffersCallback(Callback0::Type* callback); |
681 virtual bool GetServiceTextureId(uint32 client_texture_id, | 682 virtual bool GetServiceTextureId(uint32 client_texture_id, |
682 uint32* service_texture_id); | 683 uint32* service_texture_id); |
683 | 684 |
684 // Restores the current state to the user's settings. | 685 // Restores the current state to the user's settings. |
685 void RestoreCurrentFramebufferBindings(); | 686 void RestoreCurrentFramebufferBindings(); |
686 void RestoreCurrentRenderbufferBindings(); | 687 void RestoreCurrentRenderbufferBindings(); |
687 void RestoreCurrentTexture2DBindings(); | 688 void RestoreCurrentTexture2DBindings(); |
688 | 689 |
689 private: | 690 private: |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1417 GLsizei offscreen_target_samples_; | 1418 GLsizei offscreen_target_samples_; |
1418 | 1419 |
1419 GLuint copy_texture_to_parent_texture_fb_; | 1420 GLuint copy_texture_to_parent_texture_fb_; |
1420 | 1421 |
1421 // The copy that is saved when SwapBuffers is called. It is also | 1422 // The copy that is saved when SwapBuffers is called. It is also |
1422 // used as the destination for multi-sample resolves. | 1423 // used as the destination for multi-sample resolves. |
1423 scoped_ptr<FrameBuffer> offscreen_saved_frame_buffer_; | 1424 scoped_ptr<FrameBuffer> offscreen_saved_frame_buffer_; |
1424 scoped_ptr<Texture> offscreen_saved_color_texture_; | 1425 scoped_ptr<Texture> offscreen_saved_color_texture_; |
1425 GLenum offscreen_saved_color_format_; | 1426 GLenum offscreen_saved_color_format_; |
1426 | 1427 |
1428 scoped_ptr<Callback1<gfx::Size>::Type> resize_callback_; | |
1427 scoped_ptr<Callback0::Type> swap_buffers_callback_; | 1429 scoped_ptr<Callback0::Type> swap_buffers_callback_; |
1428 | 1430 |
1429 // The last error message set. | 1431 // The last error message set. |
1430 std::string last_error_; | 1432 std::string last_error_; |
1431 | 1433 |
1432 // The current decoder error. | 1434 // The current decoder error. |
1433 error::Error current_decoder_error_; | 1435 error::Error current_decoder_error_; |
1434 | 1436 |
1435 bool use_shader_translator_; | 1437 bool use_shader_translator_; |
1436 scoped_ptr<ShaderTranslator> vertex_translator_; | 1438 scoped_ptr<ShaderTranslator> vertex_translator_; |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2415 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); | 2417 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
2416 glDisable(GL_SCISSOR_TEST); | 2418 glDisable(GL_SCISSOR_TEST); |
2417 glClear(GL_COLOR_BUFFER_BIT); | 2419 glClear(GL_COLOR_BUFFER_BIT); |
2418 RestoreClearState(); | 2420 RestoreClearState(); |
2419 } | 2421 } |
2420 } | 2422 } |
2421 | 2423 |
2422 return true; | 2424 return true; |
2423 } | 2425 } |
2424 | 2426 |
2427 void GLES2DecoderImpl::SetResizeCallback(Callback1<gfx::Size>::Type* callback) { | |
2428 resize_callback_.reset(callback); | |
2429 } | |
2430 | |
2425 void GLES2DecoderImpl::SetSwapBuffersCallback(Callback0::Type* callback) { | 2431 void GLES2DecoderImpl::SetSwapBuffersCallback(Callback0::Type* callback) { |
2426 swap_buffers_callback_.reset(callback); | 2432 swap_buffers_callback_.reset(callback); |
2427 } | 2433 } |
2428 | 2434 |
2429 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, | 2435 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, |
2430 uint32* service_texture_id) { | 2436 uint32* service_texture_id) { |
2431 TextureManager::TextureInfo* texture = | 2437 TextureManager::TextureInfo* texture = |
2432 texture_manager()->GetTextureInfo(client_texture_id); | 2438 texture_manager()->GetTextureInfo(client_texture_id); |
2433 if (texture) { | 2439 if (texture) { |
2434 *service_texture_id = texture->service_id(); | 2440 *service_texture_id = texture->service_id(); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2545 0, // level | 2551 0, // level |
2546 GL_RGBA, | 2552 GL_RGBA, |
2547 0, 0, // x, y | 2553 0, 0, // x, y |
2548 width, | 2554 width, |
2549 height, | 2555 height, |
2550 0); // border | 2556 0); // border |
2551 } | 2557 } |
2552 } | 2558 } |
2553 | 2559 |
2554 void GLES2DecoderImpl::DoResizeCHROMIUM(GLuint width, GLuint height) { | 2560 void GLES2DecoderImpl::DoResizeCHROMIUM(GLuint width, GLuint height) { |
2555 gfx::Size size(width, height); | 2561 #if defined(LINUX) |
Ken Russell (switch to Gerrit)
2010/11/23 22:01:17
#if defined(OS_LINUX)
jonathan.backer
2010/11/24 14:14:45
Done.
| |
2556 context_->SetSize(size); | 2562 // Make sure that we are done drawing to the back buffer before resizing. |
2563 glFinish(); | |
2564 #endif | |
2565 if (resize_callback_.get()) { | |
2566 gfx::Size size(width, height); | |
2567 resize_callback_->Run(size); | |
2568 } | |
2557 } | 2569 } |
2558 | 2570 |
2559 const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const { | 2571 const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const { |
2560 if (command_id > kStartPoint && command_id < kNumCommands) { | 2572 if (command_id > kStartPoint && command_id < kNumCommands) { |
2561 return gles2::GetCommandName(static_cast<CommandId>(command_id)); | 2573 return gles2::GetCommandName(static_cast<CommandId>(command_id)); |
2562 } | 2574 } |
2563 return GetCommonCommandName(static_cast<cmd::CommandId>(command_id)); | 2575 return GetCommonCommandName(static_cast<cmd::CommandId>(command_id)); |
2564 } | 2576 } |
2565 | 2577 |
2566 // Decode command with its arguments, and call the corresponding GL function. | 2578 // Decode command with its arguments, and call the corresponding GL function. |
(...skipping 3355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5922 return error::kNoError; | 5934 return error::kNoError; |
5923 } | 5935 } |
5924 | 5936 |
5925 // Include the auto-generated part of this file. We split this because it means | 5937 // Include the auto-generated part of this file. We split this because it means |
5926 // we can easily edit the non-auto generated parts right here in this file | 5938 // we can easily edit the non-auto generated parts right here in this file |
5927 // instead of having to edit some template or the code generator. | 5939 // instead of having to edit some template or the code generator. |
5928 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 5940 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
5929 | 5941 |
5930 } // namespace gles2 | 5942 } // namespace gles2 |
5931 } // namespace gpu | 5943 } // namespace gpu |
OLD | NEW |