[PATCH 2/2] d3d10/effect: Handle vector arguments in expression instructions.

Nikolay Sivov nsivov at codeweavers.com
Fri Nov 19 08:50:10 CST 2021



On 11/19/21 5:22 PM, Matteo Bruni wrote:
> On Fri, Nov 19, 2021 at 3:13 PM Nikolay Sivov <nsivov at codeweavers.com> wrote:
>>
>>
>> On 11/19/21 4:41 PM, Matteo Bruni wrote:
>>> On Tue, Nov 16, 2021 at 6:15 PM Nikolay Sivov <nsivov at codeweavers.com> wrote:
>>>> Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
>>>> ---
>>>>  dlls/d3d10/effect.c | 39 +++++++++++++++++++--------------------
>>>>  1 file changed, 19 insertions(+), 20 deletions(-)
>>>>
>>>> diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
>>>> index 9c2012768dd..74ee4bf468c 100644
>>>> --- a/dlls/d3d10/effect.c
>>>> +++ b/dlls/d3d10/effect.c
>>>> @@ -191,17 +191,21 @@ struct preshader_instr
>>>>      unsigned int scalar     :  1;
>>>>  };
>>>>
>>>> -typedef float (*pres_op_func)(float **args, unsigned int n);
>>>> +typedef void (*pres_op_func)(float **args, unsigned int n, const struct preshader_instr *instr);
>>>>
>>>> -static float pres_ftou(float **args, unsigned int n)
>>>> +static void pres_ftou(float **args, unsigned int n, const struct preshader_instr *instr)
>>>>  {
>>>>      unsigned int u = *args[0];
>>>> -    return *(float *)&u;
>>>> +    *args[1] = *(float *)&u;
>>>>  }
>>> Is ftou always scalar? Not that I'm quite sure how to test it i.e.
>>> what would be a case where a vector ftou could be in effect?
>>>
>>> What I'm getting at, I think it would be safer to handle vector ftou,
>>> just in case that's a thing.
>> Yes, I guess it makes sense. I can't think of a case where this could
>> happen in effects, I've only seen ftou() as a conversion to index
>> integer, and since index is scalar, it always generated ftou() on a
>> single component.
> Yeah, it's a bit paranoid on my part, but we might as well...
>
> The only case where it would come up that I can think of is with
> preshaders used to "preprocess" uniform data i.e. the compiler figures
> out that some intermediate shader data only depends on uniform values
> and pulls the relevant computation out of the shader proper into a
> preshader. That's a thing in d3dx9 but I don't think we encountered it
> with d3d10 yet.
I see. Is that an equivalent of some constant buffer variables depending
on other constant buffer variables?



More information about the wine-devel mailing list