DirectX11 Device Creation (Win10)

The Device.CreateWithSwapChain function is not working with Windows10. You have to generate Device und Swapchain by yourself.


Declare variables

Private _Adapter As Adapter
Private _Factory As Factory
Private _Device As SlimDX.Direct3D11.Device

 


Generate Device

'
'#Factory
_Factory = New Factory
'#Set FeatureLevel
Dim Fl() As SlimDX.Direct3D11.FeatureLevel = {SlimDX.Direct3D11.FeatureLevel.Level_10_1, SlimDX.Direct3D11.FeatureLevel.Level_11_0}
'#Get Adaptercount
Dim AdpCount As Integer = _Factory.GetAdapterCount

'#Create Device
If AdpCount > 0 Then
  _Adapter = _Factory.GetAdapter(0)
  _Device = New SlimDX.Direct3D11.Device(_Adapter, SlimDX.Direct3D11.DeviceCreationFlags.Debug, Fl)
End If
'

 


Dispose variables

'
If Not _Adapter Is Nothing Then _Adapter.Dispose()
If Not _Factory Is Nothing Then _Factory.Dispose()
If Not _Device Is Nothing Then _Device.Dispose()
'

All SlimDX object musst be disposed by yourself. Net does not do that for us in that case!

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s