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

Unified Diff: bench/nanobench.cpp

Issue 1965273004: Nanobench running on Vulkan (Closed) Base URL: https://chromium.googlesource.com/skia.git@gltotest
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/gpu/TestContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/nanobench.cpp
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 30eab5c3d81c9cbb24a866c2bd301ade12092e24..69f1c4f9885659b8c49b849273c629a62054e238 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -58,7 +58,7 @@
#include "GrContextFactory.h"
#include "gl/GrGLUtil.h"
using sk_gpu_test::GrContextFactory;
- using sk_gpu_test::GLTestContext;
+ using sk_gpu_test::TestContext;
SkAutoTDelete<GrContextFactory> gGrFactory;
#endif
@@ -157,26 +157,25 @@ bool Target::capturePixels(SkBitmap* bmp) {
#if SK_SUPPORT_GPU
struct GPUTarget : public Target {
- explicit GPUTarget(const Config& c) : Target(c), gl(nullptr) { }
- GLTestContext* gl;
+ explicit GPUTarget(const Config& c) : Target(c), context(nullptr) { }
+ TestContext* context;
void setup() override {
- this->gl->makeCurrent();
+ this->context->makeCurrent();
// Make sure we're done with whatever came before.
- GR_GL_CALL(this->gl->gl(), Finish());
+ this->context->finish();
}
void endTiming() override {
- if (this->gl) {
- GR_GL_CALL(this->gl->gl(), Flush());
- this->gl->waitOnSyncOrSwap();
+ if (this->context) {
+ this->context->waitOnSyncOrSwap();
}
}
void fence() override {
- GR_GL_CALL(this->gl->gl(), Finish());
+ this->context->finish();
}
bool needsFrameTiming(int* maxFrameLag) const override {
- if (!this->gl->getMaxGpuFrameLag(maxFrameLag)) {
+ if (!this->context->getMaxGpuFrameLag(maxFrameLag)) {
// Frame lag is unknown.
*maxFrameLag = FLAGS_gpuFrameLag;
}
@@ -190,12 +189,12 @@ struct GPUTarget : public Target {
this->config.ctxOptions),
SkBudgeted::kNo, info,
this->config.samples, &props);
- this->gl = gGrFactory->getContextInfo(this->config.ctxType,
- this->config.ctxOptions).glContext();
+ this->context = gGrFactory->getContextInfo(this->config.ctxType,
+ this->config.ctxOptions).testContext();
if (!this->surface.get()) {
return false;
}
- if (!this->gl->fenceSyncSupport()) {
+ if (!this->context->fenceSyncSupport()) {
SkDebugf("WARNING: GL context for config \"%s\" does not support fence sync. "
"Timings might not be accurate.\n", this->config.name.c_str());
}
@@ -203,17 +202,21 @@ struct GPUTarget : public Target {
}
void fillOptions(ResultsWriter* log) override {
const GrGLubyte* version;
- GR_GL_CALL_RET(this->gl->gl(), version, GetString(GR_GL_VERSION));
- log->configOption("GL_VERSION", (const char*)(version));
+ if (this->context->backend() == kOpenGL_GrBackend) {
+ const GrGLInterface* gl =
+ reinterpret_cast<const GrGLInterface*>(this->context->backendContext());
+ GR_GL_CALL_RET(gl, version, GetString(GR_GL_VERSION));
+ log->configOption("GL_VERSION", (const char*)(version));
- GR_GL_CALL_RET(this->gl->gl(), version, GetString(GR_GL_RENDERER));
- log->configOption("GL_RENDERER", (const char*) version);
+ GR_GL_CALL_RET(gl, version, GetString(GR_GL_RENDERER));
+ log->configOption("GL_RENDERER", (const char*) version);
- GR_GL_CALL_RET(this->gl->gl(), version, GetString(GR_GL_VENDOR));
- log->configOption("GL_VENDOR", (const char*) version);
+ GR_GL_CALL_RET(gl, version, GetString(GR_GL_VENDOR));
+ log->configOption("GL_VENDOR", (const char*) version);
- GR_GL_CALL_RET(this->gl->gl(), version, GetString(GR_GL_SHADING_LANGUAGE_VERSION));
- log->configOption("GL_SHADING_LANGUAGE_VERSION", (const char*) version);
+ GR_GL_CALL_RET(gl, version, GetString(GR_GL_SHADING_LANGUAGE_VERSION));
+ log->configOption("GL_SHADING_LANGUAGE_VERSION", (const char*) version);
+ }
}
};
« no previous file with comments | « no previous file | tools/gpu/TestContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698