[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:11:42 CDT 2021
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?
More information about the wine-devel
mailing list