[Piglit] [PATCH 3/7] gl-1.0-blend: Trivial code simplification

Ian Romanick idr at freedesktop.org
Thu Apr 26 21:29:12 UTC 2018


From: Ian Romanick <ian.d.romanick at intel.com>

num_operators_rgb and num_operators_a always have the same value, so
just use one variable.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 tests/spec/gl-1.0/blend.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/tests/spec/gl-1.0/blend.c b/tests/spec/gl-1.0/blend.c
index 278ef75ac..3370cc70d 100644
--- a/tests/spec/gl-1.0/blend.c
+++ b/tests/spec/gl-1.0/blend.c
@@ -712,7 +712,7 @@ run_all_factor_sets(void)
 	int sf, sfa, df, dfa;
 
 	unsigned num_src_factors_sep, num_dst_factors_sep;
-	unsigned num_operators_rgb, num_operators_a;
+	unsigned num_operators;
 
 	/* Find out what kind of GL blending capability we have. */
 	if (gl_version >= 14) {
@@ -753,29 +753,27 @@ run_all_factor_sets(void)
 		num_dst_factors_sep = 1;
 	}
 
-	num_operators_rgb = 0;
+	num_operators = 0;
 	if (piglit_is_extension_supported("GL_EXT_blend_subtract")) {
-		memcpy(&operators[num_operators_rgb],
+		memcpy(&operators[num_operators],
 		       subtract_operators,
 		       ARRAY_SIZE(subtract_operators) * sizeof(operators[0]));
-		num_operators_rgb += ARRAY_SIZE(subtract_operators);
+		num_operators += ARRAY_SIZE(subtract_operators);
 	}
 	else {
-		num_operators_rgb = 1;
+		num_operators = 1;
 		operators[0] = GL_FUNC_ADD;
 	}
 
 	if (piglit_is_extension_supported("GL_EXT_blend_minmax")) {
-		memcpy(&operators[num_operators_rgb],
+		memcpy(&operators[num_operators],
 		       minmax_operators,
 		       ARRAY_SIZE(minmax_operators) * sizeof(operators[0]));
-		num_operators_rgb += ARRAY_SIZE(minmax_operators);
+		num_operators += ARRAY_SIZE(minmax_operators);
 	}
 
-	num_operators_a = num_operators_rgb;
-
-	for (op = 0; op < num_operators_rgb; ++op) {
-		for (opa = 0; opa < num_operators_a; ++opa) {
+	for (op = 0; op < num_operators; ++op) {
+		for (opa = 0; opa < num_operators; ++opa) {
 			if (operators[op] == GL_FUNC_ADD && 
 			    operators[opa] == GL_FUNC_ADD) {
 				/* test _all_ blend term combinations */
-- 
2.14.3



More information about the Piglit mailing list