Microsoft Direct3D - Architecture

Architecture

Direct3D is a Microsoft DirectX API subsystem component. The aim of Direct3D is to abstract the communication between a graphics application and the graphics hardware drivers. It is presented like a thin abstract layer at a level comparable to GDI (see attached diagram). Direct3D contains numerous features that GDI lacks.

Direct3D is an Immediate mode graphics API. It provides a low-level interface to every video card 3D function (transformations, clipping, lighting, materials, textures, depth buffering and so on). It also had a higher level Retained mode component, that has now been officially discontinued.

Direct3D immediate mode presents three main abstractions: devices, resources and swap chains (see attached diagram). Devices are responsible for rendering the 3D scene. They provide an interface with different rendering capabilities. For example, the mono device provides white and black rendering, while the RGB device renders in color. There are four types of devices:

  • HAL (hardware abstraction layer) device: For devices supporting hardware acceleration.
  • Reference device: Simulates new functions not yet available in hardware. It is necessary to install the Direct3D SDK to use this device type.
  • Null reference device: Does nothing. This device is used when the SDK is not installed and a reference device is requested.
  • Pluggable software device: Performs software rendering. This device was introduced with DirectX 9.0.

Every device contains at least one swap chain. A swap chain is made up of one or more back buffer surfaces. Rendering occurs in the back buffer.

Moreover, devices contain a collection of resources; specific data used during rendering. Each resource has four attributes:

  • Type: Determines the type of resource: surface, volume, texture, cube texture, volume texture, surface texture, index buffer or vertex buffer.
  • Pool: Describes how the resource is managed by the runtime and where it is stored. In the Default pool the resource will exist only in device memory. Resources in the managed pool will be stored in system memory, and will be sent to the device when required. Resources in system memory pool will only exist in system memory. Finally, the scratch pool is basically the same as the system memory pool, but resources are not bound by hardware restrictions.
  • Format: Describes the layout of the resource data in memory. For example, D3DFMT_R8G8B8 format value means a 24 bits colour depth (8 bits for red, 8 bits for green and 8 bits for blue).
  • Usage: Describes, with a collection of flag bits, how the resource will be used by the application. These flags dictate which resources are used in dynamic or static access patterns. Static resource values don’t change after being loaded, whereas dynamic resource values may be modified.

Direct3D implements two display modes:

  • Fullscreen mode: The Direct3D application generates all of the graphical output for a display device. In this mode Direct3D automatically captures Alt-Tab and sets/restores screen resolution and pixel format without the programmer intervention. This also provides plenty of problems for debugging due to the 'Exclusive Cooperative Mode'.
  • Windowed mode: The result is shown inside the area of a window. Direct3D communicates with GDI to generate the graphical output in the display. Windowed mode can have the same level of performance as full-screen, depending on driver support.

Read more about this topic:  Microsoft Direct3D

Famous quotes containing the word architecture:

    It seems a fantastic paradox, but it is nevertheless a most important truth, that no architecture can be truly noble which is not imperfect.
    John Ruskin (1819–1900)

    Polarized light showed the secret architecture of bodies; and when the second-sight of the mind is opened, now one color or form or gesture, and now another, has a pungency, as if a more interior ray had been emitted, disclosing its deep holdings in the frame of things.
    Ralph Waldo Emerson (1803–1882)

    They can do without architecture who have no olives nor wines in the cellar.
    Henry David Thoreau (1817–1862)