[Piglit] [PATCH 2/7] gl-1.0-blend: Enable EXT_blend_subtract tests on implementations that lack EXT_blend_minmax
Ian Romanick
idr at freedesktop.org
Thu May 3 21:25:29 UTC 2018
On 05/02/2018 10:47 AM, Eric Anholt wrote:
> Ian Romanick <idr at freedesktop.org> writes:
>
>> From: Ian Romanick <ian.d.romanick at intel.com>
>>
>> And vice versa.
>>
>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>> ---
>> 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;
Yeah, that's a nice cleanup. Updated patch on the way shortly.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20180503/5a9e77b2/attachment.sig>
More information about the Piglit
mailing list