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

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

Issue 10836185: Implement GL_EXT_debug_marker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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>
11 #include <queue> 11 #include <queue>
12 #include <set> 12 #include <set>
13 #include <stdio.h>
14 #include <string.h>
13 #include <GLES2/gl2ext.h> 15 #include <GLES2/gl2ext.h>
14 #include "../client/mapped_memory.h" 16 #include "../client/mapped_memory.h"
15 #include "../client/program_info_manager.h" 17 #include "../client/program_info_manager.h"
16 #include "../client/query_tracker.h" 18 #include "../client/query_tracker.h"
17 #include "../client/transfer_buffer.h" 19 #include "../client/transfer_buffer.h"
18 #include "../common/gles2_cmd_utils.h" 20 #include "../common/gles2_cmd_utils.h"
19 #include "../common/trace_event.h" 21 #include "../common/trace_event.h"
20 22
21 #if defined(__native_client__) && !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 23 #if defined(__native_client__) && !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
22 #define GLES2_SUPPORT_CLIENT_SIDE_ARRAYS 24 #define GLES2_SUPPORT_CLIENT_SIDE_ARRAYS
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 client_side_array_id_(0), 404 client_side_array_id_(0),
403 client_side_element_array_id_(0), 405 client_side_element_array_id_(0),
404 error_bits_(0), 406 error_bits_(0),
405 debug_(false), 407 debug_(false),
406 use_count_(0), 408 use_count_(0),
407 current_query_(NULL), 409 current_query_(NULL),
408 error_message_callback_(NULL), 410 error_message_callback_(NULL),
409 context_lost_(false) { 411 context_lost_(false) {
410 GPU_DCHECK(helper); 412 GPU_DCHECK(helper);
411 GPU_DCHECK(transfer_buffer); 413 GPU_DCHECK(transfer_buffer);
414
415 char temp[128];
416 sprintf(temp, "%p", this);
417 this_in_hex_ = std::string(temp);
apatrick_chromium 2012/08/10 19:29:31 There's a function in base/stringprintf.h that let
greggman 2012/08/11 00:17:30 I can't use base here :-(
418
412 GPU_CLIENT_LOG_CODE_BLOCK({ 419 GPU_CLIENT_LOG_CODE_BLOCK({
413 debug_ = CommandLine::ForCurrentProcess()->HasSwitch( 420 debug_ = CommandLine::ForCurrentProcess()->HasSwitch(
414 switches::kEnableGPUClientLogging); 421 switches::kEnableGPUClientLogging);
415 }); 422 });
416 423
417 share_group_ = (share_group ? share_group : new ShareGroup( 424 share_group_ = (share_group ? share_group : new ShareGroup(
418 share_resources, bind_generates_resource)); 425 share_resources, bind_generates_resource));
419 426
420 memset(&reserved_ids_, 0, sizeof(reserved_ids_)); 427 memset(&reserved_ids_, 0, sizeof(reserved_ids_));
421 } 428 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 if (IsExtensionAvailable("GL_ANGLE_pack_reverse_row_order")) { 589 if (IsExtensionAvailable("GL_ANGLE_pack_reverse_row_order")) {
583 angle_pack_reverse_row_order_status = kAvailableExtensionStatus; 590 angle_pack_reverse_row_order_status = kAvailableExtensionStatus;
584 return true; 591 return true;
585 } else { 592 } else {
586 angle_pack_reverse_row_order_status = kUnavailableExtensionStatus; 593 angle_pack_reverse_row_order_status = kUnavailableExtensionStatus;
587 return false; 594 return false;
588 } 595 }
589 } 596 }
590 } 597 }
591 598
599 const std::string& GLES2Implementation::GetLogPrefix() const {
600 const std::string& prefix(debug_marker_manager_.GetMarker());
601 return prefix.empty() ? this_in_hex_ : prefix;
602 }
603
592 GLenum GLES2Implementation::GetError() { 604 GLenum GLES2Implementation::GetError() {
593 GPU_CLIENT_SINGLE_THREAD_CHECK(); 605 GPU_CLIENT_SINGLE_THREAD_CHECK();
594 GPU_CLIENT_LOG("[" << this << "] glGetError()"); 606 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetError()");
595 GLenum err = GetGLError(); 607 GLenum err = GetGLError();
596 GPU_CLIENT_LOG("returned " << GLES2Util::GetStringError(err)); 608 GPU_CLIENT_LOG("returned " << GLES2Util::GetStringError(err));
597 return err; 609 return err;
598 } 610 }
599 611
600 GLenum GLES2Implementation::GetClientSideGLError() { 612 GLenum GLES2Implementation::GetClientSideGLError() {
601 if (error_bits_ == 0) { 613 if (error_bits_ == 0) {
602 return GL_NO_ERROR; 614 return GL_NO_ERROR;
603 } 615 }
604 616
(...skipping 25 matching lines...) Expand all
630 error = GetClientSideGLError(); 642 error = GetClientSideGLError();
631 } else { 643 } else {
632 // There was an error, clear the corresponding wrapped error. 644 // There was an error, clear the corresponding wrapped error.
633 error_bits_ &= ~GLES2Util::GLErrorToErrorBit(error); 645 error_bits_ &= ~GLES2Util::GLErrorToErrorBit(error);
634 } 646 }
635 return error; 647 return error;
636 } 648 }
637 649
638 void GLES2Implementation::SetGLError( 650 void GLES2Implementation::SetGLError(
639 GLenum error, const char* function_name, const char* msg) { 651 GLenum error, const char* function_name, const char* msg) {
640 GPU_CLIENT_LOG("[" << this << "] Client Synthesized Error: " 652 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] Client Synthesized Error: "
641 << GLES2Util::GetStringError(error) << ": " 653 << GLES2Util::GetStringError(error) << ": "
642 << function_name << ": " << msg); 654 << function_name << ": " << msg);
643 if (msg) { 655 if (msg) {
644 last_error_ = msg; 656 last_error_ = msg;
645 } 657 }
646 if (error_message_callback_) { 658 if (error_message_callback_) {
647 std::string temp(GLES2Util::GetStringError(error) + " : " + 659 std::string temp(GLES2Util::GetStringError(error) + " : " +
648 function_name + ": " + (msg ? msg : "")); 660 function_name + ": " + (msg ? msg : ""));
649 error_message_callback_->OnErrorMessage(temp.c_str(), 0); 661 error_message_callback_->OnErrorMessage(temp.c_str(), 0);
650 } 662 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 case GL_STENCIL_TEST: 794 case GL_STENCIL_TEST:
783 gl_state_.enable_state.stencil_test = enabled; 795 gl_state_.enable_state.stencil_test = enabled;
784 return true; 796 return true;
785 default: 797 default:
786 return false; 798 return false;
787 } 799 }
788 } 800 }
789 801
790 void GLES2Implementation::Disable(GLenum cap) { 802 void GLES2Implementation::Disable(GLenum cap) {
791 GPU_CLIENT_SINGLE_THREAD_CHECK(); 803 GPU_CLIENT_SINGLE_THREAD_CHECK();
792 GPU_CLIENT_LOG("[" << this << "] glDisable(" 804 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDisable("
793 << GLES2Util::GetStringCapability(cap) << ")"); 805 << GLES2Util::GetStringCapability(cap) << ")");
794 SetCapabilityState(cap, false); 806 SetCapabilityState(cap, false);
795 helper_->Disable(cap); 807 helper_->Disable(cap);
796 } 808 }
797 809
798 void GLES2Implementation::Enable(GLenum cap) { 810 void GLES2Implementation::Enable(GLenum cap) {
799 GPU_CLIENT_SINGLE_THREAD_CHECK(); 811 GPU_CLIENT_SINGLE_THREAD_CHECK();
800 GPU_CLIENT_LOG("[" << this << "] glEnable(" 812 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEnable("
801 << GLES2Util::GetStringCapability(cap) << ")"); 813 << GLES2Util::GetStringCapability(cap) << ")");
802 SetCapabilityState(cap, true); 814 SetCapabilityState(cap, true);
803 helper_->Enable(cap); 815 helper_->Enable(cap);
804 } 816 }
805 817
806 GLboolean GLES2Implementation::IsEnabled(GLenum cap) { 818 GLboolean GLES2Implementation::IsEnabled(GLenum cap) {
807 GPU_CLIENT_SINGLE_THREAD_CHECK(); 819 GPU_CLIENT_SINGLE_THREAD_CHECK();
808 GPU_CLIENT_LOG("[" << this << "] glIsEnabled(" 820 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsEnabled("
809 << GLES2Util::GetStringCapability(cap) << ")"); 821 << GLES2Util::GetStringCapability(cap) << ")");
810 bool state = false; 822 bool state = false;
811 switch (cap) { 823 switch (cap) {
812 case GL_DITHER: 824 case GL_DITHER:
813 state = gl_state_.enable_state.dither; 825 state = gl_state_.enable_state.dither;
814 break; 826 break;
815 case GL_BLEND: 827 case GL_BLEND:
816 state = gl_state_.enable_state.blend; 828 state = gl_state_.enable_state.blend;
817 break; 829 break;
818 case GL_CULL_FACE: 830 case GL_CULL_FACE:
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 *result = 0; 981 *result = 0;
970 helper_->GetMaxValueInBufferCHROMIUM( 982 helper_->GetMaxValueInBufferCHROMIUM(
971 buffer_id, count, type, offset, GetResultShmId(), GetResultShmOffset()); 983 buffer_id, count, type, offset, GetResultShmId(), GetResultShmOffset());
972 WaitForCmd(); 984 WaitForCmd();
973 return *result; 985 return *result;
974 } 986 }
975 987
976 GLuint GLES2Implementation::GetMaxValueInBufferCHROMIUM( 988 GLuint GLES2Implementation::GetMaxValueInBufferCHROMIUM(
977 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { 989 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) {
978 GPU_CLIENT_SINGLE_THREAD_CHECK(); 990 GPU_CLIENT_SINGLE_THREAD_CHECK();
979 GPU_CLIENT_LOG("[" << this << "] glGetMaxValueInBufferCHROMIUM(" 991 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetMaxValueInBufferCHROMIUM("
980 << buffer_id << ", " << count << ", " 992 << buffer_id << ", " << count << ", "
981 << GLES2Util::GetStringGetMaxIndexType(type) 993 << GLES2Util::GetStringGetMaxIndexType(type)
982 << ", " << offset << ")"); 994 << ", " << offset << ")");
983 GLuint result = GetMaxValueInBufferCHROMIUMHelper( 995 GLuint result = GetMaxValueInBufferCHROMIUMHelper(
984 buffer_id, count, type, offset); 996 buffer_id, count, type, offset);
985 GPU_CLIENT_LOG("returned " << result); 997 GPU_CLIENT_LOG("returned " << result);
986 return result; 998 return result;
987 } 999 }
988 1000
989 void GLES2Implementation::Clear(GLbitfield mask) { 1001 void GLES2Implementation::Clear(GLbitfield mask) {
990 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1002 GPU_CLIENT_SINGLE_THREAD_CHECK();
991 GPU_CLIENT_LOG("[" << this << "] glClear(" << mask << ")"); 1003 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClear(" << mask << ")");
992 helper_->Clear(mask); 1004 helper_->Clear(mask);
993 } 1005 }
994 1006
995 void GLES2Implementation::DrawElements( 1007 void GLES2Implementation::DrawElements(
996 GLenum mode, GLsizei count, GLenum type, const void* indices) { 1008 GLenum mode, GLsizei count, GLenum type, const void* indices) {
997 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1009 GPU_CLIENT_SINGLE_THREAD_CHECK();
998 GPU_CLIENT_LOG("[" << this << "] glDrawElements(" 1010 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawElements("
999 << GLES2Util::GetStringDrawMode(mode) << ", " 1011 << GLES2Util::GetStringDrawMode(mode) << ", "
1000 << count << ", " 1012 << count << ", "
1001 << GLES2Util::GetStringIndexType(type) << ", " 1013 << GLES2Util::GetStringIndexType(type) << ", "
1002 << static_cast<const void*>(indices) << ")"); 1014 << static_cast<const void*>(indices) << ")");
1003 if (count < 0) { 1015 if (count < 0) {
1004 SetGLError(GL_INVALID_VALUE, "glDrawElements", "count less than 0."); 1016 SetGLError(GL_INVALID_VALUE, "glDrawElements", "count less than 0.");
1005 return; 1017 return;
1006 } 1018 }
1007 if (count == 0) { 1019 if (count == 0) {
1008 return; 1020 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 // Restore the element array binding. 1053 // Restore the element array binding.
1042 helper_->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); 1054 helper_->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
1043 } 1055 }
1044 #else 1056 #else
1045 helper_->DrawElements(mode, count, type, ToGLuint(indices)); 1057 helper_->DrawElements(mode, count, type, ToGLuint(indices));
1046 #endif 1058 #endif
1047 } 1059 }
1048 1060
1049 void GLES2Implementation::Flush() { 1061 void GLES2Implementation::Flush() {
1050 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1062 GPU_CLIENT_SINGLE_THREAD_CHECK();
1051 GPU_CLIENT_LOG("[" << this << "] glFlush()"); 1063 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFlush()");
1052 // Insert the cmd to call glFlush 1064 // Insert the cmd to call glFlush
1053 helper_->Flush(); 1065 helper_->Flush();
1054 // Flush our command buffer 1066 // Flush our command buffer
1055 // (tell the service to execute up to the flush cmd.) 1067 // (tell the service to execute up to the flush cmd.)
1056 helper_->CommandBufferHelper::Flush(); 1068 helper_->CommandBufferHelper::Flush();
1057 } 1069 }
1058 1070
1059 void GLES2Implementation::ShallowFlushCHROMIUM() { 1071 void GLES2Implementation::ShallowFlushCHROMIUM() {
1060 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1072 GPU_CLIENT_SINGLE_THREAD_CHECK();
1061 GPU_CLIENT_LOG("[" << this << "] glShallowFlushCHROMIUM()"); 1073 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShallowFlushCHROMIUM()");
1062 // Flush our command buffer 1074 // Flush our command buffer
1063 // (tell the service to execute up to the flush cmd.) 1075 // (tell the service to execute up to the flush cmd.)
1064 helper_->CommandBufferHelper::Flush(); 1076 helper_->CommandBufferHelper::Flush();
1065 } 1077 }
1066 1078
1067 void GLES2Implementation::Finish() { 1079 void GLES2Implementation::Finish() {
1068 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1080 GPU_CLIENT_SINGLE_THREAD_CHECK();
1069 FinishHelper(); 1081 FinishHelper();
1070 } 1082 }
1071 1083
1072 bool GLES2Implementation::MustBeContextLost() { 1084 bool GLES2Implementation::MustBeContextLost() {
1073 if (!context_lost_) { 1085 if (!context_lost_) {
1074 FinishHelper(); 1086 FinishHelper();
1075 context_lost_ = error::IsError(helper_->command_buffer()->GetLastError()); 1087 context_lost_ = error::IsError(helper_->command_buffer()->GetLastError());
1076 } 1088 }
1077 GPU_CHECK(context_lost_); 1089 GPU_CHECK(context_lost_);
1078 return context_lost_; 1090 return context_lost_;
1079 } 1091 }
1080 1092
1081 void GLES2Implementation::FinishHelper() { 1093 void GLES2Implementation::FinishHelper() {
1082 GPU_CLIENT_LOG("[" << this << "] glFinish()"); 1094 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFinish()");
1083 TRACE_EVENT0("gpu", "GLES2::Finish"); 1095 TRACE_EVENT0("gpu", "GLES2::Finish");
1084 // Insert the cmd to call glFinish 1096 // Insert the cmd to call glFinish
1085 helper_->Finish(); 1097 helper_->Finish();
1086 // Finish our command buffer 1098 // Finish our command buffer
1087 // (tell the service to execute up to the Finish cmd and wait for it to 1099 // (tell the service to execute up to the Finish cmd and wait for it to
1088 // execute.) 1100 // execute.)
1089 helper_->CommandBufferHelper::Finish(); 1101 helper_->CommandBufferHelper::Finish();
1090 } 1102 }
1091 1103
1092 void GLES2Implementation::SwapBuffers() { 1104 void GLES2Implementation::SwapBuffers() {
1093 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1105 GPU_CLIENT_SINGLE_THREAD_CHECK();
1094 GPU_CLIENT_LOG("[" << this << "] glSwapBuffers()"); 1106 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSwapBuffers()");
1095 // TODO(piman): Strictly speaking we'd want to insert the token after the 1107 // TODO(piman): Strictly speaking we'd want to insert the token after the
1096 // swap, but the state update with the updated token might not have happened 1108 // swap, but the state update with the updated token might not have happened
1097 // by the time the SwapBuffer callback gets called, forcing us to synchronize 1109 // by the time the SwapBuffer callback gets called, forcing us to synchronize
1098 // with the GPU process more than needed. So instead, make it happen before. 1110 // with the GPU process more than needed. So instead, make it happen before.
1099 // All it means is that we could be slightly looser on the kMaxSwapBuffers 1111 // All it means is that we could be slightly looser on the kMaxSwapBuffers
1100 // semantics if the client doesn't use the callback mechanism, and by chance 1112 // semantics if the client doesn't use the callback mechanism, and by chance
1101 // the scheduler yields between the InsertToken and the SwapBuffers. 1113 // the scheduler yields between the InsertToken and the SwapBuffers.
1102 swap_buffers_tokens_.push(helper_->InsertToken()); 1114 swap_buffers_tokens_.push(helper_->InsertToken());
1103 helper_->SwapBuffers(); 1115 helper_->SwapBuffers();
1104 helper_->CommandBufferHelper::Flush(); 1116 helper_->CommandBufferHelper::Flush();
1105 // Wait if we added too many swap buffers. Add 1 to kMaxSwapBuffers to 1117 // Wait if we added too many swap buffers. Add 1 to kMaxSwapBuffers to
1106 // compensate for TODO above. 1118 // compensate for TODO above.
1107 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) { 1119 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) {
1108 helper_->WaitForToken(swap_buffers_tokens_.front()); 1120 helper_->WaitForToken(swap_buffers_tokens_.front());
1109 swap_buffers_tokens_.pop(); 1121 swap_buffers_tokens_.pop();
1110 } 1122 }
1111 } 1123 }
1112 1124
1113 void GLES2Implementation::GenSharedIdsCHROMIUM( 1125 void GLES2Implementation::GenSharedIdsCHROMIUM(
1114 GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) { 1126 GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) {
1115 GPU_CLIENT_LOG("[" << this << "] glGenSharedIdsCHROMIUM(" 1127 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenSharedIdsCHROMIUM("
1116 << namespace_id << ", " << id_offset << ", " << n << ", " << 1128 << namespace_id << ", " << id_offset << ", " << n << ", " <<
1117 static_cast<void*>(ids) << ")"); 1129 static_cast<void*>(ids) << ")");
1118 TRACE_EVENT0("gpu", "GLES2::GenSharedIdsCHROMIUM"); 1130 TRACE_EVENT0("gpu", "GLES2::GenSharedIdsCHROMIUM");
1119 GLsizei num = n; 1131 GLsizei num = n;
1120 GLuint* dst = ids; 1132 GLuint* dst = ids;
1121 while (num) { 1133 while (num) {
1122 ScopedTransferBufferArray<GLint> id_buffer(num, helper_, transfer_buffer_); 1134 ScopedTransferBufferArray<GLint> id_buffer(num, helper_, transfer_buffer_);
1123 if (!id_buffer.valid()) { 1135 if (!id_buffer.valid()) {
1124 return; 1136 return;
1125 } 1137 }
1126 helper_->GenSharedIdsCHROMIUM( 1138 helper_->GenSharedIdsCHROMIUM(
1127 namespace_id, id_offset, id_buffer.num_elements(), 1139 namespace_id, id_offset, id_buffer.num_elements(),
1128 id_buffer.shm_id(), id_buffer.offset()); 1140 id_buffer.shm_id(), id_buffer.offset());
1129 WaitForCmd(); 1141 WaitForCmd();
1130 memcpy(dst, id_buffer.address(), sizeof(*dst) * id_buffer.num_elements()); 1142 memcpy(dst, id_buffer.address(), sizeof(*dst) * id_buffer.num_elements());
1131 num -= id_buffer.num_elements(); 1143 num -= id_buffer.num_elements();
1132 dst += id_buffer.num_elements(); 1144 dst += id_buffer.num_elements();
1133 } 1145 }
1134 GPU_CLIENT_LOG_CODE_BLOCK({ 1146 GPU_CLIENT_LOG_CODE_BLOCK({
1135 for (GLsizei i = 0; i < n; ++i) { 1147 for (GLsizei i = 0; i < n; ++i) {
1136 GPU_CLIENT_LOG(" " << i << ": " << namespace_id << ", " << ids[i]); 1148 GPU_CLIENT_LOG(" " << i << ": " << namespace_id << ", " << ids[i]);
1137 } 1149 }
1138 }); 1150 });
1139 } 1151 }
1140 1152
1141 void GLES2Implementation::DeleteSharedIdsCHROMIUM( 1153 void GLES2Implementation::DeleteSharedIdsCHROMIUM(
1142 GLuint namespace_id, GLsizei n, const GLuint* ids) { 1154 GLuint namespace_id, GLsizei n, const GLuint* ids) {
1143 GPU_CLIENT_LOG("[" << this << "] glDeleteSharedIdsCHROMIUM(" 1155 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteSharedIdsCHROMIUM("
1144 << namespace_id << ", " << n << ", " 1156 << namespace_id << ", " << n << ", "
1145 << static_cast<const void*>(ids) << ")"); 1157 << static_cast<const void*>(ids) << ")");
1146 GPU_CLIENT_LOG_CODE_BLOCK({ 1158 GPU_CLIENT_LOG_CODE_BLOCK({
1147 for (GLsizei i = 0; i < n; ++i) { 1159 for (GLsizei i = 0; i < n; ++i) {
1148 GPU_CLIENT_LOG(" " << i << ": " << namespace_id << ", " << ids[i]); 1160 GPU_CLIENT_LOG(" " << i << ": " << namespace_id << ", " << ids[i]);
1149 } 1161 }
1150 }); 1162 });
1151 TRACE_EVENT0("gpu", "GLES2::DeleteSharedIdsCHROMIUM"); 1163 TRACE_EVENT0("gpu", "GLES2::DeleteSharedIdsCHROMIUM");
1152 while (n) { 1164 while (n) {
1153 ScopedTransferBufferArray<GLint> id_buffer(n, helper_, transfer_buffer_); 1165 ScopedTransferBufferArray<GLint> id_buffer(n, helper_, transfer_buffer_);
1154 if (!id_buffer.valid()) { 1166 if (!id_buffer.valid()) {
1155 return; 1167 return;
1156 } 1168 }
1157 memcpy(id_buffer.address(), ids, sizeof(*ids) * id_buffer.num_elements()); 1169 memcpy(id_buffer.address(), ids, sizeof(*ids) * id_buffer.num_elements());
1158 helper_->DeleteSharedIdsCHROMIUM( 1170 helper_->DeleteSharedIdsCHROMIUM(
1159 namespace_id, id_buffer.num_elements(), 1171 namespace_id, id_buffer.num_elements(),
1160 id_buffer.shm_id(), id_buffer.offset()); 1172 id_buffer.shm_id(), id_buffer.offset());
1161 WaitForCmd(); 1173 WaitForCmd();
1162 n -= id_buffer.num_elements(); 1174 n -= id_buffer.num_elements();
1163 ids += id_buffer.num_elements(); 1175 ids += id_buffer.num_elements();
1164 } 1176 }
1165 } 1177 }
1166 1178
1167 void GLES2Implementation::RegisterSharedIdsCHROMIUM( 1179 void GLES2Implementation::RegisterSharedIdsCHROMIUM(
1168 GLuint namespace_id, GLsizei n, const GLuint* ids) { 1180 GLuint namespace_id, GLsizei n, const GLuint* ids) {
1169 GPU_CLIENT_LOG("[" << this << "] glRegisterSharedIdsCHROMIUM(" 1181 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRegisterSharedIdsCHROMIUM("
1170 << namespace_id << ", " << n << ", " 1182 << namespace_id << ", " << n << ", "
1171 << static_cast<const void*>(ids) << ")"); 1183 << static_cast<const void*>(ids) << ")");
1172 GPU_CLIENT_LOG_CODE_BLOCK({ 1184 GPU_CLIENT_LOG_CODE_BLOCK({
1173 for (GLsizei i = 0; i < n; ++i) { 1185 for (GLsizei i = 0; i < n; ++i) {
1174 GPU_CLIENT_LOG(" " << i << ": " << namespace_id << ", " << ids[i]); 1186 GPU_CLIENT_LOG(" " << i << ": " << namespace_id << ", " << ids[i]);
1175 } 1187 }
1176 }); 1188 });
1177 TRACE_EVENT0("gpu", "GLES2::RegisterSharedIdsCHROMIUM"); 1189 TRACE_EVENT0("gpu", "GLES2::RegisterSharedIdsCHROMIUM");
1178 while (n) { 1190 while (n) {
1179 ScopedTransferBufferArray<GLint> id_buffer(n, helper_, transfer_buffer_); 1191 ScopedTransferBufferArray<GLint> id_buffer(n, helper_, transfer_buffer_);
1180 if (!id_buffer.valid()) { 1192 if (!id_buffer.valid()) {
1181 return; 1193 return;
1182 } 1194 }
1183 memcpy(id_buffer.address(), ids, sizeof(*ids) * id_buffer.num_elements()); 1195 memcpy(id_buffer.address(), ids, sizeof(*ids) * id_buffer.num_elements());
1184 helper_->RegisterSharedIdsCHROMIUM( 1196 helper_->RegisterSharedIdsCHROMIUM(
1185 namespace_id, id_buffer.num_elements(), 1197 namespace_id, id_buffer.num_elements(),
1186 id_buffer.shm_id(), id_buffer.offset()); 1198 id_buffer.shm_id(), id_buffer.offset());
1187 WaitForCmd(); 1199 WaitForCmd();
1188 n -= id_buffer.num_elements(); 1200 n -= id_buffer.num_elements();
1189 ids += id_buffer.num_elements(); 1201 ids += id_buffer.num_elements();
1190 } 1202 }
1191 } 1203 }
1192 1204
1193 void GLES2Implementation::BindAttribLocation( 1205 void GLES2Implementation::BindAttribLocation(
1194 GLuint program, GLuint index, const char* name) { 1206 GLuint program, GLuint index, const char* name) {
1195 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1207 GPU_CLIENT_SINGLE_THREAD_CHECK();
1196 GPU_CLIENT_LOG("[" << this << "] glBindAttribLocation(" << program << ", " 1208 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindAttribLocation("
1197 << index << ", " << name << ")"); 1209 << program << ", " << index << ", " << name << ")");
1198 SetBucketAsString(kResultBucketId, name); 1210 SetBucketAsString(kResultBucketId, name);
1199 helper_->BindAttribLocationBucket(program, index, kResultBucketId); 1211 helper_->BindAttribLocationBucket(program, index, kResultBucketId);
1200 helper_->SetBucketSize(kResultBucketId, 0); 1212 helper_->SetBucketSize(kResultBucketId, 0);
1201 } 1213 }
1202 1214
1203 void GLES2Implementation::BindUniformLocationCHROMIUM( 1215 void GLES2Implementation::BindUniformLocationCHROMIUM(
1204 GLuint program, GLint location, const char* name) { 1216 GLuint program, GLint location, const char* name) {
1205 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1217 GPU_CLIENT_SINGLE_THREAD_CHECK();
1206 GPU_CLIENT_LOG("[" << this << "] glBindUniformLocationCHROMIUM(" 1218 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindUniformLocationCHROMIUM("
1207 << program << ", " << location << ", " << name << ")"); 1219 << program << ", " << location << ", " << name << ")");
1208 SetBucketAsString(kResultBucketId, name); 1220 SetBucketAsString(kResultBucketId, name);
1209 helper_->BindUniformLocationCHROMIUMBucket( 1221 helper_->BindUniformLocationCHROMIUMBucket(
1210 program, location, kResultBucketId); 1222 program, location, kResultBucketId);
1211 helper_->SetBucketSize(kResultBucketId, 0); 1223 helper_->SetBucketSize(kResultBucketId, 0);
1212 } 1224 }
1213 1225
1214 void GLES2Implementation::GetVertexAttribPointerv( 1226 void GLES2Implementation::GetVertexAttribPointerv(
1215 GLuint index, GLenum pname, void** ptr) { 1227 GLuint index, GLenum pname, void** ptr) {
1216 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1228 GPU_CLIENT_SINGLE_THREAD_CHECK();
1217 GPU_CLIENT_LOG("[" << this << "] glGetVertexAttribPointer(" << index << ", " 1229 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribPointer("
1218 << GLES2Util::GetStringVertexPointer(pname) << ", " 1230 << index << ", " << GLES2Util::GetStringVertexPointer(pname) << ", "
1219 << static_cast<void*>(ptr) << ")"); 1231 << static_cast<void*>(ptr) << ")");
1220 1232
1221 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 1233 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
1222 // If it's a client side buffer the client has the data. 1234 // If it's a client side buffer the client has the data.
1223 if (client_side_buffer_helper_->GetAttribPointer(index, pname, ptr)) { 1235 if (client_side_buffer_helper_->GetAttribPointer(index, pname, ptr)) {
1224 return; 1236 return;
1225 } 1237 }
1226 #endif // defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 1238 #endif // defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
1227 1239
1228 TRACE_EVENT0("gpu", "GLES2::GetVertexAttribPointerv"); 1240 TRACE_EVENT0("gpu", "GLES2::GetVertexAttribPointerv");
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 helper_->GetAttribLocationBucket( 1304 helper_->GetAttribLocationBucket(
1293 program, kResultBucketId, GetResultShmId(), GetResultShmOffset()); 1305 program, kResultBucketId, GetResultShmId(), GetResultShmOffset());
1294 WaitForCmd(); 1306 WaitForCmd();
1295 helper_->SetBucketSize(kResultBucketId, 0); 1307 helper_->SetBucketSize(kResultBucketId, 0);
1296 return *result; 1308 return *result;
1297 } 1309 }
1298 1310
1299 GLint GLES2Implementation::GetAttribLocation( 1311 GLint GLES2Implementation::GetAttribLocation(
1300 GLuint program, const char* name) { 1312 GLuint program, const char* name) {
1301 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1313 GPU_CLIENT_SINGLE_THREAD_CHECK();
1302 GPU_CLIENT_LOG("[" << this << "] glGetAttribLocation(" << program 1314 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetAttribLocation(" << program
1303 << ", " << name << ")"); 1315 << ", " << name << ")");
1304 TRACE_EVENT0("gpu", "GLES2::GetAttribLocation"); 1316 TRACE_EVENT0("gpu", "GLES2::GetAttribLocation");
1305 GLint loc = share_group_->program_info_manager()->GetAttribLocation( 1317 GLint loc = share_group_->program_info_manager()->GetAttribLocation(
1306 this, program, name); 1318 this, program, name);
1307 GPU_CLIENT_LOG("returned " << loc); 1319 GPU_CLIENT_LOG("returned " << loc);
1308 return loc; 1320 return loc;
1309 } 1321 }
1310 1322
1311 GLint GLES2Implementation::GetUniformLocationHelper( 1323 GLint GLES2Implementation::GetUniformLocationHelper(
1312 GLuint program, const char* name) { 1324 GLuint program, const char* name) {
1313 typedef GetUniformLocationBucket::Result Result; 1325 typedef GetUniformLocationBucket::Result Result;
1314 Result* result = GetResultAs<Result*>(); 1326 Result* result = GetResultAs<Result*>();
1315 if (!result) { 1327 if (!result) {
1316 return -1; 1328 return -1;
1317 } 1329 }
1318 *result = -1; 1330 *result = -1;
1319 SetBucketAsCString(kResultBucketId, name); 1331 SetBucketAsCString(kResultBucketId, name);
1320 helper_->GetUniformLocationBucket(program, kResultBucketId, 1332 helper_->GetUniformLocationBucket(program, kResultBucketId,
1321 GetResultShmId(), GetResultShmOffset()); 1333 GetResultShmId(), GetResultShmOffset());
1322 WaitForCmd(); 1334 WaitForCmd();
1323 helper_->SetBucketSize(kResultBucketId, 0); 1335 helper_->SetBucketSize(kResultBucketId, 0);
1324 return *result; 1336 return *result;
1325 } 1337 }
1326 1338
1327 GLint GLES2Implementation::GetUniformLocation( 1339 GLint GLES2Implementation::GetUniformLocation(
1328 GLuint program, const char* name) { 1340 GLuint program, const char* name) {
1329 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1341 GPU_CLIENT_SINGLE_THREAD_CHECK();
1330 GPU_CLIENT_LOG("[" << this << "] glGetUniformLocation(" << program 1342 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetUniformLocation(" << program
1331 << ", " << name << ")"); 1343 << ", " << name << ")");
1332 TRACE_EVENT0("gpu", "GLES2::GetUniformLocation"); 1344 TRACE_EVENT0("gpu", "GLES2::GetUniformLocation");
1333 GLint loc = share_group_->program_info_manager()->GetUniformLocation( 1345 GLint loc = share_group_->program_info_manager()->GetUniformLocation(
1334 this, program, name); 1346 this, program, name);
1335 GPU_CLIENT_LOG("returned " << loc); 1347 GPU_CLIENT_LOG("returned " << loc);
1336 return loc; 1348 return loc;
1337 } 1349 }
1338 1350
1339 bool GLES2Implementation::GetProgramivHelper( 1351 bool GLES2Implementation::GetProgramivHelper(
1340 GLuint program, GLenum pname, GLint* params) { 1352 GLuint program, GLenum pname, GLint* params) {
1341 bool got_value = share_group_->program_info_manager()->GetProgramiv( 1353 bool got_value = share_group_->program_info_manager()->GetProgramiv(
1342 this, program, pname, params); 1354 this, program, pname, params);
1343 GPU_CLIENT_LOG_CODE_BLOCK({ 1355 GPU_CLIENT_LOG_CODE_BLOCK({
1344 if (got_value) { 1356 if (got_value) {
1345 GPU_CLIENT_LOG(" 0: " << *params); 1357 GPU_CLIENT_LOG(" 0: " << *params);
1346 } 1358 }
1347 }); 1359 });
1348 return got_value; 1360 return got_value;
1349 } 1361 }
1350 1362
1351 void GLES2Implementation::LinkProgram(GLuint program) { 1363 void GLES2Implementation::LinkProgram(GLuint program) {
1352 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1364 GPU_CLIENT_SINGLE_THREAD_CHECK();
1353 GPU_CLIENT_LOG("[" << this << "] glLinkProgram(" << program << ")"); 1365 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLinkProgram(" << program << ")");
1354 helper_->LinkProgram(program); 1366 helper_->LinkProgram(program);
1355 share_group_->program_info_manager()->CreateInfo(program); 1367 share_group_->program_info_manager()->CreateInfo(program);
1356 } 1368 }
1357 1369
1358 void GLES2Implementation::ShaderBinary( 1370 void GLES2Implementation::ShaderBinary(
1359 GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, 1371 GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary,
1360 GLsizei length) { 1372 GLsizei length) {
1361 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1373 GPU_CLIENT_SINGLE_THREAD_CHECK();
1362 GPU_CLIENT_LOG("[" << this << "] glShaderBinary(" << n << ", " 1374 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShaderBinary(" << n << ", "
1363 << static_cast<const void*>(shaders) << ", " 1375 << static_cast<const void*>(shaders) << ", "
1364 << GLES2Util::GetStringEnum(binaryformat) << ", " 1376 << GLES2Util::GetStringEnum(binaryformat) << ", "
1365 << static_cast<const void*>(binary) << ", " 1377 << static_cast<const void*>(binary) << ", "
1366 << length << ")"); 1378 << length << ")");
1367 if (n < 0) { 1379 if (n < 0) {
1368 SetGLError(GL_INVALID_VALUE, "glShaderBinary", "n < 0."); 1380 SetGLError(GL_INVALID_VALUE, "glShaderBinary", "n < 0.");
1369 return; 1381 return;
1370 } 1382 }
1371 if (length < 0) { 1383 if (length < 0) {
1372 SetGLError(GL_INVALID_VALUE, "glShaderBinary", "length < 0."); 1384 SetGLError(GL_INVALID_VALUE, "glShaderBinary", "length < 0.");
(...skipping 16 matching lines...) Expand all
1389 buffer.shm_id(), 1401 buffer.shm_id(),
1390 buffer.offset(), 1402 buffer.offset(),
1391 binaryformat, 1403 binaryformat,
1392 buffer.shm_id(), 1404 buffer.shm_id(),
1393 buffer.offset() + shader_id_size, 1405 buffer.offset() + shader_id_size,
1394 length); 1406 length);
1395 } 1407 }
1396 1408
1397 void GLES2Implementation::PixelStorei(GLenum pname, GLint param) { 1409 void GLES2Implementation::PixelStorei(GLenum pname, GLint param) {
1398 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1410 GPU_CLIENT_SINGLE_THREAD_CHECK();
1399 GPU_CLIENT_LOG("[" << this << "] glPixelStorei(" 1411 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPixelStorei("
1400 << GLES2Util::GetStringPixelStore(pname) << ", " 1412 << GLES2Util::GetStringPixelStore(pname) << ", "
1401 << param << ")"); 1413 << param << ")");
1402 switch (pname) { 1414 switch (pname) {
1403 case GL_PACK_ALIGNMENT: 1415 case GL_PACK_ALIGNMENT:
1404 pack_alignment_ = param; 1416 pack_alignment_ = param;
1405 break; 1417 break;
1406 case GL_UNPACK_ALIGNMENT: 1418 case GL_UNPACK_ALIGNMENT:
1407 unpack_alignment_ = param; 1419 unpack_alignment_ = param;
1408 break; 1420 break;
1409 case GL_UNPACK_ROW_LENGTH: 1421 case GL_UNPACK_ROW_LENGTH:
(...skipping 16 matching lines...) Expand all
1426 break; 1438 break;
1427 } 1439 }
1428 helper_->PixelStorei(pname, param); 1440 helper_->PixelStorei(pname, param);
1429 } 1441 }
1430 1442
1431 1443
1432 void GLES2Implementation::VertexAttribPointer( 1444 void GLES2Implementation::VertexAttribPointer(
1433 GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, 1445 GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride,
1434 const void* ptr) { 1446 const void* ptr) {
1435 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1447 GPU_CLIENT_SINGLE_THREAD_CHECK();
1436 GPU_CLIENT_LOG("[" << this << "] glVertexAttribPointer(" 1448 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribPointer("
1437 << index << ", " 1449 << index << ", "
1438 << size << ", " 1450 << size << ", "
1439 << GLES2Util::GetStringVertexAttribType(type) << ", " 1451 << GLES2Util::GetStringVertexAttribType(type) << ", "
1440 << GLES2Util::GetStringBool(normalized) << ", " 1452 << GLES2Util::GetStringBool(normalized) << ", "
1441 << stride << ", " 1453 << stride << ", "
1442 << static_cast<const void*>(ptr) << ")"); 1454 << static_cast<const void*>(ptr) << ")");
1443 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 1455 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
1444 // Record the info on the client side. 1456 // Record the info on the client side.
1445 client_side_buffer_helper_->SetAttribPointer( 1457 client_side_buffer_helper_->SetAttribPointer(
1446 bound_array_buffer_id_, index, size, type, normalized, stride, ptr); 1458 bound_array_buffer_id_, index, size, type, normalized, stride, ptr);
1447 if (bound_array_buffer_id_ != 0) { 1459 if (bound_array_buffer_id_ != 0) {
1448 // Only report NON client side buffers to the service. 1460 // Only report NON client side buffers to the service.
1449 helper_->VertexAttribPointer(index, size, type, normalized, stride, 1461 helper_->VertexAttribPointer(index, size, type, normalized, stride,
1450 ToGLuint(ptr)); 1462 ToGLuint(ptr));
1451 } 1463 }
1452 #else // !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 1464 #else // !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
1453 helper_->VertexAttribPointer(index, size, type, normalized, stride, 1465 helper_->VertexAttribPointer(index, size, type, normalized, stride,
1454 ToGLuint(ptr)); 1466 ToGLuint(ptr));
1455 #endif // !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 1467 #endif // !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
1456 } 1468 }
1457 1469
1458 void GLES2Implementation::VertexAttribDivisorANGLE( 1470 void GLES2Implementation::VertexAttribDivisorANGLE(
1459 GLuint index, GLuint divisor) { 1471 GLuint index, GLuint divisor) {
1460 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1472 GPU_CLIENT_SINGLE_THREAD_CHECK();
1461 GPU_CLIENT_LOG("[" << this << "] glVertexAttribDivisorANGLE(" 1473 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribDivisorANGLE("
1462 << index << ", " 1474 << index << ", "
1463 << divisor << ") "); 1475 << divisor << ") ");
1464 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 1476 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
1465 // Record the info on the client side. 1477 // Record the info on the client side.
1466 client_side_buffer_helper_->SetAttribDivisor(index, divisor); 1478 client_side_buffer_helper_->SetAttribDivisor(index, divisor);
1467 #endif // defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 1479 #endif // defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
1468 helper_->VertexAttribDivisorANGLE(index, divisor); 1480 helper_->VertexAttribDivisorANGLE(index, divisor);
1469 } 1481 }
1470 1482
1471 void GLES2Implementation::ShaderSource( 1483 void GLES2Implementation::ShaderSource(
1472 GLuint shader, GLsizei count, const char** source, const GLint* length) { 1484 GLuint shader, GLsizei count, const char** source, const GLint* length) {
1473 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1485 GPU_CLIENT_SINGLE_THREAD_CHECK();
1474 GPU_CLIENT_LOG("[" << this << "] glShaderSource(" 1486 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShaderSource("
1475 << shader << ", " << count << ", " 1487 << shader << ", " << count << ", "
1476 << static_cast<const void*>(source) << ", " 1488 << static_cast<const void*>(source) << ", "
1477 << static_cast<const void*>(length) << ")"); 1489 << static_cast<const void*>(length) << ")");
1478 GPU_CLIENT_LOG_CODE_BLOCK({ 1490 GPU_CLIENT_LOG_CODE_BLOCK({
1479 for (GLsizei ii = 0; ii < count; ++ii) { 1491 for (GLsizei ii = 0; ii < count; ++ii) {
1480 if (source[ii]) { 1492 if (source[ii]) {
1481 if (length && length[ii] >= 0) { 1493 if (length && length[ii] >= 0) {
1482 std::string str(source[ii], length[ii]); 1494 std::string str(source[ii], length[ii]);
1483 GPU_CLIENT_LOG(" " << ii << ": ---\n" << str << "\n---"); 1495 GPU_CLIENT_LOG(" " << ii << ": ---\n" << str << "\n---");
1484 } else { 1496 } else {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 } 1583 }
1572 1584
1573 // Make the buffer with BufferData then send via BufferSubData 1585 // Make the buffer with BufferData then send via BufferSubData
1574 helper_->BufferData(target, size, 0, 0, usage); 1586 helper_->BufferData(target, size, 0, 0, usage);
1575 BufferSubDataHelperImpl(target, 0, size, data, &buffer); 1587 BufferSubDataHelperImpl(target, 0, size, data, &buffer);
1576 } 1588 }
1577 1589
1578 void GLES2Implementation::BufferData( 1590 void GLES2Implementation::BufferData(
1579 GLenum target, GLsizeiptr size, const void* data, GLenum usage) { 1591 GLenum target, GLsizeiptr size, const void* data, GLenum usage) {
1580 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1592 GPU_CLIENT_SINGLE_THREAD_CHECK();
1581 GPU_CLIENT_LOG("[" << this << "] glBufferData(" 1593 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBufferData("
1582 << GLES2Util::GetStringBufferTarget(target) << ", " 1594 << GLES2Util::GetStringBufferTarget(target) << ", "
1583 << size << ", " 1595 << size << ", "
1584 << static_cast<const void*>(data) << ", " 1596 << static_cast<const void*>(data) << ", "
1585 << GLES2Util::GetStringBufferUsage(usage) << ")"); 1597 << GLES2Util::GetStringBufferUsage(usage) << ")");
1586 BufferDataHelper(target, size, data, usage); 1598 BufferDataHelper(target, size, data, usage);
1587 } 1599 }
1588 1600
1589 void GLES2Implementation::BufferSubDataHelper( 1601 void GLES2Implementation::BufferSubDataHelper(
1590 GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { 1602 GLenum target, GLintptr offset, GLsizeiptr size, const void* data) {
1591 if (size == 0) { 1603 if (size == 0) {
(...skipping 29 matching lines...) Expand all
1621 offset += buffer->size(); 1633 offset += buffer->size();
1622 source += buffer->size(); 1634 source += buffer->size();
1623 size -= buffer->size(); 1635 size -= buffer->size();
1624 buffer->Release(); 1636 buffer->Release();
1625 } 1637 }
1626 } 1638 }
1627 1639
1628 void GLES2Implementation::BufferSubData( 1640 void GLES2Implementation::BufferSubData(
1629 GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { 1641 GLenum target, GLintptr offset, GLsizeiptr size, const void* data) {
1630 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1642 GPU_CLIENT_SINGLE_THREAD_CHECK();
1631 GPU_CLIENT_LOG("[" << this << "] glBufferSubData(" 1643 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBufferSubData("
1632 << GLES2Util::GetStringBufferTarget(target) << ", " 1644 << GLES2Util::GetStringBufferTarget(target) << ", "
1633 << offset << ", " << size << ", " 1645 << offset << ", " << size << ", "
1634 << static_cast<const void*>(data) << ")"); 1646 << static_cast<const void*>(data) << ")");
1635 BufferSubDataHelper(target, offset, size, data); 1647 BufferSubDataHelper(target, offset, size, data);
1636 } 1648 }
1637 1649
1638 void GLES2Implementation::CompressedTexImage2D( 1650 void GLES2Implementation::CompressedTexImage2D(
1639 GLenum target, GLint level, GLenum internalformat, GLsizei width, 1651 GLenum target, GLint level, GLenum internalformat, GLsizei width,
1640 GLsizei height, GLint border, GLsizei image_size, const void* data) { 1652 GLsizei height, GLint border, GLsizei image_size, const void* data) {
1641 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1653 GPU_CLIENT_SINGLE_THREAD_CHECK();
1642 GPU_CLIENT_LOG("[" << this << "] glCompressedTexImage2D(" 1654 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompressedTexImage2D("
1643 << GLES2Util::GetStringTextureTarget(target) << ", " 1655 << GLES2Util::GetStringTextureTarget(target) << ", "
1644 << level << ", " 1656 << level << ", "
1645 << GLES2Util::GetStringCompressedTextureFormat(internalformat) << ", " 1657 << GLES2Util::GetStringCompressedTextureFormat(internalformat) << ", "
1646 << width << ", " << height << ", " << border << ", " 1658 << width << ", " << height << ", " << border << ", "
1647 << image_size << ", " 1659 << image_size << ", "
1648 << static_cast<const void*>(data) << ")"); 1660 << static_cast<const void*>(data) << ")");
1649 if (width < 0 || height < 0 || level < 0) { 1661 if (width < 0 || height < 0 || level < 0) {
1650 SetGLError(GL_INVALID_VALUE, "glCompressedTexImage2D", "dimension < 0"); 1662 SetGLError(GL_INVALID_VALUE, "glCompressedTexImage2D", "dimension < 0");
1651 return; 1663 return;
1652 } 1664 }
1653 if (height == 0 || width == 0) { 1665 if (height == 0 || width == 0) {
1654 return; 1666 return;
1655 } 1667 }
1656 SetBucketContents(kResultBucketId, data, image_size); 1668 SetBucketContents(kResultBucketId, data, image_size);
1657 helper_->CompressedTexImage2DBucket( 1669 helper_->CompressedTexImage2DBucket(
1658 target, level, internalformat, width, height, border, kResultBucketId); 1670 target, level, internalformat, width, height, border, kResultBucketId);
1659 // Free the bucket. This is not required but it does free up the memory. 1671 // Free the bucket. This is not required but it does free up the memory.
1660 // and we don't have to wait for the result so from the client's perspective 1672 // and we don't have to wait for the result so from the client's perspective
1661 // it's cheap. 1673 // it's cheap.
1662 helper_->SetBucketSize(kResultBucketId, 0); 1674 helper_->SetBucketSize(kResultBucketId, 0);
1663 } 1675 }
1664 1676
1665 void GLES2Implementation::CompressedTexSubImage2D( 1677 void GLES2Implementation::CompressedTexSubImage2D(
1666 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, 1678 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
1667 GLsizei height, GLenum format, GLsizei image_size, const void* data) { 1679 GLsizei height, GLenum format, GLsizei image_size, const void* data) {
1668 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1680 GPU_CLIENT_SINGLE_THREAD_CHECK();
1669 GPU_CLIENT_LOG("[" << this << "] glCompressedTexSubImage2D(" 1681 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompressedTexSubImage2D("
1670 << GLES2Util::GetStringTextureTarget(target) << ", " 1682 << GLES2Util::GetStringTextureTarget(target) << ", "
1671 << level << ", " 1683 << level << ", "
1672 << xoffset << ", " << yoffset << ", " 1684 << xoffset << ", " << yoffset << ", "
1673 << width << ", " << height << ", " 1685 << width << ", " << height << ", "
1674 << GLES2Util::GetStringCompressedTextureFormat(format) << ", " 1686 << GLES2Util::GetStringCompressedTextureFormat(format) << ", "
1675 << image_size << ", " 1687 << image_size << ", "
1676 << static_cast<const void*>(data) << ")"); 1688 << static_cast<const void*>(data) << ")");
1677 if (width < 0 || height < 0 || level < 0) { 1689 if (width < 0 || height < 0 || level < 0) {
1678 SetGLError(GL_INVALID_VALUE, "glCompressedTexSubImage2D", "dimension < 0"); 1690 SetGLError(GL_INVALID_VALUE, "glCompressedTexSubImage2D", "dimension < 0");
1679 return; 1691 return;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 } 1732 }
1721 } 1733 }
1722 1734
1723 } // anonymous namespace 1735 } // anonymous namespace
1724 1736
1725 void GLES2Implementation::TexImage2D( 1737 void GLES2Implementation::TexImage2D(
1726 GLenum target, GLint level, GLint internalformat, GLsizei width, 1738 GLenum target, GLint level, GLint internalformat, GLsizei width,
1727 GLsizei height, GLint border, GLenum format, GLenum type, 1739 GLsizei height, GLint border, GLenum format, GLenum type,
1728 const void* pixels) { 1740 const void* pixels) {
1729 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1741 GPU_CLIENT_SINGLE_THREAD_CHECK();
1730 GPU_CLIENT_LOG("[" << this << "] glTexImage2D(" 1742 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImage2D("
1731 << GLES2Util::GetStringTextureTarget(target) << ", " 1743 << GLES2Util::GetStringTextureTarget(target) << ", "
1732 << level << ", " 1744 << level << ", "
1733 << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", " 1745 << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", "
1734 << width << ", " << height << ", " << border << ", " 1746 << width << ", " << height << ", " << border << ", "
1735 << GLES2Util::GetStringTextureFormat(format) << ", " 1747 << GLES2Util::GetStringTextureFormat(format) << ", "
1736 << GLES2Util::GetStringPixelType(type) << ", " 1748 << GLES2Util::GetStringPixelType(type) << ", "
1737 << static_cast<const void*>(pixels) << ")"); 1749 << static_cast<const void*>(pixels) << ")");
1738 if (level < 0 || height < 0 || width < 0) { 1750 if (level < 0 || height < 0 || width < 0) {
1739 SetGLError(GL_INVALID_VALUE, "glTexImage2D", "dimension < 0"); 1751 SetGLError(GL_INVALID_VALUE, "glTexImage2D", "dimension < 0");
1740 return; 1752 return;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 0, 0); 1814 0, 0);
1803 TexSubImage2DImpl( 1815 TexSubImage2DImpl(
1804 target, level, 0, 0, width, height, format, type, unpadded_row_size, 1816 target, level, 0, 0, width, height, format, type, unpadded_row_size,
1805 pixels, src_padded_row_size, GL_TRUE, &buffer, padded_row_size); 1817 pixels, src_padded_row_size, GL_TRUE, &buffer, padded_row_size);
1806 } 1818 }
1807 1819
1808 void GLES2Implementation::TexSubImage2D( 1820 void GLES2Implementation::TexSubImage2D(
1809 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, 1821 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
1810 GLsizei height, GLenum format, GLenum type, const void* pixels) { 1822 GLsizei height, GLenum format, GLenum type, const void* pixels) {
1811 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1823 GPU_CLIENT_SINGLE_THREAD_CHECK();
1812 GPU_CLIENT_LOG("[" << this << "] glTexSubImage2D(" 1824 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexSubImage2D("
1813 << GLES2Util::GetStringTextureTarget(target) << ", " 1825 << GLES2Util::GetStringTextureTarget(target) << ", "
1814 << level << ", " 1826 << level << ", "
1815 << xoffset << ", " << yoffset << ", " 1827 << xoffset << ", " << yoffset << ", "
1816 << width << ", " << height << ", " 1828 << width << ", " << height << ", "
1817 << GLES2Util::GetStringTextureFormat(format) << ", " 1829 << GLES2Util::GetStringTextureFormat(format) << ", "
1818 << GLES2Util::GetStringPixelType(type) << ", " 1830 << GLES2Util::GetStringPixelType(type) << ", "
1819 << static_cast<const void*>(pixels) << ")"); 1831 << static_cast<const void*>(pixels) << ")");
1820 1832
1821 if (level < 0 || height < 0 || width < 0) { 1833 if (level < 0 || height < 0 || width < 0) {
1822 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D", "dimension < 0"); 1834 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D", "dimension < 0");
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 } 1966 }
1955 } 1967 }
1956 } 1968 }
1957 return result->success != 0; 1969 return result->success != 0;
1958 } 1970 }
1959 1971
1960 void GLES2Implementation::GetActiveAttrib( 1972 void GLES2Implementation::GetActiveAttrib(
1961 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, 1973 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
1962 GLenum* type, char* name) { 1974 GLenum* type, char* name) {
1963 GPU_CLIENT_SINGLE_THREAD_CHECK(); 1975 GPU_CLIENT_SINGLE_THREAD_CHECK();
1964 GPU_CLIENT_LOG("[" << this << "] glGetActiveAttrib(" 1976 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetActiveAttrib("
1965 << program << ", " << index << ", " << bufsize << ", " 1977 << program << ", " << index << ", " << bufsize << ", "
1966 << static_cast<const void*>(length) << ", " 1978 << static_cast<const void*>(length) << ", "
1967 << static_cast<const void*>(size) << ", " 1979 << static_cast<const void*>(size) << ", "
1968 << static_cast<const void*>(type) << ", " 1980 << static_cast<const void*>(type) << ", "
1969 << static_cast<const void*>(name) << ", "); 1981 << static_cast<const void*>(name) << ", ");
1970 if (bufsize < 0) { 1982 if (bufsize < 0) {
1971 SetGLError(GL_INVALID_VALUE, "glGetActiveAttrib", "bufsize < 0"); 1983 SetGLError(GL_INVALID_VALUE, "glGetActiveAttrib", "bufsize < 0");
1972 return; 1984 return;
1973 } 1985 }
1974 TRACE_EVENT0("gpu", "GLES2::GetActiveAttrib"); 1986 TRACE_EVENT0("gpu", "GLES2::GetActiveAttrib");
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 } 2036 }
2025 } 2037 }
2026 } 2038 }
2027 return result->success != 0; 2039 return result->success != 0;
2028 } 2040 }
2029 2041
2030 void GLES2Implementation::GetActiveUniform( 2042 void GLES2Implementation::GetActiveUniform(
2031 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, 2043 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
2032 GLenum* type, char* name) { 2044 GLenum* type, char* name) {
2033 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2045 GPU_CLIENT_SINGLE_THREAD_CHECK();
2034 GPU_CLIENT_LOG("[" << this << "] glGetActiveUniform(" 2046 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetActiveUniform("
2035 << program << ", " << index << ", " << bufsize << ", " 2047 << program << ", " << index << ", " << bufsize << ", "
2036 << static_cast<const void*>(length) << ", " 2048 << static_cast<const void*>(length) << ", "
2037 << static_cast<const void*>(size) << ", " 2049 << static_cast<const void*>(size) << ", "
2038 << static_cast<const void*>(type) << ", " 2050 << static_cast<const void*>(type) << ", "
2039 << static_cast<const void*>(name) << ", "); 2051 << static_cast<const void*>(name) << ", ");
2040 if (bufsize < 0) { 2052 if (bufsize < 0) {
2041 SetGLError(GL_INVALID_VALUE, "glGetActiveUniform", "bufsize < 0"); 2053 SetGLError(GL_INVALID_VALUE, "glGetActiveUniform", "bufsize < 0");
2042 return; 2054 return;
2043 } 2055 }
2044 TRACE_EVENT0("gpu", "GLES2::GetActiveUniform"); 2056 TRACE_EVENT0("gpu", "GLES2::GetActiveUniform");
2045 bool success = share_group_->program_info_manager()->GetActiveUniform( 2057 bool success = share_group_->program_info_manager()->GetActiveUniform(
2046 this, program, index, bufsize, length, size, type, name); 2058 this, program, index, bufsize, length, size, type, name);
2047 if (success) { 2059 if (success) {
2048 if (size) { 2060 if (size) {
2049 GPU_CLIENT_LOG(" size: " << *size); 2061 GPU_CLIENT_LOG(" size: " << *size);
2050 } 2062 }
2051 if (type) { 2063 if (type) {
2052 GPU_CLIENT_LOG(" type: " << GLES2Util::GetStringEnum(*type)); 2064 GPU_CLIENT_LOG(" type: " << GLES2Util::GetStringEnum(*type));
2053 } 2065 }
2054 if (name) { 2066 if (name) {
2055 GPU_CLIENT_LOG(" name: " << name); 2067 GPU_CLIENT_LOG(" name: " << name);
2056 } 2068 }
2057 } 2069 }
2058 } 2070 }
2059 2071
2060 void GLES2Implementation::GetAttachedShaders( 2072 void GLES2Implementation::GetAttachedShaders(
2061 GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { 2073 GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) {
2062 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2074 GPU_CLIENT_SINGLE_THREAD_CHECK();
2063 GPU_CLIENT_LOG("[" << this << "] glGetAttachedShaders(" 2075 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetAttachedShaders("
2064 << program << ", " << maxcount << ", " 2076 << program << ", " << maxcount << ", "
2065 << static_cast<const void*>(count) << ", " 2077 << static_cast<const void*>(count) << ", "
2066 << static_cast<const void*>(shaders) << ", "); 2078 << static_cast<const void*>(shaders) << ", ");
2067 if (maxcount < 0) { 2079 if (maxcount < 0) {
2068 SetGLError(GL_INVALID_VALUE, "glGetAttachedShaders", "maxcount < 0"); 2080 SetGLError(GL_INVALID_VALUE, "glGetAttachedShaders", "maxcount < 0");
2069 return; 2081 return;
2070 } 2082 }
2071 TRACE_EVENT0("gpu", "GLES2::GetAttachedShaders"); 2083 TRACE_EVENT0("gpu", "GLES2::GetAttachedShaders");
2072 typedef gles2::GetAttachedShaders::Result Result; 2084 typedef gles2::GetAttachedShaders::Result Result;
2073 uint32 size = Result::ComputeSize(maxcount); 2085 uint32 size = Result::ComputeSize(maxcount);
(...skipping 17 matching lines...) Expand all
2091 for (int32 i = 0; i < result->GetNumResults(); ++i) { 2103 for (int32 i = 0; i < result->GetNumResults(); ++i) {
2092 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); 2104 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
2093 } 2105 }
2094 }); 2106 });
2095 transfer_buffer_->FreePendingToken(result, token); 2107 transfer_buffer_->FreePendingToken(result, token);
2096 } 2108 }
2097 2109
2098 void GLES2Implementation::GetShaderPrecisionFormat( 2110 void GLES2Implementation::GetShaderPrecisionFormat(
2099 GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { 2111 GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
2100 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2112 GPU_CLIENT_SINGLE_THREAD_CHECK();
2101 GPU_CLIENT_LOG("[" << this << "] glGetShaderPrecisionFormat(" 2113 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderPrecisionFormat("
2102 << GLES2Util::GetStringShaderType(shadertype) << ", " 2114 << GLES2Util::GetStringShaderType(shadertype) << ", "
2103 << GLES2Util::GetStringShaderPrecision(precisiontype) << ", " 2115 << GLES2Util::GetStringShaderPrecision(precisiontype) << ", "
2104 << static_cast<const void*>(range) << ", " 2116 << static_cast<const void*>(range) << ", "
2105 << static_cast<const void*>(precision) << ", "); 2117 << static_cast<const void*>(precision) << ", ");
2106 TRACE_EVENT0("gpu", "GLES2::GetShaderPrecisionFormat"); 2118 TRACE_EVENT0("gpu", "GLES2::GetShaderPrecisionFormat");
2107 typedef gles2::GetShaderPrecisionFormat::Result Result; 2119 typedef gles2::GetShaderPrecisionFormat::Result Result;
2108 Result* result = GetResultAs<Result*>(); 2120 Result* result = GetResultAs<Result*>();
2109 if (!result) { 2121 if (!result) {
2110 return; 2122 return;
2111 } 2123 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 string_set.insert(str); 2179 string_set.insert(str);
2168 GPU_DCHECK(insert_result.second); 2180 GPU_DCHECK(insert_result.second);
2169 result = insert_result.first->c_str(); 2181 result = insert_result.first->c_str();
2170 } 2182 }
2171 } 2183 }
2172 return reinterpret_cast<const GLubyte*>(result); 2184 return reinterpret_cast<const GLubyte*>(result);
2173 } 2185 }
2174 2186
2175 const GLubyte* GLES2Implementation::GetString(GLenum name) { 2187 const GLubyte* GLES2Implementation::GetString(GLenum name) {
2176 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2188 GPU_CLIENT_SINGLE_THREAD_CHECK();
2177 GPU_CLIENT_LOG("[" << this << "] glGetString(" 2189 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetString("
2178 << GLES2Util::GetStringStringType(name) << ")"); 2190 << GLES2Util::GetStringStringType(name) << ")");
2179 const GLubyte* result = GetStringHelper(name); 2191 const GLubyte* result = GetStringHelper(name);
2180 GPU_CLIENT_LOG(" returned " << reinterpret_cast<const char*>(result)); 2192 GPU_CLIENT_LOG(" returned " << reinterpret_cast<const char*>(result));
2181 return result; 2193 return result;
2182 } 2194 }
2183 2195
2184 void GLES2Implementation::GetUniformfv( 2196 void GLES2Implementation::GetUniformfv(
2185 GLuint program, GLint location, GLfloat* params) { 2197 GLuint program, GLint location, GLfloat* params) {
2186 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2198 GPU_CLIENT_SINGLE_THREAD_CHECK();
2187 GPU_CLIENT_LOG("[" << this << "] glGetUniformfv(" 2199 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetUniformfv("
2188 << program << ", " << location << ", " 2200 << program << ", " << location << ", "
2189 << static_cast<const void*>(params) << ")"); 2201 << static_cast<const void*>(params) << ")");
2190 TRACE_EVENT0("gpu", "GLES2::GetUniformfv"); 2202 TRACE_EVENT0("gpu", "GLES2::GetUniformfv");
2191 typedef gles2::GetUniformfv::Result Result; 2203 typedef gles2::GetUniformfv::Result Result;
2192 Result* result = GetResultAs<Result*>(); 2204 Result* result = GetResultAs<Result*>();
2193 if (!result) { 2205 if (!result) {
2194 return; 2206 return;
2195 } 2207 }
2196 result->SetNumResults(0); 2208 result->SetNumResults(0);
2197 helper_->GetUniformfv( 2209 helper_->GetUniformfv(
2198 program, location, GetResultShmId(), GetResultShmOffset()); 2210 program, location, GetResultShmId(), GetResultShmOffset());
2199 WaitForCmd(); 2211 WaitForCmd();
2200 result->CopyResult(params); 2212 result->CopyResult(params);
2201 GPU_CLIENT_LOG_CODE_BLOCK({ 2213 GPU_CLIENT_LOG_CODE_BLOCK({
2202 for (int32 i = 0; i < result->GetNumResults(); ++i) { 2214 for (int32 i = 0; i < result->GetNumResults(); ++i) {
2203 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); 2215 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
2204 } 2216 }
2205 }); 2217 });
2206 } 2218 }
2207 2219
2208 void GLES2Implementation::GetUniformiv( 2220 void GLES2Implementation::GetUniformiv(
2209 GLuint program, GLint location, GLint* params) { 2221 GLuint program, GLint location, GLint* params) {
2210 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2222 GPU_CLIENT_SINGLE_THREAD_CHECK();
2211 GPU_CLIENT_LOG("[" << this << "] glGetUniformiv(" 2223 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetUniformiv("
2212 << program << ", " << location << ", " 2224 << program << ", " << location << ", "
2213 << static_cast<const void*>(params) << ")"); 2225 << static_cast<const void*>(params) << ")");
2214 TRACE_EVENT0("gpu", "GLES2::GetUniformiv"); 2226 TRACE_EVENT0("gpu", "GLES2::GetUniformiv");
2215 typedef gles2::GetUniformiv::Result Result; 2227 typedef gles2::GetUniformiv::Result Result;
2216 Result* result = GetResultAs<Result*>(); 2228 Result* result = GetResultAs<Result*>();
2217 if (!result) { 2229 if (!result) {
2218 return; 2230 return;
2219 } 2231 }
2220 result->SetNumResults(0); 2232 result->SetNumResults(0);
2221 helper_->GetUniformiv( 2233 helper_->GetUniformiv(
2222 program, location, GetResultShmId(), GetResultShmOffset()); 2234 program, location, GetResultShmId(), GetResultShmOffset());
2223 WaitForCmd(); 2235 WaitForCmd();
2224 GetResultAs<gles2::GetUniformfv::Result*>()->CopyResult(params); 2236 GetResultAs<gles2::GetUniformfv::Result*>()->CopyResult(params);
2225 GPU_CLIENT_LOG_CODE_BLOCK({ 2237 GPU_CLIENT_LOG_CODE_BLOCK({
2226 for (int32 i = 0; i < result->GetNumResults(); ++i) { 2238 for (int32 i = 0; i < result->GetNumResults(); ++i) {
2227 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); 2239 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
2228 } 2240 }
2229 }); 2241 });
2230 } 2242 }
2231 2243
2232 void GLES2Implementation::ReadPixels( 2244 void GLES2Implementation::ReadPixels(
2233 GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, 2245 GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format,
2234 GLenum type, void* pixels) { 2246 GLenum type, void* pixels) {
2235 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2247 GPU_CLIENT_SINGLE_THREAD_CHECK();
2236 GPU_CLIENT_LOG("[" << this << "] glReadPixels(" 2248 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReadPixels("
2237 << xoffset << ", " << yoffset << ", " 2249 << xoffset << ", " << yoffset << ", "
2238 << width << ", " << height << ", " 2250 << width << ", " << height << ", "
2239 << GLES2Util::GetStringReadPixelFormat(format) << ", " 2251 << GLES2Util::GetStringReadPixelFormat(format) << ", "
2240 << GLES2Util::GetStringPixelType(type) << ", " 2252 << GLES2Util::GetStringPixelType(type) << ", "
2241 << static_cast<const void*>(pixels) << ")"); 2253 << static_cast<const void*>(pixels) << ")");
2242 if (width < 0 || height < 0) { 2254 if (width < 0 || height < 0) {
2243 SetGLError(GL_INVALID_VALUE, "glReadPixels", "dimensions < 0"); 2255 SetGLError(GL_INVALID_VALUE, "glReadPixels", "dimensions < 0");
2244 return; 2256 return;
2245 } 2257 }
2246 if (width == 0 || height == 0) { 2258 if (width == 0 || height == 0) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 if (*result == 0) { 2326 if (*result == 0) {
2315 return; 2327 return;
2316 } 2328 }
2317 yoffset += num_rows; 2329 yoffset += num_rows;
2318 height -= num_rows; 2330 height -= num_rows;
2319 } 2331 }
2320 } 2332 }
2321 2333
2322 void GLES2Implementation::ActiveTexture(GLenum texture) { 2334 void GLES2Implementation::ActiveTexture(GLenum texture) {
2323 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2335 GPU_CLIENT_SINGLE_THREAD_CHECK();
2324 GPU_CLIENT_LOG("[" << this << "] glActiveTexture(" 2336 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glActiveTexture("
2325 << GLES2Util::GetStringEnum(texture) << ")"); 2337 << GLES2Util::GetStringEnum(texture) << ")");
2326 GLuint texture_index = texture - GL_TEXTURE0; 2338 GLuint texture_index = texture - GL_TEXTURE0;
2327 if (texture_index >= static_cast<GLuint>( 2339 if (texture_index >= static_cast<GLuint>(
2328 gl_state_.int_state.max_combined_texture_image_units)) { 2340 gl_state_.int_state.max_combined_texture_image_units)) {
2329 SetGLError( 2341 SetGLError(
2330 GL_INVALID_ENUM, "glActiveTexture", "texture_unit out of range."); 2342 GL_INVALID_ENUM, "glActiveTexture", "texture_unit out of range.");
2331 return; 2343 return;
2332 } 2344 }
2333 2345
2334 active_texture_unit_ = texture_index; 2346 active_texture_unit_ = texture_index;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 } 2527 }
2516 2528
2517 void GLES2Implementation::DeleteTexturesStub( 2529 void GLES2Implementation::DeleteTexturesStub(
2518 GLsizei n, const GLuint* textures) { 2530 GLsizei n, const GLuint* textures) {
2519 helper_->DeleteTexturesImmediate(n, textures); 2531 helper_->DeleteTexturesImmediate(n, textures);
2520 } 2532 }
2521 2533
2522 void GLES2Implementation::DisableVertexAttribArray(GLuint index) { 2534 void GLES2Implementation::DisableVertexAttribArray(GLuint index) {
2523 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2535 GPU_CLIENT_SINGLE_THREAD_CHECK();
2524 GPU_CLIENT_LOG( 2536 GPU_CLIENT_LOG(
2525 "[" << this << "] glDisableVertexAttribArray(" << index << ")"); 2537 "[" << GetLogPrefix() << "] glDisableVertexAttribArray(" << index << ")");
2526 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 2538 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
2527 client_side_buffer_helper_->SetAttribEnable(index, false); 2539 client_side_buffer_helper_->SetAttribEnable(index, false);
2528 #endif 2540 #endif
2529 helper_->DisableVertexAttribArray(index); 2541 helper_->DisableVertexAttribArray(index);
2530 } 2542 }
2531 2543
2532 void GLES2Implementation::EnableVertexAttribArray(GLuint index) { 2544 void GLES2Implementation::EnableVertexAttribArray(GLuint index) {
2533 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2545 GPU_CLIENT_SINGLE_THREAD_CHECK();
2534 GPU_CLIENT_LOG("[" << this << "] glEnableVertexAttribArray(" << index << ")"); 2546 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEnableVertexAttribArray("
2547 << index << ")");
2535 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 2548 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
2536 client_side_buffer_helper_->SetAttribEnable(index, true); 2549 client_side_buffer_helper_->SetAttribEnable(index, true);
2537 #endif 2550 #endif
2538 helper_->EnableVertexAttribArray(index); 2551 helper_->EnableVertexAttribArray(index);
2539 } 2552 }
2540 2553
2541 void GLES2Implementation::DrawArrays(GLenum mode, GLint first, GLsizei count) { 2554 void GLES2Implementation::DrawArrays(GLenum mode, GLint first, GLsizei count) {
2542 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2555 GPU_CLIENT_SINGLE_THREAD_CHECK();
2543 GPU_CLIENT_LOG("[" << this << "] glDrawArrays(" 2556 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawArrays("
2544 << GLES2Util::GetStringDrawMode(mode) << ", " 2557 << GLES2Util::GetStringDrawMode(mode) << ", "
2545 << first << ", " << count << ")"); 2558 << first << ", " << count << ")");
2546 if (count < 0) { 2559 if (count < 0) {
2547 SetGLError(GL_INVALID_VALUE, "glDrawArrays", "count < 0"); 2560 SetGLError(GL_INVALID_VALUE, "glDrawArrays", "count < 0");
2548 return; 2561 return;
2549 } 2562 }
2550 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 2563 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
2551 bool have_client_side = 2564 bool have_client_side =
2552 client_side_buffer_helper_->HaveEnabledClientSideBuffers(); 2565 client_side_buffer_helper_->HaveEnabledClientSideBuffers();
2553 if (have_client_side) { 2566 if (have_client_side) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 SetGLError(GL_INVALID_ENUM, "glGetVertexAttrib", "invalid enum"); 2611 SetGLError(GL_INVALID_ENUM, "glGetVertexAttrib", "invalid enum");
2599 break; 2612 break;
2600 } 2613 }
2601 return true; 2614 return true;
2602 } 2615 }
2603 #endif // GLES2_SUPPORT_CLIENT_SIDE_ARRAYS 2616 #endif // GLES2_SUPPORT_CLIENT_SIDE_ARRAYS
2604 2617
2605 void GLES2Implementation::GetVertexAttribfv( 2618 void GLES2Implementation::GetVertexAttribfv(
2606 GLuint index, GLenum pname, GLfloat* params) { 2619 GLuint index, GLenum pname, GLfloat* params) {
2607 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2620 GPU_CLIENT_SINGLE_THREAD_CHECK();
2608 GPU_CLIENT_LOG("[" << this << "] glGetVertexAttribfv(" 2621 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribfv("
2609 << index << ", " 2622 << index << ", "
2610 << GLES2Util::GetStringVertexAttribute(pname) << ", " 2623 << GLES2Util::GetStringVertexAttribute(pname) << ", "
2611 << static_cast<const void*>(params) << ")"); 2624 << static_cast<const void*>(params) << ")");
2612 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 2625 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
2613 uint32 value = 0; 2626 uint32 value = 0;
2614 if (GetVertexAttribHelper(index, pname, &value)) { 2627 if (GetVertexAttribHelper(index, pname, &value)) {
2615 *params = static_cast<float>(value); 2628 *params = static_cast<float>(value);
2616 return; 2629 return;
2617 } 2630 }
2618 #endif 2631 #endif
(...skipping 11 matching lines...) Expand all
2630 GPU_CLIENT_LOG_CODE_BLOCK({ 2643 GPU_CLIENT_LOG_CODE_BLOCK({
2631 for (int32 i = 0; i < result->GetNumResults(); ++i) { 2644 for (int32 i = 0; i < result->GetNumResults(); ++i) {
2632 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); 2645 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
2633 } 2646 }
2634 }); 2647 });
2635 } 2648 }
2636 2649
2637 void GLES2Implementation::GetVertexAttribiv( 2650 void GLES2Implementation::GetVertexAttribiv(
2638 GLuint index, GLenum pname, GLint* params) { 2651 GLuint index, GLenum pname, GLint* params) {
2639 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2652 GPU_CLIENT_SINGLE_THREAD_CHECK();
2640 GPU_CLIENT_LOG("[" << this << "] glGetVertexAttribiv(" 2653 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribiv("
2641 << index << ", " 2654 << index << ", "
2642 << GLES2Util::GetStringVertexAttribute(pname) << ", " 2655 << GLES2Util::GetStringVertexAttribute(pname) << ", "
2643 << static_cast<const void*>(params) << ")"); 2656 << static_cast<const void*>(params) << ")");
2644 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) 2657 #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
2645 uint32 value = 0; 2658 uint32 value = 0;
2646 if (GetVertexAttribHelper(index, pname, &value)) { 2659 if (GetVertexAttribHelper(index, pname, &value)) {
2647 *params = value; 2660 *params = value;
2648 return; 2661 return;
2649 } 2662 }
2650 #endif 2663 #endif
(...skipping 11 matching lines...) Expand all
2662 GPU_CLIENT_LOG_CODE_BLOCK({ 2675 GPU_CLIENT_LOG_CODE_BLOCK({
2663 for (int32 i = 0; i < result->GetNumResults(); ++i) { 2676 for (int32 i = 0; i < result->GetNumResults(); ++i) {
2664 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); 2677 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
2665 } 2678 }
2666 }); 2679 });
2667 } 2680 }
2668 2681
2669 GLboolean GLES2Implementation::EnableFeatureCHROMIUM( 2682 GLboolean GLES2Implementation::EnableFeatureCHROMIUM(
2670 const char* feature) { 2683 const char* feature) {
2671 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2684 GPU_CLIENT_SINGLE_THREAD_CHECK();
2672 GPU_CLIENT_LOG("[" << this << "] glEnableFeatureCHROMIUM(" 2685 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEnableFeatureCHROMIUM("
2673 << feature << ")"); 2686 << feature << ")");
2674 TRACE_EVENT0("gpu", "GLES2::EnableFeatureCHROMIUM"); 2687 TRACE_EVENT0("gpu", "GLES2::EnableFeatureCHROMIUM");
2675 typedef EnableFeatureCHROMIUM::Result Result; 2688 typedef EnableFeatureCHROMIUM::Result Result;
2676 Result* result = GetResultAs<Result*>(); 2689 Result* result = GetResultAs<Result*>();
2677 if (!result) { 2690 if (!result) {
2678 return false; 2691 return false;
2679 } 2692 }
2680 *result = 0; 2693 *result = 0;
2681 SetBucketAsCString(kResultBucketId, feature); 2694 SetBucketAsCString(kResultBucketId, feature);
2682 helper_->EnableFeatureCHROMIUM( 2695 helper_->EnableFeatureCHROMIUM(
2683 kResultBucketId, GetResultShmId(), GetResultShmOffset()); 2696 kResultBucketId, GetResultShmId(), GetResultShmOffset());
2684 WaitForCmd(); 2697 WaitForCmd();
2685 helper_->SetBucketSize(kResultBucketId, 0); 2698 helper_->SetBucketSize(kResultBucketId, 0);
2686 GPU_CLIENT_LOG(" returned " << GLES2Util::GetStringBool(*result)); 2699 GPU_CLIENT_LOG(" returned " << GLES2Util::GetStringBool(*result));
2687 return *result; 2700 return *result;
2688 } 2701 }
2689 2702
2690 void* GLES2Implementation::MapBufferSubDataCHROMIUM( 2703 void* GLES2Implementation::MapBufferSubDataCHROMIUM(
2691 GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) { 2704 GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) {
2692 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2705 GPU_CLIENT_SINGLE_THREAD_CHECK();
2693 GPU_CLIENT_LOG("[" << this << "] glMapBufferSubDataCHROMIUM(" 2706 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMapBufferSubDataCHROMIUM("
2694 << target << ", " << offset << ", " << size << ", " 2707 << target << ", " << offset << ", " << size << ", "
2695 << GLES2Util::GetStringEnum(access) << ")"); 2708 << GLES2Util::GetStringEnum(access) << ")");
2696 // NOTE: target is NOT checked because the service will check it 2709 // NOTE: target is NOT checked because the service will check it
2697 // and we don't know what targets are valid. 2710 // and we don't know what targets are valid.
2698 if (access != GL_WRITE_ONLY) { 2711 if (access != GL_WRITE_ONLY) {
2699 SetGLError( 2712 SetGLError(
2700 GL_INVALID_ENUM, "glMapBufferSubDataCHROMIUM", "bad access mode"); 2713 GL_INVALID_ENUM, "glMapBufferSubDataCHROMIUM", "bad access mode");
2701 return NULL; 2714 return NULL;
2702 } 2715 }
2703 if (offset < 0 || size < 0) { 2716 if (offset < 0 || size < 0) {
(...skipping 14 matching lines...) Expand all
2718 MappedBuffer( 2731 MappedBuffer(
2719 access, shm_id, mem, shm_offset, target, offset, size))); 2732 access, shm_id, mem, shm_offset, target, offset, size)));
2720 GPU_DCHECK(result.second); 2733 GPU_DCHECK(result.second);
2721 GPU_CLIENT_LOG(" returned " << mem); 2734 GPU_CLIENT_LOG(" returned " << mem);
2722 return mem; 2735 return mem;
2723 } 2736 }
2724 2737
2725 void GLES2Implementation::UnmapBufferSubDataCHROMIUM(const void* mem) { 2738 void GLES2Implementation::UnmapBufferSubDataCHROMIUM(const void* mem) {
2726 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2739 GPU_CLIENT_SINGLE_THREAD_CHECK();
2727 GPU_CLIENT_LOG( 2740 GPU_CLIENT_LOG(
2728 "[" << this << "] glUnmapBufferSubDataCHROMIUM(" << mem << ")"); 2741 "[" << GetLogPrefix() << "] glUnmapBufferSubDataCHROMIUM(" << mem << ")");
2729 MappedBufferMap::iterator it = mapped_buffers_.find(mem); 2742 MappedBufferMap::iterator it = mapped_buffers_.find(mem);
2730 if (it == mapped_buffers_.end()) { 2743 if (it == mapped_buffers_.end()) {
2731 SetGLError( 2744 SetGLError(
2732 GL_INVALID_VALUE, "UnmapBufferSubDataCHROMIUM", "buffer not mapped"); 2745 GL_INVALID_VALUE, "UnmapBufferSubDataCHROMIUM", "buffer not mapped");
2733 return; 2746 return;
2734 } 2747 }
2735 const MappedBuffer& mb = it->second; 2748 const MappedBuffer& mb = it->second;
2736 helper_->BufferSubData( 2749 helper_->BufferSubData(
2737 mb.target, mb.offset, mb.size, mb.shm_id, mb.shm_offset); 2750 mb.target, mb.offset, mb.size, mb.shm_id, mb.shm_offset);
2738 mapped_memory_->FreePendingToken(mb.shm_memory, helper_->InsertToken()); 2751 mapped_memory_->FreePendingToken(mb.shm_memory, helper_->InsertToken());
2739 mapped_buffers_.erase(it); 2752 mapped_buffers_.erase(it);
2740 } 2753 }
2741 2754
2742 void* GLES2Implementation::MapTexSubImage2DCHROMIUM( 2755 void* GLES2Implementation::MapTexSubImage2DCHROMIUM(
2743 GLenum target, 2756 GLenum target,
2744 GLint level, 2757 GLint level,
2745 GLint xoffset, 2758 GLint xoffset,
2746 GLint yoffset, 2759 GLint yoffset,
2747 GLsizei width, 2760 GLsizei width,
2748 GLsizei height, 2761 GLsizei height,
2749 GLenum format, 2762 GLenum format,
2750 GLenum type, 2763 GLenum type,
2751 GLenum access) { 2764 GLenum access) {
2752 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2765 GPU_CLIENT_SINGLE_THREAD_CHECK();
2753 GPU_CLIENT_LOG("[" << this << "] glMapTexSubImage2DCHROMIUM(" 2766 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMapTexSubImage2DCHROMIUM("
2754 << target << ", " << level << ", " 2767 << target << ", " << level << ", "
2755 << xoffset << ", " << yoffset << ", " 2768 << xoffset << ", " << yoffset << ", "
2756 << width << ", " << height << ", " 2769 << width << ", " << height << ", "
2757 << GLES2Util::GetStringTextureFormat(format) << ", " 2770 << GLES2Util::GetStringTextureFormat(format) << ", "
2758 << GLES2Util::GetStringPixelType(type) << ", " 2771 << GLES2Util::GetStringPixelType(type) << ", "
2759 << GLES2Util::GetStringEnum(access) << ")"); 2772 << GLES2Util::GetStringEnum(access) << ")");
2760 if (access != GL_WRITE_ONLY) { 2773 if (access != GL_WRITE_ONLY) {
2761 SetGLError( 2774 SetGLError(
2762 GL_INVALID_ENUM, "glMapTexSubImage2DCHROMIUM", "bad access mode"); 2775 GL_INVALID_ENUM, "glMapTexSubImage2DCHROMIUM", "bad access mode");
2763 return NULL; 2776 return NULL;
(...skipping 27 matching lines...) Expand all
2791 access, shm_id, mem, shm_offset, 2804 access, shm_id, mem, shm_offset,
2792 target, level, xoffset, yoffset, width, height, format, type))); 2805 target, level, xoffset, yoffset, width, height, format, type)));
2793 GPU_DCHECK(result.second); 2806 GPU_DCHECK(result.second);
2794 GPU_CLIENT_LOG(" returned " << mem); 2807 GPU_CLIENT_LOG(" returned " << mem);
2795 return mem; 2808 return mem;
2796 } 2809 }
2797 2810
2798 void GLES2Implementation::UnmapTexSubImage2DCHROMIUM(const void* mem) { 2811 void GLES2Implementation::UnmapTexSubImage2DCHROMIUM(const void* mem) {
2799 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2812 GPU_CLIENT_SINGLE_THREAD_CHECK();
2800 GPU_CLIENT_LOG( 2813 GPU_CLIENT_LOG(
2801 "[" << this << "] glUnmapTexSubImage2DCHROMIUM(" << mem << ")"); 2814 "[" << GetLogPrefix() << "] glUnmapTexSubImage2DCHROMIUM(" << mem << ")");
2802 MappedTextureMap::iterator it = mapped_textures_.find(mem); 2815 MappedTextureMap::iterator it = mapped_textures_.find(mem);
2803 if (it == mapped_textures_.end()) { 2816 if (it == mapped_textures_.end()) {
2804 SetGLError( 2817 SetGLError(
2805 GL_INVALID_VALUE, "UnmapTexSubImage2DCHROMIUM", "texture not mapped"); 2818 GL_INVALID_VALUE, "UnmapTexSubImage2DCHROMIUM", "texture not mapped");
2806 return; 2819 return;
2807 } 2820 }
2808 const MappedTexture& mt = it->second; 2821 const MappedTexture& mt = it->second;
2809 helper_->TexSubImage2D( 2822 helper_->TexSubImage2D(
2810 mt.target, mt.level, mt.xoffset, mt.yoffset, mt.width, mt.height, 2823 mt.target, mt.level, mt.xoffset, mt.yoffset, mt.width, mt.height,
2811 mt.format, mt.type, mt.shm_id, mt.shm_offset, GL_FALSE); 2824 mt.format, mt.type, mt.shm_id, mt.shm_offset, GL_FALSE);
2812 mapped_memory_->FreePendingToken(mt.shm_memory, helper_->InsertToken()); 2825 mapped_memory_->FreePendingToken(mt.shm_memory, helper_->InsertToken());
2813 mapped_textures_.erase(it); 2826 mapped_textures_.erase(it);
2814 } 2827 }
2815 2828
2816 void GLES2Implementation::ResizeCHROMIUM(GLuint width, GLuint height) { 2829 void GLES2Implementation::ResizeCHROMIUM(GLuint width, GLuint height) {
2817 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2830 GPU_CLIENT_SINGLE_THREAD_CHECK();
2818 GPU_CLIENT_LOG("[" << this << "] glResizeCHROMIUM(" 2831 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glResizeCHROMIUM("
2819 << width << ", " << height << ")"); 2832 << width << ", " << height << ")");
2820 helper_->ResizeCHROMIUM(width, height); 2833 helper_->ResizeCHROMIUM(width, height);
2821 } 2834 }
2822 2835
2823 const GLchar* GLES2Implementation::GetRequestableExtensionsCHROMIUM() { 2836 const GLchar* GLES2Implementation::GetRequestableExtensionsCHROMIUM() {
2824 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2837 GPU_CLIENT_SINGLE_THREAD_CHECK();
2825 GPU_CLIENT_LOG("[" << this << "] glGetRequestableExtensionsCHROMIUM()"); 2838 GPU_CLIENT_LOG("[" << GetLogPrefix()
2839 << "] glGetRequestableExtensionsCHROMIUM()");
2826 TRACE_EVENT0("gpu", 2840 TRACE_EVENT0("gpu",
2827 "GLES2Implementation::GetRequestableExtensionsCHROMIUM()"); 2841 "GLES2Implementation::GetRequestableExtensionsCHROMIUM()");
2828 const char* result = NULL; 2842 const char* result = NULL;
2829 // Clear the bucket so if the command fails nothing will be in it. 2843 // Clear the bucket so if the command fails nothing will be in it.
2830 helper_->SetBucketSize(kResultBucketId, 0); 2844 helper_->SetBucketSize(kResultBucketId, 0);
2831 helper_->GetRequestableExtensionsCHROMIUM(kResultBucketId); 2845 helper_->GetRequestableExtensionsCHROMIUM(kResultBucketId);
2832 std::string str; 2846 std::string str;
2833 if (GetBucketAsString(kResultBucketId, &str)) { 2847 if (GetBucketAsString(kResultBucketId, &str)) {
2834 // The set of requestable extensions shrinks as we enable 2848 // The set of requestable extensions shrinks as we enable
2835 // them. Because we don't know when the client will stop referring 2849 // them. Because we don't know when the client will stop referring
2836 // to a previous one it queries (see GetString) we need to cache 2850 // to a previous one it queries (see GetString) we need to cache
2837 // the unique results. 2851 // the unique results.
2838 std::set<std::string>::const_iterator sit = 2852 std::set<std::string>::const_iterator sit =
2839 requestable_extensions_set_.find(str); 2853 requestable_extensions_set_.find(str);
2840 if (sit != requestable_extensions_set_.end()) { 2854 if (sit != requestable_extensions_set_.end()) {
2841 result = sit->c_str(); 2855 result = sit->c_str();
2842 } else { 2856 } else {
2843 std::pair<std::set<std::string>::const_iterator, bool> insert_result = 2857 std::pair<std::set<std::string>::const_iterator, bool> insert_result =
2844 requestable_extensions_set_.insert(str); 2858 requestable_extensions_set_.insert(str);
2845 GPU_DCHECK(insert_result.second); 2859 GPU_DCHECK(insert_result.second);
2846 result = insert_result.first->c_str(); 2860 result = insert_result.first->c_str();
2847 } 2861 }
2848 } 2862 }
2849 GPU_CLIENT_LOG(" returned " << result); 2863 GPU_CLIENT_LOG(" returned " << result);
2850 return reinterpret_cast<const GLchar*>(result); 2864 return reinterpret_cast<const GLchar*>(result);
2851 } 2865 }
2852 2866
2853 void GLES2Implementation::RequestExtensionCHROMIUM(const char* extension) { 2867 void GLES2Implementation::RequestExtensionCHROMIUM(const char* extension) {
2854 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2868 GPU_CLIENT_SINGLE_THREAD_CHECK();
2855 GPU_CLIENT_LOG("[" << this << "] glRequestExtensionCHROMIUM(" 2869 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRequestExtensionCHROMIUM("
2856 << extension << ")"); 2870 << extension << ")");
2857 SetBucketAsCString(kResultBucketId, extension); 2871 SetBucketAsCString(kResultBucketId, extension);
2858 helper_->RequestExtensionCHROMIUM(kResultBucketId); 2872 helper_->RequestExtensionCHROMIUM(kResultBucketId);
2859 helper_->SetBucketSize(kResultBucketId, 0); 2873 helper_->SetBucketSize(kResultBucketId, 0);
2860 if (kUnavailableExtensionStatus == angle_pack_reverse_row_order_status && 2874 if (kUnavailableExtensionStatus == angle_pack_reverse_row_order_status &&
2861 !strcmp(extension, "GL_ANGLE_pack_reverse_row_order")) { 2875 !strcmp(extension, "GL_ANGLE_pack_reverse_row_order")) {
2862 angle_pack_reverse_row_order_status = kUnknownExtensionStatus; 2876 angle_pack_reverse_row_order_status = kUnknownExtensionStatus;
2863 } 2877 }
2864 } 2878 }
2865 2879
2866 void GLES2Implementation::RateLimitOffscreenContextCHROMIUM() { 2880 void GLES2Implementation::RateLimitOffscreenContextCHROMIUM() {
2867 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2881 GPU_CLIENT_SINGLE_THREAD_CHECK();
2868 GPU_CLIENT_LOG("[" << this << "] glRateLimitOffscreenCHROMIUM()"); 2882 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRateLimitOffscreenCHROMIUM()");
2869 // Wait if this would add too many rate limit tokens. 2883 // Wait if this would add too many rate limit tokens.
2870 if (rate_limit_tokens_.size() == kMaxSwapBuffers) { 2884 if (rate_limit_tokens_.size() == kMaxSwapBuffers) {
2871 helper_->WaitForToken(rate_limit_tokens_.front()); 2885 helper_->WaitForToken(rate_limit_tokens_.front());
2872 rate_limit_tokens_.pop(); 2886 rate_limit_tokens_.pop();
2873 } 2887 }
2874 rate_limit_tokens_.push(helper_->InsertToken()); 2888 rate_limit_tokens_.push(helper_->InsertToken());
2875 } 2889 }
2876 2890
2877 void GLES2Implementation::GetMultipleIntegervCHROMIUM( 2891 void GLES2Implementation::GetMultipleIntegervCHROMIUM(
2878 const GLenum* pnames, GLuint count, GLint* results, GLsizeiptr size) { 2892 const GLenum* pnames, GLuint count, GLint* results, GLsizeiptr size) {
2879 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2893 GPU_CLIENT_SINGLE_THREAD_CHECK();
2880 GPU_CLIENT_LOG("[" << this << "] glGetMultipleIntegervCHROMIUM(" 2894 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetMultipleIntegervCHROMIUM("
2881 << static_cast<const void*>(pnames) << ", " 2895 << static_cast<const void*>(pnames) << ", "
2882 << count << ", " << results << ", " << size << ")"); 2896 << count << ", " << results << ", " << size << ")");
2883 GPU_CLIENT_LOG_CODE_BLOCK({ 2897 GPU_CLIENT_LOG_CODE_BLOCK({
2884 for (GLuint i = 0; i < count; ++i) { 2898 for (GLuint i = 0; i < count; ++i) {
2885 GPU_CLIENT_LOG( 2899 GPU_CLIENT_LOG(
2886 " " << i << ": " << GLES2Util::GetStringGLState(pnames[i])); 2900 " " << i << ": " << GLES2Util::GetStringGLState(pnames[i]));
2887 } 2901 }
2888 }); 2902 });
2889 int num_results = 0; 2903 int num_results = 0;
2890 for (GLuint ii = 0; ii < count; ++ii) { 2904 for (GLuint ii = 0; ii < count; ++ii) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2971 if (static_cast<size_t>(bufsize) < result.size()) { 2985 if (static_cast<size_t>(bufsize) < result.size()) {
2972 SetGLError(GL_INVALID_OPERATION, 2986 SetGLError(GL_INVALID_OPERATION,
2973 "glProgramInfoCHROMIUM", "bufsize is too small for result."); 2987 "glProgramInfoCHROMIUM", "bufsize is too small for result.");
2974 return; 2988 return;
2975 } 2989 }
2976 memcpy(info, &result[0], result.size()); 2990 memcpy(info, &result[0], result.size());
2977 } 2991 }
2978 2992
2979 GLuint GLES2Implementation::CreateStreamTextureCHROMIUM(GLuint texture) { 2993 GLuint GLES2Implementation::CreateStreamTextureCHROMIUM(GLuint texture) {
2980 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2994 GPU_CLIENT_SINGLE_THREAD_CHECK();
2981 GPU_CLIENT_LOG("[" << this << "] CreateStreamTextureCHROMIUM(" 2995 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CreateStreamTextureCHROMIUM("
2982 << texture << ")"); 2996 << texture << ")");
2983 TRACE_EVENT0("gpu", "GLES2::CreateStreamTextureCHROMIUM"); 2997 TRACE_EVENT0("gpu", "GLES2::CreateStreamTextureCHROMIUM");
2984 typedef CreateStreamTextureCHROMIUM::Result Result; 2998 typedef CreateStreamTextureCHROMIUM::Result Result;
2985 Result* result = GetResultAs<Result*>(); 2999 Result* result = GetResultAs<Result*>();
2986 if (!result) { 3000 if (!result) {
2987 return GL_ZERO; 3001 return GL_ZERO;
2988 } 3002 }
2989 *result = GL_ZERO; 3003 *result = GL_ZERO;
2990 3004
2991 helper_->CreateStreamTextureCHROMIUM(texture, 3005 helper_->CreateStreamTextureCHROMIUM(texture,
2992 GetResultShmId(), 3006 GetResultShmId(),
2993 GetResultShmOffset()); 3007 GetResultShmOffset());
2994 WaitForCmd(); 3008 WaitForCmd();
2995 3009
2996 return *result; 3010 return *result;
2997 } 3011 }
2998 3012
2999 void GLES2Implementation::DestroyStreamTextureCHROMIUM(GLuint texture) { 3013 void GLES2Implementation::DestroyStreamTextureCHROMIUM(GLuint texture) {
3000 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3014 GPU_CLIENT_SINGLE_THREAD_CHECK();
3001 GPU_CLIENT_LOG("[" << this << "] DestroyStreamTextureCHROMIUM(" 3015 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] DestroyStreamTextureCHROMIUM("
3002 << texture << ")"); 3016 << texture << ")");
3003 TRACE_EVENT0("gpu", "GLES2::DestroyStreamTextureCHROMIUM"); 3017 TRACE_EVENT0("gpu", "GLES2::DestroyStreamTextureCHROMIUM");
3004 helper_->DestroyStreamTextureCHROMIUM(texture); 3018 helper_->DestroyStreamTextureCHROMIUM(texture);
3005 } 3019 }
3006 3020
3007 void GLES2Implementation::PostSubBufferCHROMIUM( 3021 void GLES2Implementation::PostSubBufferCHROMIUM(
3008 GLint x, GLint y, GLint width, GLint height) { 3022 GLint x, GLint y, GLint width, GLint height) {
3009 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3023 GPU_CLIENT_SINGLE_THREAD_CHECK();
3010 GPU_CLIENT_LOG("[" << this << "] PostSubBufferCHROMIUM(" 3024 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] PostSubBufferCHROMIUM("
3011 << x << ", " << y << ", " << width << ", " << height << ")"); 3025 << x << ", " << y << ", " << width << ", " << height << ")");
3012 TRACE_EVENT0("gpu", "GLES2::PostSubBufferCHROMIUM"); 3026 TRACE_EVENT0("gpu", "GLES2::PostSubBufferCHROMIUM");
3013 3027
3014 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). 3028 // Same flow control as GLES2Implementation::SwapBuffers (see comments there).
3015 swap_buffers_tokens_.push(helper_->InsertToken()); 3029 swap_buffers_tokens_.push(helper_->InsertToken());
3016 helper_->PostSubBufferCHROMIUM(x, y, width, height); 3030 helper_->PostSubBufferCHROMIUM(x, y, width, height);
3017 helper_->CommandBufferHelper::Flush(); 3031 helper_->CommandBufferHelper::Flush();
3018 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) { 3032 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) {
3019 helper_->WaitForToken(swap_buffers_tokens_.front()); 3033 helper_->WaitForToken(swap_buffers_tokens_.front());
3020 swap_buffers_tokens_.pop(); 3034 swap_buffers_tokens_.pop();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
3064 helper_->DeleteQueriesEXTImmediate(n, queries); 3078 helper_->DeleteQueriesEXTImmediate(n, queries);
3065 } 3079 }
3066 3080
3067 // TODO(gman): Remove this. Queries are not shared resources. 3081 // TODO(gman): Remove this. Queries are not shared resources.
3068 void GLES2Implementation::DeleteQueriesStub( 3082 void GLES2Implementation::DeleteQueriesStub(
3069 GLsizei /* n */, const GLuint* /* queries */) { 3083 GLsizei /* n */, const GLuint* /* queries */) {
3070 } 3084 }
3071 3085
3072 GLboolean GLES2Implementation::IsQueryEXT(GLuint id) { 3086 GLboolean GLES2Implementation::IsQueryEXT(GLuint id) {
3073 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3087 GPU_CLIENT_SINGLE_THREAD_CHECK();
3074 GPU_CLIENT_LOG("[" << this << "] IsQueryEXT(" << id << ")"); 3088 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] IsQueryEXT(" << id << ")");
3075 3089
3076 // TODO(gman): To be spec compliant IDs from other contexts sharing 3090 // TODO(gman): To be spec compliant IDs from other contexts sharing
3077 // resources need to return true here even though you can't share 3091 // resources need to return true here even though you can't share
3078 // queries across contexts? 3092 // queries across contexts?
3079 return query_tracker_->GetQuery(id) != NULL; 3093 return query_tracker_->GetQuery(id) != NULL;
3080 } 3094 }
3081 3095
3082 void GLES2Implementation::BeginQueryEXT(GLenum target, GLuint id) { 3096 void GLES2Implementation::BeginQueryEXT(GLenum target, GLuint id) {
3083 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3097 GPU_CLIENT_SINGLE_THREAD_CHECK();
3084 GPU_CLIENT_LOG("[" << this << "] BeginQueryEXT(" 3098 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] BeginQueryEXT("
3085 << GLES2Util::GetStringQueryTarget(target) 3099 << GLES2Util::GetStringQueryTarget(target)
3086 << ", " << id << ")"); 3100 << ", " << id << ")");
3087 3101
3088 // if any outstanding queries INV_OP 3102 // if any outstanding queries INV_OP
3089 if (current_query_) { 3103 if (current_query_) {
3090 SetGLError( 3104 SetGLError(
3091 GL_INVALID_OPERATION, "glBeginQueryEXT", "query already in progress"); 3105 GL_INVALID_OPERATION, "glBeginQueryEXT", "query already in progress");
3092 return; 3106 return;
3093 } 3107 }
3094 3108
(...skipping 19 matching lines...) Expand all
3114 return; 3128 return;
3115 } 3129 }
3116 3130
3117 current_query_ = query; 3131 current_query_ = query;
3118 3132
3119 query->Begin(this); 3133 query->Begin(this);
3120 } 3134 }
3121 3135
3122 void GLES2Implementation::EndQueryEXT(GLenum target) { 3136 void GLES2Implementation::EndQueryEXT(GLenum target) {
3123 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3137 GPU_CLIENT_SINGLE_THREAD_CHECK();
3124 GPU_CLIENT_LOG("[" << this << "] EndQueryEXT(" 3138 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] EndQueryEXT("
3125 << GLES2Util::GetStringQueryTarget(target) << ")"); 3139 << GLES2Util::GetStringQueryTarget(target) << ")");
3126 // Don't do anything if the context is lost. 3140 // Don't do anything if the context is lost.
3127 if (context_lost_) { 3141 if (context_lost_) {
3128 return; 3142 return;
3129 } 3143 }
3130 3144
3131 if (!current_query_) { 3145 if (!current_query_) {
3132 SetGLError(GL_INVALID_OPERATION, "glEndQueryEXT", "no active query"); 3146 SetGLError(GL_INVALID_OPERATION, "glEndQueryEXT", "no active query");
3133 return; 3147 return;
3134 } 3148 }
3135 3149
3136 if (current_query_->target() != target) { 3150 if (current_query_->target() != target) {
3137 SetGLError(GL_INVALID_OPERATION, 3151 SetGLError(GL_INVALID_OPERATION,
3138 "glEndQueryEXT", "target does not match active query"); 3152 "glEndQueryEXT", "target does not match active query");
3139 return; 3153 return;
3140 } 3154 }
3141 3155
3142 current_query_->End(this); 3156 current_query_->End(this);
3143 current_query_ = NULL; 3157 current_query_ = NULL;
3144 } 3158 }
3145 3159
3146 void GLES2Implementation::GetQueryivEXT( 3160 void GLES2Implementation::GetQueryivEXT(
3147 GLenum target, GLenum pname, GLint* params) { 3161 GLenum target, GLenum pname, GLint* params) {
3148 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3162 GPU_CLIENT_SINGLE_THREAD_CHECK();
3149 GPU_CLIENT_LOG("[" << this << "] GetQueryivEXT(" 3163 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] GetQueryivEXT("
3150 << GLES2Util::GetStringQueryTarget(target) << ", " 3164 << GLES2Util::GetStringQueryTarget(target) << ", "
3151 << GLES2Util::GetStringQueryParameter(pname) << ", " 3165 << GLES2Util::GetStringQueryParameter(pname) << ", "
3152 << static_cast<const void*>(params) << ")"); 3166 << static_cast<const void*>(params) << ")");
3153 3167
3154 if (pname != GL_CURRENT_QUERY_EXT) { 3168 if (pname != GL_CURRENT_QUERY_EXT) {
3155 SetGLError(GL_INVALID_ENUM, "glGetQueryivEXT", "invalid pname"); 3169 SetGLError(GL_INVALID_ENUM, "glGetQueryivEXT", "invalid pname");
3156 return; 3170 return;
3157 } 3171 }
3158 *params = (current_query_ && current_query_->target() == target) ? 3172 *params = (current_query_ && current_query_->target() == target) ?
3159 current_query_->id() : 0; 3173 current_query_->id() : 0;
3160 GPU_CLIENT_LOG(" " << *params); 3174 GPU_CLIENT_LOG(" " << *params);
3161 } 3175 }
3162 3176
3163 void GLES2Implementation::GetQueryObjectuivEXT( 3177 void GLES2Implementation::GetQueryObjectuivEXT(
3164 GLuint id, GLenum pname, GLuint* params) { 3178 GLuint id, GLenum pname, GLuint* params) {
3165 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3179 GPU_CLIENT_SINGLE_THREAD_CHECK();
3166 GPU_CLIENT_LOG("[" << this << "] GetQueryivEXT(" << id << ", " 3180 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] GetQueryivEXT(" << id << ", "
3167 << GLES2Util::GetStringQueryObjectParameter(pname) << ", " 3181 << GLES2Util::GetStringQueryObjectParameter(pname) << ", "
3168 << static_cast<const void*>(params) << ")"); 3182 << static_cast<const void*>(params) << ")");
3169 3183
3170 // exit if the context is lost. 3184 // exit if the context is lost.
3171 if (context_lost_) { 3185 if (context_lost_) {
3172 return; 3186 return;
3173 } 3187 }
3174 3188
3175 QueryTracker::Query* query = query_tracker_->GetQuery(id); 3189 QueryTracker::Query* query = query_tracker_->GetQuery(id);
3176 if (!query) { 3190 if (!query) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3210 default: 3224 default:
3211 SetGLError(GL_INVALID_ENUM, "glQueryObjectuivEXT", "unknown pname"); 3225 SetGLError(GL_INVALID_ENUM, "glQueryObjectuivEXT", "unknown pname");
3212 break; 3226 break;
3213 } 3227 }
3214 GPU_CLIENT_LOG(" " << *params); 3228 GPU_CLIENT_LOG(" " << *params);
3215 } 3229 }
3216 3230
3217 void GLES2Implementation::DrawArraysInstancedANGLE( 3231 void GLES2Implementation::DrawArraysInstancedANGLE(
3218 GLenum mode, GLint first, GLsizei count, GLsizei primcount) { 3232 GLenum mode, GLint first, GLsizei count, GLsizei primcount) {
3219 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3233 GPU_CLIENT_SINGLE_THREAD_CHECK();
3220 GPU_CLIENT_LOG("[" << this << "] glDrawArraysInstancedANGLE(" 3234 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawArraysInstancedANGLE("
3221 << GLES2Util::GetStringDrawMode(mode) << ", " 3235 << GLES2Util::GetStringDrawMode(mode) << ", "
3222 << first << ", " << count << ", " << primcount << ")"); 3236 << first << ", " << count << ", " << primcount << ")");
3223 if (count < 0) { 3237 if (count < 0) {
3224 SetGLError(GL_INVALID_VALUE, "glDrawArraysInstancedANGLE", "count < 0"); 3238 SetGLError(GL_INVALID_VALUE, "glDrawArraysInstancedANGLE", "count < 0");
3225 return; 3239 return;
3226 } 3240 }
3227 if (primcount < 0) { 3241 if (primcount < 0) {
3228 SetGLError(GL_INVALID_VALUE, "glDrawArraysInstancedANGLE", "primcount < 0"); 3242 SetGLError(GL_INVALID_VALUE, "glDrawArraysInstancedANGLE", "primcount < 0");
3229 return; 3243 return;
3230 } 3244 }
(...skipping 14 matching lines...) Expand all
3245 // Restore the user's current binding. 3259 // Restore the user's current binding.
3246 helper_->BindBuffer(GL_ARRAY_BUFFER, bound_array_buffer_id_); 3260 helper_->BindBuffer(GL_ARRAY_BUFFER, bound_array_buffer_id_);
3247 } 3261 }
3248 #endif 3262 #endif
3249 } 3263 }
3250 3264
3251 void GLES2Implementation::DrawElementsInstancedANGLE( 3265 void GLES2Implementation::DrawElementsInstancedANGLE(
3252 GLenum mode, GLsizei count, GLenum type, const void* indices, 3266 GLenum mode, GLsizei count, GLenum type, const void* indices,
3253 GLsizei primcount) { 3267 GLsizei primcount) {
3254 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3268 GPU_CLIENT_SINGLE_THREAD_CHECK();
3255 GPU_CLIENT_LOG("[" << this << "] glDrawElementsInstancedANGLE(" 3269 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawElementsInstancedANGLE("
3256 << GLES2Util::GetStringDrawMode(mode) << ", " 3270 << GLES2Util::GetStringDrawMode(mode) << ", "
3257 << count << ", " 3271 << count << ", "
3258 << GLES2Util::GetStringIndexType(type) << ", " 3272 << GLES2Util::GetStringIndexType(type) << ", "
3259 << static_cast<const void*>(indices) << ", " 3273 << static_cast<const void*>(indices) << ", "
3260 << primcount << ")"); 3274 << primcount << ")");
3261 if (count < 0) { 3275 if (count < 0) {
3262 SetGLError(GL_INVALID_VALUE, 3276 SetGLError(GL_INVALID_VALUE,
3263 "glDrawElementsInstancedANGLE", "count less than 0."); 3277 "glDrawElementsInstancedANGLE", "count less than 0.");
3264 return; 3278 return;
3265 } 3279 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3310 } 3324 }
3311 #else 3325 #else
3312 helper_->DrawElementsInstancedANGLE( 3326 helper_->DrawElementsInstancedANGLE(
3313 mode, count, type, ToGLuint(indices), primcount); 3327 mode, count, type, ToGLuint(indices), primcount);
3314 #endif 3328 #endif
3315 } 3329 }
3316 3330
3317 void GLES2Implementation::GenMailboxCHROMIUM( 3331 void GLES2Implementation::GenMailboxCHROMIUM(
3318 GLbyte* mailbox) { 3332 GLbyte* mailbox) {
3319 GPU_CLIENT_SINGLE_THREAD_CHECK(); 3333 GPU_CLIENT_SINGLE_THREAD_CHECK();
3320 GPU_CLIENT_LOG("[" << this << "] glGenMailboxCHROMIUM(" 3334 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenMailboxCHROMIUM("
3321 << static_cast<const void*>(mailbox) << ")"); 3335 << static_cast<const void*>(mailbox) << ")");
3322 TRACE_EVENT0("gpu", "GLES2::GenMailboxCHROMIUM"); 3336 TRACE_EVENT0("gpu", "GLES2::GenMailboxCHROMIUM");
3323 3337
3324 helper_->GenMailboxCHROMIUM(kResultBucketId); 3338 helper_->GenMailboxCHROMIUM(kResultBucketId);
3325 3339
3326 std::vector<GLbyte> result; 3340 std::vector<GLbyte> result;
3327 GetBucketContents(kResultBucketId, &result); 3341 GetBucketContents(kResultBucketId, &result);
3328 3342
3329 std::copy(result.begin(), result.end(), mailbox); 3343 std::copy(result.begin(), result.end(), mailbox);
3330 } 3344 }
3331 3345
3346 void GLES2Implementation::PushGroupMarkerEXT(
3347 GLsizei length, const GLchar* marker) {
3348 GPU_CLIENT_SINGLE_THREAD_CHECK();
3349 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPushGroupMarkerEXT("
3350 << length << ", " << marker << ")");
3351 if (!marker) {
3352 marker = "";
3353 }
3354 SetBucketAsString(
3355 kResultBucketId,
3356 (length ? std::string(marker, length) : std::string(marker)));
3357 helper_->PushGroupMarkerEXT(kResultBucketId);
3358 helper_->SetBucketSize(kResultBucketId, 0);
3359 debug_marker_manager_.PushGroup(
3360 length ? std::string(marker, length) : std::string(marker));
3361 }
3362
3363 void GLES2Implementation::InsertEventMarkerEXT(
3364 GLsizei length, const GLchar* marker) {
3365 GPU_CLIENT_SINGLE_THREAD_CHECK();
3366 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertEventMarkerEXT("
3367 << length << ", " << marker << ")");
3368 if (!marker) {
3369 marker = "";
3370 }
3371 SetBucketAsString(
3372 kResultBucketId,
3373 (length ? std::string(marker, length) : std::string(marker)));
3374 helper_->InsertEventMarkerEXT(kResultBucketId);
3375 helper_->SetBucketSize(kResultBucketId, 0);
3376 debug_marker_manager_.SetMarker(
3377 length ? std::string(marker, length) : std::string(marker));
3378 }
3379
3380 void GLES2Implementation::PopGroupMarkerEXT() {
3381 GPU_CLIENT_SINGLE_THREAD_CHECK();
3382 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPopGroupMarkerEXT()");
3383 helper_->PopGroupMarkerEXT();
3384 debug_marker_manager_.PopGroup();
3385 }
3386
3332 } // namespace gles2 3387 } // namespace gles2
3333 } // namespace gpu 3388 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698