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

Unified Diff: gpu/command_buffer/service/gpu_timing.h

Issue 940633004: Added disjoint context class which manages disjoints within gpu timing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplified DisjointContext to simply be an ID instead of an object Created 5 years, 10 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/service/gpu_timing.h
diff --git a/gpu/command_buffer/service/gpu_timing.h b/gpu/command_buffer/service/gpu_timing.h
index 726ac4e5f776a19a466276edd017a4a48cfc0446..8b3d4db471b01de5bc27150564e09d36b65ebb82 100644
--- a/gpu/command_buffer/service/gpu_timing.h
+++ b/gpu/command_buffer/service/gpu_timing.h
@@ -5,6 +5,8 @@
#ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_TIMING_H_
#define GPU_COMMAND_BUFFER_SERVICE_GPU_TIMING_H_
+#include <vector>
+
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "gpu/gpu_export.h"
@@ -51,19 +53,23 @@ class GPU_EXPORT GPUTiming {
kTimerTypeDisjoint // EXT_disjoint_timer_query
};
- GPUTiming();
+ GPUTiming(gfx::GLContext* gl_context = NULL);
virtual ~GPUTiming();
- bool Initialize(gfx::GLContext* context);
+ void Initialize(gfx::GLContext* gl_context);
bool IsAvailable();
+ int CreateDisjointContextID();
+ bool ReleaseDisjointContextID(int disjoint_context_id);
+
// CheckAndResetTimerErrors has to be called before reading timestamps
// from GPUTimers instances and after making sure all the timers
// were available.
// If the returned value is false, all the previous timers should be
// discarded.
- bool CheckAndResetTimerErrors();
-
+ bool CheckAndResetTimerErrors(int disjoint_context_id);
+
+ TimerType GetTimerType() const { return timer_type_; }
const char* GetTimerTypeName() const;
// Returns the offset between the current gpu time and the cpu time.
@@ -71,14 +77,24 @@ class GPU_EXPORT GPUTiming {
void InvalidateTimerOffset();
void SetCpuTimeForTesting(const base::Callback<int64(void)>& cpu_time);
- void SetOffsetForTesting(int64 offset, bool cache_it);
- void SetTimerTypeForTesting(TimerType type);
private:
TimerType timer_type_ = kTimerTypeInvalid;
int64 offset_ = 0; // offset cache when timer_type_ == kTimerTypeARB
bool offset_valid_ = false;
+ bool disjoint_occurred_ = false;
base::Callback<int64(void)> cpu_time_for_testing_;
+
+ struct DisjointContext {
+ DisjointContext(bool initial_value)
+ : valid_(true),
+ disjoint_value_(initial_value) {
+ }
+ bool valid_;
Daniele Castagna 2015/02/23 22:21:19 Do we need this? Can't we just keep valid context
+ bool disjoint_value_;
+ };
+ std::vector<DisjointContext> disjoint_contexts_;
+
friend class GPUTimer;
DISALLOW_COPY_AND_ASSIGN(GPUTiming);
};

Powered by Google App Engine
This is Rietveld 408576698