#include "gpu/command_buffer/service/gles2_query_manager.h"
#include <stddef.h>
#include <stdint.h>
#include "base/atomicops.h"
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/notreached.h"
#include "base/time/time.h"
#include "gpu/command_buffer/service/error_state.h"
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_fence.h"
#include "ui/gl/gpu_timing.h"
namespace gpu {
namespace gles2 {
namespace {
class AbstractIntegerQuery : public QueryManager::Query { … };
AbstractIntegerQuery::AbstractIntegerQuery(QueryManager* manager,
GLenum target,
scoped_refptr<gpu::Buffer> buffer,
QuerySync* sync)
: … { … }
void AbstractIntegerQuery::Begin() { … }
void AbstractIntegerQuery::End(base::subtle::Atomic32 submit_count) { … }
void AbstractIntegerQuery::QueryCounter(base::subtle::Atomic32 submit_count) { … }
void AbstractIntegerQuery::Pause() { … }
void AbstractIntegerQuery::Resume() { … }
void AbstractIntegerQuery::Destroy(bool have_context) { … }
AbstractIntegerQuery::~AbstractIntegerQuery() = default;
bool AbstractIntegerQuery::AreAllResultsAvailable() { … }
class BooleanQuery : public AbstractIntegerQuery { … };
BooleanQuery::BooleanQuery(QueryManager* manager,
GLenum target,
scoped_refptr<gpu::Buffer> buffer,
QuerySync* sync)
: … { … }
BooleanQuery::~BooleanQuery() = default;
void BooleanQuery::Process(bool did_finish) { … }
class SummedIntegerQuery : public AbstractIntegerQuery { … };
SummedIntegerQuery::SummedIntegerQuery(QueryManager* manager,
GLenum target,
scoped_refptr<gpu::Buffer> buffer,
QuerySync* sync)
: … { … }
SummedIntegerQuery::~SummedIntegerQuery() = default;
void SummedIntegerQuery::Process(bool did_finish) { … }
class AsyncReadPixelsCompletedQuery final
: public GLES2QueryManager::GLES2Query { … };
AsyncReadPixelsCompletedQuery::AsyncReadPixelsCompletedQuery(
GLES2QueryManager* manager,
GLenum target,
scoped_refptr<gpu::Buffer> buffer,
QuerySync* sync)
: … { … }
void AsyncReadPixelsCompletedQuery::Begin() { … }
void AsyncReadPixelsCompletedQuery::Pause() { … }
void AsyncReadPixelsCompletedQuery::Resume() { … }
void AsyncReadPixelsCompletedQuery::End(base::subtle::Atomic32 submit_count) { … }
void AsyncReadPixelsCompletedQuery::QueryCounter(
base::subtle::Atomic32 submit_count) { … }
void AsyncReadPixelsCompletedQuery::Complete() { … }
void AsyncReadPixelsCompletedQuery::Process(bool did_finish) { … }
void AsyncReadPixelsCompletedQuery::Destroy(bool ) { … }
AsyncReadPixelsCompletedQuery::~AsyncReadPixelsCompletedQuery() = default;
class GetErrorQuery : public GLES2QueryManager::GLES2Query { … };
GetErrorQuery::GetErrorQuery(GLES2QueryManager* manager,
GLenum target,
scoped_refptr<gpu::Buffer> buffer,
QuerySync* sync)
: … { … }
void GetErrorQuery::Begin() { … }
void GetErrorQuery::Pause() { … }
void GetErrorQuery::Resume() { … }
void GetErrorQuery::End(base::subtle::Atomic32 submit_count) { … }
void GetErrorQuery::QueryCounter(base::subtle::Atomic32 submit_count) { … }
void GetErrorQuery::Process(bool did_finish) { … }
void GetErrorQuery::Destroy(bool ) { … }
GetErrorQuery::~GetErrorQuery() = default;
class TimeElapsedQuery : public GLES2QueryManager::GLES2Query { … };
TimeElapsedQuery::TimeElapsedQuery(GLES2QueryManager* manager,
GLenum target,
scoped_refptr<gpu::Buffer> buffer,
QuerySync* sync)
: … { … }
void TimeElapsedQuery::Begin() { … }
void TimeElapsedQuery::End(base::subtle::Atomic32 submit_count) { … }
void TimeElapsedQuery::QueryCounter(base::subtle::Atomic32 submit_count) { … }
void TimeElapsedQuery::Pause() { … }
void TimeElapsedQuery::Resume() { … }
void TimeElapsedQuery::Process(bool did_finish) { … }
void TimeElapsedQuery::Destroy(bool have_context) { … }
TimeElapsedQuery::~TimeElapsedQuery() = default;
class TimeStampQuery : public GLES2QueryManager::GLES2Query { … };
TimeStampQuery::TimeStampQuery(GLES2QueryManager* manager,
GLenum target,
scoped_refptr<gpu::Buffer> buffer,
QuerySync* sync)
: … { … }
void TimeStampQuery::Begin() { … }
void TimeStampQuery::End(base::subtle::Atomic32 submit_count) { … }
void TimeStampQuery::Pause() { … }
void TimeStampQuery::Resume() { … }
void TimeStampQuery::QueryCounter(base::subtle::Atomic32 submit_count) { … }
void TimeStampQuery::Process(bool did_finish) { … }
void TimeStampQuery::Destroy(bool have_context) { … }
TimeStampQuery::~TimeStampQuery() = default;
}
GLES2QueryManager::GLES2Query::GLES2Query(GLES2QueryManager* manager,
GLenum target,
scoped_refptr<gpu::Buffer> buffer,
QuerySync* sync)
: … { … }
GLES2QueryManager::GLES2Query::~GLES2Query() = default;
GLES2QueryManager::GLES2QueryManager(GLES2Decoder* decoder,
FeatureInfo* feature_info)
: … { … }
GLES2QueryManager::~GLES2QueryManager() = default;
QueryManager::Query* GLES2QueryManager::CreateQuery(
GLenum target,
GLuint client_id,
scoped_refptr<gpu::Buffer> buffer,
QuerySync* sync) { … }
void GLES2QueryManager::ProcessFrameBeginUpdates() { … }
error::Error GLES2QueryManager::SetDisjointSync(int32_t shm_id,
uint32_t shm_offset) { … }
std::unique_ptr<gl::GPUTimer> GLES2QueryManager::CreateGPUTimer(
bool elapsed_time) { … }
bool GLES2QueryManager::GPUTimingAvailable() { … }
void GLES2QueryManager::UpdateDisjointValue() { … }
void GLES2QueryManager::SafelyResetDisjointValue() { … }
}
}