mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 20:38:06 +02:00
r600: handle cayman border color sint formats
This is the cayman implementation for these border
color formats which are already working on evergreen.
Here are the tests fixed:
deqp-gles31/functional/texture/border_clamp/formats/r16i/nearest_size_npot: fail pass
deqp-gles31/functional/texture/border_clamp/formats/r16i/nearest_size_pot: fail pass
deqp-gles31/functional/texture/border_clamp/formats/r8i/nearest_size_npot: fail pass
deqp-gles31/functional/texture/border_clamp/formats/r8i/nearest_size_pot: fail pass
deqp-gles31/functional/texture/border_clamp/formats/rg16i/nearest_size_npot: fail pass
deqp-gles31/functional/texture/border_clamp/formats/rg16i/nearest_size_pot: fail pass
deqp-gles31/functional/texture/border_clamp/formats/rg8i/nearest_size_npot: fail pass
deqp-gles31/functional/texture/border_clamp/formats/rg8i/nearest_size_pot: fail pass
deqp-gles31/functional/texture/border_clamp/formats/rgb16i/nearest_size_npot: fail pass
deqp-gles31/functional/texture/border_clamp/formats/rgb16i/nearest_size_pot: fail pass
deqp-gles31/functional/texture/border_clamp/formats/rgb8i/nearest_size_npot: fail pass
deqp-gles31/functional/texture/border_clamp/formats/rgb8i/nearest_size_pot: fail pass
deqp-gles31/functional/texture/border_clamp/per_axis_wrap_mode/texture_2d/int_color/nearest/s_clamp_to_edge_t_clamp_to_border_npot: fail pass
deqp-gles31/functional/texture/border_clamp/per_axis_wrap_mode/texture_2d/int_color/nearest/s_clamp_to_edge_t_clamp_to_border_pot: fail pass
deqp-gles31/functional/texture/border_clamp/per_axis_wrap_mode/texture_2d/int_color/nearest/s_mirrored_repeat_t_clamp_to_border_npot: fail pass
deqp-gles31/functional/texture/border_clamp/per_axis_wrap_mode/texture_2d/int_color/nearest/s_mirrored_repeat_t_clamp_to_border_pot: fail pass
deqp-gles31/functional/texture/border_clamp/per_axis_wrap_mode/texture_2d/int_color/nearest/s_repeat_t_clamp_to_border_npot: fail pass
deqp-gles31/functional/texture/border_clamp/per_axis_wrap_mode/texture_2d/int_color/nearest/s_repeat_t_clamp_to_border_pot: fail pass
deqp-gles31/functional/texture/border_clamp/per_axis_wrap_mode/texture_3d/int_color/nearest/s_clamp_to_border_t_clamp_to_border_r_clamp_to_border_npot: fail pass
deqp-gles31/functional/texture/border_clamp/per_axis_wrap_mode/texture_3d/int_color/nearest/s_clamp_to_border_t_clamp_to_border_r_clamp_to_border_pot: fail pass
deqp-gles31/functional/texture/border_clamp/per_axis_wrap_mode/texture_3d/int_color/nearest/s_clamp_to_border_t_clamp_to_border_r_repeat_npot: fail pass
deqp-gles31/functional/texture/border_clamp/per_axis_wrap_mode/texture_3d/int_color/nearest/s_clamp_to_border_t_clamp_to_border_r_repeat_pot: fail pass
deqp-gles31/functional/texture/border_clamp/per_axis_wrap_mode/texture_3d/int_color/nearest/s_mirrored_repeat_t_clamp_to_border_r_repeat_npot: fail pass
deqp-gles31/functional/texture/border_clamp/per_axis_wrap_mode/texture_3d/int_color/nearest/s_mirrored_repeat_t_clamp_to_border_r_repeat_pot: fail pass
deqp-gles31/functional/texture/border_clamp/per_axis_wrap_mode/texture_3d/int_color/nearest/s_repeat_t_mirrored_repeat_r_clamp_to_border_npot: fail pass
deqp-gles31/functional/texture/border_clamp/per_axis_wrap_mode/texture_3d/int_color/nearest/s_repeat_t_mirrored_repeat_r_clamp_to_border_pot: fail pass
deqp-gles31/functional/texture/border_clamp/range_clamp/nearest_int_color: fail pass
deqp-gles31/functional/texture/border_clamp/sampler/int_color: fail pass
Cc: mesa-stable
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35280>
(cherry picked from commit 1d28931d2c)
This commit is contained in:
parent
71cf1fed4f
commit
d85452e2c9
2 changed files with 73 additions and 5 deletions
|
|
@ -1334,7 +1334,7 @@
|
|||
"description": "r600: handle cayman border color sint formats",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -2461,6 +2461,39 @@ static void border_swizzle_nr_channels_2(const unsigned *swizzle,
|
|||
}
|
||||
}
|
||||
|
||||
/* These two functions cayman_sint8() and cayman_sint16() calculate
|
||||
* the sint border color value in a way compatible with cayman.
|
||||
* The functions check first that the value is in the representable
|
||||
* range, if not the value is clamped. In both cases the value is
|
||||
* truncated to be compatible with what cayman expects. */
|
||||
static inline unsigned cayman_sint8(const unsigned value)
|
||||
{
|
||||
const unsigned mask = 0xffffff80U;
|
||||
const unsigned value_masked = value & mask;
|
||||
|
||||
if (likely(!value_masked ||
|
||||
value_masked == mask))
|
||||
return value & 0xff;
|
||||
|
||||
return value & (1U<<31) ?
|
||||
0x80 :
|
||||
0x7f;
|
||||
}
|
||||
|
||||
static inline unsigned cayman_sint16(const unsigned value)
|
||||
{
|
||||
const unsigned mask = 0xffff8000U;
|
||||
const unsigned value_masked = value & mask;
|
||||
|
||||
if (likely(!value_masked ||
|
||||
value_masked == mask))
|
||||
return value & 0xffff;
|
||||
|
||||
return value & (1U<<31) ?
|
||||
0x8000 :
|
||||
0x7fff;
|
||||
}
|
||||
|
||||
static void cayman_convert_border_color(union pipe_color_union *in,
|
||||
union pipe_color_union *out,
|
||||
struct pipe_sampler_view *view)
|
||||
|
|
@ -2496,10 +2529,28 @@ static void cayman_convert_border_color(union pipe_color_union *in,
|
|||
} else {
|
||||
memcpy(output_swz, neutral_swz, sizeof(output_swz));
|
||||
}
|
||||
out->f[output_swz[0]] = in->f[0];
|
||||
out->f[output_swz[1]] = in->f[1];
|
||||
out->f[output_swz[2]] = in->f[2];
|
||||
out->f[output_swz[3]] = in->f[3];
|
||||
switch(format) {
|
||||
case PIPE_FORMAT_R8_SINT:
|
||||
case PIPE_FORMAT_R8G8_SINT:
|
||||
out->ui[output_swz[0]] = cayman_sint8(in->ui[0]);
|
||||
out->ui[output_swz[1]] = cayman_sint8(in->ui[1]);
|
||||
out->ui[output_swz[2]] = cayman_sint8(in->ui[2]);
|
||||
out->ui[output_swz[3]] = cayman_sint8(in->ui[3]);
|
||||
break;
|
||||
case PIPE_FORMAT_R16_SINT:
|
||||
case PIPE_FORMAT_R16G16_SINT:
|
||||
out->ui[output_swz[0]] = cayman_sint16(in->ui[0]);
|
||||
out->ui[output_swz[1]] = cayman_sint16(in->ui[1]);
|
||||
out->ui[output_swz[2]] = cayman_sint16(in->ui[2]);
|
||||
out->ui[output_swz[3]] = cayman_sint16(in->ui[3]);
|
||||
break;
|
||||
default:
|
||||
out->f[output_swz[0]] = in->f[0];
|
||||
out->f[output_swz[1]] = in->f[1];
|
||||
out->f[output_swz[2]] = in->f[2];
|
||||
out->f[output_swz[3]] = in->f[3];
|
||||
break;
|
||||
}
|
||||
} else if ((!util_format_is_alpha(format) &&
|
||||
!util_format_is_luminance(format) &&
|
||||
!util_format_is_luminance_alpha(format) &&
|
||||
|
|
@ -2525,6 +2576,23 @@ static void cayman_convert_border_color(union pipe_color_union *in,
|
|||
out->f[1] = values[view->swizzle_g];
|
||||
out->f[2] = values[view->swizzle_b];
|
||||
out->f[3] = values[view->swizzle_a];
|
||||
|
||||
switch(format) {
|
||||
case PIPE_FORMAT_R8G8B8X8_SINT:
|
||||
out->ui[0] = cayman_sint8(out->ui[0]);
|
||||
out->ui[1] = cayman_sint8(out->ui[1]);
|
||||
out->ui[2] = cayman_sint8(out->ui[2]);
|
||||
out->ui[3] = cayman_sint8(out->ui[3]);
|
||||
break;
|
||||
case PIPE_FORMAT_R16G16B16X16_SINT:
|
||||
out->ui[0] = cayman_sint16(out->ui[0]);
|
||||
out->ui[1] = cayman_sint16(out->ui[1]);
|
||||
out->ui[2] = cayman_sint16(out->ui[2]);
|
||||
out->ui[3] = cayman_sint16(out->ui[3]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
memcpy(out->f, in->f, 4 * sizeof(float));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue