Ian Romanick <[email protected]> writes: > From: Ian Romanick <[email protected]> > > And vice versa. > > Signed-off-by: Ian Romanick <[email protected]> > --- > tests/spec/gl-1.0/blend.c | 40 ++++++++++++++++++++++++++-------------- > 1 file changed, 26 insertions(+), 14 deletions(-) > > diff --git a/tests/spec/gl-1.0/blend.c b/tests/spec/gl-1.0/blend.c > index 0cacf69cb..278ef75ac 100644 > --- a/tests/spec/gl-1.0/blend.c > +++ b/tests/spec/gl-1.0/blend.c > @@ -115,14 +115,20 @@ static const GLenum dst_factors[] = { > GL_CONSTANT_ALPHA, > GL_ONE_MINUS_CONSTANT_ALPHA > }; > -static const GLenum operators[] = { > + > +static const GLenum subtract_operators[] = { > GL_FUNC_ADD, > GL_FUNC_SUBTRACT, > - GL_FUNC_REVERSE_SUBTRACT, > + GL_FUNC_REVERSE_SUBTRACT > +}; > + > +static const GLenum minmax_operators[] = { > GL_MIN, > GL_MAX > }; > > +GLenum operators[ARRAY_SIZE(subtract_operators) + > ARRAY_SIZE(minmax_operators)]; > + > struct image { > GLuint name; > GLfloat *data; > @@ -714,14 +720,8 @@ run_all_factor_sets(void) > have_blend_color = true; > have_sep_func = true; > } else { > - /* glBlendEquation is added by either extension. > - * However, there is only one table of operators to > - * test, and it includes the operators from both > - * extensions. In Mesa, only R100 supports > - * GL_EXT_blend_subtract but not GL_EXT_blend_minmax. > - */ > have_blend_equation = > - piglit_is_extension_supported("GL_EXT_blend_subtract") > && > + piglit_is_extension_supported("GL_EXT_blend_subtract") > || > piglit_is_extension_supported("GL_EXT_blend_minmax"); > have_blend_color = > piglit_is_extension_supported("GL_EXT_blend_color"); > @@ -753,15 +753,27 @@ run_all_factor_sets(void) > num_dst_factors_sep = 1; > } > > - if (have_blend_equation) { > - num_operators_rgb = ARRAY_SIZE(operators); > - num_operators_a = ARRAY_SIZE(operators); > + num_operators_rgb = 0; > + if (piglit_is_extension_supported("GL_EXT_blend_subtract")) { > + memcpy(&operators[num_operators_rgb], > + subtract_operators, > + ARRAY_SIZE(subtract_operators) * sizeof(operators[0])); > + num_operators_rgb += ARRAY_SIZE(subtract_operators); > } > else { > - num_operators_rgb = 1; /* just ADD */ > - num_operators_a = 1; /* just ADD */ > + num_operators_rgb = 1; > + operators[0] = GL_FUNC_ADD; > + } > + > + if (piglit_is_extension_supported("GL_EXT_blend_minmax")) { > + memcpy(&operators[num_operators_rgb], > + minmax_operators, > + ARRAY_SIZE(minmax_operators) * sizeof(operators[0])); > + num_operators_rgb += ARRAY_SIZE(minmax_operators); > }
This all feels like it could be *so* much simpler.
operators[num_operators_rgb++] = GL_FUNC_ADD;
if (piglit_is_extension_supported("GL_EXT_blend_subtract"))
operators[num_operators_rgb++] = GL_FUNC_SUBTRACT;
operators[num_operators_rgb++] = GL_FUNC_REVERSE_SUBTRACT;
if (piglit_is_extension_supported("GL_EXT_blend_minmax")) {
operators[num_operators_rgb++] = GL_MIN;
operators[num_operators_rgb++] = GL_MAX;
}
assert(num_operators_rgb <= ARRAY_SIZE(operators);
num_operators_a = num_operators_rgb;
signature.asc
Description: PGP signature
_______________________________________________ Piglit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/piglit
