Ejemplo n.º 1
0
void GLBackend::init() {
    static std::once_flag once;
    std::call_once(once, [] {
        QString vendor{ (const char*)glGetString(GL_VENDOR) };
        QString renderer{ (const char*)glGetString(GL_RENDERER) };
        qCDebug(gpugllogging) << "GL Version: " << QString((const char*) glGetString(GL_VERSION));
        qCDebug(gpugllogging) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
        qCDebug(gpugllogging) << "GL Vendor: " << vendor;
        qCDebug(gpugllogging) << "GL Renderer: " << renderer;
        GPUIdent* gpu = GPUIdent::getInstance(vendor, renderer); 
        // From here on, GPUIdent::getInstance()->getMumble() should efficiently give the same answers.
        qCDebug(gpugllogging) << "GPU:";
        qCDebug(gpugllogging) << "\tcard:" << gpu->getName();
        qCDebug(gpugllogging) << "\tdriver:" << gpu->getDriver();
        qCDebug(gpugllogging) << "\tdedicated memory:" << gpu->getMemory() << "MB";
#if !defined(USE_GLES)
        qCDebug(gpugllogging, "V-Sync is %s\n", (::gl::getSwapInterval() > 0 ? "ON" : "OFF"));
#endif
#if THREADED_TEXTURE_BUFFERING
        // This has to happen on the main thread in order to give the thread 
        // pool a reasonable parent object
        GLVariableAllocationSupport::TransferJob::startBufferingThread();
#endif

    });
}
Ejemplo n.º 2
0
void GLBackend::init() {
    static std::once_flag once;
    std::call_once(once, [] {
        QString vendor{ (const char*)glGetString(GL_VENDOR) };
        QString renderer{ (const char*)glGetString(GL_RENDERER) };
        qCDebug(gpugllogging) << "GL Version: " << QString((const char*) glGetString(GL_VERSION));
        qCDebug(gpugllogging) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
        qCDebug(gpugllogging) << "GL Vendor: " << vendor;
        qCDebug(gpugllogging) << "GL Renderer: " << renderer;
        GPUIdent* gpu = GPUIdent::getInstance(vendor, renderer); 
        // From here on, GPUIdent::getInstance()->getMumble() should efficiently give the same answers.
        qCDebug(gpugllogging) << "GPU:";
        qCDebug(gpugllogging) << "\tcard:" << gpu->getName();
        qCDebug(gpugllogging) << "\tdriver:" << gpu->getDriver();
        qCDebug(gpugllogging) << "\tdedicated memory:" << gpu->getMemory() << "MB";

        glewExperimental = true;
        GLenum err = glewInit();
        glGetError(); // clear the potential error from glewExperimental
        if (GLEW_OK != err) {
            // glewInit failed, something is seriously wrong.
            qCDebug(gpugllogging, "Error: %s\n", glewGetErrorString(err));
        }
        qCDebug(gpugllogging, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));

#if defined(Q_OS_WIN)
        if (wglewGetExtension("WGL_EXT_swap_control")) {
            int swapInterval = wglGetSwapIntervalEXT();
            qCDebug(gpugllogging, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
        }
#endif

#if defined(Q_OS_LINUX)
        // TODO: Write the correct  code for Linux...
        /* if (wglewGetExtension("WGL_EXT_swap_control")) {
            int swapInterval = wglGetSwapIntervalEXT();
            qCDebug(gpugllogging, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
        }*/
#endif
#if THREADED_TEXTURE_BUFFERING
        // This has to happen on the main thread in order to give the thread 
        // pool a reasonable parent object
        GLVariableAllocationSupport::TransferJob::startBufferingThread();
#endif
    });
}
Ejemplo n.º 3
0
void AndroidInstance::enumerateGpu() {
    GPUIdent* ident = GPUIdent::getInstance();
    json gpu = {};
    gpu[keys::gpu::vendor] = ident->getName().toUtf8().constData();
    gpu[keys::gpu::model] = ident->getName().toUtf8().constData();
    gpu[keys::gpu::videoMemory] = ident->getMemory();
    gpu[keys::gpu::driver] = ident->getDriver().toUtf8().constData();

    _gpu.push_back(gpu);
    _display = ident->getOutput();
}