[PATCH 3/4] d3d10: Implement ShaderResource effect variable set method.

Connor McAdams conmanx360 at gmail.com
Tue Mar 24 12:23:37 CDT 2020


On Tue, Mar 24, 2020 at 02:12:23PM +0100, Matteo Bruni wrote:
> On Sat, Mar 21, 2020 at 7:31 PM Connor McAdams <conmanx360 at gmail.com> wrote:
> 
> > @@ -5908,8 +5961,24 @@ static const struct ID3D10EffectStringVariableVtbl d3d10_effect_string_variable_
> >      d3d10_effect_string_variable_GetStringArray,
> >  };
> >
> > +static void set_shader_resource_variable(ID3D10ShaderResourceView **src, ID3D10ShaderResourceView **dst)
> > +{
> > +    if (*dst)
> > +        ID3D10ShaderResourceView_Release(*dst);
> > +    if (*src)
> > +        ID3D10ShaderResourceView_AddRef(*src);
> > +
> > +    *dst = *src;
> > +}
> 
> When we have to handle something like this in other places we usually
> check that *dst != *src first, as an optimization. Also, can either of
> them be NULL?

I will add the check for *dst != *src, hadn't thought of that.

src or dst can be NULL, depending on the circumstance. To clear a bound
resource, SetResource is called with the SRV set to NULL, and in that
case, if the resource was set to a valid SRV previously, you'd have *dst
be non-NULL and src be NULL, then the opposite case could be true as
well.



More information about the wine-devel mailing list