[PATCH vkd3d] vkd3d-shader/hlsl: Handle constant value operations on a different file.

Zebediah Figura (she/her) zfigura at codeweavers.com
Tue Jan 4 12:18:37 CST 2022


On 1/3/22 08:57, Francisco Casas wrote:
> On constant folding, first switch on the op type, handling each
> operation using a function defined on hlsl_constant_ops.c.
> Each of these operations switches on the data type, if needed.
> 
> Since constant value casting had to be rewritten, support was
> extended to all numeric types.
> 
> Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
> ---
> 
> I suggest moving the definitions of the operations to this new file
> since they may end up being considerably large and similar.
> 
> I am not sure if I should be on the copyright notice of the new files.
> 
> Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
> ---
>   Makefile.am                           |   2 +-
>   libs/vkd3d-shader/hlsl_codegen.c      | 104 ++++---------
>   libs/vkd3d-shader/hlsl_constant_ops.c | 209 ++++++++++++++++++++++++++
>   libs/vkd3d-shader/hlsl_constant_ops.h |  30 ++++
>   4 files changed, 268 insertions(+), 77 deletions(-)
>   create mode 100644 libs/vkd3d-shader/hlsl_constant_ops.c
>   create mode 100644 libs/vkd3d-shader/hlsl_constant_ops.h
> 

Giovanni has already said most of what I would say. I would append, 
though, that this patch does at least three things at once. In general 
please try to avoid moving code and changing it at the same time. I.e. 
move hlsl_fold_constants() to a separate file, *then* change the switch 
order, *then* make cast folding more generic.



More information about the wine-devel mailing list