summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-15 00:40:56 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-15 00:40:56 +0000
commit6d792ee1a144b455574588b884bb0881fc134972 (patch)
treeb2738251ddebf7107a97c8747a749645a4201d7b /gpu
parent8db2df99d2d221930739d684aa7dfd40a272b07a (diff)
downloadchromium_src-6d792ee1a144b455574588b884bb0881fc134972.zip
chromium_src-6d792ee1a144b455574588b884bb0881fc134972.tar.gz
chromium_src-6d792ee1a144b455574588b884bb0881fc134972.tar.bz2
Lose context if SwapBuffers fails.
I think this might have worked at some point but now returning kLostContext from HandleSwapBuffers is not enough so call LoseContext if SwapBuffers fails. BUG=240434 Review URL: https://chromiumcodereview.appspot.com/14649023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py2
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc21
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_autogen.h6
3 files changed, 17 insertions, 12 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 8d2a935..f8a355d 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -1883,8 +1883,8 @@ _FUNCTION_INFO = {
'expectation': False,
},
'SwapBuffers': {
- 'type': 'Custom',
'impl_func': False,
+ 'decoder_func': 'DoSwapBuffers',
'unit_test': False,
'client_test': False,
'extension': True,
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 33f10bf..1637a0b 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -751,6 +751,9 @@ class GLES2DecoderImpl : public GLES2Decoder {
GLsizei height,
GLint border);
+ // Wrapper for SwapBuffers.
+ void DoSwapBuffers();
+
// Wrapper for CopyTexSubImage2D.
void DoCopyTexSubImage2D(
GLenum target,
@@ -8698,8 +8701,7 @@ error::Error GLES2DecoderImpl::HandleShaderBinary(
#endif
}
-error::Error GLES2DecoderImpl::HandleSwapBuffers(
- uint32 immediate_data_size, const cmds::SwapBuffers& c) {
+void GLES2DecoderImpl::DoSwapBuffers() {
bool is_offscreen = !!offscreen_target_frame_buffer_.get();
int this_frame_number = frame_number_++;
@@ -8709,7 +8711,7 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
"GLImpl", static_cast<int>(gfx::GetGLImplementation()),
"width", (is_offscreen ? offscreen_size_.width() :
surface_->GetSize().width()));
- TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleSwapBuffers",
+ TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers",
"offscreen", is_offscreen,
"frame", this_frame_number);
// If offscreen then don't actually SwapBuffers to the display. Just copy
@@ -8738,7 +8740,8 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
GL_FRAMEBUFFER_COMPLETE) {
LOG(ERROR) << "GLES2DecoderImpl::ResizeOffscreenFrameBuffer failed "
<< "because offscreen saved FBO was incomplete.";
- return error::kLostContext;
+ LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB);
+ return;
}
// Clear the offscreen color texture.
@@ -8758,14 +8761,13 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
}
if (offscreen_size_.width() == 0 || offscreen_size_.height() == 0)
- return error::kNoError;
+ return;
ScopedGLErrorSuppressor suppressor(
- "GLES2DecoderImpl::HandleSwapBuffers", this);
+ "GLES2DecoderImpl::DoSwapBuffers", this);
if (IsOffscreenBufferMultisampled()) {
// For multisampled buffers, resolve the frame buffer.
ScopedResolvedFrameBufferBinder binder(this, true, false);
- return error::kNoError;
} else {
ScopedFrameBufferBinder binder(this,
offscreen_target_frame_buffer_->id());
@@ -8791,7 +8793,6 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
// single D3D device for all contexts.
if (!IsAngle())
glFlush();
- return error::kNoError;
}
} else {
TRACE_EVENT2("gpu", "Onscreen",
@@ -8799,11 +8800,9 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
"height", surface_->GetSize().height());
if (!surface_->SwapBuffers()) {
LOG(ERROR) << "Context lost because SwapBuffers failed.";
- return error::kLostContext;
+ LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB);
}
}
-
- return error::kNoError;
}
error::Error GLES2DecoderImpl::HandleEnableFeatureCHROMIUM(
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
index 0bc6350..f021ef3 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
@@ -2969,6 +2969,12 @@ error::Error GLES2DecoderImpl::HandleBindVertexArrayOES(
return error::kNoError;
}
+error::Error GLES2DecoderImpl::HandleSwapBuffers(
+ uint32 immediate_data_size, const gles2::cmds::SwapBuffers& c) {
+ DoSwapBuffers();
+ return error::kNoError;
+}
+
error::Error GLES2DecoderImpl::HandleGetMaxValueInBufferCHROMIUM(
uint32 immediate_data_size,
const gles2::cmds::GetMaxValueInBufferCHROMIUM& c) {