Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 9910004: Implement Discard and EnsureBackbufferCHROMIUM using command buffer instead of IPC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 virtual gfx::GLSurface* GetGLSurface() { return surface_.get(); } 582 virtual gfx::GLSurface* GetGLSurface() { return surface_.get(); }
583 virtual ContextGroup* GetContextGroup() { return group_.get(); } 583 virtual ContextGroup* GetContextGroup() { return group_.get(); }
584 virtual QueryManager* GetQueryManager() { return query_manager_.get(); } 584 virtual QueryManager* GetQueryManager() { return query_manager_.get(); }
585 virtual bool ProcessPendingQueries(); 585 virtual bool ProcessPendingQueries();
586 586
587 virtual void SetGLError(GLenum error, const char* msg); 587 virtual void SetGLError(GLenum error, const char* msg);
588 virtual void SetResizeCallback( 588 virtual void SetResizeCallback(
589 const base::Callback<void(gfx::Size)>& callback); 589 const base::Callback<void(gfx::Size)>& callback);
590 590
591 virtual void SetMsgCallback(const MsgCallback& callback); 591 virtual void SetMsgCallback(const MsgCallback& callback);
592 virtual void SetDiscardBackbufferCallback(
593 const DiscardBackbufferCallback& callback);
594 virtual void SetEnsureBackbufferCallback(
595 const EnsureBackbufferCallback& callback);
592 596
593 virtual void SetStreamTextureManager(StreamTextureManager* manager); 597 virtual void SetStreamTextureManager(StreamTextureManager* manager);
594 virtual bool GetServiceTextureId(uint32 client_texture_id, 598 virtual bool GetServiceTextureId(uint32 client_texture_id,
595 uint32* service_texture_id); 599 uint32* service_texture_id);
596 600
597 // Restores the current state to the user's settings. 601 // Restores the current state to the user's settings.
598 void RestoreCurrentFramebufferBindings(); 602 void RestoreCurrentFramebufferBindings();
599 void RestoreCurrentRenderbufferBindings(); 603 void RestoreCurrentRenderbufferBindings();
600 void RestoreCurrentTexture2DBindings(); 604 void RestoreCurrentTexture2DBindings();
601 605
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 scoped_ptr<FrameBuffer> offscreen_resolved_frame_buffer_; 1522 scoped_ptr<FrameBuffer> offscreen_resolved_frame_buffer_;
1519 scoped_ptr<Texture> offscreen_resolved_color_texture_; 1523 scoped_ptr<Texture> offscreen_resolved_color_texture_;
1520 GLenum offscreen_saved_color_format_; 1524 GLenum offscreen_saved_color_format_;
1521 1525
1522 scoped_ptr<QueryManager> query_manager_; 1526 scoped_ptr<QueryManager> query_manager_;
1523 QueryManager::Query::Ref current_query_; 1527 QueryManager::Query::Ref current_query_;
1524 1528
1525 base::Callback<void(gfx::Size)> resize_callback_; 1529 base::Callback<void(gfx::Size)> resize_callback_;
1526 1530
1527 MsgCallback msg_callback_; 1531 MsgCallback msg_callback_;
1532 DiscardBackbufferCallback discard_backbuffer_callback_;
1533 EnsureBackbufferCallback ensure_backbuffer_callback_;
1528 1534
1529 StreamTextureManager* stream_texture_manager_; 1535 StreamTextureManager* stream_texture_manager_;
1530 1536
1531 // The format of the back buffer_ 1537 // The format of the back buffer_
1532 GLenum back_buffer_color_format_; 1538 GLenum back_buffer_color_format_;
1533 bool back_buffer_has_depth_; 1539 bool back_buffer_has_depth_;
1534 bool back_buffer_has_stencil_; 1540 bool back_buffer_has_stencil_;
1535 1541
1536 bool teximage2d_faster_than_texsubimage2d_; 1542 bool teximage2d_faster_than_texsubimage2d_;
1537 bool bufferdata_faster_than_buffersubdata_; 1543 bool bufferdata_faster_than_buffersubdata_;
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2747 2753
2748 void GLES2DecoderImpl::SetResizeCallback( 2754 void GLES2DecoderImpl::SetResizeCallback(
2749 const base::Callback<void(gfx::Size)>& callback) { 2755 const base::Callback<void(gfx::Size)>& callback) {
2750 resize_callback_ = callback; 2756 resize_callback_ = callback;
2751 } 2757 }
2752 2758
2753 void GLES2DecoderImpl::SetMsgCallback(const MsgCallback& callback) { 2759 void GLES2DecoderImpl::SetMsgCallback(const MsgCallback& callback) {
2754 msg_callback_ = callback; 2760 msg_callback_ = callback;
2755 } 2761 }
2756 2762
2763 void GLES2DecoderImpl::SetDiscardBackbufferCallback(
2764 const DiscardBackbufferCallback& callback) {
2765 discard_backbuffer_callback_ = callback;
2766 }
2767
2768 void GLES2DecoderImpl::SetEnsureBackbufferCallback(
2769 const EnsureBackbufferCallback& callback) {
2770 ensure_backbuffer_callback_ = callback;
2771 }
2772
2757 void GLES2DecoderImpl::SetStreamTextureManager(StreamTextureManager* manager) { 2773 void GLES2DecoderImpl::SetStreamTextureManager(StreamTextureManager* manager) {
2758 stream_texture_manager_ = manager; 2774 stream_texture_manager_ = manager;
2759 } 2775 }
2760 2776
2761 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, 2777 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id,
2762 uint32* service_texture_id) { 2778 uint32* service_texture_id) {
2763 TextureManager::TextureInfo* texture = 2779 TextureManager::TextureInfo* texture =
2764 texture_manager()->GetTextureInfo(client_texture_id); 2780 texture_manager()->GetTextureInfo(client_texture_id);
2765 if (texture) { 2781 if (texture) {
2766 *service_texture_id = texture->service_id(); 2782 *service_texture_id = texture->service_id();
(...skipping 5636 matching lines...) Expand 10 before | Expand all | Expand 10 after
8403 texture_manager()->SetLevelInfo( 8419 texture_manager()->SetLevelInfo(
8404 info, target, 0, format, level_width, level_height, 1, 0, format, 8420 info, target, 0, format, level_width, level_height, 1, 0, format,
8405 type, false); 8421 type, false);
8406 level_width = std::max(1, level_width >> 1); 8422 level_width = std::max(1, level_width >> 1);
8407 level_height = std::max(1, level_height >> 1); 8423 level_height = std::max(1, level_height >> 1);
8408 } 8424 }
8409 info->SetImmutable(true); 8425 info->SetImmutable(true);
8410 } 8426 }
8411 } 8427 }
8412 8428
8429 error::Error GLES2DecoderImpl::HandleDiscardBackbufferCHROMIUM(
8430 uint32 immediate_data_size, const gles2::DiscardBackbufferCHROMIUM& c) {
8431 TRACE_EVENT0("gpu", "glDiscardBackbuffer");
8432 if (!discard_backbuffer_callback_.is_null())
8433 discard_backbuffer_callback_.Run();
8434 return error::kNoError;
8435 }
8436
8437 error::Error GLES2DecoderImpl::HandleEnsureBackbufferCHROMIUM(
8438 uint32 immediate_data_size, const gles2::EnsureBackbufferCHROMIUM& c) {
8439 TRACE_EVENT0("gpu", "glEnsureBackbuffer");
8440 if (!ensure_backbuffer_callback_.is_null())
8441 ensure_backbuffer_callback_.Run();
8442 return error::kNoError;
8443 }
8444
8413 // Include the auto-generated part of this file. We split this because it means 8445 // Include the auto-generated part of this file. We split this because it means
8414 // we can easily edit the non-auto generated parts right here in this file 8446 // we can easily edit the non-auto generated parts right here in this file
8415 // instead of having to edit some template or the code generator. 8447 // instead of having to edit some template or the code generator.
8416 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 8448 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
8417 8449
8418 } // namespace gles2 8450 } // namespace gles2
8419 } // namespace gpu 8451 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698