Add more structure constructor tests.
[piglit/hramrach.git] / tests / glean / tblend.h
blobef733c1faedfa7df322c55dfd10577879c8fe91a
1 // BEGIN_COPYRIGHT -*- glean -*-
2 //
3 // Copyright (C) 1999 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:
14 // The above copyright notice and this permission notice shall be
15 // included in all copies or substantial portions of the
16 // Software.
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.
27 // END_COPYRIGHT
29 // tblend.h: Test blending functions.
31 #ifndef __tblend_h__
32 #define __tblend_h__
34 #include "tbase.h"
36 namespace GLEAN {
38 #define drawingSize 8 // We will check each pair of blend factors
39 // for each pixel in a square image of this
40 // dimension, so if you make it too large,
41 // the tests may take quite a while to run.
42 #define windowSize (drawingSize + 2)
44 class BlendFuncResult: public BaseResult {
45 public:
46 bool pass; // not written to log file
48 struct PartialResult {
49 GLenum srcRGB, srcA; // Source blend factor.
50 GLenum dstRGB, dstA; // Destination blend factor.
51 GLenum opRGB, opA; // Operator (add, sub, min, max)
52 GLfloat constColor[4];
53 float rbErr; // Max readback error, in bits.
54 float blErr; // Max blend error, in bits.
56 vector<PartialResult> results;
58 virtual void putresults(ostream& s) const;
59 virtual bool getresults(istream& s);
62 class BlendFuncTest: public BaseTest<BlendFuncResult> {
63 public:
64 GLEAN_CLASS_WH(BlendFuncTest, BlendFuncResult,
65 windowSize, windowSize);
67 private:
68 struct runFactorsResult {
69 float readbackErrorBits;
70 float blendRGBErrorBits;
71 float blendAlphaErrorBits;
74 runFactorsResult runFactors(GLenum srcFactorRGB, GLenum srcFactorA,
75 GLenum dstFactorRGB, GLenum dstFactorA,
76 GLenum opRGB, GLenum opA,
77 const GLfloat constantColor[4],
78 GLEAN::DrawingSurfaceConfig& config,
79 GLEAN::Environment& env,
80 float rgbTolerance, float alphaTolerance);
82 bool runCombo(BlendFuncResult& r, Window& w,
83 BlendFuncResult::PartialResult p,
84 GLEAN::Environment& env,
85 float rgbTolerance, float alphaTolerance);
87 bool equalMode(const BlendFuncResult::PartialResult &r1,
88 const BlendFuncResult::PartialResult &r2) const;
90 void printMode(const BlendFuncResult::PartialResult &r) const;
92 bool haveSepFunc;
93 bool haveBlendEquation;
94 bool haveBlendEquationSep;
95 bool haveBlendColor;
97 }; // class BlendFuncTest
99 } // namespace GLEAN
101 #endif // __tblend_h__