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

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 7253052: Execute all GL commands up to the put offset reported by a flush. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 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 // A class to emulate GLES2 over command buffers. 5 // A class to emulate GLES2 over command buffers.
6 6
7 #include "../client/gles2_implementation.h" 7 #include "../client/gles2_implementation.h"
8 #include <GLES2/gles2_command_buffer.h> 8 #include <GLES2/gles2_command_buffer.h>
9 #include "../client/mapped_memory.h" 9 #include "../client/mapped_memory.h"
10 #include "../common/gles2_cmd_utils.h" 10 #include "../common/gles2_cmd_utils.h"
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 GPU_CLIENT_LOG("[" << this << "] glSwapBuffers()"); 793 GPU_CLIENT_LOG("[" << this << "] glSwapBuffers()");
794 // TODO(piman): Strictly speaking we'd want to insert the token after the 794 // TODO(piman): Strictly speaking we'd want to insert the token after the
795 // swap, but the state update with the updated token might not have happened 795 // swap, but the state update with the updated token might not have happened
796 // by the time the SwapBuffer callback gets called, forcing us to synchronize 796 // by the time the SwapBuffer callback gets called, forcing us to synchronize
797 // with the GPU process more than needed. So instead, make it happen before. 797 // with the GPU process more than needed. So instead, make it happen before.
798 // All it means is that we could be slightly looser on the kMaxSwapBuffers 798 // All it means is that we could be slightly looser on the kMaxSwapBuffers
799 // semantics if the client doesn't use the callback mechanism, and by chance 799 // semantics if the client doesn't use the callback mechanism, and by chance
800 // the scheduler yields between the InsertToken and the SwapBuffers. 800 // the scheduler yields between the InsertToken and the SwapBuffers.
801 swap_buffers_tokens_.push(helper_->InsertToken()); 801 swap_buffers_tokens_.push(helper_->InsertToken());
802 helper_->SwapBuffers(); 802 helper_->SwapBuffers();
803 helper_->YieldScheduler();
804 helper_->CommandBufferHelper::Flush(); 803 helper_->CommandBufferHelper::Flush();
805 // Wait if we added too many swap buffers. 804 // Wait if we added too many swap buffers.
806 if (swap_buffers_tokens_.size() > kMaxSwapBuffers) { 805 if (swap_buffers_tokens_.size() > kMaxSwapBuffers) {
807 helper_->WaitForToken(swap_buffers_tokens_.front()); 806 helper_->WaitForToken(swap_buffers_tokens_.front());
808 swap_buffers_tokens_.pop(); 807 swap_buffers_tokens_.pop();
809 } 808 }
810 } 809 }
811 810
812 void GLES2Implementation::CopyTextureToParentTextureCHROMIUM( 811 void GLES2Implementation::CopyTextureToParentTextureCHROMIUM(
813 GLuint client_child_id, GLuint client_parent_id) { 812 GLuint client_child_id, GLuint client_parent_id) {
814 GPU_CLIENT_LOG("[" << this << "] glCopyTextureToParentTextureCHROMIUM(" 813 GPU_CLIENT_LOG("[" << this << "] glCopyTextureToParentTextureCHROMIUM("
815 << client_child_id << ", " 814 << client_child_id << ", "
816 << client_parent_id << ")"); 815 << client_parent_id << ")");
817 helper_->CopyTextureToParentTextureCHROMIUM(client_child_id, 816 helper_->CopyTextureToParentTextureCHROMIUM(client_child_id,
818 client_parent_id); 817 client_parent_id);
819 } 818 }
820 819
820 void GLES2Implementation::ResizeCHROMIUM(GLuint width, GLuint height) {
821 GPU_CLIENT_LOG("[" << this << "] glResizeCHROMIUM("
822 << width << ", " << height << ")");
823 helper_->ResizeCHROMIUM(width, height);
824
825 // ResizeCHROMIUM might unschedule. Make sure it is flushed so that subsequent
826 // commands are not issued out-of-order with other command buffers.
827 helper_->CommandBufferHelper::Flush();
piman 2011/07/09 20:40:22 It took me a while to figure this out, even with t
jbates 2011/07/11 18:39:50 I'm not sure why this Flush is needed. Why does ge
apatrick_chromium 2011/07/11 21:25:45 It's complicated and confusing and liable to cause
828 }
829
821 void GLES2Implementation::GenSharedIdsCHROMIUM( 830 void GLES2Implementation::GenSharedIdsCHROMIUM(
822 GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) { 831 GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) {
823 GPU_CLIENT_LOG("[" << this << "] glGenSharedIdsCHROMIUMTextures(" 832 GPU_CLIENT_LOG("[" << this << "] glGenSharedIdsCHROMIUMTextures("
824 << namespace_id << ", " << id_offset << ", " << n << ", " << 833 << namespace_id << ", " << id_offset << ", " << n << ", " <<
825 static_cast<void*>(ids) << ")"); 834 static_cast<void*>(ids) << ")");
826 GPU_CLIENT_LOG_CODE_BLOCK({ 835 GPU_CLIENT_LOG_CODE_BLOCK({
827 for (GLsizei i = 0; i < n; ++i) { 836 for (GLsizei i = 0; i < n; ++i) {
828 GPU_CLIENT_LOG(" " << i << ": " << ids[i]); 837 GPU_CLIENT_LOG(" " << i << ": " << ids[i]);
829 } 838 }
830 }); 839 });
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
2141 GPU_CLIENT_LOG(" returned"); 2150 GPU_CLIENT_LOG(" returned");
2142 GPU_CLIENT_LOG_CODE_BLOCK({ 2151 GPU_CLIENT_LOG_CODE_BLOCK({
2143 for (int i = 0; i < num_results; ++i) { 2152 for (int i = 0; i < num_results; ++i) {
2144 GPU_CLIENT_LOG(" " << i << ": " << (results[i])); 2153 GPU_CLIENT_LOG(" " << i << ": " << (results[i]));
2145 } 2154 }
2146 }); 2155 });
2147 } 2156 }
2148 2157
2149 } // namespace gles2 2158 } // namespace gles2
2150 } // namespace gpu 2159 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698