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

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

Issue 199443004: gpu: Raise GL_OUT_OF_MEMORY when BeginQueryEXT fails to allocate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: checkmem: 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
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index e0b0cb82f60b36b2a9e5f3f39217aaec0112f9d4..d5f21eaaf1a183405149ace660ef1e16e7e86cea 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -82,11 +82,12 @@ GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() {
}
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 @@ GLES2Implementation::GLES2Implementation(
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 @@ void GLES2Implementation::SetGLError(
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_UNKNOWN_CONTEXT_RESET_ARB,
piman 2014/03/21 21:34:48 nit: we're the guilty one.
danakj 2014/03/21 21:36:02 Should I tell the others they're innocent also? I
danakj 2014/03/21 22:53:50 Done.
+ GL_UNKNOWN_CONTEXT_RESET_ARB);
+ }
}
void GLES2Implementation::SetGLErrorInvalidEnum(
@@ -870,16 +877,6 @@ void GLES2Implementation::ShallowFinishCHROMIUM() {
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");
@@ -3285,7 +3282,9 @@ void GLES2Implementation::BeginQueryEXT(GLenum target, GLuint id) {
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) {

Powered by Google App Engine
This is Rietveld 408576698