50 #ifndef ACG_GPU_CACHE_OPT_HH 51 #define ACG_GPU_CACHE_OPT_HH 56 #include <ACG/Config/ACGDefines.hh> 89 GPUCacheOptimizer(
unsigned int NumTris,
unsigned int NumVerts,
unsigned int IndexSize,
const void* pIndices);
110 void WriteIndexBuffer(
unsigned int DstIndexSize,
void* pDst);
128 static void OptimizeVertices(
unsigned int NumTris,
unsigned int NumVerts,
unsigned int IndexSize,
129 const void* pIndices,
unsigned int* pVertMap);
158 static void RemapVertices(
unsigned int NumTris,
unsigned int NumVerts,
const unsigned int* pVertMap,
159 unsigned int IndexSize,
void* pInOutIndices,
unsigned int VertexStride,
void* pInOutVertices);
165 unsigned int ComputeNumberOfVertexTransformations(
unsigned int VertexCacheSize = 16);
171 float ComputeACMR(
unsigned int VertexCacheSize = 16);
179 float ComputeATVR(
unsigned int VertexCacheSize = 16);
183 unsigned int GetIndex(
unsigned int i)
const;
185 static unsigned int GetIndex(
unsigned int i,
unsigned int IndexSize,
const void* pIB);
186 static void SetIndex(
unsigned int i,
unsigned int val,
unsigned int IndexSize,
void* pIB);
188 virtual void MakeAbstract() = 0;
193 unsigned int m_NumVerts;
194 unsigned int m_NumTris;
203 unsigned int m_IndexSize;
204 const void* m_pIndices;
207 unsigned int m_NumTransformations;
229 void FindScore(
unsigned int MaxSizeVertexCache);
231 void RemoveTriFromList(
unsigned int tri);
236 Opt_Tris() : bAdded(0), fScore(0.0f)
237 { v[0] = v[1] = v[2] = 0xDEADBEEF;}
245 inline void FindScore(
const Opt_Vertex* pVertices)
248 for (
int i = 0; i < 3; ++i)
249 fScore += pVertices[v[i]].fScore;
275 unsigned int NumTris,
276 unsigned int NumVerts,
277 unsigned int IndexSize,
278 const void* pIndices);
282 void MakeAbstract(){}
288 unsigned int* pStack;
289 unsigned int uiStart, uiLen;
292 inline unsigned int pos(
unsigned int i)
const 294 unsigned int t = uiStart + i;
295 if (t >= uiLen) t -= uiLen;
305 pStack =
new unsigned int[uiSize];
311 uiSize = _other.uiSize;
312 uiLen = _other.uiLen;
313 uiStart = _other.uiStart;
316 pStack =
new unsigned int[uiSize];
319 for (
unsigned int i = 0 ; i < uiSize; ++i )
320 pStack[i] = _other.pStack[i];
326 unsigned int length()
const {
return uiLen;}
327 unsigned int size()
const {
return uiSize;}
329 inline void push(
unsigned int v)
333 pStack[uiStart++] = v;
334 if (uiStart == uiSize) uiStart = 0;
337 pStack[pos(uiLen++)] = v;
340 inline unsigned int pop()
342 if (uiSize && uiLen)
return pStack[pos(--uiLen)];
355 GPUCacheEfficiencyTester(
unsigned int NumTris,
unsigned int NumVerts,
unsigned int IndexSize,
const void* pIndices);
358 void MakeAbstract(){}
366 #endif // ACG_GPU_CACHE_OPT_HH defined
unsigned int length() const
current stack length
int iNumTrisLeft
tris left to add to final result
Simple and fast fixed size stack used in tipsify implementation.
const unsigned int * GetTriangleMap() const
Retrieves the map from dst triangle to src triangle. how to remap: for each triangle t in DstTriBuffe...
float fScore
sum of scores of vertices
int iNumTrisTotal
tris using this vertex
unsigned int size() const
reserved stack size i.e. maximum length
Namespace providing different geometric functions concerning angles.