1 // BEGIN_COPYRIGHT -*- glean -*-
3 // Copyright (C) 1999 Allen Akin All Rights Reserved.
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
14 // The above copyright notice and this permission notice shall be
15 // included in all copies or substantial portions of the
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.
30 // ttexcombing.h: Test the GL_EXT_texture_env_combine extension
31 // Author: Brian Paul (brianp@valinux.com) September 2000
34 #ifndef __ttexcombine_h__
35 #define __ttexcombine_h__
41 #define MAX_TEX_UNITS 8
43 class TexCombineTest
: public BasicTest
{
45 TexCombineTest(const char* testName
, const char* filter
,
46 const char* description
):
48 BasicTest(testName
, filter
, "GL_ARB_texture_env_combine",
51 BasicTest(testName
, filter
, "GL_EXT_texture_env_combine",
58 virtual void runOne(BasicResult
& r
, Window
& w
);
59 virtual void logOne(BasicResult
& r
);
62 // Our model of GL machine state
64 GLenum COMBINE_RGB
[MAX_TEX_UNITS
];
65 GLenum COMBINE_ALPHA
[MAX_TEX_UNITS
];
66 GLenum SOURCE0_RGB
[MAX_TEX_UNITS
];
67 GLenum SOURCE1_RGB
[MAX_TEX_UNITS
];
68 GLenum SOURCE2_RGB
[MAX_TEX_UNITS
];
69 GLenum SOURCE0_ALPHA
[MAX_TEX_UNITS
];
70 GLenum SOURCE1_ALPHA
[MAX_TEX_UNITS
];
71 GLenum SOURCE2_ALPHA
[MAX_TEX_UNITS
];
72 GLenum OPERAND0_RGB
[MAX_TEX_UNITS
];
73 GLenum OPERAND1_RGB
[MAX_TEX_UNITS
];
74 GLenum OPERAND2_RGB
[MAX_TEX_UNITS
];
75 GLenum OPERAND0_ALPHA
[MAX_TEX_UNITS
];
76 GLenum OPERAND1_ALPHA
[MAX_TEX_UNITS
];
77 GLenum OPERAND2_ALPHA
[MAX_TEX_UNITS
];
78 GLfloat RGB_SCALE
[MAX_TEX_UNITS
];
79 GLfloat ALPHA_SCALE
[MAX_TEX_UNITS
];
80 GLfloat FragColor
[4]; // fragment color
81 GLfloat EnvColor
[MAX_TEX_UNITS
][4]; // texture env color
82 GLfloat TexColor
[MAX_TEX_UNITS
][4]; // texture image color
83 GLenum TexFormat
[MAX_TEX_UNITS
]; // texture base format
87 // describes possible state combinations
90 GLenum validValues
[6];
94 static test_param ReplaceParams
[];
95 static test_param ModulateParams
[];
96 static test_param AddParams
[];
97 static test_param AddSignedParams
[];
98 static test_param InterpolateParams
[];
99 static test_param Dot3RGBParams
[];
100 static test_param Dot3RGBAParams
[];
101 static test_param MultitexParams
[];
102 static test_param CrossbarParams
[];
105 GLfloat mTolerance
[4];
106 GLuint mTextures
[MAX_TEX_UNITS
];
109 void ResetMachine(glmachine
&machine
);
110 void ComputeTexCombine(const glmachine
&machine
, int texUnit
,
111 const GLfloat prevColor
[4], GLfloat result
[4]) const;
112 void PrintMachineState(const glmachine
&machine
) const;
113 bool VerifyMachineState(const glmachine
&machine
) const;
114 void ReportFailure(const glmachine
&machine
, const GLfloat expected
[4],
115 const GLfloat rendered
[4], BasicResult
&r
, const char *where
);
116 void TexEnv(glmachine
&machine
, int texUnit
, GLenum target
,
118 void SetupTestEnv(glmachine
&machine
, int texUnit
, int testNum
,
119 const test_param testParams
[]);
120 void SetupColors(struct glmachine
&machine
);
121 int CountTestCombinations(const test_param testParams
[]) const;
122 bool RunSingleTextureTest(glmachine
&machine
,
123 const test_param testParams
[], BasicResult
&r
, Window
&w
);
124 int CountMultiTextureTestCombinations(const glmachine
&machine
) const;
125 bool RunMultiTextureTest(glmachine
&machine
, BasicResult
&r
, Window
&w
);
126 int CountCrossbarCombinations() const;
127 bool RunCrossbarTest(glmachine
&machine
, BasicResult
&r
, Window
&w
);
129 PFNGLACTIVETEXTUREARBPROC p_glActiveTextureARB
;
130 PFNGLMULTITEXCOORD2FARBPROC p_glMultiTexCoord2fARB
;
132 }; // class TexCombineTest
136 #endif // __ttexcombine_h__