2017-05-31 13:45:19 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2017 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkRefCnt.h"
|
|
|
|
#include "include/gpu/GrContext.h"
|
|
|
|
#include "include/gpu/gl/GrGLFunctions.h"
|
|
|
|
#include "include/gpu/gl/GrGLInterface.h"
|
|
|
|
#include "tools/gpu/gl/GLTestContext.h"
|
2017-05-31 13:45:19 +00:00
|
|
|
|
|
|
|
#include <EGL/egl.h>
|
2017-06-01 17:24:11 +00:00
|
|
|
#include <GLES2/gl2.h>
|
2017-05-31 13:45:19 +00:00
|
|
|
|
2018-05-22 20:44:53 +00:00
|
|
|
#include <sstream>
|
|
|
|
|
2017-05-31 13:45:19 +00:00
|
|
|
// create_grcontext implementation for EGL.
|
2018-05-29 17:56:27 +00:00
|
|
|
sk_sp<GrContext> create_grcontext(std::ostringstream& driverinfo,
|
|
|
|
std::unique_ptr<sk_gpu_test::GLTestContext>* glContext) {
|
|
|
|
// We are leaking tc, but that's OK because fiddle is a short lived proces.
|
|
|
|
glContext->reset(sk_gpu_test::CreatePlatformGLTestContext(kGLES_GrGLStandard));
|
|
|
|
if (!glContext) {
|
2017-05-31 13:45:19 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
2018-05-29 17:56:27 +00:00
|
|
|
(*glContext)->makeCurrent();
|
|
|
|
sk_sp<GrContext> result = (*glContext)->makeGrContext(GrContextOptions());
|
|
|
|
if (!result) {
|
|
|
|
glContext->reset();
|
2017-05-31 13:45:19 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2018-05-29 17:56:27 +00:00
|
|
|
driverinfo << "GL Version: " << glGetString(GL_VERSION) << "\n";
|
|
|
|
driverinfo << "GL Vendor: " << glGetString(GL_VENDOR) << "\n";
|
|
|
|
driverinfo << "GL Renderer: " << glGetString(GL_RENDERER) << "\n";
|
|
|
|
driverinfo << "GL Extensions: " << glGetString(GL_EXTENSIONS) << "\n";
|
2017-05-31 13:45:19 +00:00
|
|
|
|
2018-05-29 17:56:27 +00:00
|
|
|
return result;
|
2017-05-31 13:45:19 +00:00
|
|
|
}
|