Beispiel #1
0
const bool GPUQuery::extensionSupported(const char * extension)
{
    if(isCoreProfile())
        return false;

    bool supported = glewIsSupported(extension) ? true : false;

    if(!supported)
#ifdef WIN32
        return wglewIsSupported(extension) ? true : false;
#elif defined(LINUX)
        return glxewIsSupported(extension) ? true : false;
#else
        return supported;
#endif

    return supported;
}
std::vector<DebugInfo::InfoGroup> DebugInfo::generalInfo()
{
	InfoGroup generalGroup;

	InfoUnit generalInfo;
	InfoUnit memoryInfo;
	InfoUnit textureInfo;

	generalGroup.name = "General";

	generalInfo.name = "OpenGL";
	memoryInfo.name = "Memory";
	textureInfo.name = "General Texture Info";

    generalInfo.addProperty("version", versionString());
    generalInfo.addProperty("vendor", vendor());
    generalInfo.addProperty("renderer", renderer());
    generalInfo.addProperty("core profile", isCoreProfile()?"true":"false");
    generalInfo.addProperty("GLSL version", getString(gl::GL_SHADING_LANGUAGE_VERSION));

	memoryInfo.addProperty("total", humanReadableSize(1024ll*memory::total()));
	memoryInfo.addProperty("dedicated", humanReadableSize(1024ll*memory::dedicated()));
	memoryInfo.addProperty("available", humanReadableSize(1024ll*memory::available()));
	memoryInfo.addProperty("evicted", humanReadableSize(1024ll*memory::evicted()));
	memoryInfo.addProperty("evictionCount", memory::evictionCount());

    int maxTextureSize = getInteger(gl::GL_MAX_TEXTURE_SIZE);
	textureInfo.addProperty("Max Texture Size", std::to_string(maxTextureSize)+" x "+std::to_string(maxTextureSize));
    textureInfo.addProperty("Max Vertex Texture Image Units", getInteger(gl::GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS));
    textureInfo.addProperty("Max Texture Image Units", getInteger(gl::GL_MAX_IMAGE_UNITS));
    textureInfo.addProperty("Max Geometry Texture Units", getInteger(gl::GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS));
    auto maxViewportSize = getIntegers<2>(gl::GL_MAX_VIEWPORT_DIMS);
	textureInfo.addProperty("Max viewport size", std::to_string(maxViewportSize[0])+" x "+std::to_string(maxViewportSize[1]));
    textureInfo.addProperty("Max clip distances", getInteger(gl::GL_MAX_CLIP_DISTANCES));
    textureInfo.addProperty("Max Samples", getInteger(gl::GL_MAX_SAMPLES));

	generalGroup.addInfoUnit(generalInfo);
	generalGroup.addInfoUnit(memoryInfo);
	generalGroup.addInfoUnit(textureInfo);

	return std::vector<InfoGroup>({ generalGroup });
}
Beispiel #3
0
bool
Context::hasExtension(const char *string) {
    os::log("glws.cpp hasExtension");
    if (extensions.empty()) {
        if (isCoreProfile(profile)) {
            // Use glGetStringi
            GLint num_extensions = 0;
            glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
            for (int i = 0; i < num_extensions; ++i) {
                const char *extension = reinterpret_cast<const char *>(glGetStringi(GL_EXTENSIONS, i));
                if (extension) {
                    extensions.insert(extension);
                }
            }
        } else {
            // Use glGetString
            const char *begin = reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS));
            do {
                const char *end = begin;
                char c = *end;
                while (c != '\0' && c != ' ') {
                    ++end;
                    c = *end;
                }
                if (end != begin) {
                    extensions.insert(std::string(begin, end));
                }
                
                if (c == '\0') {
                    break;
                }
                begin = end + 1;
            } while(1);
        }
    }

    return extensions.find(string) != extensions.end();
}