kwin: Add GLPlatform::preferBufferSubData()
This method returns true when glMapBufferRange() is likely to perform worse than glBufferSubData() when updating an unused range in a buffer object. This is the case with the NVIDIA driver, where glMapBufferRange() will force thread serialization. The driver tracks which ranges of the buffer are in use, so calls to glBufferSubData() should not cause a pipeline stall.
This commit is contained in:
parent
4e897f2315
commit
9de4c490ba
2 changed files with 18 additions and 1 deletions
|
@ -602,6 +602,7 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
|
|||
}
|
||||
|
||||
m_chipset = "Unknown";
|
||||
m_preferBufferSubData = false;
|
||||
|
||||
|
||||
// Mesa classic drivers
|
||||
|
@ -794,8 +795,10 @@ void GLPlatform::detect(OpenGLPlatformInterface platformInterface)
|
|||
if (m_driver == Driver_NVidia && m_chipClass < NV40)
|
||||
m_supportsGLSL = false; // High likelihood of software emulation
|
||||
|
||||
if (m_driver == Driver_NVidia)
|
||||
if (m_driver == Driver_NVidia) {
|
||||
m_looseBinding = true;
|
||||
m_preferBufferSubData = true;
|
||||
}
|
||||
|
||||
if (m_chipClass < NV20) {
|
||||
m_recommendedCompositor = XRenderCompositing;
|
||||
|
@ -1051,6 +1054,11 @@ CompositingType GLPlatform::recommendedCompositor() const
|
|||
return m_recommendedCompositor;
|
||||
}
|
||||
|
||||
bool GLPlatform::preferBufferSubData() const
|
||||
{
|
||||
return m_preferBufferSubData;
|
||||
}
|
||||
|
||||
bool GLPlatform::isGLES() const
|
||||
{
|
||||
#ifdef KWIN_HAVE_OPENGLES
|
||||
|
|
|
@ -307,6 +307,14 @@ public:
|
|||
**/
|
||||
CompositingType recommendedCompositor() const;
|
||||
|
||||
/**
|
||||
* Returns true if glMapBufferRange() is likely to perform worse than glBufferSubData()
|
||||
* when updating an unused range of a buffer object, and false otherwise.
|
||||
*
|
||||
* @since 4.11
|
||||
*/
|
||||
bool preferBufferSubData() const;
|
||||
|
||||
/**
|
||||
* @returns a human readable form of the @p version.
|
||||
* @since 4.9
|
||||
|
@ -359,6 +367,7 @@ private:
|
|||
bool m_textureNPOT: 1;
|
||||
bool m_limitedNPOT: 1;
|
||||
bool m_virtualMachine: 1;
|
||||
bool m_preferBufferSubData: 1;
|
||||
static GLPlatform *s_platform;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue