zengqh / slimdx

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

Missing function in D3D9 Device (CreateStateBlock) #352

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There was a function missing (CreateStateBlock) in the bindings for the
D3D9 device that I need for my current project. I added the function and
created a patch for svn revision 751.

Original issue reported on code.google.com by michael.stoyke@gmx.de on 25 Oct 2008 at 4:15

Attachments:

GoogleCodeExporter commented 9 years ago
The functionality already exists, in the form of the constructor for the 
StateBlock
object.

Original comment by Mike.Popoloski on 25 Oct 2008 at 5:48

GoogleCodeExporter commented 9 years ago
Ok, I think I have to get used to some design decisions in SlimDX :) I'm just 
too
much used to the C++ API of DirectX and was expecting to find everything in C# 
where
I left it in C++.

As far as I understand in SlimDX all Create* functions are implemented in the
constructors of their "result" classes. So instead of "device.CreateTexture()" 
I can
just use "new Texture()". That's OK for most of the Create* functions.

For state blocks I was expecting the function CreateStateBlock in the device, 
because
the "usual" way to create a state block is through 
BeginStateBlock()/EndStateBlock()
and these are left in the device class of SlimDX.

CreateStateBlock is, in my opinion, a special case and the name Microsoft used 
in
DirectX is a little bit misleading. It should be named 
CaptureCurrentDeviceState and
no more confusion about what it really does.

I'll revert my changes and use the "new StateBlock()" approach for this now. 
Thanks
for this hint and keep up the good work, I really like SlimDX because it's a 
big time
saver for me now. Another wheel I don't need to reinvent :)

Original comment by michael.stoyke@gmx.de on 25 Oct 2008 at 7:20

GoogleCodeExporter commented 9 years ago
Yes, the state block set up is a little misleading. However, we followed the 
same
pattern as the other resources, so I don't think it's too bad. Anyway, thanks 
for the
kind words. Good luck on your project.

Original comment by Mike.Popoloski on 25 Oct 2008 at 8:05