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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 virtual bool ResizeOffscreenFrameBuffer(const gfx::Size& size); | 476 virtual bool ResizeOffscreenFrameBuffer(const gfx::Size& size); |
477 void UpdateParentTextureInfo(); | 477 void UpdateParentTextureInfo(); |
478 virtual bool MakeCurrent(); | 478 virtual bool MakeCurrent(); |
479 virtual GLES2Util* GetGLES2Util() { return &util_; } | 479 virtual GLES2Util* GetGLES2Util() { return &util_; } |
480 virtual gfx::GLContext* GetGLContext() { return context_.get(); } | 480 virtual gfx::GLContext* GetGLContext() { return context_.get(); } |
481 virtual gfx::GLSurface* GetGLSurface() { return surface_.get(); } | 481 virtual gfx::GLSurface* GetGLSurface() { return surface_.get(); } |
482 virtual ContextGroup* GetContextGroup() { return group_.get(); } | 482 virtual ContextGroup* GetContextGroup() { return group_.get(); } |
483 | 483 |
484 virtual void SetResizeCallback(Callback1<gfx::Size>::Type* callback); | 484 virtual void SetResizeCallback(Callback1<gfx::Size>::Type* callback); |
485 | 485 |
486 virtual void SetSurfaceVisibleCallback(Callback1<bool>::Type* callback); | |
487 | |
486 #if defined(OS_MACOSX) | 488 #if defined(OS_MACOSX) |
487 virtual void SetSwapBuffersCallback(Callback0::Type* callback); | 489 virtual void SetSwapBuffersCallback(Callback0::Type* callback); |
488 #endif | 490 #endif |
489 | 491 |
490 virtual void SetStreamTextureManager(StreamTextureManager* manager); | 492 virtual void SetStreamTextureManager(StreamTextureManager* manager); |
491 virtual bool GetServiceTextureId(uint32 client_texture_id, | 493 virtual bool GetServiceTextureId(uint32 client_texture_id, |
492 uint32* service_texture_id); | 494 uint32* service_texture_id); |
493 | 495 |
494 // Restores the current state to the user's settings. | 496 // Restores the current state to the user's settings. |
495 void RestoreCurrentFramebufferBindings(); | 497 void RestoreCurrentFramebufferBindings(); |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1284 scoped_ptr<FrameBuffer> offscreen_saved_frame_buffer_; | 1286 scoped_ptr<FrameBuffer> offscreen_saved_frame_buffer_; |
1285 scoped_ptr<Texture> offscreen_saved_color_texture_; | 1287 scoped_ptr<Texture> offscreen_saved_color_texture_; |
1286 | 1288 |
1287 // The copy that is used as the destination for multi-sample resolves. | 1289 // The copy that is used as the destination for multi-sample resolves. |
1288 scoped_ptr<FrameBuffer> offscreen_resolved_frame_buffer_; | 1290 scoped_ptr<FrameBuffer> offscreen_resolved_frame_buffer_; |
1289 scoped_ptr<Texture> offscreen_resolved_color_texture_; | 1291 scoped_ptr<Texture> offscreen_resolved_color_texture_; |
1290 GLenum offscreen_saved_color_format_; | 1292 GLenum offscreen_saved_color_format_; |
1291 | 1293 |
1292 scoped_ptr<Callback1<gfx::Size>::Type> resize_callback_; | 1294 scoped_ptr<Callback1<gfx::Size>::Type> resize_callback_; |
1293 | 1295 |
1296 scoped_ptr<Callback1<bool>::Type> surface_visible_callback_; | |
1297 | |
1294 #if defined(OS_MACOSX) | 1298 #if defined(OS_MACOSX) |
1295 scoped_ptr<Callback0::Type> swap_buffers_callback_; | 1299 scoped_ptr<Callback0::Type> swap_buffers_callback_; |
1296 #endif | 1300 #endif |
1297 | 1301 |
1298 StreamTextureManager* stream_texture_manager_; | 1302 StreamTextureManager* stream_texture_manager_; |
1299 | 1303 |
1300 // The format of the back buffer_ | 1304 // The format of the back buffer_ |
1301 GLenum back_buffer_color_format_; | 1305 GLenum back_buffer_color_format_; |
1302 bool back_buffer_has_depth_; | 1306 bool back_buffer_has_depth_; |
1303 bool back_buffer_has_stencil_; | 1307 bool back_buffer_has_stencil_; |
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2329 GL_TEXTURE_WRAP_T, | 2333 GL_TEXTURE_WRAP_T, |
2330 GL_CLAMP_TO_EDGE); | 2334 GL_CLAMP_TO_EDGE); |
2331 } | 2335 } |
2332 } | 2336 } |
2333 | 2337 |
2334 void GLES2DecoderImpl::SetResizeCallback( | 2338 void GLES2DecoderImpl::SetResizeCallback( |
2335 Callback1<gfx::Size>::Type* callback) { | 2339 Callback1<gfx::Size>::Type* callback) { |
2336 resize_callback_.reset(callback); | 2340 resize_callback_.reset(callback); |
2337 } | 2341 } |
2338 | 2342 |
2343 void GLES2DecoderImpl::SetSurfaceVisibleCallback( | |
2344 Callback1<bool>::Type* callback) { | |
2345 surface_visible_callback_.reset(callback); | |
2346 } | |
2347 | |
2339 #if defined(OS_MACOSX) | 2348 #if defined(OS_MACOSX) |
2340 void GLES2DecoderImpl::SetSwapBuffersCallback(Callback0::Type* callback) { | 2349 void GLES2DecoderImpl::SetSwapBuffersCallback(Callback0::Type* callback) { |
2341 swap_buffers_callback_.reset(callback); | 2350 swap_buffers_callback_.reset(callback); |
2342 } | 2351 } |
2343 #endif | 2352 #endif |
2344 | 2353 |
2345 void GLES2DecoderImpl::SetStreamTextureManager(StreamTextureManager* manager) { | 2354 void GLES2DecoderImpl::SetStreamTextureManager(StreamTextureManager* manager) { |
2346 stream_texture_manager_ = manager; | 2355 stream_texture_manager_ = manager; |
2347 } | 2356 } |
2348 | 2357 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2613 if (resize_callback_.get()) { | 2622 if (resize_callback_.get()) { |
2614 resize_callback_->Run(gfx::Size(width, height)); | 2623 resize_callback_->Run(gfx::Size(width, height)); |
2615 DCHECK(context_->IsCurrent(surface_.get())); | 2624 DCHECK(context_->IsCurrent(surface_.get())); |
2616 if (!context_->IsCurrent(surface_.get())) | 2625 if (!context_->IsCurrent(surface_.get())) |
2617 return error::kLostContext; | 2626 return error::kLostContext; |
2618 } | 2627 } |
2619 | 2628 |
2620 return error::kNoError; | 2629 return error::kNoError; |
2621 } | 2630 } |
2622 | 2631 |
2632 error::Error GLES2DecoderImpl::HandleSetSurfaceVisibleCHROMIUM( | |
2633 uint32 immediate_data_size, const gles2::SetSurfaceVisibleCHROMIUM& c) { | |
2634 bool visible = !!static_cast<GLboolean>(c.visible); | |
2635 TRACE_EVENT1("gpu", "glSetSurfaceVisibleChromium", "visible", visible); | |
jonathan.backer
2011/10/07 15:48:37
I'm not sure if this should be upstreamed. Not all
| |
2636 | |
2637 if (surface_visible_callback_.get()) { | |
2638 surface_visible_callback_->Run(visible); | |
2639 } | |
2640 | |
2641 return error::kNoError; | |
2642 } | |
2643 | |
2623 const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const { | 2644 const char* GLES2DecoderImpl::GetCommandName(unsigned int command_id) const { |
2624 if (command_id > kStartPoint && command_id < kNumCommands) { | 2645 if (command_id > kStartPoint && command_id < kNumCommands) { |
2625 return gles2::GetCommandName(static_cast<CommandId>(command_id)); | 2646 return gles2::GetCommandName(static_cast<CommandId>(command_id)); |
2626 } | 2647 } |
2627 return GetCommonCommandName(static_cast<cmd::CommandId>(command_id)); | 2648 return GetCommonCommandName(static_cast<cmd::CommandId>(command_id)); |
2628 } | 2649 } |
2629 | 2650 |
2630 // Decode command with its arguments, and call the corresponding GL function. | 2651 // Decode command with its arguments, and call the corresponding GL function. |
2631 // Note: args is a pointer to the command buffer. As such, it could be changed | 2652 // Note: args is a pointer to the command buffer. As such, it could be changed |
2632 // by a (malicious) client at any time, so if validation has to happen, it | 2653 // by a (malicious) client at any time, so if validation has to happen, it |
(...skipping 4454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7087 return error::kNoError; | 7108 return error::kNoError; |
7088 } | 7109 } |
7089 | 7110 |
7090 // Include the auto-generated part of this file. We split this because it means | 7111 // Include the auto-generated part of this file. We split this because it means |
7091 // we can easily edit the non-auto generated parts right here in this file | 7112 // we can easily edit the non-auto generated parts right here in this file |
7092 // instead of having to edit some template or the code generator. | 7113 // instead of having to edit some template or the code generator. |
7093 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 7114 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
7094 | 7115 |
7095 } // namespace gles2 | 7116 } // namespace gles2 |
7096 } // namespace gpu | 7117 } // namespace gpu |
OLD | NEW |