Re: [Mesa-dev] [PATCH] Revert "radv: fix color conversions for normalized uint/sint formats"
Please ignore this patch. See https://github.com/doitsujin/dxvk/commit/3b1e03f9887fc7b540c90e9e34e32b46612281bb On 6/5/19 2:45 PM, Bas Nieuwenhuizen wrote: r-b On Wed, Jun 5, 2019 at 12:02 PM Samuel Pitoiset 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 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@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Revert "radv: fix color conversions for normalized uint/sint formats"
r-b On Wed, Jun 5, 2019 at 12:02 PM Samuel Pitoiset 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 > 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@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev