Reduced context locking&unlocking while creating textures
This commit is contained in:
parent
f4f7ef0d70
commit
ff87e1c922
@ -129,6 +129,11 @@ bool Texture::create(unsigned int width, unsigned int height)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TransientContextLock lock;
|
||||||
|
|
||||||
|
// Make sure that extensions are initialized
|
||||||
|
priv::ensureExtensionsInit();
|
||||||
|
|
||||||
// Compute the internal texture dimensions depending on NPOT textures support
|
// Compute the internal texture dimensions depending on NPOT textures support
|
||||||
Vector2u actualSize(getValidSize(width), getValidSize(height));
|
Vector2u actualSize(getValidSize(width), getValidSize(height));
|
||||||
|
|
||||||
@ -150,8 +155,6 @@ bool Texture::create(unsigned int width, unsigned int height)
|
|||||||
m_pixelsFlipped = false;
|
m_pixelsFlipped = false;
|
||||||
m_fboAttachment = false;
|
m_fboAttachment = false;
|
||||||
|
|
||||||
TransientContextLock lock;
|
|
||||||
|
|
||||||
// Create the OpenGL texture if it doesn't exist yet
|
// Create the OpenGL texture if it doesn't exist yet
|
||||||
if (!m_texture)
|
if (!m_texture)
|
||||||
{
|
{
|
||||||
@ -160,9 +163,6 @@ bool Texture::create(unsigned int width, unsigned int height)
|
|||||||
m_texture = static_cast<unsigned int>(texture);
|
m_texture = static_cast<unsigned int>(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that extensions are initialized
|
|
||||||
priv::ensureExtensionsInit();
|
|
||||||
|
|
||||||
// Make sure that the current texture binding will be preserved
|
// Make sure that the current texture binding will be preserved
|
||||||
priv::TextureSaver save;
|
priv::TextureSaver save;
|
||||||
|
|
||||||
@ -851,11 +851,6 @@ unsigned int Texture::getNativeHandle() const
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
unsigned int Texture::getValidSize(unsigned int size)
|
unsigned int Texture::getValidSize(unsigned int size)
|
||||||
{
|
{
|
||||||
TransientContextLock lock;
|
|
||||||
|
|
||||||
// Make sure that extensions are initialized
|
|
||||||
priv::ensureExtensionsInit();
|
|
||||||
|
|
||||||
if (GLEXT_texture_non_power_of_two)
|
if (GLEXT_texture_non_power_of_two)
|
||||||
{
|
{
|
||||||
// If hardware supports NPOT textures, then just return the unmodified size
|
// If hardware supports NPOT textures, then just return the unmodified size
|
||||||
|
Loading…
x
Reference in New Issue
Block a user