[Mesa-stable] [Mesa-dev] [PATCH] Revert "radv: fix color conversions for normalized uint/sint formats"

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Wed Jun 5 12:45:02 UTC 2019


r-b

On Wed, Jun 5, 2019 at 12:02 PM Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
>
> For some reasons, this actually introduced rendering issues with
> Far Cry 3 (and probably Far Cry 4). I'm reverting it for now
> until I figure out the right fix.
>
> See the following link for reference:
> https://github.com/ValveSoftware/Proton/issues/727#issuecomment-498638025
>
> Cc: 19.0 19.1 <mesa-stable at lists.freedesktop.org>
> This reverts commit e03e7c510f571a8867ab7a8604058c075c601a70.
> ---
>  src/amd/vulkan/radv_formats.c | 20 ++++----------------
>  1 file changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c
> index d7b560082f6..0434c0641d8 100644
> --- a/src/amd/vulkan/radv_formats.c
> +++ b/src/amd/vulkan/radv_formats.c
> @@ -1034,22 +1034,10 @@ bool radv_format_pack_clear_color(VkFormat format,
>                                 assert(channel->size == 8);
>
>                                 v = util_format_linear_float_to_srgb_8unorm(value->float32[c]);
> -                       } else {
> -                               float f = MIN2(value->float32[c], 1.0f);
> -
> -                               if (channel->type == VK_FORMAT_TYPE_UNSIGNED) {
> -                                       f = MAX2(f, 0.0f) * ((1ULL << channel->size) - 1);
> -                               } else {
> -                                       f = MAX2(f, -1.0f) * ((1ULL << (channel->size - 1)) - 1);
> -                               }
> -
> -                               /* The hardware rounds before conversion. */
> -                               if (f > 0)
> -                                       f += 0.5f;
> -                               else
> -                                       f -= 0.5f;
> -
> -                               v = (uint64_t)f;
> +                       } else if (channel->type == VK_FORMAT_TYPE_UNSIGNED) {
> +                               v = MAX2(MIN2(value->float32[c], 1.0f), 0.0f) * ((1ULL << channel->size) - 1);
> +                       } else  {
> +                               v = MAX2(MIN2(value->float32[c], 1.0f), -1.0f) * ((1ULL << (channel->size - 1)) - 1);
>                         }
>                 } else if (channel->type == VK_FORMAT_TYPE_FLOAT) {
>                         if (channel->size == 32) {
> --
> 2.21.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-stable mailing list