More getters for GlPlatform

A few more getters for parsed information are added to GlPlatform.
This includes the driver information retrieved through glGetString
and information like direct rendering and loose binding.

Additionally the methods to convert version, driver and chipClass
to string are added to the public interface.

These changes allow parts outside GlPlatform to get the same debug
information about the GL system.
icc-effect-5.14.5
Martin Gräßlin 2012-03-04 15:10:45 +01:00
parent c4ba09aa93
commit e8a038d66f
2 changed files with 90 additions and 3 deletions

View File

@ -377,7 +377,7 @@ static ChipClass detectIntelClass(const QByteArray &chipset)
return UnknownIntel;
}
static QString versionToString(qint64 version)
QString GLPlatform::versionToString(qint64 version)
{
int major = (version >> 32);
int minor = (version >> 16) & 0xffff;
@ -390,7 +390,7 @@ static QString versionToString(qint64 version)
return string;
}
static QString driverToString(Driver driver)
QString GLPlatform::driverToString(Driver driver)
{
switch(driver) {
case Driver_R100:
@ -425,7 +425,7 @@ static QString driverToString(Driver driver)
}
}
static QString chipClassToString(ChipClass chipClass)
QString GLPlatform::chipClassToString(ChipClass chipClass)
{
switch(chipClass) {
case R100:
@ -887,5 +887,35 @@ bool GLPlatform::isSoftwareEmulation() const
return m_driver == Driver_Softpipe || m_driver == Driver_Swrast || m_driver == Driver_Llvmpipe;
}
const QByteArray &GLPlatform::glRendererString() const
{
return m_renderer;
}
const QByteArray &GLPlatform::glVendorString() const
{
return m_vendor;
}
const QByteArray &GLPlatform::glVersionString() const
{
return m_version;
}
const QByteArray &GLPlatform::glShadingLanguageVersionString() const
{
return m_glsl_version;
}
bool GLPlatform::isDirectRendering() const
{
return m_directRendering;
}
bool GLPlatform::isLooseBinding() const
{
return m_looseBinding;
}
} // namespace KWin

View File

@ -241,6 +241,63 @@ public:
**/
bool isSoftwareEmulation() const;
/**
* @returns the GL_VERSION string as provided by the driver.
* @since 4.9
**/
const QByteArray &glVersionString() const;
/**
* @returns the GL_RENDERER string as provided by the driver.
* @since 4.9
**/
const QByteArray &glRendererString() const;
/**
* @returns the GL_VENDOR string as provided by the driver.
* @since 4.9
**/
const QByteArray &glVendorString() const;
/**
* @returns the GL_SHADING_LANGUAGE_VERSION string as provided by the driver.
* If the driver does not support the OpenGL Shading Language a null bytearray is returned.
* @since 4.9
**/
const QByteArray &glShadingLanguageVersionString() const;
/**
* @returns Whether a direct rendering OpenGL context is used.
* @since 4.9
**/
bool isDirectRendering() const;
/**
* @returns Whether the driver supports loose texture binding.
* @since 4.9
**/
bool isLooseBinding() const;
/**
* @returns a human readable form of the @p version.
* @since 4.9
* @see glVersion
* @see glslVersion
* @see driverVersion
* @see mesaVersion
* @see galliumVersion
* @see kernelVersion
* @see serverVersion
**/
static QString versionToString(qint64 version);
/**
* @returns a human readable form for the @p driver.
* @since 4.9
* @see driver
**/
static QString driverToString(Driver driver);
/**
* @returns a human readable form for the @p chipClass.
* @since 4.9
* @see chipClass
**/
static QString chipClassToString(ChipClass chipClass);
private:
GLPlatform();