- removal of sse2 compiler flags for better compatibility

- added workings for a future flag for interpolation cache
This commit is contained in:
Mark Vejvoda 2010-07-28 23:24:56 +00:00
parent f0d492371f
commit d8e41495d0
3 changed files with 34 additions and 30 deletions

View File

@ -4,7 +4,7 @@ if ! $(top_builddir)
} }
top_srcdir = $(TOP) ; top_srcdir = $(TOP) ;
MGFLAGS = -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -msse2 ; MGFLAGS = -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse ;
JAMCONFIG ?= $(top_builddir)/Jamconfig ; JAMCONFIG ?= $(top_builddir)/Jamconfig ;
include $(JAMCONFIG) ; include $(JAMCONFIG) ;
@ -24,8 +24,6 @@ if $(USE_STLPORT_DEBUG)
# if using streflop then add some special compiler defines # if using streflop then add some special compiler defines
if $(USE_STREFLOP) if $(USE_STREFLOP)
{ {
# COMPILER_CFLAGS_optimize += -mfpmath=sse -msse -fsingle-precision-constant -pipe -fno-strict-aliasing $(MGFLAGS) -mieee-fp -mno-tls-direct-seg-refs ;
# COMPILER_CXXFLAGS_optimize += -mfpmath=sse -msse -fsingle-precision-constant -frounding-math -pipe -fno-strict-aliasing $(MGFLAGS) -mieee-fp -mno-tls-direct-seg-refs ;
CPPFLAGS += $(MGFLAGS) ; CPPFLAGS += $(MGFLAGS) ;
COMPILER_CFLAGS += $(MGFLAGS) ; COMPILER_CFLAGS += $(MGFLAGS) ;
COMPILER_CFLAGS_optimize += $(MGFLAGS) ; COMPILER_CFLAGS_optimize += $(MGFLAGS) ;

View File

@ -34,6 +34,7 @@ private:
std::map<float, std::map<bool, Vec3f *> > cacheVertices; std::map<float, std::map<bool, Vec3f *> > cacheVertices;
std::map<float, std::map<bool, Vec3f *> > cacheNormals; std::map<float, std::map<bool, Vec3f *> > cacheNormals;
bool enableCache;
public: public:
InterpolationData(const Mesh *mesh); InterpolationData(const Mesh *mesh);

View File

@ -39,6 +39,8 @@ InterpolationData::InterpolationData(const Mesh *mesh){
normals= new Vec3f[mesh->getVertexCount()]; normals= new Vec3f[mesh->getVertexCount()];
} }
enableCache = true;
cacheVertices.clear(); cacheVertices.clear();
cacheNormals.clear(); cacheNormals.clear();
} }
@ -77,21 +79,20 @@ void InterpolationData::updateVertices(float t, bool cycle) {
uint32 vertexCount= mesh->getVertexCount(); uint32 vertexCount= mesh->getVertexCount();
if(frameCount > 1) { if(frameCount > 1) {
if(enableCache == true) {
std::map<float, std::map<bool, Vec3f *> >::iterator iterFind = cacheVertices.find(t); std::map<float, std::map<bool, Vec3f *> >::iterator iterFind = cacheVertices.find(t);
if(iterFind != cacheVertices.end()) { if(iterFind != cacheVertices.end()) {
std::map<bool, Vec3f *>::iterator iterFind2 = iterFind->second.find(cycle); std::map<bool, Vec3f *>::iterator iterFind2 = iterFind->second.find(cycle);
if(iterFind2 != iterFind->second.end()) { if(iterFind2 != iterFind->second.end()) {
//for(uint32 j=0; j< vertexCount; ++j){ //for(uint32 j=0; j< vertexCount; ++j){
// vertices[j] = iterFind2->second[j]; // vertices[j] = iterFind2->second[j];
//} //}
memcpy(vertices,iterFind2->second,sizeof(Vec3f) * vertexCount); memcpy(vertices,iterFind2->second,sizeof(Vec3f) * vertexCount);
return; return;
}
} }
cacheVertices[t][cycle] = new Vec3f[vertexCount];
} }
cacheVertices[t][cycle] = new Vec3f[vertexCount];
const Vec3f *meshVertices= mesh->getVertices(); const Vec3f *meshVertices= mesh->getVertices();
@ -110,7 +111,9 @@ void InterpolationData::updateVertices(float t, bool cycle) {
for(uint32 j=0; j<vertexCount; ++j){ for(uint32 j=0; j<vertexCount; ++j){
vertices[j]= meshVertices[prevFrameBase+j].lerp(localT, meshVertices[nextFrameBase+j]); vertices[j]= meshVertices[prevFrameBase+j].lerp(localT, meshVertices[nextFrameBase+j]);
cacheVertices[t][cycle][j] = vertices[j]; if(enableCache == true) {
cacheVertices[t][cycle][j] = vertices[j];
}
} }
} }
} }
@ -122,20 +125,20 @@ void InterpolationData::updateNormals(float t, bool cycle){
uint32 vertexCount= mesh->getVertexCount(); uint32 vertexCount= mesh->getVertexCount();
if(frameCount > 1) { if(frameCount > 1) {
if(enableCache == true) {
std::map<float, std::map<bool, Vec3f *> >::iterator iterFind = cacheNormals.find(t); std::map<float, std::map<bool, Vec3f *> >::iterator iterFind = cacheNormals.find(t);
if(iterFind != cacheNormals.end()) { if(iterFind != cacheNormals.end()) {
std::map<bool, Vec3f *>::iterator iterFind2 = iterFind->second.find(cycle); std::map<bool, Vec3f *>::iterator iterFind2 = iterFind->second.find(cycle);
if(iterFind2 != iterFind->second.end()) { if(iterFind2 != iterFind->second.end()) {
//for(uint32 j=0; j< vertexCount; ++j){ //for(uint32 j=0; j< vertexCount; ++j){
// normals[j] = iterFind2->second[j]; // normals[j] = iterFind2->second[j];
//} //}
memcpy(normals,iterFind2->second,sizeof(Vec3f) * vertexCount); memcpy(normals,iterFind2->second,sizeof(Vec3f) * vertexCount);
return; return;
}
} }
cacheNormals[t][cycle] = new Vec3f[vertexCount];
} }
cacheNormals[t][cycle] = new Vec3f[vertexCount];
const Vec3f *meshNormals= mesh->getNormals(); const Vec3f *meshNormals= mesh->getNormals();
@ -154,7 +157,9 @@ void InterpolationData::updateNormals(float t, bool cycle){
for(uint32 j=0; j<vertexCount; ++j){ for(uint32 j=0; j<vertexCount; ++j){
normals[j]= meshNormals[prevFrameBase+j].lerp(localT, meshNormals[nextFrameBase+j]); normals[j]= meshNormals[prevFrameBase+j].lerp(localT, meshNormals[nextFrameBase+j]);
cacheNormals[t][cycle][j] = normals[j]; if(enableCache == true) {
cacheNormals[t][cycle][j] = normals[j];
}
} }
} }
} }