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

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 1919203003: Revert of Report lost context from GLES2Implementation based on share group state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A class to emulate GLES2 over command buffers. 5 // A class to emulate GLES2 over command buffers.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 } 320 }
321 321
322 IdAllocator* GLES2Implementation::GetIdAllocator(int namespace_id) const { 322 IdAllocator* GLES2Implementation::GetIdAllocator(int namespace_id) const {
323 if (namespace_id == id_namespaces::kQueries) 323 if (namespace_id == id_namespaces::kQueries)
324 return query_id_allocator_.get(); 324 return query_id_allocator_.get();
325 NOTREACHED(); 325 NOTREACHED();
326 return NULL; 326 return NULL;
327 } 327 }
328 328
329 void GLES2Implementation::OnGpuControlLostContext() { 329 void GLES2Implementation::OnGpuControlLostContext() {
330 #if DCHECK_IS_ON()
330 // This should never occur more than once. 331 // This should never occur more than once.
331 DCHECK(!lost_context_callback_run_); 332 DCHECK(!lost_context_);
332 lost_context_callback_run_ = true; 333 lost_context_ = true;
333 share_group_->Lose(); 334 #endif
334 if (!lost_context_callback_.is_null()) 335 if (!lost_context_callback_.is_null())
335 lost_context_callback_.Run(); 336 lost_context_callback_.Run();
336 } 337 }
337 338
338 void GLES2Implementation::OnGpuControlErrorMessage(const char* message, 339 void GLES2Implementation::OnGpuControlErrorMessage(const char* message,
339 int32_t id) { 340 int32_t id) {
340 if (!error_message_callback_.is_null()) 341 if (!error_message_callback_.is_null())
341 error_message_callback_.Run(message, id); 342 error_message_callback_.Run(message, id);
342 } 343 }
343 344
(...skipping 15 matching lines...) Expand all
359 360
360 void GLES2Implementation::FreeEverything() { 361 void GLES2Implementation::FreeEverything() {
361 WaitForCmd(); 362 WaitForCmd();
362 query_tracker_->Shrink(); 363 query_tracker_->Shrink();
363 FreeUnusedSharedMemory(); 364 FreeUnusedSharedMemory();
364 transfer_buffer_->Free(); 365 transfer_buffer_->Free();
365 helper_->FreeRingBuffer(); 366 helper_->FreeRingBuffer();
366 } 367 }
367 368
368 void GLES2Implementation::RunIfContextNotLost(const base::Closure& callback) { 369 void GLES2Implementation::RunIfContextNotLost(const base::Closure& callback) {
369 if (!lost_context_callback_run_) 370 if (!helper_->IsContextLost())
370 callback.Run(); 371 callback.Run();
371 } 372 }
372 373
373 void GLES2Implementation::SignalSyncToken(const gpu::SyncToken& sync_token, 374 void GLES2Implementation::SignalSyncToken(const gpu::SyncToken& sync_token,
374 const base::Closure& callback) { 375 const base::Closure& callback) {
375 if (sync_token.HasData() && 376 if (sync_token.HasData() &&
376 (sync_token.verified_flush() || 377 (sync_token.verified_flush() ||
377 gpu_control_->CanWaitUnverifiedSyncToken(&sync_token))) { 378 gpu_control_->CanWaitUnverifiedSyncToken(&sync_token))) {
378 379
379 gpu::SyncToken intermediate_sync_token = sync_token; 380 gpu::SyncToken intermediate_sync_token = sync_token;
(...skipping 4249 matching lines...) Expand 10 before | Expand all | Expand 10 after
4629 for (int32_t i = 0; i < result->GetNumResults(); ++i) { 4630 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
4630 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); 4631 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
4631 } 4632 }
4632 }); 4633 });
4633 CheckGLError(); 4634 CheckGLError();
4634 } 4635 }
4635 4636
4636 GLenum GLES2Implementation::GetGraphicsResetStatusKHR() { 4637 GLenum GLES2Implementation::GetGraphicsResetStatusKHR() {
4637 GPU_CLIENT_SINGLE_THREAD_CHECK(); 4638 GPU_CLIENT_SINGLE_THREAD_CHECK();
4638 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetGraphicsResetStatusKHR()"); 4639 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetGraphicsResetStatusKHR()");
4639 // If any context (including ourselves) has seen itself become lost, 4640 // If we can't make command buffers then the context is lost.
4640 // then it will have told the ShareGroup, so just report its status. 4641 if (gpu_control_->IsGpuChannelLost())
4641 if (share_group_->IsLost())
4642 return GL_UNKNOWN_CONTEXT_RESET_KHR; 4642 return GL_UNKNOWN_CONTEXT_RESET_KHR;
4643 // Otherwise, check the command buffer if it is lost.
4644 if (helper_->IsContextLost()) {
4645 // TODO(danakj): We could GetLastState() off the CommandBuffer and return
4646 // the actual reason here if we cared to.
4647 return GL_UNKNOWN_CONTEXT_RESET_KHR;
4648 }
4643 return GL_NO_ERROR; 4649 return GL_NO_ERROR;
4644 } 4650 }
4645 4651
4646 void GLES2Implementation::Swap() { 4652 void GLES2Implementation::Swap() {
4647 SwapBuffers(); 4653 SwapBuffers();
4648 } 4654 }
4649 4655
4650 void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) { 4656 void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) {
4651 PostSubBufferCHROMIUM( 4657 PostSubBufferCHROMIUM(
4652 sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), sub_buffer.height()); 4658 sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), sub_buffer.height());
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
5369 } 5375 }
5370 5376
5371 if (query_tracker_->BeginQuery(id, target, this)) 5377 if (query_tracker_->BeginQuery(id, target, this))
5372 CheckGLError(); 5378 CheckGLError();
5373 } 5379 }
5374 5380
5375 void GLES2Implementation::EndQueryEXT(GLenum target) { 5381 void GLES2Implementation::EndQueryEXT(GLenum target) {
5376 GPU_CLIENT_SINGLE_THREAD_CHECK(); 5382 GPU_CLIENT_SINGLE_THREAD_CHECK();
5377 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] EndQueryEXT(" 5383 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] EndQueryEXT("
5378 << GLES2Util::GetStringQueryTarget(target) << ")"); 5384 << GLES2Util::GetStringQueryTarget(target) << ")");
5385 // Don't do anything if the context is lost.
5386 if (helper_->IsContextLost()) {
5387 return;
5388 }
5389
5379 if (query_tracker_->EndQuery(target, this)) 5390 if (query_tracker_->EndQuery(target, this))
5380 CheckGLError(); 5391 CheckGLError();
5381 } 5392 }
5382 5393
5383 void GLES2Implementation::QueryCounterEXT(GLuint id, GLenum target) { 5394 void GLES2Implementation::QueryCounterEXT(GLuint id, GLenum target) {
5384 GPU_CLIENT_SINGLE_THREAD_CHECK(); 5395 GPU_CLIENT_SINGLE_THREAD_CHECK();
5385 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] QueryCounterEXT(" 5396 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] QueryCounterEXT("
5386 << id 5397 << id
5387 << ", " << GLES2Util::GetStringQueryTarget(target) << ")"); 5398 << ", " << GLES2Util::GetStringQueryTarget(target) << ")");
5388 5399
(...skipping 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after
6810 cached_extensions_.clear(); 6821 cached_extensions_.clear();
6811 } 6822 }
6812 6823
6813 // Include the auto-generated part of this file. We split this because it means 6824 // Include the auto-generated part of this file. We split this because it means
6814 // we can easily edit the non-auto generated parts right here in this file 6825 // we can easily edit the non-auto generated parts right here in this file
6815 // instead of having to edit some template or the code generator. 6826 // instead of having to edit some template or the code generator.
6816 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 6827 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
6817 6828
6818 } // namespace gles2 6829 } // namespace gles2
6819 } // namespace gpu 6830 } // namespace gpu
OLDNEW
« 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