HeavenWu / slimdx

Automatically exported from code.google.com/p/slimdx
MIT License
0 stars 0 forks source link

D3D11 BlendStateDescription does not implement IEquatable<> or GetHashCode() #806

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Unlike other state descriptors and the D3D10 BlendStateDescription, the D3D11 
BlendStateDescription does not support IEquatable<> or GetHashCode().

Support would be very useful, since it is common to use this as a dictionary 
key when caching states. The RenderTargets array should also be compared based 
on the values of its elements.

(which is more or less required since FromDescription()and the object table 
effectivly hides the ability to use the D3D ref count to deal with identical 
states:-( This is perhaps one case where it would be better to create a new 
managed object each time the ref count is increased.)

Original issue reported on code.google.com by dbl...@fastmail.fm on 12 Jun 2011 at 1:22

GoogleCodeExporter commented 8 years ago
Or better yet a ref count within the managed states.

Original comment by dbl...@fastmail.fm on 12 Jun 2011 at 1:32

GoogleCodeExporter commented 8 years ago
Sorry for the comment spam, but:

It appears D3D can silently modify slightly invalid descriptors, for example if 
you leave the fields of the render target entries zero. 

Hence this leads to the situation where the descriptor you used to create the 
state is not the same as the descriptor retrieved from the Descriptor property.

It turns out that it is more robust to hash based on the object reference of 
the newly created state return by FromDescription()...

Original comment by dbl...@fastmail.fm on 12 Jun 2011 at 2:15

GoogleCodeExporter commented 8 years ago
Yes, hashing on the actual object itself is the preferred method. However, the 
Description should still implement IEquatable and GetHashCode.

Original comment by Mike.Popoloski on 8 Jul 2011 at 4:36

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r2111.

Original comment by Mike.Popoloski on 8 Jul 2011 at 5:16