How do i use PureDevice?

Started by
86 comments, last by ZeroWalker 10 years, 7 months ago

How do you initialize "cap" prior to that code?

Niko Suni

Advertisement

Capabilities cap = new Capabilities();

Though, not even sure which capabilities it is, cause it doesn´t seem to point to my Device or anything;S

Use the logic I outlined in my second reply to this thread. It doesn't involve creating a device.

The line you posted creates an empty Capabilities structure. The system won't make guesses as to which device you may refer with that :)

Niko Suni

Like this

if (0 != (DeviceCaps.PureDevice & SharpDX.Direct3D9.DeviceCaps.PureDevice))
{
devFlags |= CreateFlags.PureDevice;
}

?

You need to get an instance of the DeviceCaps structure from the AdapterInformation structure instance. You get an array of AdapterInformation structure instances from the Direct3D object, for each adapter in your system.

Niko Suni

The device caps structure represents the information reported by your GPU driver about the capabilities of a given device instance. If you simply create an empty instance of such a structure, it won't contain any useful information.

Niko Suni

I got AdapterInformaiton ,but i can´t choose anything, they are just, well, empty.

DeviceType devType = DeviceType.Reference;
Capabilities cap = new Capabilities();
AdapterDetails u = new AdapterDetails();
MessageBox.Show(u.DeviceName);
AdapterCollection dd = new AdapterCollection;

how can i choose my own adapter, which probably is int 0?

You keep creating empty structure instances; it is only logical that they don't contain any info.

You need to get the structures via the Direct3D interface.

...

Once you get the array of AdapterDetails from the Direct3D object, you can inspect the DeivceOrdinal field of that struct to determine which of those represents the device 0. It is generally regarded as the "primary adapter."

Niko Suni

Yes, but, i don´t know which is the "Direct3D" object. I don´t have something like that.

Now i think i found it:




                      CreateFlags devFlags = CreateFlags.HardwareVertexProcessing;
                      using (Direct3DEx D3DEx = new Direct3DEx())
                      {

                          cap = D3DEx.GetDeviceCaps(0, SharpDX.Direct3D9.DeviceType.Hardware);


                          
                          if (0 != (cap.DeviceCaps & SharpDX.Direct3D9.DeviceCaps.PureDevice))
                          {
                              devFlags = CreateFlags.PureDevice;
                              MessageBox.Show(devFlags.ToString());
                          }
                      }

Is this correct?

This topic is closed to new replies.

Advertisement