summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-15 09:10:57 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-15 09:10:57 +0000
commit0c652b8e854aad1f44751449e7029f432f4502fe (patch)
tree359f8746b45ec4d26f249dd6604a2e18c6dded79 /gpu
parent86fda59076bc3cdca5ff72581e87ed002d885027 (diff)
downloadchromium_src-0c652b8e854aad1f44751449e7029f432f4502fe.zip
chromium_src-0c652b8e854aad1f44751449e7029f432f4502fe.tar.gz
chromium_src-0c652b8e854aad1f44751449e7029f432f4502fe.tar.bz2
Plumb client side synthesized GL messages to JS Console
TEST=tested by hand BUG=none R=apatrick@chromium.org Review URL: http://codereview.chromium.org/9706042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126869 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc7
-rw-r--r--gpu/command_buffer/client/gles2_implementation.h12
2 files changed, 18 insertions, 1 deletions
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index c3a2c24..7965689 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -607,7 +607,8 @@ GLES2Implementation::GLES2Implementation(
sharing_resources_(share_resources),
bind_generates_resource_(bind_generates_resource),
use_count_(0),
- current_query_(NULL) {
+ current_query_(NULL),
+ error_message_callback_(NULL) {
GPU_DCHECK(helper);
GPU_DCHECK(transfer_buffer);
GPU_CLIENT_LOG_CODE_BLOCK({
@@ -829,6 +830,10 @@ void GLES2Implementation::SetGLError(GLenum error, const char* msg) {
if (msg) {
last_error_ = msg;
}
+ if (error_message_callback_) {
+ std::string temp(GLES2Util::GetStringError(error) + " : " + msg);
+ error_message_callback_->OnErrorMessage(temp.c_str(), 0);
+ }
error_bits_ |= GLES2Util::GLErrorToErrorBit(error);
}
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h
index 2b5312a..4e5334a 100644
--- a/gpu/command_buffer/client/gles2_implementation.h
+++ b/gpu/command_buffer/client/gles2_implementation.h
@@ -108,6 +108,12 @@ class IdHandlerInterface {
// shared memory and synchronization issues.
class GLES2_IMPL_EXPORT GLES2Implementation {
public:
+ class ErrorMessageCallback {
+ public:
+ virtual ~ErrorMessageCallback() { }
+ virtual void OnErrorMessage(const char* msg, int id) = 0;
+ };
+
// Stores client side cached GL state.
struct GLState {
GLState()
@@ -215,6 +221,10 @@ class GLES2_IMPL_EXPORT GLES2Implementation {
void FreeUnusedSharedMemory();
void FreeEverything();
+ void SetErrorMessageCallback(ErrorMessageCallback* callback) {
+ error_message_callback_ = callback;
+ }
+
private:
friend class ClientSideBufferHelper;
friend class GLES2ImplementationTest;
@@ -522,6 +532,8 @@ class GLES2_IMPL_EXPORT GLES2Implementation {
scoped_ptr<QueryTracker> query_tracker_;
QueryTracker::Query* current_query_;
+ ErrorMessageCallback* error_message_callback_;
+
DISALLOW_COPY_AND_ASSIGN(GLES2Implementation);
};