OLD | NEW |
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 <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 bound_renderbuffer_(0), | 600 bound_renderbuffer_(0), |
601 bound_array_buffer_id_(0), | 601 bound_array_buffer_id_(0), |
602 bound_element_array_buffer_id_(0), | 602 bound_element_array_buffer_id_(0), |
603 client_side_array_id_(0), | 603 client_side_array_id_(0), |
604 client_side_element_array_id_(0), | 604 client_side_element_array_id_(0), |
605 error_bits_(0), | 605 error_bits_(0), |
606 debug_(false), | 606 debug_(false), |
607 sharing_resources_(share_resources), | 607 sharing_resources_(share_resources), |
608 bind_generates_resource_(bind_generates_resource), | 608 bind_generates_resource_(bind_generates_resource), |
609 use_count_(0), | 609 use_count_(0), |
610 current_query_(NULL) { | 610 current_query_(NULL), |
| 611 error_message_callback_(NULL) { |
611 GPU_DCHECK(helper); | 612 GPU_DCHECK(helper); |
612 GPU_DCHECK(transfer_buffer); | 613 GPU_DCHECK(transfer_buffer); |
613 GPU_CLIENT_LOG_CODE_BLOCK({ | 614 GPU_CLIENT_LOG_CODE_BLOCK({ |
614 debug_ = CommandLine::ForCurrentProcess()->HasSwitch( | 615 debug_ = CommandLine::ForCurrentProcess()->HasSwitch( |
615 switches::kEnableGPUClientLogging); | 616 switches::kEnableGPUClientLogging); |
616 }); | 617 }); |
617 | 618 |
618 memset(&reserved_ids_, 0, sizeof(reserved_ids_)); | 619 memset(&reserved_ids_, 0, sizeof(reserved_ids_)); |
619 } | 620 } |
620 | 621 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 } | 823 } |
823 return error; | 824 return error; |
824 } | 825 } |
825 | 826 |
826 void GLES2Implementation::SetGLError(GLenum error, const char* msg) { | 827 void GLES2Implementation::SetGLError(GLenum error, const char* msg) { |
827 GPU_CLIENT_LOG("[" << this << "] Client Synthesized Error: " | 828 GPU_CLIENT_LOG("[" << this << "] Client Synthesized Error: " |
828 << GLES2Util::GetStringError(error) << ": " << msg); | 829 << GLES2Util::GetStringError(error) << ": " << msg); |
829 if (msg) { | 830 if (msg) { |
830 last_error_ = msg; | 831 last_error_ = msg; |
831 } | 832 } |
| 833 if (error_message_callback_) { |
| 834 std::string temp(GLES2Util::GetStringError(error) + " : " + msg); |
| 835 error_message_callback_->OnErrorMessage(temp.c_str(), 0); |
| 836 } |
832 error_bits_ |= GLES2Util::GLErrorToErrorBit(error); | 837 error_bits_ |= GLES2Util::GLErrorToErrorBit(error); |
833 } | 838 } |
834 | 839 |
835 bool GLES2Implementation::GetBucketContents(uint32 bucket_id, | 840 bool GLES2Implementation::GetBucketContents(uint32 bucket_id, |
836 std::vector<int8>* data) { | 841 std::vector<int8>* data) { |
837 TRACE_EVENT0("gpu", "GLES2::GetBucketContents"); | 842 TRACE_EVENT0("gpu", "GLES2::GetBucketContents"); |
838 GPU_DCHECK(data); | 843 GPU_DCHECK(data); |
839 typedef cmd::GetBucketSize::Result Result; | 844 typedef cmd::GetBucketSize::Result Result; |
840 Result* result = GetResultAs<Result*>(); | 845 Result* result = GetResultAs<Result*>(); |
841 if (!result) { | 846 if (!result) { |
(...skipping 2408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3250 helper_->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); | 3255 helper_->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); |
3251 } | 3256 } |
3252 #else | 3257 #else |
3253 helper_->DrawElementsInstancedANGLE( | 3258 helper_->DrawElementsInstancedANGLE( |
3254 mode, count, type, ToGLuint(indices), primcount); | 3259 mode, count, type, ToGLuint(indices), primcount); |
3255 #endif | 3260 #endif |
3256 } | 3261 } |
3257 | 3262 |
3258 } // namespace gles2 | 3263 } // namespace gles2 |
3259 } // namespace gpu | 3264 } // namespace gpu |
OLD | NEW |