Skip to main content
gamedev.net
🔒 Locked

Question About Creating A Device

Started by Kenny77 Jul 31, 2007 at 7:40 PM 2 replies 600+ views
Original Post
Kenny77
Kenny77
I'm working on a tutorial that is about creating graphical devices. In the code there is some if statements to check if the computer supports hardware or software vertex processing, but when creating the device one of the parameters is DeviceType.Hardware. Wouldn't this make the if statements useless if it's passing that parameter?

public Game()
        {
            InitializeComponent();

            this.SetStyle(ControlStyles.AllPaintingInWmPaint |
                ControlStyles.Opaque, true);

            int adapterOrdinal = Manager.Adapters.Default.Adapter;

            Caps caps = Manager.GetDeviceCaps(adapterOrdinal, DeviceType.Hardware);
            CreateFlags createFlags;

            if (caps.DeviceCaps.SupportsHardwareTransformAndLight)
            {
                createFlags = CreateFlags.HardwareVertexProcessing;
            }
            else
            {
                createFlags = CreateFlags.SoftwareVertexProcessing;
            }

            if (caps.DeviceCaps.SupportsPureDevice && createFlags == CreateFlags.HardwareVertexProcessing)
            {
                createFlags |= CreateFlags.PureDevice;
            }

            PresentParameters presentParams = new PresentParameters();
            presentParams.SwapEffect = SwapEffect.Discard;
            presentParams.Windowed = true;

            #if DEBUG
            presentParams.Windowed = true;
            #endif

            device = new Device(
                adapterOrdinal,
                DeviceType.Hardware,
                this,
                createFlags,
                presentParams);
        }

ET3D
ET3D
No, that's the correct way to go. The "hardware" device supports both software and hardware vertex processing. It's C++ name (D3DDEVTYPE_HAL -- Hardware Abstraction Layer) perhaps makes a little more sense, in that you're interfacing with a layer that then interfaces with the hardware. This layer has the option of doing vertex processing itself, instead of having the hardware do it.

The software device, on the other hand, is meant to be a plug-in of a renderer, though it's basically a bad joke on Microsoft's part, since the specification isn't available, and nobody ever wrote such a device (though people did write complete D3D replacement DLLs).
Promit
Promit
Quote:
Original post by ET3D
The software device, on the other hand, is meant to be a plug-in of a renderer, though it's basically a bad joke on Microsoft's part, since the specification isn't available, and nobody ever wrote such a device (though people did write complete D3D replacement DLLs).
I was under the impression that the spec and related materials were all in the Windows DDK...I haven't looked, admittedly.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
jollyjeffers
jollyjeffers
I would imagine the WDK contains the information - apart from the registration part I'd imagine there is a lot of similarity (at least under XPDM) between HAL and HEL drivers...

SwiftShader is a good example, Microsoft ship a software rasterizer for Direct3D9 and Pixomatic lists a 9.0 and 8.1 wrapper...

Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.