From: Giovanni Mascellani Subject: Re: [PATCH vkd3d] vkd3d-shader/hlsl: Handle constant value operations on a different file. Message-Id: <8eab6bc2-4c13-a291-b0ca-1a79a9ef65b5@codeweavers.com> Date: Wed, 19 Jan 2022 13:42:09 +0100 In-Reply-To: References: <20220103145733.104047-1-fcasas@codeweavers.com> <3a4f11c7-f56d-1690-1860-a3085b18467d@codeweavers.com> Hi, Il 19/01/22 13:10, Matteo Bruni ha scritto: > Another one that potentially needs some care is folding float > expressions. E.g. even transforming a "(x + a) + b" into "x + (a + b)" > (with x float, a and b constants) can technically affect the final > result, depending on the specific values. > We need to replicate MS's compiler in this regard, or at least support > compatible behavior as one of the options. I've been looking into this > a bit and it appears that the native compiler always allows constant > folding transformations, regardless of the presence of the precise > keyword or the D3DCOMPILE_IEEE_STRICTNESS flag to D3DCompile(). Other > transformations / optimizations are affected but I guess we'll think > about those when we get there. > > So, as far as constant folding is concerned, always optimizing float > constants should be okay. Or we could have our own compilation flag to > control that, in case we feel that behavior might be useful to some > non-Wine user. I am not completely sure of what you mean here. You say that you fear that if we have "(x + y) + z" with x, y and z constants, native compiler could transform this to "x + (y + z)" before doing constant folding? Giovanni.