Module: tools
Branch: master
Commit: d6b3ff7f6fa99544dae245155ef3a0d9bac2c365
URL: https://source.winehq.org/git/tools.git/?a=commit;h=d6b3ff7f6fa99544dae2451…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Tue Aug 31 15:40:02 2021 +0200
winetest/build-patterns: Use the Luv colorspace for interpolating colors.
Interpolation works best in a colorspace where the distance between
colors is representative of their perceptual difference. That's
roughly the case in the Luv colorspace and much less so in the RGB
one.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
winetest/build-patterns | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/winetest/build-patterns b/winetest/build-patterns
index ff72516..7229140 100755
--- a/winetest/build-patterns
+++ b/winetest/build-patterns
@@ -22,6 +22,7 @@ use open ':utf8';
use CGI qw(:standard);
use POSIX; # ceil()
+use Graphics::ColorObject;
use Text::CSV::Encoded;
use Time::Piece;
@@ -860,15 +861,15 @@ if (open(my $fh, "-|", $cmd))
sub color2html($)
{
my ($c) = @_;
- return sprintf "#%02x%02x%02x", $c->[0], $c->[1], $c->[2];
+ return "#". $c->as_RGBhex();
}
-sub blend($$$)
+sub interpolate($$$)
{
my ($p, $start, $end) = @_;
- my $r = [int($start->[0] * (1 - $p) + $end->[0] * $p + 0.5),
- int($start->[1] * (1 - $p) + $end->[1] * $p + 0.5),
- int($start->[2] * (1 - $p) + $end->[2] * $p + 0.5)];
+ my $r = [$start->[0] * (1 - $p) + $end->[0] * $p,
+ $start->[1] * (1 - $p) + $end->[1] * $p,
+ $start->[2] * (1 - $p) + $end->[2] * $p];
return $r;
}
@@ -896,7 +897,7 @@ sub compute_set_colors($)
my $count = @values;
if ($count == 1)
{
- $set->{$values[0]} = color2html($keycolors[0]);
+ $set->{$values[0]} = color2html(Graphics::ColorObject->new_RGB255($keycolors[0]));
}
else
{
@@ -904,6 +905,12 @@ sub compute_set_colors($)
# when many colors are needed.
$keycolors[0] = [0, 179, 179] if ($count > 10);
+ # Convert the key colors to the Luv colorspace where the distance
+ # between colors is roughly representative of the perceptual difference
+ # between them. This allows linear interpolation to produce relatively
+ # uniform gradients (which is not the case in the RGB colorspace).
+ map { $_ = Graphics::ColorObject->new_RGB255($_)->as_Luv() } @keycolors;
+
# Compute the total length of the path traced by the key colors through
# the colorspace. This is necessary so the gradient remains uniform
# even if two key colors are close to each other. This does assume that
@@ -929,8 +936,8 @@ sub compute_set_colors($)
}
# And blend
- my $Rgb = blend(($pos - $keypos[$k]) / ($keypos[$k+1] - $keypos[$k]), $keycolors[$k], $keycolors[$k+1]);
- $set->{$values[$_]} = color2html($Rgb);
+ my $Luv = interpolate(($pos - $keypos[$k]) / ($keypos[$k+1] - $keypos[$k]), $keycolors[$k], $keycolors[$k+1]);
+ $set->{$values[$_]} = color2html(Graphics::ColorObject->new_Luv($Luv));
}
}
}
Module: tools
Branch: master
Commit: e527645adc6e2b145428087afb1b68215f9e1840
URL: https://source.winehq.org/git/tools.git/?a=commit;h=e527645adc6e2b145428087…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Tue Aug 31 15:39:59 2021 +0200
winetest/build-patterns: Take the distance between key colors into account.
To get a uniform color gradient, fewer colors should be squeezed between
close key colors than between distant ones.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
winetest/build-patterns | 35 ++++++++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/winetest/build-patterns b/winetest/build-patterns
index 2ee5d5b..ff72516 100755
--- a/winetest/build-patterns
+++ b/winetest/build-patterns
@@ -872,6 +872,13 @@ sub blend($$$)
return $r;
}
+sub distance($$)
+{
+ my ($a, $b) = @_;
+ return sqrt(($b->[0] - $a->[0])**2 +
+ ($b->[1] - $a->[1])**2 +
+ ($b->[2] - $a->[2])**2);
+}
# Use colors to differentiate the set values. Each unique value is assigned
# a color (in HTML format) picked along a series of gradients passing by the
@@ -897,19 +904,33 @@ sub compute_set_colors($)
# when many colors are needed.
$keycolors[0] = [0, 179, 179] if ($count > 10);
+ # Compute the total length of the path traced by the key colors through
+ # the colorspace. This is necessary so the gradient remains uniform
+ # even if two key colors are close to each other. This does assume that
+ # the path does not zigzag too much: (0,0,0)->(255,0,0)->(1,0,0) cannot
+ # produce a meaningful gradient.
+ my @keypos = (0);
+ for (my $i = 1; $i < @keycolors; $i++)
+ {
+ my $d = distance($keycolors[$i - 1], $keycolors[$i]);
+ $keypos[$i] = $keypos[$i - 1] + $d;
+ }
+
my $k = 0;
- my ($start, $end) = (-1, 0);
for (0..$count-1)
{
- while (!$end or $_ > $end)
+ # Compute the position of the current item on the path
+ my $pos = $_ / ($count - 1) * $keypos[-1];
+
+ # Figure out which segment of the path this corresponds to
+ while ($pos > $keypos[$k+1] and $k+1 < @keycolors-1)
{
$k++;
- $start = $end;
- $end = ($count-1) * $k / (@keycolors-1);
}
- $set->{$values[$_]} = color2html(blend(($_-$start)/($end-$start),
- $keycolors[$k-1],
- $keycolors[$k]));
+
+ # And blend
+ my $Rgb = blend(($pos - $keypos[$k]) / ($keypos[$k+1] - $keypos[$k]), $keycolors[$k], $keycolors[$k+1]);
+ $set->{$values[$_]} = color2html($Rgb);
}
}
}
Module: vkd3d
Branch: master
Commit: 0de7a2eeb5ccff2d8c1e3016fb5f2dec1ad29e9b
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=0de7a2eeb5ccff2d8c1e301…
Author: Henri Verbeet <hverbeet(a)codeweavers.com>
Date: Tue Aug 31 01:16:26 2021 +0200
vkd3d-compiler: Default to monochrome output when NO_COLOUR/NO_COLOR is set.
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
README | 5 +++++
programs/vkd3d-compiler/main.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/README b/README
index 3c70ede..ed53f20 100644
--- a/README
+++ b/README
@@ -45,6 +45,11 @@ removed in the future versions of vkd3d.
Some of debug variables are lists of elements. Elements must be separated by
commas or semicolons.
+ * NO_COLOR - this is an alias of NO_COLOUR.
+
+ * NO_COLOUR - when set, vkd3d-compiler will default to monochrome output,
+ even when the output supports colour.
+
* VKD3D_CONFIG - a list of options that change the behavior of libvkd3d.
* vk_debug - enables Vulkan debug extensions.
diff --git a/programs/vkd3d-compiler/main.c b/programs/vkd3d-compiler/main.c
index 40e27ed..ac01d59 100644
--- a/programs/vkd3d-compiler/main.c
+++ b/programs/vkd3d-compiler/main.c
@@ -674,7 +674,7 @@ int main(int argc, char **argv)
}
}
- if (!options.explicit_colour && has_colour(output))
+ if (!options.explicit_colour && !getenv("NO_COLOUR") && !getenv("NO_COLOR") && has_colour(output))
options.formatting |= VKD3D_SHADER_COMPILE_OPTION_FORMATTING_COLOUR;
add_compile_option(&options, VKD3D_SHADER_COMPILE_OPTION_FORMATTING, options.formatting);
Module: vkd3d
Branch: master
Commit: cc05e9c39124dbb46a9a97979ed5a61686423386
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=cc05e9c39124dbb46a9a979…
Author: Henri Verbeet <hverbeet(a)codeweavers.com>
Date: Tue Aug 31 01:16:25 2021 +0200
vkd3d-compiler: Mention the default target type in the help text for -b.
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
programs/vkd3d-compiler/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/programs/vkd3d-compiler/main.c b/programs/vkd3d-compiler/main.c
index 4c7a462..40e27ed 100644
--- a/programs/vkd3d-compiler/main.c
+++ b/programs/vkd3d-compiler/main.c
@@ -162,7 +162,8 @@ static void print_usage(const char *program_name)
"Options:\n"
" -h, --help Display this information and exit.\n"
" -b <type> Specify the target type. Use --print-target-types to\n"
- " list valid target types for a given source type.\n"
+ " list valid target types for a given source type. The\n"
+ " default target type is 'spirv-binary'.\n"
" --buffer-uav=<type> Specify the buffer type to use for buffer UAV bindings.\n"
" Valid values are 'buffer-texture' (default) and\n"
" 'storage-buffer'.\n"