Line | |
---|
1 | //
|
---|
2 | // Copyright (C) 2004 Tanguy Fautré.
|
---|
3 | // For conditions of distribution and use,
|
---|
4 | // see copyright notice in tri_stripper.h
|
---|
5 | //
|
---|
6 | //////////////////////////////////////////////////////////////////////
|
---|
7 | // SVN: $Id: policy.cpp 86 2005-06-08 17:47:27Z gpsnoopy $
|
---|
8 | //////////////////////////////////////////////////////////////////////
|
---|
9 |
|
---|
10 | #include "detail/policy.h"
|
---|
11 |
|
---|
12 |
|
---|
13 |
|
---|
14 |
|
---|
15 | namespace triangle_stripper {
|
---|
16 |
|
---|
17 | namespace detail {
|
---|
18 |
|
---|
19 |
|
---|
20 |
|
---|
21 |
|
---|
22 | void policy::Challenge(strip Strip, size_t Degree, size_t CacheHits)
|
---|
23 | {
|
---|
24 | if (Strip.Size() < m_MinStripSize)
|
---|
25 | return;
|
---|
26 |
|
---|
27 | // Cache is disabled, take the longest strip
|
---|
28 | if (! m_Cache) {
|
---|
29 |
|
---|
30 | if (Strip.Size() > m_Strip.Size())
|
---|
31 | m_Strip = Strip;
|
---|
32 |
|
---|
33 | // Cache simulator enabled
|
---|
34 | } else {
|
---|
35 |
|
---|
36 | // Priority 1: Keep the strip with the best cache hit count
|
---|
37 | if (CacheHits > m_CacheHits) {
|
---|
38 | m_Strip = Strip;
|
---|
39 | m_Degree = Degree;
|
---|
40 | m_CacheHits = CacheHits;
|
---|
41 |
|
---|
42 | } else if (CacheHits == m_CacheHits) {
|
---|
43 |
|
---|
44 | // Priority 2: Keep the strip with the loneliest start triangle
|
---|
45 | if ((m_Strip.Size() != 0) && (Degree < m_Degree)) {
|
---|
46 | m_Strip = Strip;
|
---|
47 | m_Degree = Degree;
|
---|
48 |
|
---|
49 | // Priority 3: Keep the longest strip
|
---|
50 | } else if (Strip.Size() > m_Strip.Size()) {
|
---|
51 | m_Strip = Strip;
|
---|
52 | m_Degree = Degree;
|
---|
53 | }
|
---|
54 | }
|
---|
55 | }
|
---|
56 | }
|
---|
57 |
|
---|
58 |
|
---|
59 |
|
---|
60 |
|
---|
61 | } // namespace detail
|
---|
62 |
|
---|
63 | } // namespace triangle_stripper
|
---|
Note: See
TracBrowser
for help on using the repository browser.