[Mesa-dev] [PATCH 09/24] st/mesa: sink code needed for apply_texture_swizzle_to_border_color
Marek Olšák
maraeo at gmail.com
Wed Jun 14 17:27:40 UTC 2017
On Tue, Jun 13, 2017 at 8:10 AM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
>
>
> On 13/06/17 04:18, Marek Olšák wrote:
>>
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> AMD SI-VI use this. GFX9 doesn't. We can stop doing this for SI-VI since
>> border color swizzling is broken there anyway. The only other user of this
>> code is nouveau.
>
>
> Maybe move this comment into the code as a TODO? I was a little confused at
> first as I thought this commit was meant to make the change. With that:
I don't understand. What are you confused about?
Marek
>
> Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
>
>
>> ---
>> src/mesa/state_tracker/st_atom_sampler.c | 61
>> +++++++++++++++++---------------
>> 1 file changed, 33 insertions(+), 28 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_atom_sampler.c
>> b/src/mesa/state_tracker/st_atom_sampler.c
>> index 9e5d940..9695069 100644
>> --- a/src/mesa/state_tracker/st_atom_sampler.c
>> +++ b/src/mesa/state_tracker/st_atom_sampler.c
>> @@ -170,51 +170,56 @@ st_convert_sampler(const struct st_context *st,
>> sampler->max_lod = sampler->min_lod;
>> sampler->min_lod = tmp;
>> assert(sampler->min_lod <= sampler->max_lod);
>> }
>> /* For non-black borders... */
>> if (msamp->BorderColor.ui[0] ||
>> msamp->BorderColor.ui[1] ||
>> msamp->BorderColor.ui[2] ||
>> msamp->BorderColor.ui[3]) {
>> - const struct st_texture_object *stobj =
>> st_texture_object_const(texobj);
>> const GLboolean is_integer = texobj->_IsIntegerFormat;
>> - const struct pipe_sampler_view *sv = NULL;
>> - union pipe_color_union border_color;
>> - GLuint i;
>> -
>> - /* Just search for the first used view. We can do this because the
>> - swizzle is per-texture, not per context. */
>> - /* XXX: clean that up to not use the sampler view at all */
>> - for (i = 0; i < stobj->num_sampler_views; ++i) {
>> - if (stobj->sampler_views[i]) {
>> - sv = stobj->sampler_views[i];
>> - break;
>> - }
>> - }
>> - if (st->apply_texture_swizzle_to_border_color && sv) {
>> - const unsigned char swz[4] =
>> - {
>> - sv->swizzle_r,
>> - sv->swizzle_g,
>> - sv->swizzle_b,
>> - sv->swizzle_a,
>> - };
>> -
>> - st_translate_color(&msamp->BorderColor,
>> - &border_color,
>> - texBaseFormat, is_integer);
>> + if (st->apply_texture_swizzle_to_border_color) {
>> + const struct st_texture_object *stobj =
>> st_texture_object_const(texobj);
>> + const struct pipe_sampler_view *sv = NULL;
>> +
>> + /* Just search for the first used view. We can do this because
>> the
>> + swizzle is per-texture, not per context. */
>> + /* XXX: clean that up to not use the sampler view at all */
>> + for (unsigned i = 0; i < stobj->num_sampler_views; ++i) {
>> + if (stobj->sampler_views[i]) {
>> + sv = stobj->sampler_views[i];
>> + break;
>> + }
>> + }
>> - util_format_apply_color_swizzle(&sampler->border_color,
>> - &border_color, swz, is_integer);
>> + if (sv) {
>> + union pipe_color_union tmp;
>> + const unsigned char swz[4] =
>> + {
>> + sv->swizzle_r,
>> + sv->swizzle_g,
>> + sv->swizzle_b,
>> + sv->swizzle_a,
>> + };
>> +
>> + st_translate_color(&msamp->BorderColor, &tmp,
>> + texBaseFormat, is_integer);
>> +
>> + util_format_apply_color_swizzle(&sampler->border_color,
>> + &tmp, swz, is_integer);
>> + } else {
>> + st_translate_color(&msamp->BorderColor,
>> + &sampler->border_color,
>> + texBaseFormat, is_integer);
>> + }
>> } else {
>> st_translate_color(&msamp->BorderColor,
>> &sampler->border_color,
>> texBaseFormat, is_integer);
>> }
>> }
>> sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ?
>> 0 : (GLuint) msamp->MaxAnisotropy);
>>
More information about the mesa-dev
mailing list