Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

How to create ID3D11Device1?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 zerorepent   Members   -  Reputation: 405

Like
0Likes
Like

Posted 24 October 2012 - 07:11 AM

Hi!
I am trying to use direct2d in directx11.1 with feature level 11, however i quickly run into problems, when creating a directx10.1 device you use D3D10CreateDevice1, however a similar function for directx11.1 doesn't seem to exist. I look at this example http://msdn.microsof...9(v=vs.85).aspx however they use ComPtr's, And I am not that familiar with using them,

They declare
ComPtr<ID3D11Device> device;
ComPtr<ID3D11DeviceContext> context;
uses the regular D3D11CreateDevice function, and then uses
DX::ThrowIfFailed(
		device.As(&m_d3dDevice)
		);
where m_d3dDevice is a ID3D11Device1. Is that a regular typecast (in the ComPtr way)? If so is it safe to do use
m_d3dDevice= (ID3D11Device1*)(device);
I do not use ComPtrs in my project, so in this example above both are "regular" pointers.

Sponsor:

#2 mhagain   Members   -  Reputation: 3827

Like
1Likes
Like

Posted 24 October 2012 - 08:22 AM

You should be able to get it by using the regular D3D11CreateDevice, then QueryInterface to get the Device1 interface; something like this (error checking omitted):

ID3D11Device *d3d11_Device;
ID3D11Device1 *d3d11_Device1;

// create d3d11_Device as normal, then
d3d11_Device->QueryInterface (__uuidof (ID3D11Device1), (void **) &d3d11_Device1);

// throw away the original device
d3d11_Device->Release ();

Disclaimer/fair warning: I haven't tested this with ID3D11Device1 myself, but I do use it with IDXGIDevice1, and it's standard procedure for cases where a DX interface isn't exposed via a Create method (e.g. IDirectSoundBuffer8).

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#3 zerorepent   Members   -  Reputation: 405

Like
0Likes
Like

Posted 24 October 2012 - 08:47 AM

Thanks! It works perfectly for the Id3d11Device1, but fails on the id3d11devicecontext1. I guess thats because I use featurelevel 11 and not 11.1 so I don't think thats an issue ^^.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS