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

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

Issue 1814573002: Move flush id from WebGraphicsContext3DImpl to GLES2Implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lastflush: . Created 4 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 4cda61be1f5994c73c86ffd95b7636c712d4ae9f..9bb62324ec89a1e116803cb62f01832f9b04cf1d 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -76,6 +76,13 @@ GLuint ToGLuint(const void* ptr) {
return static_cast<GLuint>(reinterpret_cast<size_t>(ptr));
}
+uint32_t GenerateNextFlushId() {
piman 2016/03/16 22:53:46 Should we use StaticAtomicSequenceNumber instead?
+ static base::subtle::Atomic32 flush_id = 0;
+ base::subtle::Atomic32 my_id =
+ base::subtle::Barrier_AtomicIncrement(&flush_id, 1);
+ return static_cast<uint32_t>(my_id);
+}
+
} // anonymous namespace
#if !defined(_MSC_VER)
@@ -142,6 +149,7 @@ GLES2Implementation::GLES2Implementation(
lose_context_when_out_of_memory_(lose_context_when_out_of_memory),
support_client_side_arrays_(support_client_side_arrays),
use_count_(0),
+ flush_id_(0),
max_extra_transfer_buffer_size_(
#if defined(OS_NACL)
0),
@@ -1326,6 +1334,7 @@ void GLES2Implementation::DrawElementsImpl(
void GLES2Implementation::Flush() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFlush()");
+ flush_id_ = GenerateNextFlushId();
// Insert the cmd to call glFlush
helper_->Flush();
FlushHelper();
@@ -1334,6 +1343,7 @@ void GLES2Implementation::Flush() {
void GLES2Implementation::ShallowFlushCHROMIUM() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShallowFlushCHROMIUM()");
+ flush_id_ = GenerateNextFlushId();
FlushHelper();
}
@@ -1355,12 +1365,14 @@ void GLES2Implementation::OrderingBarrierCHROMIUM() {
void GLES2Implementation::Finish() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
+ flush_id_ = GenerateNextFlushId();
FinishHelper();
}
void GLES2Implementation::ShallowFinishCHROMIUM() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
TRACE_EVENT0("gpu", "GLES2::ShallowFinishCHROMIUM");
+ flush_id_ = GenerateNextFlushId();
// Flush our command buffer (tell the service to execute up to the flush cmd
// and don't return until it completes).
helper_->CommandBufferHelper::Finish();
@@ -1383,6 +1395,12 @@ void GLES2Implementation::FinishHelper() {
FreeEverything();
}
+GLuint GLES2Implementation::GetLastFlushIdCHROMIUM() {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetLastFlushIdCHROMIUM()");
+ return flush_id_;
+}
+
void GLES2Implementation::SwapBuffers() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSwapBuffers()");
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.h ('k') | gpu/command_buffer/client/gles2_implementation_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698