2

I am trying to save and restore state by using a StateBlock in SlimDX via the following snippet:

StateBlockMask mask = new StateBlockMask(null) { RasterizerState = true };
var sb = new StateBlock(device.Device, mask);

Both StateBlockMask and StateBlock are classes. This gives me a compilation error:

'.ctor' is not supported by the language

Reading from some other posts here on SO, it seems that this is a problem that has to do with calling the managed code with the wrong arguments. In the source of SlimDX, I find:

StateBlock::StateBlock(SlimDX::Direct3D10::Device^ device, StateBlockMask mask)

I have no experience at all with C++/CLI, so I am wondering if there is something wrong here (like a missing or extra ^), or should I concentrate of faults on my side?

(NOTE: This question has been cross-posted to gamedev.net, future users with the same question may also want to check for answers given there)

2 Answers 2

3

Is StateBlockMask a struct? If not, use StateBlockMask^ mask in the C++ constructor.

3
  • StateBlockMask is a class (added the info to the original post). Unfortunately, I cannot recompile the C++ code at the current state of my project (not allowed).
    – erik
    Mar 1, 2011 at 14:08
  • 1
    @erik - then you are done with this project, you cannot use this C++/CLI code without fixing the bug. Mar 1, 2011 at 15:07
  • You could write your own C++/CLI wrapper class that takes a StateBlockMask ^ and then within that wrapper class, call the StateBlock constructor.
    – Matt Smith
    Mar 2, 2011 at 1:55
0

This looks like a bug in SlimDX. You might want to use the issue tracker to make sure it gets dealt with properly.

1
  • 1
    Plagiarizing yourself?... shame shame shame. Hurry up and get 2k rep so you can edit questions and add links to cross-posts. In the meantime you can always use comments.
    – Ben Voigt
    Mar 2, 2011 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.