Big config/debug update

Added config checkers
Macro no longer use suffixes
Moved MemoryManager to upper directory
Renamed *_MEMORYMANAGER to *_MANAGE_MEMORY
Renamed AUDIO_STREAMEDBUFFERCOUNT to AUDIO_STREAMED_BUFFER_COUNT
Renamed CORE_REAL_PRECISION to CORE_DECIMAL_DIGITS
Renamed DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION to
DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION
Renamed GRAPHICS_MAX_LIGHTPERPASS to GRAPHICS_MAX_LIGHT_PER_PASS
Renamed UTILITY_FORCE_DECLARATION_STRIDE_MULTIPLE_OF_32 to
UTILITY_VERTEX_DECLARATION_FORCE_STRIDE_MULTIPLE_OF_32


Former-commit-id: 81ef836ac9f092ac471f60e544bb7c7c6370593c
This commit is contained in:
Lynix
2014-07-08 10:56:37 +02:00
parent f819beb747
commit c4b10dddda
64 changed files with 471 additions and 206 deletions

View File

@@ -3,10 +3,10 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Audio/Config.hpp>
#if NAZARA_AUDIO_MEMORYMANAGER || defined(NAZARA_DEBUG)
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
#include <Nazara/Core/Debug/MemoryManager.hpp>
#include <new>
#if NAZARA_AUDIO_MANAGE_MEMORY
#include <Nazara/Core/MemoryManager.hpp>
#include <new> // Nécessaire ?
void* operator new(std::size_t size)
{
@@ -28,4 +28,4 @@ void operator delete[](void* pointer) noexcept
NzMemoryManager::Free(pointer, true);
}
#endif
#endif // NAZARA_AUDIO_MANAGE_MEMORY

View File

