summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorkbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-13 22:49:17 +0000
committerkbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-13 22:49:17 +0000
commit35d90072e5c73f4091eeb12f26e6c5015e7597c0 (patch)
treecf74f45c43b911d3356b4e7cf387da6916703ddb /gpu
parentde6ea3ae3c0444d4f0a9f65bb57dbacb8846ce5b (diff)
downloadchromium_src-35d90072e5c73f4091eeb12f26e6c5015e7597c0.zip
chromium_src-35d90072e5c73f4091eeb12f26e6c5015e7597c0.tar.gz
chromium_src-35d90072e5c73f4091eeb12f26e6c5015e7597c0.tar.bz2
Revert 92429 - Detect and expose loss of OpenGL context using GL_ARB_robustness. (Regressed static initalizer size on Linux -- will need to reexamine code to understand why.)
This initial patch changes the Linux port to use GLX_ARB_create_context_robustness when available, and tests periodically whether the context has been lost after each draw call and when making the context current. The detection of context loss also works with EGL and ANGLE, although it always reports an unknown reset status. WebKit changes will follow which test the reset status and determine what to do in response; for example, the policy might be to never restore a WebGL context which was lost (due to a GPU reset) and which was determined to be the guilty context. Tested manually with WebGL stress tests and verified on Linux and Windows that in at least some situations it is possible to detect guilty contexts and shut down the associated WebGL application. Some precision of this detection was recently lost and will need to be fixed in following CLs. Also updated and ran GPU unit tests. BUG=88106 TEST=none (tested manually; try servers) Review URL: http://codereview.chromium.org/7331020 TBR=kbr@chromium.org Review URL: http://codereview.chromium.org/7346032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/GLES2/gl2ext.h20
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py5
-rw-r--r--gpu/command_buffer/client/gles2_implementation.h1
-rw-r--r--gpu/command_buffer/client/gles2_implementation_autogen.h2
-rw-r--r--gpu/command_buffer/client/gles2_implementation_unittest.cc5
-rw-r--r--gpu/command_buffer/common/cmd_buffer_common.cc13
-rw-r--r--gpu/command_buffer/common/command_buffer.h16
-rw-r--r--gpu/command_buffer/common/command_buffer_mock.h2
-rw-r--r--gpu/command_buffer/common/constants.h12
-rw-r--r--gpu/command_buffer/common/gl_mock.h2
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h3
-rw-r--r--gpu/command_buffer/service/command_buffer_service.cc6
-rw-r--r--gpu/command_buffer/service/command_buffer_service.h2
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc152
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.h3
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_autogen.h17
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_mock.h1
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h1
-rw-r--r--gpu/command_buffer/service/gpu_scheduler.cc2
-rw-r--r--gpu/command_buffer/service/gpu_scheduler_unittest.cc2
20 files changed, 63 insertions, 204 deletions
diff --git a/gpu/GLES2/gl2ext.h b/gpu/GLES2/gl2ext.h
index 1afb408..7ad5ef1 100644
--- a/gpu/GLES2/gl2ext.h
+++ b/gpu/GLES2/gl2ext.h
@@ -1010,26 +1010,6 @@ typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOCHROMIUM) ();
#endif
#endif
-/* GL_ARB_robustness */
-/* This extension is subsetted for the moment, incorporating only the
- * enums necessary to describe the reasons that we might encounter for
- * losing the context. The entry point querying the reset status is
- * not yet incorporated; to do so, a spec will be needed of a GLES2
- * subset of GL_ARB_robustness.
- */
-#ifndef GL_ARB_robustness
-#define GL_ARB_robustness 1
-#ifndef GL_GUILTY_CONTEXT_RESET_ARB
-#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253
-#endif
-#ifndef GL_INNOCENT_CONTEXT_RESET_ARB
-#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254
-#endif
-#ifndef GL_UNKNOWN_CONTEXT_RESET_ARB
-#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255
-#endif
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 3b89e87..2b5876d 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -1220,8 +1220,9 @@ _FUNCTION_INFO = {
'impl_decl': False,
},
'DrawArrays': {
- 'type': 'Manual',
- 'cmd_args': 'GLenum mode, GLint first, GLsizei count',
+ 'decoder_func': 'DoDrawArrays',
+ 'unit_test': False,
+ 'impl_decl': False,
},
'DrawElements': {
'type': 'Manual',
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h
index 138fc43..ef7f07d 100644
--- a/gpu/command_buffer/client/gles2_implementation.h
+++ b/gpu/command_buffer/client/gles2_implementation.h
@@ -173,6 +173,7 @@ class GLES2Implementation {
void BindBuffer(GLenum target, GLuint buffer);
void DeleteBuffers(GLsizei n, const GLuint* buffers);
void DisableVertexAttribArray(GLuint index);
+ void DrawArrays(GLenum mode, GLint first, GLsizei count);
void EnableVertexAttribArray(GLuint index);
void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h
index 0808ecd..902bbdf 100644
--- a/gpu/command_buffer/client/gles2_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_autogen.h
@@ -297,8 +297,6 @@ void Disable(GLenum cap) {
helper_->Disable(cap);
}
-void DrawArrays(GLenum mode, GLint first, GLsizei count);
-
void DrawElements(
GLenum mode, GLsizei count, GLenum type, const void* indices);
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index 76ad25d..2d69fce 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -95,11 +95,6 @@ class GLES2MockCommandBufferHelper : public CommandBuffer {
state_.error = error;
}
- virtual void SetContextLostReason(error::ContextLostReason reason) {
- GPU_NOTREACHED();
- state_.context_lost_reason = reason;
- }
-
virtual void OnFlush(void* transfer_buffer) = 0;
private:
diff --git a/gpu/command_buffer/common/cmd_buffer_common.cc b/gpu/command_buffer/common/cmd_buffer_common.cc
index 3252bb5..abfdc93 100644
--- a/gpu/command_buffer/common/cmd_buffer_common.cc
+++ b/gpu/command_buffer/common/cmd_buffer_common.cc
@@ -6,8 +6,6 @@
// command buffer commands.
#include "../common/cmd_buffer_common.h"
-#include "../common/command_buffer.h"
-#include "../common/logging.h"
namespace gpu {
#if !defined(_WIN32)
@@ -30,17 +28,6 @@ const char* GetCommandName(CommandId command_id) {
}
} // namespace cmd
-
-// TODO(kbr): this method body is here instead of command_buffer.cc
-// because NaCl currently compiles in this file but not the other.
-// Remove this method body and the includes of command_buffer.h and
-// logging.h above once NaCl defines SetContextLostReason() in its
-// CommandBuffer subclass and has been rolled forward. See
-// http://crbug.com/89127 .
-void CommandBuffer::SetContextLostReason(error::ContextLostReason) {
- GPU_NOTREACHED();
-}
-
} // namespace gpu
diff --git a/gpu/command_buffer/common/command_buffer.h b/gpu/command_buffer/common/command_buffer.h
index 713d69e..d5fb24d 100644
--- a/gpu/command_buffer/common/command_buffer.h
+++ b/gpu/command_buffer/common/command_buffer.h
@@ -7,7 +7,6 @@
#include "../common/buffer.h"
#include "../common/constants.h"
-#include "../common/logging.h"
namespace base {
class SharedMemory;
@@ -29,7 +28,6 @@ class CommandBuffer {
put_offset(0),
token(-1),
error(error::kNoError),
- context_lost_reason(error::kUnknown),
generation(0) {
}
@@ -52,9 +50,6 @@ class CommandBuffer {
// Error status.
error::Error error;
- // Lost context detail information.
- error::ContextLostReason context_lost_reason;
-
// Generation index of this state. The generation index is incremented every
// time a new state is retrieved from the command processor, so that
// consistency can be kept even if IPC messages are processed out-of-order.
@@ -124,17 +119,6 @@ class CommandBuffer {
// Allows the reader to set the current parse error.
virtual void SetParseError(error::Error) = 0;
- // Allows the reader to set the current context lost reason.
- // NOTE: if calling this in conjunction with SetParseError,
- // call this first.
- //
- // TODO(kbr): this temporarily has a definition (i.e., is not pure
- // virtual) to work around a difficult interdependency with the NaCl
- // build. Make this pure virtual and remove the body once this is
- // defined in CommandBufferNaCl and NaCl has rolled forward. See
- // http://crbug.com/89127 .
- virtual void SetContextLostReason(error::ContextLostReason);
-
private:
DISALLOW_COPY_AND_ASSIGN(CommandBuffer);
};
diff --git a/gpu/command_buffer/common/command_buffer_mock.h b/gpu/command_buffer/common/command_buffer_mock.h
index 3243d17..4da8e82 100644
--- a/gpu/command_buffer/common/command_buffer_mock.h
+++ b/gpu/command_buffer/common/command_buffer_mock.h
@@ -36,8 +36,6 @@ class MockCommandBuffer : public CommandBuffer {
int32 id_request));
MOCK_METHOD1(SetToken, void(int32 token));
MOCK_METHOD1(SetParseError, void(error::Error error));
- MOCK_METHOD1(SetContextLostReason,
- void(error::ContextLostReason context_lost_reason));
private:
DISALLOW_COPY_AND_ASSIGN(MockCommandBuffer);
diff --git a/gpu/command_buffer/common/constants.h b/gpu/command_buffer/common/constants.h
index c204e87..873dfa0 100644
--- a/gpu/command_buffer/common/constants.h
+++ b/gpu/command_buffer/common/constants.h
@@ -44,18 +44,6 @@ namespace error {
return true;
}
}
-
- // Provides finer grained information about why the context was lost.
- enum ContextLostReason {
- // This context definitely provoked the loss of context.
- kGuilty,
-
- // This context definitely did not provoke the loss of context.
- kInnocent,
-
- // It is unknown whether this context provoked the loss of context.
- kUnknown
- };
}
// Invalid shared memory Id, returned by RegisterSharedMemory in case of
diff --git a/gpu/command_buffer/common/gl_mock.h b/gpu/command_buffer/common/gl_mock.h
index ed39af4..43e877b 100644
--- a/gpu/command_buffer/common/gl_mock.h
+++ b/gpu/command_buffer/common/gl_mock.h
@@ -431,8 +431,6 @@ class MockGLInterface : public GLInterface {
MOCK_METHOD3(GetFenceivNV, void(GLuint fence, GLenum pname, GLint *params));
MOCK_METHOD1(SetSurfaceCHROMIUM, void(GLuint));
-
- MOCK_METHOD0(GetGraphicsResetStatusARB, GLenum());
};
} // namespace gfx
diff --git a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
index 1988472..37bf93e 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
@@ -341,7 +341,6 @@ static GLES2Util::EnumToString enum_to_string_table[] = {
{ 0x2600, "GL_NEAREST", },
{ 0x84C4, "GL_TEXTURE4", },
{ 0x85B5, "GL_VERTEX_ARRAY_BINDING_OES", },
- { 0x8253, "GL_GUILTY_CONTEXT_RESET_ARB", },
{ 0x00200000, "GL_STENCIL_BUFFER_BIT5_QCOM", },
{ 0x8D61, "GL_HALF_FLOAT_OES", },
{ 0x8D62, "GL_RGB565", },
@@ -419,8 +418,6 @@ static GLES2Util::EnumToString enum_to_string_table[] = {
{ 0x8625, "GL_VERTEX_ATTRIB_ARRAY_TYPE", },
{ 0x8622, "GL_VERTEX_ATTRIB_ARRAY_ENABLED", },
{ 0x8623, "GL_VERTEX_ATTRIB_ARRAY_SIZE", },
- { 0x8255, "GL_UNKNOWN_CONTEXT_RESET_ARB", },
- { 0x8254, "GL_INNOCENT_CONTEXT_RESET_ARB", },
{ 0x1100, "GL_DONT_CARE", },
{ 0x1101, "GL_FASTEST", },
{ 0x1102, "GL_NICEST", },
diff --git a/gpu/command_buffer/service/command_buffer_service.cc b/gpu/command_buffer/service/command_buffer_service.cc
index 064341d..b042a23 100644
--- a/gpu/command_buffer/service/command_buffer_service.cc
+++ b/gpu/command_buffer/service/command_buffer_service.cc
@@ -98,7 +98,6 @@ CommandBufferService::State CommandBufferService::GetState() {
state.put_offset = put_offset_;
state.token = token_;
state.error = error_;
- state.context_lost_reason = context_lost_reason_;
state.generation = ++generation_;
return state;
@@ -255,11 +254,6 @@ void CommandBufferService::SetParseError(error::Error error) {
}
}
-void CommandBufferService::SetContextLostReason(
- error::ContextLostReason reason) {
- context_lost_reason_ = reason;
-}
-
void CommandBufferService::SetPutOffsetChangeCallback(
Callback1<bool>::Type* callback) {
put_offset_change_callback_.reset(callback);
diff --git a/gpu/command_buffer/service/command_buffer_service.h b/gpu/command_buffer/service/command_buffer_service.h
index 9c52531..cffef5f 100644
--- a/gpu/command_buffer/service/command_buffer_service.h
+++ b/gpu/command_buffer/service/command_buffer_service.h
@@ -40,7 +40,6 @@ class CommandBufferService : public CommandBuffer {
virtual Buffer GetTransferBuffer(int32 handle);
virtual void SetToken(int32 token);
virtual void SetParseError(error::Error error);
- virtual void SetContextLostReason(error::ContextLostReason);
// Sets a callback that is called whenever the put offset is changed. When
// called with sync==true, the callback must not return until some progress
@@ -65,7 +64,6 @@ class CommandBufferService : public CommandBuffer {
int32 token_;
uint32 generation_;
error::Error error_;
- error::ContextLostReason context_lost_reason_;
};
} // namespace gpu
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 9295279..618829fb 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -496,8 +496,6 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
bool BoundFramebufferHasDepthAttachment();
bool BoundFramebufferHasStencilAttachment();
- virtual error::ContextLostReason GetContextLostReason();
-
private:
friend class ScopedGLErrorSuppressor;
friend class ScopedResolvedFrameBufferBinder;
@@ -890,6 +888,9 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
// Wrapper for glDetachShader
void DoDetachShader(GLuint client_program_id, GLint client_shader_id);
+ // Wrapper for glDrawArrays.
+ void DoDrawArrays(GLenum mode, GLint first, GLsizei count);
+
// Wrapper for glDisable
void DoDisable(GLenum cap);
@@ -1133,9 +1134,6 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
error::Error* error, GLuint* service_id, void** result,
GLenum* result_type);
- // Returns true if the context was just lost due to e.g. GL_ARB_robustness.
- bool WasContextLost();
-
// Generate a member function prototype for each command in an automated and
// typesafe way.
#define GLES2_CMD_OP(name) \
@@ -1303,9 +1301,6 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
int frame_number_;
- bool has_arb_robustness_;
- GLenum reset_status_;
-
DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl);
};
@@ -1642,9 +1637,7 @@ GLES2DecoderImpl::GLES2DecoderImpl(SurfaceManager* surface_manager,
validators_(group_->feature_info()->validators()),
feature_info_(group_->feature_info()),
tex_image_2d_failed_(false),
- frame_number_(0),
- has_arb_robustness_(false),
- reset_status_(GL_NO_ERROR) {
+ frame_number_(0) {
attrib_0_value_.v[0] = 0.0f;
attrib_0_value_.v[1] = 0.0f;
attrib_0_value_.v[2] = 0.0f;
@@ -1892,8 +1885,6 @@ bool GLES2DecoderImpl::Initialize(
glEnable(GL_POINT_SPRITE);
}
- has_arb_robustness_ = context->HasExtension("GL_ARB_robustness");
-
if (!InitializeShaderTranslator()) {
return false;
}
@@ -2073,13 +2064,7 @@ void GLES2DecoderImpl::DeleteTexturesHelper(
// } // anonymous namespace
bool GLES2DecoderImpl::MakeCurrent() {
- bool result = context_.get() ? context_->MakeCurrent(surface_.get()) : false;
- if (result && WasContextLost()) {
- LOG(ERROR) << " GLES2DecoderImpl: Context lost during MakeCurrent.";
- result = false;
- }
-
- return result;
+ return context_.get() ? context_->MakeCurrent(surface_.get()) : false;
}
void GLES2DecoderImpl::RestoreCurrentRenderbufferBindings() {
@@ -3376,6 +3361,43 @@ void GLES2DecoderImpl::DoClear(GLbitfield mask) {
}
}
+void GLES2DecoderImpl::DoDrawArrays(
+ GLenum mode, GLint first, GLsizei count) {
+ if (!CheckFramebufferComplete("glDrawArrays")) {
+ return;
+ }
+ // We have to check this here because the prototype for glDrawArrays
+ // is GLint not GLsizei.
+ if (first < 0) {
+ SetGLError(GL_INVALID_VALUE, "glDrawArrays: first < 0");
+ return;
+ }
+
+ if (count == 0) {
+ return;
+ }
+
+ GLuint max_vertex_accessed = first + count - 1;
+ if (IsDrawValid(max_vertex_accessed)) {
+ bool simulated_attrib_0 = SimulateAttrib0(max_vertex_accessed);
+ bool simulated_fixed_attribs = false;
+ if (SimulateFixedAttribs(max_vertex_accessed, &simulated_fixed_attribs)) {
+ bool textures_set = SetBlackTextureForNonRenderableTextures();
+ ApplyDirtyState();
+ glDrawArrays(mode, first, count);
+ if (textures_set) {
+ RestoreStateForNonRenderableTextures();
+ }
+ if (simulated_fixed_attribs) {
+ RestoreStateForSimulatedFixedAttribs();
+ }
+ }
+ if (simulated_attrib_0) {
+ RestoreStateForSimulatedAttrib0();
+ }
+ }
+}
+
void GLES2DecoderImpl::DoFramebufferRenderbuffer(
GLenum target, GLenum attachment, GLenum renderbuffertarget,
GLuint client_renderbuffer_id) {
@@ -4349,59 +4371,6 @@ void GLES2DecoderImpl::RestoreStateForSimulatedFixedAttribs() {
bound_array_buffer_ ? bound_array_buffer_->service_id() : 0);
}
-error::Error GLES2DecoderImpl::HandleDrawArrays(
- uint32 immediate_data_size, const gles2::DrawArrays& c) {
- GLenum mode = static_cast<GLenum>(c.mode);
- GLint first = static_cast<GLint>(c.first);
- GLsizei count = static_cast<GLsizei>(c.count);
- if (!validators_->draw_mode.IsValid(mode)) {
- SetGLError(GL_INVALID_ENUM, "glDrawArrays: mode GL_INVALID_ENUM");
- return error::kNoError;
- }
- if (count < 0) {
- SetGLError(GL_INVALID_VALUE, "glDrawArrays: count < 0");
- return error::kNoError;
- }
- if (!CheckFramebufferComplete("glDrawArrays")) {
- return error::kNoError;
- }
- // We have to check this here because the prototype for glDrawArrays
- // is GLint not GLsizei.
- if (first < 0) {
- SetGLError(GL_INVALID_VALUE, "glDrawArrays: first < 0");
- return error::kNoError;
- }
-
- if (count == 0) {
- return error::kNoError;
- }
-
- GLuint max_vertex_accessed = first + count - 1;
- if (IsDrawValid(max_vertex_accessed)) {
- bool simulated_attrib_0 = SimulateAttrib0(max_vertex_accessed);
- bool simulated_fixed_attribs = false;
- if (SimulateFixedAttribs(max_vertex_accessed, &simulated_fixed_attribs)) {
- bool textures_set = SetBlackTextureForNonRenderableTextures();
- ApplyDirtyState();
- glDrawArrays(mode, first, count);
- if (textures_set) {
- RestoreStateForNonRenderableTextures();
- }
- if (simulated_fixed_attribs) {
- RestoreStateForSimulatedFixedAttribs();
- }
- }
- if (simulated_attrib_0) {
- RestoreStateForSimulatedAttrib0();
- }
- if (WasContextLost()) {
- LOG(ERROR) << " GLES2DecoderImpl: Context lost during DrawArrays.";
- return error::kLostContext;
- }
- }
- return error::kNoError;
-}
-
error::Error GLES2DecoderImpl::HandleDrawElements(
uint32 immediate_data_size, const gles2::DrawElements& c) {
if (!bound_element_array_buffer_ ||
@@ -4466,10 +4435,6 @@ error::Error GLES2DecoderImpl::HandleDrawElements(
if (simulated_attrib_0) {
RestoreStateForSimulatedAttrib0();
}
- if (WasContextLost()) {
- LOG(ERROR) << " GLES2DecoderImpl: Context lost during DrawElements.";
- return error::kLostContext;
- }
}
return error::kNoError;
}
@@ -6765,39 +6730,6 @@ error::Error GLES2DecoderImpl::HandleGetProgramInfoCHROMIUM(
return error::kNoError;
}
-error::ContextLostReason GLES2DecoderImpl::GetContextLostReason() {
- switch (reset_status_) {
- case GL_NO_ERROR:
- // TODO(kbr): improve the precision of the error code in this case.
- // Consider delegating to context for error code if MakeCurrent fails.
- return error::kUnknown;
- case GL_GUILTY_CONTEXT_RESET_ARB:
- return error::kGuilty;
- case GL_INNOCENT_CONTEXT_RESET_ARB:
- return error::kInnocent;
- case GL_UNKNOWN_CONTEXT_RESET_ARB:
- return error::kUnknown;
- }
-
- NOTREACHED();
- return error::kUnknown;
-}
-
-bool GLES2DecoderImpl::WasContextLost() {
- if (context_->WasAllocatedUsingARBRobustness() && has_arb_robustness_) {
- GLenum status = glGetGraphicsResetStatusARB();
- if (status != GL_NO_ERROR) {
- // The graphics card was reset. Signal a lost context to the application.
- reset_status_ = status;
- LOG(ERROR) << (surface_->IsOffscreen() ? "Offscreen" : "Onscreen")
- << " context lost via ARB_robustness. Reset status = 0x"
- << std::hex << status << std::dec;
- return true;
- }
- }
- return false;
-}
-
// Include the auto-generated part of this file. We split this because it means
// we can easily edit the non-auto generated parts right here in this file
// instead of having to edit some template or the code generator.
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h
index abd2b85..0551e5a 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.h
@@ -120,9 +120,6 @@ class GLES2Decoder : public CommonDecoder {
virtual bool GetServiceTextureId(uint32 client_texture_id,
uint32* service_texture_id);
- // Provides detail about a lost context if one occurred.
- virtual error::ContextLostReason GetContextLostReason() = 0;
-
protected:
GLES2Decoder();
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
index 44cba0b..89cf621 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
@@ -630,6 +630,23 @@ error::Error GLES2DecoderImpl::HandleDisableVertexAttribArray(
return error::kNoError;
}
+error::Error GLES2DecoderImpl::HandleDrawArrays(
+ uint32 immediate_data_size, const gles2::DrawArrays& c) {
+ GLenum mode = static_cast<GLenum>(c.mode);
+ GLint first = static_cast<GLint>(c.first);
+ GLsizei count = static_cast<GLsizei>(c.count);
+ if (!validators_->draw_mode.IsValid(mode)) {
+ SetGLError(GL_INVALID_ENUM, "glDrawArrays: mode GL_INVALID_ENUM");
+ return error::kNoError;
+ }
+ if (count < 0) {
+ SetGLError(GL_INVALID_VALUE, "glDrawArrays: count < 0");
+ return error::kNoError;
+ }
+ DoDrawArrays(mode, first, count);
+ return error::kNoError;
+}
+
error::Error GLES2DecoderImpl::HandleEnable(
uint32 immediate_data_size, const gles2::Enable& c) {
GLenum cap = static_cast<GLenum>(c.cap);
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
index 2f1275c..0a44ecf 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
@@ -54,7 +54,6 @@ class MockGLES2Decoder : public GLES2Decoder {
const void* cmd_data));
MOCK_METHOD2(GetServiceTextureId, bool(uint32 client_texture_id,
uint32* service_texture_id));
- MOCK_METHOD0(GetContextLostReason, error::ContextLostReason());
MOCK_CONST_METHOD1(GetCommandName, const char*(unsigned int command_id));
DISALLOW_COPY_AND_ASSIGN(MockGLES2Decoder);
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h
index 209f259..fe90c47 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h
@@ -704,7 +704,6 @@ TEST_F(GLES2DecoderTest1, DisableVertexAttribArrayValidArgs) {
EXPECT_EQ(GL_NO_ERROR, GetGLError());
}
// TODO(gman): DrawArrays
-
// TODO(gman): DrawElements
diff --git a/gpu/command_buffer/service/gpu_scheduler.cc b/gpu/command_buffer/service/gpu_scheduler.cc
index 9365118..0a7d1dd 100644
--- a/gpu/command_buffer/service/gpu_scheduler.cc
+++ b/gpu/command_buffer/service/gpu_scheduler.cc
@@ -170,7 +170,6 @@ void GpuScheduler::ProcessCommands() {
if (decoder_.get()) {
if (!decoder_->MakeCurrent()) {
LOG(ERROR) << "Context lost because MakeCurrent failed.";
- command_buffer_->SetContextLostReason(decoder_->GetContextLostReason());
command_buffer_->SetParseError(error::kLostContext);
return;
}
@@ -214,7 +213,6 @@ void GpuScheduler::ProcessCommands() {
is_break = true;
break;
} else if (error::IsError(error)) {
- command_buffer_->SetContextLostReason(decoder_->GetContextLostReason());
command_buffer_->SetParseError(error);
return;
}
diff --git a/gpu/command_buffer/service/gpu_scheduler_unittest.cc b/gpu/command_buffer/service/gpu_scheduler_unittest.cc
index 3d21f90..8cdb361 100644
--- a/gpu/command_buffer/service/gpu_scheduler_unittest.cc
+++ b/gpu/command_buffer/service/gpu_scheduler_unittest.cc
@@ -217,8 +217,6 @@ TEST_F(GpuSchedulerTest, SetsErrorCodeOnCommandBuffer) {
error::kUnknownCommand));
EXPECT_CALL(*command_buffer_, SetGetOffset(1));
- EXPECT_CALL(*decoder_, GetContextLostReason())
- .WillOnce(Return(error::kUnknown));
EXPECT_CALL(*command_buffer_,
SetParseError(error::kUnknownCommand));