summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2011-02-06 10:56:32 +0000
committerJosé Fonseca <jfonseca@vmware.com>2011-02-07 15:58:31 +0000
commit95311553470f2c532776c252a3936eb200bcfcf7 (patch)
tree6ebd3b9e611d86298cd8044b8c6608c9a5bbf1f0
parentbfab4d5d11b28aa6ac75b4f01a8127cfe6dbd4bb (diff)
blendFunc: observe the --quick flag.
Using the same approach as texCombine. Logged all combinations and ensured that the frequencies match the desired.
-rw-r--r--src/glean/tblend.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/glean/tblend.cpp b/src/glean/tblend.cpp
index 057ee4a..2d8d5a2 100644
--- a/src/glean/tblend.cpp
+++ b/src/glean/tblend.cpp
@@ -37,6 +37,8 @@
#define ELEMENTS(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
+#define HUGE_STEP 1000
+
namespace GLEAN {
static PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate_func = NULL;
static PFNGLBLENDCOLORPROC glBlendColor_func = NULL;
@@ -695,6 +697,7 @@ BlendFuncTest::runOne(BlendFuncResult& r, Window& w) {
unsigned numOperatorsRGB, numOperatorsA;
BlendFuncResult::PartialResult p;
bool allPassed = true;
+ unsigned testNo, testStride;
// test for features, get function pointers
if (GLUtils::getVersion() >= 1.4) {
@@ -770,6 +773,18 @@ BlendFuncTest::runOne(BlendFuncResult& r, Window& w) {
numOperatorsA = 1; // just ADD
}
+ // If quick mode, run fewer tests
+ if (env->options.quick) {
+ testStride = 11; // a prime number
+ assert(ELEMENTS(srcFactors) % testStride);
+ assert(ELEMENTS(dstFactors) % testStride);
+ assert(ELEMENTS(operators) % testStride);
+ }
+ else {
+ testStride = 1;
+ }
+ testNo = testStride - 1;
+
#if 0
// use this to test a single combination:
p.srcRGB = p.srcA = GL_SRC_ALPHA;
@@ -792,7 +807,7 @@ BlendFuncTest::runOne(BlendFuncResult& r, Window& w) {
else if (p.opRGB == GL_MIN || p.opRGB == GL_MAX ||
p.opA == GL_MIN || p.opA == GL_MAX) {
// blend terms are N/A so only do one iteration of loops
- step = 1000;
+ step = HUGE_STEP;
}
else {
// subtract modes: do every 3rd blend term for speed
@@ -831,6 +846,15 @@ BlendFuncTest::runOne(BlendFuncResult& r, Window& w) {
needsBlendColor(p.dstA)))
continue;
+ // skip all but every testStride-th test
+ ++testNo;
+ if (testNo == testStride || step >= HUGE_STEP) {
+ testNo = 0;
+ }
+ else {
+ continue;
+ }
+
if (!runCombo(r, w, p, *env)) {
allPassed = false;
}