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

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

Issue 2886253003: Make sure to only call valid GL query functions when processing queries. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | 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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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_passthrough.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h"
6 6
7 #include "base/strings/string_split.h" 7 #include "base/strings/string_split.h"
8 #include "gpu/command_buffer/service/feature_info.h" 8 #include "gpu/command_buffer/service/feature_info.h"
9 #include "gpu/command_buffer/service/gl_utils.h" 9 #include "gpu/command_buffer/service/gl_utils.h"
10 #include "ui/gl/gl_version_info.h" 10 #include "ui/gl/gl_version_info.h"
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 return true; 757 return true;
758 758
759 default: 759 default:
760 return false; 760 return false;
761 } 761 }
762 } 762 }
763 763
764 error::Error GLES2DecoderPassthroughImpl::ProcessQueries(bool did_finish) { 764 error::Error GLES2DecoderPassthroughImpl::ProcessQueries(bool did_finish) {
765 while (!pending_queries_.empty()) { 765 while (!pending_queries_.empty()) {
766 const PendingQuery& query = pending_queries_.front(); 766 const PendingQuery& query = pending_queries_.front();
767 GLint result_available = GL_FALSE; 767 GLuint result_available = GL_FALSE;
768 GLuint64 result = 0; 768 GLuint64 result = 0;
769 switch (query.target) { 769 switch (query.target) {
770 case GL_COMMANDS_ISSUED_CHROMIUM: 770 case GL_COMMANDS_ISSUED_CHROMIUM:
771 result_available = GL_TRUE; 771 result_available = GL_TRUE;
772 result = GL_TRUE; 772 result = GL_TRUE;
773 break; 773 break;
774 774
775 case GL_LATENCY_QUERY_CHROMIUM: 775 case GL_LATENCY_QUERY_CHROMIUM:
776 result_available = GL_TRUE; 776 result_available = GL_TRUE;
777 // TODO: time from when the query is ended? 777 // TODO: time from when the query is ended?
(...skipping 10 matching lines...) Expand all
788 result_available = GL_TRUE; 788 result_available = GL_TRUE;
789 FlushErrors(); 789 FlushErrors();
790 result = PopError(); 790 result = PopError();
791 break; 791 break;
792 792
793 default: 793 default:
794 DCHECK(!IsEmulatedQueryTarget(query.target)); 794 DCHECK(!IsEmulatedQueryTarget(query.target));
795 if (did_finish) { 795 if (did_finish) {
796 result_available = GL_TRUE; 796 result_available = GL_TRUE;
797 } else { 797 } else {
798 glGetQueryObjectiv(query.service_id, GL_QUERY_RESULT_AVAILABLE, 798 glGetQueryObjectuiv(query.service_id, GL_QUERY_RESULT_AVAILABLE,
799 &result_available); 799 &result_available);
800 } 800 }
801 if (result_available == GL_TRUE) { 801 if (result_available == GL_TRUE) {
802 glGetQueryObjectui64v(query.service_id, GL_QUERY_RESULT, &result); 802 if (feature_info_->feature_flags().ext_disjoint_timer_query) {
803 glGetQueryObjectui64v(query.service_id, GL_QUERY_RESULT, &result);
804 } else {
805 GLuint temp_result = 0;
806 glGetQueryObjectuiv(query.service_id, GL_QUERY_RESULT,
807 &temp_result);
808 result = temp_result;
809 }
803 } 810 }
804 break; 811 break;
805 } 812 }
806 813
807 if (!result_available) { 814 if (!result_available) {
808 break; 815 break;
809 } 816 }
810 817
811 QuerySync* sync = GetSharedMemoryAs<QuerySync*>( 818 QuerySync* sync = GetSharedMemoryAs<QuerySync*>(
812 query.shm_id, query.shm_offset, sizeof(QuerySync)); 819 query.shm_id, query.shm_offset, sizeof(QuerySync));
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 }, /* NOLINT */ 915 }, /* NOLINT */
909 916
910 const GLES2DecoderPassthroughImpl::CommandInfo 917 const GLES2DecoderPassthroughImpl::CommandInfo
911 GLES2DecoderPassthroughImpl::command_info[] = { 918 GLES2DecoderPassthroughImpl::command_info[] = {
912 GLES2_COMMAND_LIST(GLES2_CMD_OP)}; 919 GLES2_COMMAND_LIST(GLES2_CMD_OP)};
913 920
914 #undef GLES2_CMD_OP 921 #undef GLES2_CMD_OP
915 922
916 } // namespace gles2 923 } // namespace gles2
917 } // namespace gpu 924 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698