[PATCH vkd3d 4/6] vkd3d-shader/hlsl: Allow values different from one in bools.

Francisco Casas fcasas at codeweavers.com
Thu Mar 24 14:59:26 CDT 2022


Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
---

But, if I am not mistaken, bool expands to _Bool (because we are including <stdbool.h>).
And I don't see any point in the program were we may be assigning .b a value that's
not 0 or 1.
Given that in C, when an scalar is converted to _Bool, it automatically becomes 0 or 1.




March 23, 2022 11:27 AM, "Giovanni Mascellani" <gmascellani at codeweavers.com> wrote:

> Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
> ---
> libs/vkd3d-shader/hlsl_constant_ops.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/libs/vkd3d-shader/hlsl_constant_ops.c b/libs/vkd3d-shader/hlsl_constant_ops.c
> index 51cee179..6c852ba1 100644
> --- a/libs/vkd3d-shader/hlsl_constant_ops.c
> +++ b/libs/vkd3d-shader/hlsl_constant_ops.c
> @@ -75,11 +75,11 @@ static bool fold_cast(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst,
> struct
> break;
> 
> case HLSL_TYPE_BOOL:
> - u = src->value[k].b;
> - i = src->value[k].b;
> - f = src->value[k].b;
> - d = src->value[k].b;
> - b = src->value[k].b;
> + u = !!src->value[k].b;
> + i = !!src->value[k].b;
> + f = !!src->value[k].b;
> + d = !!src->value[k].b;
> + b = !!src->value[k].b;
> break;
> 
> default:
> -- 
> 2.35.1



More information about the wine-devel mailing list