本文整理汇总了C++中KisConfig::forceOpenGLFenceWorkaround方法的典型用法代码示例。如果您正苦于以下问题:C++ KisConfig::forceOpenGLFenceWorkaround方法的具体用法?C++ KisConfig::forceOpenGLFenceWorkaround怎么用?C++ KisConfig::forceOpenGLFenceWorkaround使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisConfig
的用法示例。
在下文中一共展示了KisConfig::forceOpenGLFenceWorkaround方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initializeContext
int KisOpenGL::initializeContext(QOpenGLContext* s) {
#ifdef HAVE_OPENGL
KisConfig cfg;
dbgUI << "OpenGL: Opening new context";
// Double check we were given the version we requested
QSurfaceFormat format = s->format();
glVersion = 100 * format.majorVersion() + format.minorVersion();
if (!SharedSurface) {
SharedSurface = new QOffscreenSurface();
SharedSurface->setFormat(format);
SharedSurface->create();
}
if (!SharedContext) {
SharedContext = new QOpenGLContext;
SharedContext->setFormat(format);
SharedContext->setShareContext(s);
SharedContext->create();
SharedContext->makeCurrent(SharedSurface);
}
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
QFile log(QDesktopServices::storageLocation(QDesktopServices::TempLocation) + "/krita-opengl.txt");
log.open(QFile::WriteOnly);
QString vendor((const char*)f->glGetString(GL_VENDOR));
log.write(vendor.toLatin1());
log.write(", ");
QString renderer((const char*)f->glGetString(GL_RENDERER));
log.write(renderer.toLatin1());
log.write(", ");
QString version((const char*)f->glGetString(GL_VERSION));
log.write(version.toLatin1());
// Check if we have a bugged driver that needs fence workaround
bool isOnX11 = false;
#ifdef HAVE_X11
isOnX11 = true;
#endif
if ((isOnX11 && renderer.startsWith("AMD")) || cfg.forceOpenGLFenceWorkaround()) {
NeedsFenceWorkaround = true;
}
#else
Q_UNUSED(s);
NeedsFenceWorkaround = false;
#endif
return glVersion;
}
示例2: initializeContext
void KisOpenGL::initializeContext(QOpenGLContext *ctx)
{
initialize();
dbgUI << "OpenGL: Opening new context";
// Double check we were given the version we requested
QSurfaceFormat format = ctx->format();
QOpenGLFunctions *f = ctx->functions();
f->initializeOpenGLFunctions();
#ifndef GL_RENDERER
# define GL_RENDERER 0x1F01
#endif
Renderer = QString((const char*)f->glGetString(GL_RENDERER));
QFile log(QDesktopServices::storageLocation(QDesktopServices::TempLocation) + "/krita-opengl.txt");
log.open(QFile::WriteOnly);
QString vendor((const char*)f->glGetString(GL_VENDOR));
log.write(vendor.toLatin1());
log.write(", ");
log.write(Renderer.toLatin1());
log.write(", ");
QString version((const char*)f->glGetString(GL_VERSION));
log.write(version.toLatin1());
log.close();
// Check if we have a bugged driver that needs fence workaround
bool isOnX11 = false;
#ifdef HAVE_X11
isOnX11 = true;
#endif
KisConfig cfg;
if ((isOnX11 && Renderer.startsWith("AMD")) || cfg.forceOpenGLFenceWorkaround()) {
NeedsFenceWorkaround = true;
}
}