Fixed textures updated twice per state update
Former-commit-id: fb4d79e920899e6761225d72928ea62878f2c485
This commit is contained in:
parent
f7fb7e10fb
commit
0b66452e33
|
|
@ -24,6 +24,7 @@
|
||||||
#include <Nazara/Utility/VertexDeclaration.hpp>
|
#include <Nazara/Utility/VertexDeclaration.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <set>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
@ -71,8 +72,8 @@ namespace
|
||||||
using VAO_Key = std::tuple<const NzContext*, const NzIndexBuffer*, const NzVertexBuffer*, const NzVertexDeclaration*, bool>;
|
using VAO_Key = std::tuple<const NzContext*, const NzIndexBuffer*, const NzVertexBuffer*, const NzVertexDeclaration*, bool>;
|
||||||
|
|
||||||
std::map<VAO_Key, unsigned int> s_vaos;
|
std::map<VAO_Key, unsigned int> s_vaos;
|
||||||
|
std::set<unsigned int> s_dirtyTextureUnits;
|
||||||
std::vector<TextureUnit> s_textureUnits;
|
std::vector<TextureUnit> s_textureUnits;
|
||||||
std::vector<unsigned int> s_dirtyTextureUnits;
|
|
||||||
NzBuffer* s_instancingBuffer = nullptr;
|
NzBuffer* s_instancingBuffer = nullptr;
|
||||||
NzVertexBuffer* s_quadBuffer = nullptr;
|
NzVertexBuffer* s_quadBuffer = nullptr;
|
||||||
NzMatrix4f s_matrix[totalMatrixCount];
|
NzMatrix4f s_matrix[totalMatrixCount];
|
||||||
|
|
@ -743,7 +744,6 @@ bool NzRenderer::Initialize()
|
||||||
else
|
else
|
||||||
s_maxTextureUnit = 1;
|
s_maxTextureUnit = 1;
|
||||||
|
|
||||||
s_dirtyTextureUnits.reserve(s_maxTextureUnit);
|
|
||||||
s_dstBlend = nzBlendFunc_Zero;
|
s_dstBlend = nzBlendFunc_Zero;
|
||||||
s_faceCulling = nzFaceCulling_Back;
|
s_faceCulling = nzFaceCulling_Back;
|
||||||
s_faceFilling = nzFaceFilling_Fill;
|
s_faceFilling = nzFaceFilling_Fill;
|
||||||
|
|
@ -1286,7 +1286,7 @@ void NzRenderer::SetTexture(nzUInt8 unit, const NzTexture* texture)
|
||||||
s_textureUnits[unit].samplerUpdated = false;
|
s_textureUnits[unit].samplerUpdated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_dirtyTextureUnits.push_back(unit);
|
s_dirtyTextureUnits.insert(unit);
|
||||||
s_updateFlags |= Update_Textures;
|
s_updateFlags |= Update_Textures;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1307,7 +1307,7 @@ void NzRenderer::SetTextureSampler(nzUInt8 unit, const NzTextureSampler& sampler
|
||||||
if (s_textureUnits[unit].texture)
|
if (s_textureUnits[unit].texture)
|
||||||
s_textureUnits[unit].sampler.UseMipmaps(s_textureUnits[unit].texture->HasMipmaps());
|
s_textureUnits[unit].sampler.UseMipmaps(s_textureUnits[unit].texture->HasMipmaps());
|
||||||
|
|
||||||
s_dirtyTextureUnits.push_back(unit);
|
s_dirtyTextureUnits.insert(unit);
|
||||||
s_updateFlags |= Update_Textures;
|
s_updateFlags |= Update_Textures;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1462,9 +1462,10 @@ bool NzRenderer::EnsureStateUpdate()
|
||||||
s_updateFlags |= Update_Matrices;
|
s_updateFlags |= Update_Matrices;
|
||||||
for (unsigned int i = 0; i < totalMatrixCount; ++i)
|
for (unsigned int i = 0; i < totalMatrixCount; ++i)
|
||||||
{
|
{
|
||||||
if (s_matrixLocation[i] != -1)
|
///TODO: Voir le FIXME au niveau de l'envoi des matrices
|
||||||
|
/*if (s_matrixLocation[i] != -1)
|
||||||
s_matrixUpdated[i] = false;
|
s_matrixUpdated[i] = false;
|
||||||
else
|
else*/
|
||||||
s_matrixUpdated[i] = false;
|
s_matrixUpdated[i] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1527,6 +1528,8 @@ bool NzRenderer::EnsureStateUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///FIXME: Optimiser les matrices
|
||||||
|
///TODO: Prendre en compte les FIXME...
|
||||||
// Cas spéciaux car il faut recalculer la matrice
|
// Cas spéciaux car il faut recalculer la matrice
|
||||||
if (!s_matrixUpdated[nzMatrixCombination_ViewProj])
|
if (!s_matrixUpdated[nzMatrixCombination_ViewProj])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue