Add more structure constructor tests.
[piglit/hramrach.git] / tests / glean / tvtxperf.h
blob755902ea4604295d0a5762934967cac8a7f1c38f
1 // BEGIN_COPYRIGHT -*- glean -*-
2 //
3 // Copyright (C) 2000 Allen Akin All Rights Reserved.
4 //
5 // Permission is hereby granted, free of charge, to any person
6 // obtaining a copy of this software and associated documentation
7 // files (the "Software"), to deal in the Software without
8 // restriction, including without limitation the rights to use,
9 // copy, modify, merge, publish, distribute, sublicense, and/or
10 // sell copies of the Software, and to permit persons to whom the
11 // Software is furnished to do so, subject to the following
12 // conditions:
13 //
14 // The above copyright notice and this permission notice shall be
15 // included in all copies or substantial portions of the
16 // Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 // KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
21 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ALLEN AKIN BE
22 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 // OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 // DEALINGS IN THE SOFTWARE.
26 //
27 // END_COPYRIGHT
29 // tvtxperf.h: Test performance of various ways to specify vertex data
31 #ifndef __tvtxperf_h__
32 #define __tvtxperf_h__
34 #include "tbase.h"
36 namespace GLEAN {
38 #define drawingSize 256
40 // Auxiliary struct for holding a vertex-performance result:
41 class VPSubResult {
42 public:
43 double tps; // Triangles Per Second
44 double tpsLow; // Low end of tps range
45 double tpsHigh; // High end of tps range
46 bool imageOK; // Image sanity-check status
47 bool imageMatch; // Image comparison status
49 VPSubResult() {
50 tps = tpsLow = tpsHigh = 0.0;
51 imageOK = imageMatch = true;
54 void put(ostream& s) const {
55 s << tps
56 << ' ' << tpsLow
57 << ' ' << tpsHigh
58 << ' ' << imageOK
59 << ' ' << imageMatch
60 << '\n';
63 void get(istream& s) {
64 s >> tps >> tpsLow >> tpsHigh >> imageOK >> imageMatch;
68 class VPResult: public BaseResult {
69 public:
70 bool skipped; // prerequisite tests failed
71 bool pass;
73 VPSubResult imTri; // immediate-mode independent triangles
74 VPSubResult dlTri; // display-listed independent triangles
75 VPSubResult daTri; // DrawArrays independent triangles
76 VPSubResult ldaTri; // Locked DrawArrays independent tris
77 VPSubResult deTri; // DrawElements independent triangles
78 VPSubResult ldeTri; // Locked DrawElements ind. tris
80 VPSubResult imTS; // immediate-mode triangle strip
81 VPSubResult dlTS; // display-listed triangle strip
82 VPSubResult daTS; // DrawArrays triangle strip
83 VPSubResult ldaTS; // Locked DrawArrays triangle strip
84 VPSubResult deTS; // DrawElements triangle strip
85 VPSubResult ldeTS; // Locked DrawElements triangle strip
87 virtual void putresults(ostream& s) const {
89 << skipped << '\n'
90 << pass << '\n'
93 imTri.put(s);
94 dlTri.put(s);
95 daTri.put(s);
96 ldaTri.put(s);
97 deTri.put(s);
98 ldeTri.put(s);
100 imTS.put(s);
101 dlTS.put(s);
102 daTS.put(s);
103 ldaTS.put(s);
104 deTS.put(s);
105 ldeTS.put(s);
108 virtual bool getresults(istream& s) {
110 >> skipped
111 >> pass
113 imTri.get(s);
114 dlTri.get(s);
115 daTri.get(s);
116 ldaTri.get(s);
117 deTri.get(s);
118 ldeTri.get(s);
120 imTS.get(s);
121 dlTS.get(s);
122 daTS.get(s);
123 ldaTS.get(s);
124 deTS.get(s);
125 ldeTS.get(s);
127 return s.good();
131 class ColoredLitPerf: public BaseTest<VPResult> {
132 public:
133 GLEAN_CLASS_WHO(ColoredLitPerf, VPResult,
134 drawingSize, drawingSize, true);
135 void logStats(VPResult& r, GLEAN::Environment* env);
136 }; // class ColoredLitPerf
138 class ColoredTexPerf: public BaseTest<VPResult> {
139 public:
140 GLEAN_CLASS_WHO(ColoredTexPerf, VPResult,
141 drawingSize, drawingSize, true);
142 void logStats(VPResult& r, GLEAN::Environment* env);
143 }; // class ColoredTexPerf
145 } // namespace GLEAN
147 #endif // __tvtxperf_h__