Optimisations
Former-commit-id: 81d277a49b57f061a6339678bd953054e434c613
This commit is contained in:
@@ -34,9 +34,9 @@ bool NzGLSLShader::Bind()
|
||||
|
||||
bool NzGLSLShader::BindTextures()
|
||||
{
|
||||
for (auto it = m_textures.begin(); it != m_textures.end(); ++it)
|
||||
for (const std::pair<GLint, TextureSlot>& pair : m_textures)
|
||||
{
|
||||
TextureSlot& slot = it->second;
|
||||
const TextureSlot& slot = pair.second;
|
||||
if (slot.enabled)
|
||||
NzRenderer::SetTexture(slot.unit, slot.texture);
|
||||
}
|
||||
|
||||
@@ -1191,14 +1191,15 @@ void NzRenderer::Uninitialize()
|
||||
s_instancingBuffer = nullptr;
|
||||
|
||||
// Libération des VAOs
|
||||
for (auto pair : s_vaos)
|
||||
for (auto& pair : s_vaos)
|
||||
{
|
||||
for (auto pair2 : pair.second)
|
||||
for (auto& pair2 : pair.second)
|
||||
{
|
||||
GLuint vao = static_cast<GLuint>(pair2.second);
|
||||
glDeleteVertexArrays(1, &vao);
|
||||
}
|
||||
}
|
||||
s_vaos.clear();
|
||||
|
||||
NzOpenGL::Uninitialize();
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ void NzTextureSampler::SetDefaultAnisotropyLevel(nzUInt8 anisotropyLevel)
|
||||
|
||||
if (s_useAnisotropicFilter)
|
||||
{
|
||||
for (auto pair : s_samplers)
|
||||
for (const std::pair<nzUInt32, GLuint>& pair : s_samplers)
|
||||
{
|
||||
if (((pair.first >> 5) & 0xFF) == 0)
|
||||
glSamplerParameterf(pair.second, GL_TEXTURE_MAX_ANISOTROPY_EXT, static_cast<float>(anisotropyLevel));
|
||||
@@ -146,7 +146,7 @@ void NzTextureSampler::SetDefaultFilterMode(nzSamplerFilter filterMode)
|
||||
|
||||
s_defaultFilterMode = filterMode;
|
||||
|
||||
for (auto pair : s_samplers)
|
||||
for (const std::pair<nzUInt32, GLuint>& pair : s_samplers)
|
||||
{
|
||||
if (((pair.first >> 1) & 0x3) == nzSamplerFilter_Default)
|
||||
{
|
||||
@@ -201,7 +201,7 @@ void NzTextureSampler::SetDefaultWrapMode(nzSamplerWrap wrapMode)
|
||||
s_defaultWrapMode = wrapMode;
|
||||
|
||||
GLenum wrapEnum = NzOpenGL::SamplerWrapMode[wrapMode];
|
||||
for (auto pair : s_samplers)
|
||||
for (const std::pair<nzUInt32, GLuint>& pair : s_samplers)
|
||||
{
|
||||
if (((pair.first >> 3) & 0x3) == nzSamplerWrap_Default)
|
||||
{
|
||||
@@ -383,8 +383,8 @@ bool NzTextureSampler::Initialize()
|
||||
|
||||
void NzTextureSampler::Uninitialize()
|
||||
{
|
||||
for (auto it = s_samplers.begin(); it != s_samplers.end(); ++it)
|
||||
glDeleteSamplers(1, &it->second);
|
||||
for (const std::pair<nzUInt32, GLuint>& pair : s_samplers)
|
||||
glDeleteSamplers(1, &pair.second);
|
||||
|
||||
s_samplers.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user