[PATCH 1/6] d3d10/effect: Go through both local and shared buffers when looking for shader resources.

Nikolay Sivov nsivov at codeweavers.com
Thu Sep 30 14:26:20 CDT 2021



On 9/30/21 10:18 PM, Matteo Bruni wrote:
> On Thu, Sep 30, 2021 at 9:11 PM Nikolay Sivov <nsivov at codeweavers.com> wrote:
>>
>>
>> On 9/30/21 10:03 PM, Matteo Bruni wrote:
>>> On Tue, Sep 28, 2021 at 2:23 PM Nikolay Sivov <nsivov at codeweavers.com> wrote:
>>>> Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
>>>> ---
>>>>  dlls/d3d10/effect.c       | 56 ++++++++++++++++++++++++---------------
>>>>  dlls/d3d10/tests/effect.c | 53 +++++++++++++++++++++++++-----------
>>>>  2 files changed, 72 insertions(+), 37 deletions(-)
>>>>
>>>> diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
>>>> index 668efcda666..71660eb399e 100644
>>>> --- a/dlls/d3d10/effect.c
>>>> +++ b/dlls/d3d10/effect.c
>>>> @@ -526,6 +526,35 @@ static BOOL copy_name(const char *ptr, char **name)
>>>>      return TRUE;
>>>>  }
>>>>
>>>> +static struct d3d10_effect_variable * d3d10_effect_get_buffer_by_name(struct d3d10_effect *effect,
>>>> +        const char *name)
>>>> +{
>>>> +    ID3D10EffectVariable *v;
>>>> +    unsigned int i;
>>>> +
>>>> +    for (i = 0; i < effect->local_buffer_count; ++i)
>>>> +    {
>>>> +        struct d3d10_effect_variable *l = &effect->local_buffers[i];
>>>> +        if (l->name && !strcmp(l->name, name))
>>>> +        {
>>>> +            TRACE("Found local buffer %s.\n", debugstr_a(name));
>>>> +            return l;
>>>> +        }
>>>> +    }
>>>> +
>>>> +    if (effect->pool)
>>>> +    {
>>>> +        if ((v = (ID3D10EffectVariable *)effect->pool->lpVtbl->GetConstantBufferByName(effect->pool, name))
>>>> +                && v->lpVtbl->IsValid(v))
>>>> +        {
>>>> +            TRACE("Found shared buffer %s.\n", debugstr_a(name));
>>>> +            return impl_from_ID3D10EffectVariable(v);
>>>> +        }
>>>> +    }
>>>> +
>>>> +    return NULL;
>>>> +}
>>>> +
>>> I wonder if it would be nicer to just loop through the pool effect's
>>> buffers instead, or at least call d3d10_effect_get_buffer_by_name()
>>> directly.
>> Yes, I have no problems with that. Making sure, do you mean storing
>> "struct d3d10_effect*" for pool, instead of an interface pointer?
> Probably, if it doesn't make other stuff more complicated (it shouldn't).
> I guess you could check that native doesn't support "custom" pools
> either, just to be sure that we won't ever need to go back on this.
I could try testing that, but that can only get so far, because internal
assumptions could be tricky to observe. For example, when you reference
a buffer from a child effect, and update it, there is not API way to
trigger d3d buffer update. Now that might go a "proper" way via some
internal interface, but given that even QueryInterface is not really
working, I'd be surprised they made such extra effort. Probably easiest
way is to try custom pool interface, and see if any methods are called
at all, expect for addref. If nothing gets called from top level object,
that obviously means such change will be safe.



More information about the wine-devel mailing list