Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(751)

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 226423002: Merge 261120 "gpu: Lose context when BeginQueryEXT fails to allo..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1916/src/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/client/gles2_implementation.cc
===================================================================
--- gpu/command_buffer/client/gles2_implementation.cc (revision 261814)
+++ gpu/command_buffer/client/gles2_implementation.cc (working copy)
@@ -82,11 +82,12 @@
}
GLES2Implementation::GLES2Implementation(
- GLES2CmdHelper* helper,
- ShareGroup* share_group,
- TransferBufferInterface* transfer_buffer,
- bool bind_generates_resource,
- GpuControl* gpu_control)
+ GLES2CmdHelper* helper,
+ ShareGroup* share_group,
+ TransferBufferInterface* transfer_buffer,
+ bool bind_generates_resource,
+ bool lose_context_when_out_of_memory,
+ GpuControl* gpu_control)
: helper_(helper),
transfer_buffer_(transfer_buffer),
angle_pack_reverse_row_order_status_(kUnknownExtensionStatus),
@@ -108,6 +109,7 @@
bound_pixel_unpack_transfer_buffer_id_(0),
error_bits_(0),
debug_(false),
+ lose_context_when_out_of_memory_(lose_context_when_out_of_memory),
use_count_(0),
error_message_callback_(NULL),
gpu_control_(gpu_control),
@@ -483,6 +485,11 @@
error_message_callback_->OnErrorMessage(temp.c_str(), 0);
}
error_bits_ |= GLES2Util::GLErrorToErrorBit(error);
+
+ if (error == GL_OUT_OF_MEMORY && lose_context_when_out_of_memory_) {
+ helper_->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
+ GL_UNKNOWN_CONTEXT_RESET_ARB);
+ }
}
void GLES2Implementation::SetGLErrorInvalidEnum(
@@ -870,16 +877,6 @@
helper_->CommandBufferHelper::Finish();
}
-bool GLES2Implementation::MustBeContextLost() {
- bool context_lost = helper_->IsContextLost();
- if (!context_lost) {
- WaitForCmd();
- context_lost = helper_->IsContextLost();
- }
- CHECK(context_lost);
- return context_lost;
-}
-
void GLES2Implementation::FinishHelper() {
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFinish()");
TRACE_EVENT0("gpu", "GLES2::Finish");
@@ -3292,7 +3289,9 @@
if (!query) {
query = query_tracker_->CreateQuery(id, target);
if (!query) {
- MustBeContextLost();
+ SetGLError(GL_OUT_OF_MEMORY,
+ "glBeginQueryEXT",
+ "transfer buffer allocation failed");
return;
}
} else if (query->target() != target) {
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.h ('k') | gpu/command_buffer/client/gles2_implementation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698