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

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

Issue 10883036: Make glGetQueryObjectuivEXT return true for GL_QUERY_RESULT_AVAILABLE_EXT (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 // 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 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 bound_framebuffer_(0), 415 bound_framebuffer_(0),
416 bound_renderbuffer_(0), 416 bound_renderbuffer_(0),
417 bound_array_buffer_id_(0), 417 bound_array_buffer_id_(0),
418 bound_element_array_buffer_id_(0), 418 bound_element_array_buffer_id_(0),
419 client_side_array_id_(0), 419 client_side_array_id_(0),
420 client_side_element_array_id_(0), 420 client_side_element_array_id_(0),
421 error_bits_(0), 421 error_bits_(0),
422 debug_(false), 422 debug_(false),
423 use_count_(0), 423 use_count_(0),
424 current_query_(NULL), 424 current_query_(NULL),
425 error_message_callback_(NULL), 425 error_message_callback_(NULL) {
426 context_lost_(false) {
427 GPU_DCHECK(helper); 426 GPU_DCHECK(helper);
428 GPU_DCHECK(transfer_buffer); 427 GPU_DCHECK(transfer_buffer);
429 428
430 char temp[128]; 429 char temp[128];
431 sprintf(temp, "%p", static_cast<void*>(this)); 430 sprintf(temp, "%p", static_cast<void*>(this));
432 this_in_hex_ = std::string(temp); 431 this_in_hex_ = std::string(temp);
433 432
434 GPU_CLIENT_LOG_CODE_BLOCK({ 433 GPU_CLIENT_LOG_CODE_BLOCK({
435 debug_ = CommandLine::ForCurrentProcess()->HasSwitch( 434 debug_ = CommandLine::ForCurrentProcess()->HasSwitch(
436 switches::kEnableGPUClientLogging); 435 switches::kEnableGPUClientLogging);
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 // (tell the service to execute up to the flush cmd.) 1089 // (tell the service to execute up to the flush cmd.)
1091 helper_->CommandBufferHelper::Flush(); 1090 helper_->CommandBufferHelper::Flush();
1092 } 1091 }
1093 1092
1094 void GLES2Implementation::Finish() { 1093 void GLES2Implementation::Finish() {
1095 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1094 GPU_CLIENT_SINGLE_THREAD_CHECK();
1096 FinishHelper(); 1095 FinishHelper();
1097 } 1096 }
1098 1097
1099 bool GLES2Implementation::MustBeContextLost() { 1098 bool GLES2Implementation::MustBeContextLost() {
1100 if (!context_lost_) { 1099 bool context_lost = helper_->IsContextLost();
1100 if (!context_lost) {
1101 FinishHelper(); 1101 FinishHelper();
1102 context_lost_ = error::IsError(helper_->command_buffer()->GetLastError()); 1102 context_lost = helper_->IsContextLost();
1103 } 1103 }
1104 GPU_CHECK(context_lost_); 1104 GPU_CHECK(context_lost);
1105 return context_lost_; 1105 return context_lost;
1106 } 1106 }
1107 1107
1108 void GLES2Implementation::FinishHelper() { 1108 void GLES2Implementation::FinishHelper() {
1109 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFinish()"); 1109 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFinish()");
1110 TRACE_EVENT0("gpu", "GLES2::Finish"); 1110 TRACE_EVENT0("gpu", "GLES2::Finish");
1111 // Insert the cmd to call glFinish 1111 // Insert the cmd to call glFinish
1112 helper_->Finish(); 1112 helper_->Finish();
1113 // Finish our command buffer 1113 // Finish our command buffer
1114 // (tell the service to execute up to the Finish cmd and wait for it to 1114 // (tell the service to execute up to the Finish cmd and wait for it to
1115 // execute.) 1115 // execute.)
(...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after
3081 } 3081 }
3082 3082
3083 for (GLsizei ii = 0; ii < n; ++ii) { 3083 for (GLsizei ii = 0; ii < n; ++ii) {
3084 QueryTracker::Query* query = query_tracker_->GetQuery(queries[ii]); 3084 QueryTracker::Query* query = query_tracker_->GetQuery(queries[ii]);
3085 if (query && query->Pending()) { 3085 if (query && query->Pending()) {
3086 if (!query->CheckResultsAvailable(helper_)) { 3086 if (!query->CheckResultsAvailable(helper_)) {
3087 // Should only get here on context lost. 3087 // Should only get here on context lost.
3088 MustBeContextLost(); 3088 MustBeContextLost();
3089 } 3089 }
3090 } 3090 }
3091 query_tracker_->RemoveQuery(queries[ii], context_lost_); 3091 query_tracker_->RemoveQuery(queries[ii], helper_->IsContextLost());
3092 } 3092 }
3093 helper_->DeleteQueriesEXTImmediate(n, queries); 3093 helper_->DeleteQueriesEXTImmediate(n, queries);
3094 } 3094 }
3095 3095
3096 // TODO(gman): Remove this. Queries are not shared resources. 3096 // TODO(gman): Remove this. Queries are not shared resources.
3097 void GLES2Implementation::DeleteQueriesStub( 3097 void GLES2Implementation::DeleteQueriesStub(
3098 GLsizei /* n */, const GLuint* /* queries */) { 3098 GLsizei /* n */, const GLuint* /* queries */) {
3099 } 3099 }
3100 3100
3101 GLboolean GLES2Implementation::IsQueryEXT(GLuint id) { 3101 GLboolean GLES2Implementation::IsQueryEXT(GLuint id) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3146 current_query_ = query; 3146 current_query_ = query;
3147 3147
3148 query->Begin(this); 3148 query->Begin(this);
3149 } 3149 }
3150 3150
3151 void GLES2Implementation::EndQueryEXT(GLenum target) { 3151 void GLES2Implementation::EndQueryEXT(GLenum target) {
3152 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3152 GPU_CLIENT_SINGLE_THREAD_CHECK();
3153 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] EndQueryEXT(" 3153 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] EndQueryEXT("
3154 << GLES2Util::GetStringQueryTarget(target) << ")"); 3154 << GLES2Util::GetStringQueryTarget(target) << ")");
3155 // Don't do anything if the context is lost. 3155 // Don't do anything if the context is lost.
3156 if (context_lost_) { 3156 if (helper_->IsContextLost()) {
3157 return; 3157 return;
3158 } 3158 }
3159 3159
3160 if (!current_query_) { 3160 if (!current_query_) {
3161 SetGLError(GL_INVALID_OPERATION, "glEndQueryEXT", "no active query"); 3161 SetGLError(GL_INVALID_OPERATION, "glEndQueryEXT", "no active query");
3162 return; 3162 return;
3163 } 3163 }
3164 3164
3165 if (current_query_->target() != target) { 3165 if (current_query_->target() != target) {
3166 SetGLError(GL_INVALID_OPERATION, 3166 SetGLError(GL_INVALID_OPERATION,
(...skipping 22 matching lines...) Expand all
3189 GPU_CLIENT_LOG(" " << *params); 3189 GPU_CLIENT_LOG(" " << *params);
3190 } 3190 }
3191 3191
3192 void GLES2Implementation::GetQueryObjectuivEXT( 3192 void GLES2Implementation::GetQueryObjectuivEXT(
3193 GLuint id, GLenum pname, GLuint* params) { 3193 GLuint id, GLenum pname, GLuint* params) {
3194 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3194 GPU_CLIENT_SINGLE_THREAD_CHECK();
3195 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] GetQueryivEXT(" << id << ", " 3195 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] GetQueryivEXT(" << id << ", "
3196 << GLES2Util::GetStringQueryObjectParameter(pname) << ", " 3196 << GLES2Util::GetStringQueryObjectParameter(pname) << ", "
3197 << static_cast<const void*>(params) << ")"); 3197 << static_cast<const void*>(params) << ")");
3198 3198
3199 // exit if the context is lost.
3200 if (context_lost_) {
3201 return;
3202 }
3203
3204 QueryTracker::Query* query = query_tracker_->GetQuery(id); 3199 QueryTracker::Query* query = query_tracker_->GetQuery(id);
3205 if (!query) { 3200 if (!query) {
3206 SetGLError(GL_INVALID_OPERATION, "glQueryObjectuivEXT", "unknown query id"); 3201 SetGLError(GL_INVALID_OPERATION, "glQueryObjectuivEXT", "unknown query id");
3207 return; 3202 return;
3208 } 3203 }
3209 3204
3210 if (query == current_query_) { 3205 if (query == current_query_) {
3211 SetGLError( 3206 SetGLError(
3212 GL_INVALID_OPERATION, 3207 GL_INVALID_OPERATION,
3213 "glQueryObjectuivEXT", "query active. Did you to call glEndQueryEXT?"); 3208 "glQueryObjectuivEXT", "query active. Did you to call glEndQueryEXT?");
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
3394 3389
3395 void GLES2Implementation::PopGroupMarkerEXT() { 3390 void GLES2Implementation::PopGroupMarkerEXT() {
3396 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3391 GPU_CLIENT_SINGLE_THREAD_CHECK();
3397 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPopGroupMarkerEXT()"); 3392 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPopGroupMarkerEXT()");
3398 helper_->PopGroupMarkerEXT(); 3393 helper_->PopGroupMarkerEXT();
3399 debug_marker_manager_.PopGroup(); 3394 debug_marker_manager_.PopGroup();
3400 } 3395 }
3401 3396
3402 } // namespace gles2 3397 } // namespace gles2
3403 } // namespace gpu 3398 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.h ('k') | gpu/command_buffer/client/query_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698