diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-05 09:27:42 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-05 09:27:42 +0000 |
commit | e5dfab45dcc64c17f20dca8f92d623a14615cea0 (patch) | |
tree | a64d6f8ae4c5dfb1d39cbd8c018b506edcb2d92e /gpu | |
parent | 1a2f7325dd2ef1530341f677cbbd3176c0524b44 (diff) | |
download | chromium_src-e5dfab45dcc64c17f20dca8f92d623a14615cea0.zip chromium_src-e5dfab45dcc64c17f20dca8f92d623a14615cea0.tar.gz chromium_src-e5dfab45dcc64c17f20dca8f92d623a14615cea0.tar.bz2 |
Expose GLES2DecoderImpl error functions
BUG=none
Review URL: https://chromiumcodereview.appspot.com/12398032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186143 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 50 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.h | 29 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder_mock.h | 15 |
3 files changed, 63 insertions, 31 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 28d0069..77aa601 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -573,12 +573,6 @@ class GLES2DecoderImpl : public GLES2Decoder { } virtual bool ProcessPendingQueries() OVERRIDE; - virtual void SetGLError(GLenum error, - const char* function_name, - const char* msg); - virtual void SetGLErrorInvalidEnum(const char* function_name, - GLenum value, - const char* label); virtual void SetResizeCallback( const base::Callback<void(gfx::Size)>& callback) OVERRIDE; @@ -1345,26 +1339,22 @@ class GLES2DecoderImpl : public GLES2Decoder { // false if pname is unknown. bool GetNumValuesReturnedForGLGet(GLenum pname, GLsizei* num_values); - // Gets the GLError and stores it in our wrapper. Effectively - // this lets us peek at the error without losing it. - GLenum PeekGLError(); - - // Copies the real GL errors to the wrapper. This is so we can - // make sure there are no native GL errors before calling some GL function - // so that on return we know any error generated was for that specific - // command. - void CopyRealGLErrorsToWrapper(); - - // Clear all real GL errors. This is to prevent the client from seeing any - // errors caused by GL calls that it was not responsible for issuing. - void ClearRealGLErrors(); - + virtual void SetGLError(unsigned error, + const char* function_name, + const char* msg) OVERRIDE; + virtual void SetGLErrorInvalidEnum(const char* function_name, + unsigned value, + const char* label) OVERRIDE; // Generates a GL error for a bad parameter. - void SetGLErrorInvalidParam( - GLenum error, + virtual void SetGLErrorInvalidParam( + unsigned error, const char* function_name, - GLenum pname, - GLint param); + unsigned pname, + int param) OVERRIDE; + + virtual unsigned PeekGLError() OVERRIDE; + virtual void CopyRealGLErrorsToWrapper() OVERRIDE; + virtual void ClearRealGLErrors() OVERRIDE; // Checks if the current program and vertex attributes are valid for drawing. bool IsDrawValid( @@ -5514,7 +5504,7 @@ uint32 GLES2DecoderImpl::GetGLError() { return error; } -GLenum GLES2DecoderImpl::PeekGLError() { +unsigned GLES2DecoderImpl::PeekGLError() { GLenum error = glGetError(); if (error != GL_NO_ERROR) { SetGLError(error, "", ""); @@ -5523,7 +5513,7 @@ GLenum GLES2DecoderImpl::PeekGLError() { } void GLES2DecoderImpl::SetGLError( - GLenum error, const char* function_name, const char* msg) { + unsigned error, const char* function_name, const char* msg) { if (msg) { last_error_ = msg; LogMessage(GetLogPrefix() + ": " + std::string("GL ERROR :") + @@ -5534,17 +5524,17 @@ void GLES2DecoderImpl::SetGLError( } void GLES2DecoderImpl::SetGLErrorInvalidEnum( - const char* function_name, GLenum value, const char* label) { + const char* function_name, unsigned value, const char* label) { SetGLError(GL_INVALID_ENUM, function_name, (std::string(label) + " was " + GLES2Util::GetStringEnum(value)).c_str()); } void GLES2DecoderImpl::SetGLErrorInvalidParam( - GLenum error, + unsigned error, const char* function_name, - GLenum pname, - GLint param) { + unsigned pname, + int param) { if (error == GL_INVALID_ENUM) { SetGLError( GL_INVALID_ENUM, function_name, diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h index 498a9a9..cce89a4 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder.h @@ -199,6 +199,35 @@ class GPU_EXPORT GLES2Decoder : public base::SupportsWeakPtr<GLES2Decoder>, // Gets the GL error for this context. virtual uint32 GetGLError() = 0; + // Sets a GL error. + virtual void SetGLError( + unsigned error, + const char* function_name, + const char* msg) = 0; + virtual void SetGLErrorInvalidEnum( + const char* function_name, + unsigned value, + const char* label) = 0; + virtual void SetGLErrorInvalidParam( + unsigned error, + const char* function_name, + unsigned pname, + int param) = 0; + + // Copies the real GL errors to the wrapper. This is so we can + // make sure there are no native GL errors before calling some GL function + // so that on return we know any error generated was for that specific + // command. + virtual void CopyRealGLErrorsToWrapper() = 0; + + // Gets the GLError and stores it in our wrapper. Effectively + // this lets us peek at the error without losing it. + virtual unsigned PeekGLError() = 0; + + // Clear all real GL errors. This is to prevent the client from seeing any + // errors caused by GL calls that it was not responsible for issuing. + virtual void ClearRealGLErrors() = 0; + // A callback for messages from the decoder. virtual void SetMsgCallback(const MsgCallback& callback) = 0; diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h index 3a21025..8493616 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h @@ -87,7 +87,20 @@ class MockGLES2Decoder : public GLES2Decoder { int width, int height, bool is_texture_immutable)); - MOCK_METHOD0(GetGLError, uint32()); + MOCK_METHOD0(GetGLError, uint32()); + MOCK_METHOD3(SetGLError, void( + unsigned error, const char* function_name, const char* msg)); + MOCK_METHOD3(SetGLErrorInvalidEnum, void( + const char* function_name, unsigned value, const char* label)); + MOCK_METHOD4(SetGLErrorInvalidParam, void( + unsigned error, + const char* function_name, + unsigned pname, + int param)); + MOCK_METHOD0(PeekGLError, unsigned()); + MOCK_METHOD0(CopyRealGLErrorsToWrapper, void()); + MOCK_METHOD0(ClearRealGLErrors, void()); + MOCK_METHOD1(SetMsgCallback, void(const MsgCallback& callback)); MOCK_METHOD1(SetWaitSyncPointCallback, void(const WaitSyncPointCallback& callback)); |