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

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

Issue 18340003: gpu: Fix removal of pending queries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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
« no previous file with comments | « no previous file | gpu/command_buffer/client/query_tracker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // A class to emulate GLES2 over command buffers. 5 // A class to emulate GLES2 over command buffers.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 3156 matching lines...) Expand 10 before | Expand all | Expand 10 after
3167 void GLES2Implementation::DeleteQueriesEXTHelper( 3167 void GLES2Implementation::DeleteQueriesEXTHelper(
3168 GLsizei n, const GLuint* queries) { 3168 GLsizei n, const GLuint* queries) {
3169 // TODO(gman): Remove this as queries are not shared resources. 3169 // TODO(gman): Remove this as queries are not shared resources.
3170 if (!GetIdHandler(id_namespaces::kQueries)->FreeIds( 3170 if (!GetIdHandler(id_namespaces::kQueries)->FreeIds(
3171 this, n, queries, &GLES2Implementation::DeleteQueriesStub)) { 3171 this, n, queries, &GLES2Implementation::DeleteQueriesStub)) {
3172 SetGLError( 3172 SetGLError(
3173 GL_INVALID_VALUE, 3173 GL_INVALID_VALUE,
3174 "glDeleteTextures", "id not created by this context."); 3174 "glDeleteTextures", "id not created by this context.");
3175 return; 3175 return;
3176 } 3176 }
3177 // When you delete a query you can't mark its memory as unused until it's
3178 // completed.
3179 // Note: If you don't do this you won't mess up the service but you will mess
3180 // up yourself.
3181 3177
3182 // TODO(gman): Consider making this faster by putting pending quereies 3178 for (GLsizei ii = 0; ii < n; ++ii)
3183 // on some queue to be removed when they are finished. 3179 query_tracker_->RemoveQuery(queries[ii]);
3184 bool query_pending = false;
3185 for (GLsizei ii = 0; ii < n; ++ii) {
3186 QueryTracker::Query* query = query_tracker_->GetQuery(queries[ii]);
3187 if (query && query->Pending()) {
3188 query_pending = true;
3189 break;
3190 }
3191 }
3192 3180
3193 if (query_pending) {
3194 WaitForCmd();
3195 }
3196
3197 for (GLsizei ii = 0; ii < n; ++ii) {
3198 QueryTracker::Query* query = query_tracker_->GetQuery(queries[ii]);
3199 if (query && query->Pending()) {
3200 if (!query->CheckResultsAvailable(helper_)) {
3201 // Should only get here on context lost.
3202 MustBeContextLost();
3203 }
3204 }
3205 query_tracker_->RemoveQuery(queries[ii], helper_->IsContextLost());
3206 }
3207 helper_->DeleteQueriesEXTImmediate(n, queries); 3181 helper_->DeleteQueriesEXTImmediate(n, queries);
3208 } 3182 }
3209 3183
3210 // TODO(gman): Remove this. Queries are not shared resources. 3184 // TODO(gman): Remove this. Queries are not shared resources.
3211 void GLES2Implementation::DeleteQueriesStub( 3185 void GLES2Implementation::DeleteQueriesStub(
3212 GLsizei /* n */, const GLuint* /* queries */) { 3186 GLsizei /* n */, const GLuint* /* queries */) {
3213 } 3187 }
3214 3188
3215 GLboolean GLES2Implementation::IsQueryEXT(GLuint id) { 3189 GLboolean GLES2Implementation::IsQueryEXT(GLuint id) {
3216 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3190 GPU_CLIENT_SINGLE_THREAD_CHECK();
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
3851 CheckGLError(); 3825 CheckGLError();
3852 } 3826 }
3853 3827
3854 // Include the auto-generated part of this file. We split this because it means 3828 // Include the auto-generated part of this file. We split this because it means
3855 // we can easily edit the non-auto generated parts right here in this file 3829 // we can easily edit the non-auto generated parts right here in this file
3856 // instead of having to edit some template or the code generator. 3830 // instead of having to edit some template or the code generator.
3857 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 3831 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
3858 3832
3859 } // namespace gles2 3833 } // namespace gles2
3860 } // namespace gpu 3834 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/client/query_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698