@@ -237,10 +237,10 @@ bool NzMusic::FillAndQueueBuffer(unsigned int buffer)
void NzMusic::MusicThread()
{
ALuint buffers[NAZARA_AUDIO_STREAMEDBUFFERCOUNT];
alGenBuffers(NAZARA_AUDIO_STREAMEDBUFFERCOUNT, buffers);
ALuint buffers[NAZARA_AUDIO_STREAMED_BUFFER_COUNT];
alGenBuffers(NAZARA_AUDIO_STREAMED_BUFFER_COUNT, buffers);
for (unsigned int i = 0; i < NAZARA_AUDIO_STREAMEDBUFFERCOUNT; ++i)
for (unsigned int i = 0; i < NAZARA_AUDIO_STREAMED_BUFFER_COUNT; ++i)
{
if (FillAndQueueBuffer(buffers[i])) // Fin du fichier ?
break; // Nous avons atteint la fin du fichier, inutile de rajouter des buffers
@@ -280,7 +280,7 @@ void NzMusic::MusicThread()
for (ALint i = 0; i < queuedBufferCount; ++i)
alSourceUnqueueBuffers(m_source, 1, &buffer);
alDeleteBuffers(NAZARA_AUDIO_STREAMEDBUFFERCOUNT, buffers);
alDeleteBuffers(NAZARA_AUDIO_STREAMED_BUFFER_COUNT, buffers);
}
NzMusicLoader::LoaderList NzMusic::s_loaders;

View File

@@ -3,10 +3,10 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/Config.hpp>
#if NAZARA_CORE_MEMORYMANAGER || defined(NAZARA_DEBUG)
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
#include <Nazara/Core/Debug/MemoryManager.hpp>
#include <new>
#if NAZARA_CORE_MANAGE_MEMORY
#include <Nazara/Core/MemoryManager.hpp>
#include <new> // Nécessaire ?
void* operator new(std::size_t size)
{
@@ -27,4 +27,5 @@ void operator delete[](void* pointer) noexcept
{
NzMemoryManager::Free(pointer, true);
}
#endif
#endif // NAZARA_CORE_MANAGE_MEMORY

View File

@@ -0,0 +1,36 @@
// Copyright (C) 2014 Jérôme Leclercq
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/Config.hpp>
#if NAZARA_CORE_MANAGE_MEMORY
#define NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION
#include <Nazara/Core/Debug/NewRedefinition.hpp>
#include <Nazara/Core/MemoryManager.hpp>
#include <new> // Nécessaire ?
void* operator new(std::size_t size, const char* file, unsigned int line)
{
return NzMemoryManager::Allocate(size, false, file, line);
}
void* operator new[](std::size_t size, const char* file, unsigned int line)
{
return NzMemoryManager::Allocate(size, true, file, line);
}
void operator delete(void* ptr, const char* file, unsigned int line) noexcept
{
NzMemoryManager::NextFree(file, line);
NzMemoryManager::Free(ptr, false);
}
void operator delete[](void* ptr, const char* file, unsigned int line) noexcept
{
NzMemoryManager::NextFree(file, line);
NzMemoryManager::Free(ptr, true);
}
#endif // NAZARA_CORE_MANAGE_MEMORY

View File

@@ -2,9 +2,7 @@
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
#include <Nazara/Core/Debug/MemoryManager.hpp>
#include <Nazara/Core/MemoryManager.hpp>
#include <cstdio>
#include <cstdlib>
#include <ctime>
@@ -259,25 +257,3 @@ void NzMemoryManager::Uninitialize()
std::fclose(log);
}
void* operator new(std::size_t size, const char* file, unsigned int line)
{
return NzMemoryManager::Allocate(size, false, file, line);
}
void* operator new[](std::size_t size, const char* file, unsigned int line)
{
return NzMemoryManager::Allocate(size, true, file, line);
}
void operator delete(void* ptr, const char* file, unsigned int line) noexcept
{
NzMemoryManager::NextFree(file, line);
NzMemoryManager::Free(ptr, false);
}
void operator delete[](void* ptr, const char* file, unsigned int line) noexcept
{
NzMemoryManager::NextFree(file, line);
NzMemoryManager::Free(ptr, true);
}

View File

@@ -3,7 +3,7 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
// Notre utilisation du placement new n'est pas (encore ?) compatible avec les définitions du MLT
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
#define NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION
#include <Nazara/Core/ParameterList.hpp>
#include <Nazara/Core/Error.hpp>

View File

@@ -3930,7 +3930,7 @@ int NzString::Compare(const NzString& first, const NzString& second)
NzString NzString::Number(float number)
{
std::ostringstream oss;
oss.precision(NAZARA_CORE_REAL_PRECISION);
oss.precision(NAZARA_CORE_DECIMAL_DIGITS);
oss << number;
return NzString(oss.str());
@@ -3939,7 +3939,7 @@ NzString NzString::Number(float number)
NzString NzString::Number(double number)
{
std::ostringstream oss;
oss.precision(NAZARA_CORE_REAL_PRECISION);
oss.precision(NAZARA_CORE_DECIMAL_DIGITS);
oss << number;
return NzString(oss.str());
@@ -3948,7 +3948,7 @@ NzString NzString::Number(double number)
NzString NzString::Number(long double number)
{
std::ostringstream oss;
oss.precision(NAZARA_CORE_REAL_PRECISION);
oss.precision(NAZARA_CORE_DECIMAL_DIGITS);
oss << number;
return NzString(oss.str());

View File

@@ -3,10 +3,10 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Graphics/Config.hpp>
#if NAZARA_GRAPHICS_MEMORYMANAGER || defined(NAZARA_DEBUG)
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
#include <Nazara/Core/Debug/MemoryManager.hpp>
#include <new>
#if NAZARA_GRAPHICS_MANAGE_MEMORY
#include <Nazara/Core/MemoryManager.hpp>
#include <new> // Nécessaire ?
void* operator new(std::size_t size)
{
@@ -28,4 +28,4 @@ void operator delete[](void* pointer) noexcept
NzMemoryManager::Free(pointer, true);
}
#endif
#endif // NAZARA_GRAPHICS_MANAGE_MEMORY

View File

@@ -247,12 +247,12 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene) const
unsigned int lightIndex = 0;
nzRendererComparison oldDepthFunc = NzRenderer::GetDepthFunc();
unsigned int passCount = (lightCount == 0) ? 1 : (lightCount-1)/NAZARA_GRAPHICS_MAX_LIGHTPERPASS + 1;
unsigned int passCount = (lightCount == 0) ? 1 : (lightCount-1)/NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS + 1;
for (unsigned int pass = 0; pass < passCount; ++pass)
{
if (lightUniforms->exists)
{
unsigned int renderedLightCount = std::min(lightCount, NAZARA_GRAPHICS_MAX_LIGHTPERPASS);
unsigned int renderedLightCount = std::min(lightCount, NazaraSuffixMacro(NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS, U));
lightCount -= renderedLightCount;
if (pass == 1)
@@ -269,7 +269,7 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene) const
for (unsigned int i = 0; i < renderedLightCount; ++i)
m_directionalLights.GetLight(lightIndex++)->Enable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
for (unsigned int i = renderedLightCount; i < NAZARA_GRAPHICS_MAX_LIGHTPERPASS; ++i)
for (unsigned int i = renderedLightCount; i < NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS; ++i)
NzLight::Disable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
}
@@ -303,7 +303,7 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene) const
for (const NzMatrix4f& matrix : instances)
{
unsigned int directionalLightCount = m_directionalLights.GetLightCount();
unsigned int otherLightCount = m_lights.ComputeClosestLights(matrix.GetTranslation() + boundingSphere.GetPosition(), boundingSphere.radius, m_maxLightPassPerObject*NAZARA_GRAPHICS_MAX_LIGHTPERPASS - directionalLightCount);
unsigned int otherLightCount = m_lights.ComputeClosestLights(matrix.GetTranslation() + boundingSphere.GetPosition(), boundingSphere.radius, m_maxLightPassPerObject*NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS - directionalLightCount);
unsigned int lightCount = directionalLightCount + otherLightCount;
NzRenderer::SetMatrix(nzMatrixType_World, matrix);
@@ -311,10 +311,10 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene) const
unsigned int otherLightIndex = 0;
nzRendererComparison oldDepthFunc = NzRenderer::GetDepthFunc(); // Dans le cas où nous aurions à le changer
unsigned int passCount = (lightCount == 0) ? 1 : (lightCount-1)/NAZARA_GRAPHICS_MAX_LIGHTPERPASS + 1;
unsigned int passCount = (lightCount == 0) ? 1 : (lightCount-1)/NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS + 1;
for (unsigned int pass = 0; pass < passCount; ++pass)
{
unsigned int renderedLightCount = std::min(lightCount, NAZARA_GRAPHICS_MAX_LIGHTPERPASS);
unsigned int renderedLightCount = std::min(lightCount, NazaraSuffixMacro(NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS, U));
lightCount -= renderedLightCount;
if (pass == 1)
@@ -338,7 +338,7 @@ void NzForwardRenderTechnique::DrawOpaqueModels(const NzScene* scene) const
}
// On désactive l'éventuel surplus
for (unsigned int i = renderedLightCount; i < NAZARA_GRAPHICS_MAX_LIGHTPERPASS; ++i)
for (unsigned int i = renderedLightCount; i < NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS; ++i)
NzLight::Disable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
// Et on passe à l'affichage
@@ -478,7 +478,7 @@ void NzForwardRenderTechnique::DrawTransparentModels(const NzScene* scene) const
lightUniforms = GetLightUniforms(shader);
// On envoie les lumières directionnelles s'il y a (Les mêmes pour tous)
lightCount = std::min(m_directionalLights.GetLightCount(), NAZARA_GRAPHICS_MAX_LIGHTPERPASS);
lightCount = std::min(m_directionalLights.GetLightCount(), NazaraSuffixMacro(NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS, U));
for (unsigned int i = 0; i < lightCount; ++i)
m_directionalLights.GetLight(i)->Enable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
@@ -511,14 +511,14 @@ void NzForwardRenderTechnique::DrawTransparentModels(const NzScene* scene) const
NzRenderer::SetVertexBuffer(vertexBuffer);
// Calcul des lumières les plus proches
if (lightCount < NAZARA_GRAPHICS_MAX_LIGHTPERPASS && !m_lights.IsEmpty())
if (lightCount < NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS && !m_lights.IsEmpty())
{
unsigned int count = std::min(NAZARA_GRAPHICS_MAX_LIGHTPERPASS - lightCount, m_lights.ComputeClosestLights(matrix.GetTranslation() + modelData.boundingSphere.GetPosition(), modelData.boundingSphere.radius, NAZARA_GRAPHICS_MAX_LIGHTPERPASS));
unsigned int count = std::min(NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS - lightCount, m_lights.ComputeClosestLights(matrix.GetTranslation() + modelData.boundingSphere.GetPosition(), modelData.boundingSphere.radius, NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS));
for (unsigned int i = 0; i < count; ++i)
m_lights.GetResult(i)->Enable(shader, lightUniforms->uniforms, lightUniforms->offset*(lightCount++));
}
for (unsigned int i = lightCount; i < NAZARA_GRAPHICS_MAX_LIGHTPERPASS; ++i)
for (unsigned int i = lightCount; i < NAZARA_GRAPHICS_MAX_LIGHT_PER_PASS; ++i)
NzLight::Disable(shader, lightUniforms->uniforms, lightUniforms->offset*i);
NzRenderer::SetMatrix(nzMatrixType_World, matrix);

View File

@@ -3,10 +3,10 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Lua/Config.hpp>
#if NAZARA_LUA_MEMORYMANAGER || defined(NAZARA_DEBUG)
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
#include <Nazara/Core/Debug/MemoryManager.hpp>
#include <new>
#if NAZARA_LUA_MANAGE_MEMORY
#include <Nazara/Core/MemoryManager.hpp>
#include <new> // Nécessaire ?
void* operator new(std::size_t size)
{
@@ -28,4 +28,4 @@ void operator delete[](void* pointer) noexcept
NzMemoryManager::Free(pointer, true);
}
#endif
#endif // NAZARA_LUA_MANAGE_MEMORY

View File

@@ -2,7 +2,7 @@
// This file is part of the "Nazara Engine - Lua scripting module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
#define NAZARA_DEBUG_NEWREDEFINITION_DISABLE_REDEFINITION
#include <Nazara/Lua/LuaInstance.hpp>
#include <Lua/lauxlib.h>

View File

@@ -3,10 +3,10 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Noise/Config.hpp>
#if NAZARA_NOISE_MEMORYMANAGER || defined(NAZARA_DEBUG)
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
#include <Nazara/Core/Debug/MemoryManager.hpp>
#include <new>
#if NAZARA_NOISE_MANAGE_MEMORY
#include <Nazara/Core/MemoryManager.hpp>
#include <new> // Nécessaire ?
void* operator new(std::size_t size)
{
@@ -28,4 +28,4 @@ void operator delete[](void* pointer) noexcept
NzMemoryManager::Free(pointer, true);
}
#endif
#endif // NAZARA_NOISE_MANAGE_MEMORY

View File

@@ -3,10 +3,10 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Physics/Config.hpp>
#if NAZARA_PHYSICS_MEMORYMANAGER || defined(NAZARA_DEBUG)
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
#include <Nazara/Core/Debug/MemoryManager.hpp>
#include <new>
#if NAZARA_PHYSICS_MANAGE_MEMORY
#include <Nazara/Core/MemoryManager.hpp>
#include <new> // Nécessaire ?
void* operator new(std::size_t size)
{
@@ -28,4 +28,4 @@ void operator delete[](void* pointer) noexcept
NzMemoryManager::Free(pointer, true);
}
#endif
#endif // NAZARA_PHYSICS_MANAGE_MEMORY

View File

@@ -3,10 +3,10 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Renderer/Config.hpp>
#if NAZARA_RENDERER_MEMORYMANAGER || defined(NAZARA_DEBUG)
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
#include <Nazara/Core/Debug/MemoryManager.hpp>
#include <new>
#if NAZARA_RENDERER_MANAGE_MEMORY
#include <Nazara/Core/MemoryManager.hpp>
#include <new> // Nécessaire ?
void* operator new(std::size_t size)
{
@@ -28,4 +28,4 @@ void operator delete[](void* pointer) noexcept
NzMemoryManager::Free(pointer, true);
}
#endif
#endif // NAZARA_RENDERER_MANAGE_MEMORY

View File

@@ -3,10 +3,10 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Config.hpp>
#if NAZARA_UTILITY_MEMORYMANAGER || defined(NAZARA_DEBUG)
#define NAZARA_DEBUG_MEMORYMANAGER_DISABLE_REDEFINITION
#include <Nazara/Core/Debug/MemoryManager.hpp>
#include <new>
#if NAZARA_UTILITY_MANAGE_MEMORY
#include <Nazara/Core/MemoryManager.hpp>
#include <new> // Nécessaire ?
void* operator new(std::size_t size)
{
@@ -28,4 +28,4 @@ void operator delete[](void* pointer) noexcept
NzMemoryManager::Free(pointer, true);
}
#endif
#endif // NAZARA_UTILITY_MANAGE_MEMORY