42 #ifndef ACG_GPU_CACHE_OPT_HH 43 #define ACG_GPU_CACHE_OPT_HH 48 #include <ACG/Config/ACGDefines.hh> 81 GPUCacheOptimizer(
unsigned int NumTris,
unsigned int NumVerts,
unsigned int IndexSize,
const void* pIndices);
102 void WriteIndexBuffer(
unsigned int DstIndexSize,
void* pDst);
120 static void OptimizeVertices(
unsigned int NumTris,
unsigned int NumVerts,
unsigned int IndexSize,
121 const void* pIndices,
unsigned int* pVertMap);
150 static void RemapVertices(
unsigned int NumTris,
unsigned int NumVerts,
const unsigned int* pVertMap,
151 unsigned int IndexSize,
void* pInOutIndices,
unsigned int VertexStride,
void* pInOutVertices);
157 unsigned int ComputeNumberOfVertexTransformations(
unsigned int VertexCacheSize = 16);
163 float ComputeACMR(
unsigned int VertexCacheSize = 16);
171 float ComputeATVR(
unsigned int VertexCacheSize = 16);
175 unsigned int GetIndex(
unsigned int i)
const;
177 static unsigned int GetIndex(
unsigned int i,
unsigned int IndexSize,
const void* pIB);
178 static void SetIndex(
unsigned int i,
unsigned int val,
unsigned int IndexSize,
void* pIB);
180 virtual void MakeAbstract() = 0;
185 unsigned int m_NumVerts;
186 unsigned int m_NumTris;
195 unsigned int m_IndexSize;
196 const void* m_pIndices;
199 unsigned int m_NumTransformations;
221 void FindScore(
unsigned int MaxSizeVertexCache);
223 void RemoveTriFromList(
unsigned int tri);
228 Opt_Tris() : bAdded(0), fScore(0.0f)
229 { v[0] = v[1] = v[2] = 0xDEADBEEF;}
237 inline void FindScore(
const Opt_Vertex* pVertices)
240 for (
int i = 0; i < 3; ++i)
241 fScore += pVertices[v[i]].fScore;
267 unsigned int NumTris,
268 unsigned int NumVerts,
269 unsigned int IndexSize,
270 const void* pIndices);
274 void MakeAbstract(){}
280 unsigned int* pStack;
281 unsigned int uiStart, uiLen;
284 inline unsigned int pos(
unsigned int i)
const 286 unsigned int t = uiStart + i;
287 if (t >= uiLen) t -= uiLen;
292 explicit RingStack(
unsigned int _uiSize) :
297 pStack =
new unsigned int[uiSize];
303 uiSize = _other.uiSize;
304 uiLen = _other.uiLen;
305 uiStart = _other.uiStart;
308 pStack =
new unsigned int[uiSize];
311 for (
unsigned int i = 0 ; i < uiSize; ++i )
312 pStack[i] = _other.pStack[i];
318 unsigned int length()
const {
return uiLen;}
319 unsigned int size()
const {
return uiSize;}
321 inline void push(
unsigned int v)
325 pStack[uiStart++] = v;
326 if (uiStart == uiSize) uiStart = 0;
329 pStack[pos(uiLen++)] = v;
332 inline unsigned int pop()
334 if (uiSize && uiLen)
return pStack[pos(--uiLen)];
347 GPUCacheEfficiencyTester(
unsigned int NumTris,
unsigned int NumVerts,
unsigned int IndexSize,
const void* pIndices);
350 void MakeAbstract(){}
358 #endif // ACG_GPU_CACHE_OPT_HH defined const unsigned int * GetTriangleMap() const
Retrieves the map from dst triangle to src triangle. how to remap: for each triangle t in DstTriBuffe...
Namespace providing different geometric functions concerning angles.
unsigned int size() const
reserved stack size i.e. maximum length
int iNumTrisTotal
tris using this vertex
int iNumTrisLeft
tris left to add to final result
float fScore
sum of scores of vertices
Simple and fast fixed size stack used in tipsify implementation.
unsigned int length() const
current stack length