From: "Zebediah Figura (she/her)" Subject: Re: [PATCH vkd3d] vkd3d-shader/hlsl: Handle constant value operations on a different file. Message-Id: <95e82cbb-d495-f828-344a-39bef88a311a@codeweavers.com> Date: Tue, 4 Jan 2022 12:18:37 -0600 In-Reply-To: <20220103145733.104047-1-fcasas@codeweavers.com> References: <20220103145733.104047-1-fcasas@codeweavers.com> 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 > --- > > 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 > --- > 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.