Direct3D 9,Direct3D 10,Direct3D 11渲染流水线

1649 篇文章 12 订阅
1277 篇文章 12 订阅

Direct3D Architecture (Direct3D 9)

This topic provides two high-level views of the architecture of Direct3D:

Direct3D Graphics Pipeline

The graphics pipeline provides the horsepower to efficiently process and render Direct3D scenes to a display, taking advantage of available hardware. The following diagram shows the building blocks of the pipeline:

Diagram of the Direct3D graphics pipeline

Pipeline Component Description Related Topics
Vertex Data Untransformed model vertices are stored in vertex memory buffers. Vertex Buffers (Direct3D 9),IDirect3DVertexBuffer9
Primitive Data Geometric primitives, including points, lines, triangles, and polygons, are referenced in the vertex data with index buffers. Index Buffers (Direct3D 9),IDirect3DIndexBuffer9,PrimitivesHigher-Order Primitives (Direct3D 9)
Tessellation The tesselator unit converts higher-order primitives, displacement maps, and mesh patches to vertex locations and stores those locations in vertex buffers. Tessellation (Direct3D 9)
Vertex Processing Direct3D transformations are applied to vertices stored in the vertex buffer. Vertex Pipeline (Direct3D 9)
Geometry Processing Clipping, back face culling, attribute evaluation, and rasterization are applied to the transformed vertices. Pixel Pipeline (Direct3D 9)
Textured Surface Texture coordinates for Direct3D surfaces are supplied to Direct3D through the IDirect3DTexture9 interface. Direct3D Textures (Direct3D 9),IDirect3DTexture9
Texture Sampler Texture level-of-detail filtering is applied to input texture values. Direct3D Textures (Direct3D 9)
Pixel Processing Pixel shader operations use geometry data to modify input vertex and texture data, yielding output pixel color values. Pixel Pipeline (Direct3D 9)
Pixel Rendering Final rendering processes modify pixel color values with alpha, depth, or stencil testing, or by applying alpha blending or fog. All resulting pixel values are presented to the output display. Pixel Pipeline (Direct3D 9)

 

Direct3D System Integration

The following diagram shows the relationships between a Window application, Direct3D,GDI, and the hardware:

Diagram of the relationship between Direct3D and other system components

Direct3D exposes a device-independent interface to an application. Direct3D applications can exist alongsideGDI applications, and both have access to the computer's graphics hardware through the device driver for the graphics card. UnlikeGDI, Direct3D can take advantage of hardware features by creating a hal device.

A hal device provides hardware acceleration to graphics pipeline functions, based upon the feature set supported by the graphics card. Direct3D methods are provided to retrieve device display capabilities at run time. (See GetDeviceCaps andGetDeviceCaps.) If a capability is not provided by the hardware, the hal does not report it as a hardware capability.

For more information about hal and reference devices supported by Direct3D, see Device Types (Direct3D 9).


Pipeline Stages (Direct3D 10)

The Direct3D 10 programmable pipeline is designed for generating graphics for realtime gaming applications. The following diagram shows the data flow from input to output through each of the programmable stages.

Diagram of the data flow in the Direct3D 10 programmable pipeline

All of the stages can be configured using the API. Stages featuring common shader cores (the rounded rectangular blocks) are programmable using the HLSL programming language. As you will see, this makes the pipeline extremely flexible and adaptable. The purpose of each of the stages is listed below.

  • Input-Assembler Stage - The input-assembler stage is responsible for supplying data (triangles, lines and points) to the pipeline.
  • Vertex-Shader Stage - The vertex-shader stage processes vertices, typically performing operations such as transformations, skinning, and lighting. A vertex shader always takes a single input vertex and produces a single output vertex.
  • Geometry-Shader Stage - The geometry-shader stage processes entire primitives. Its input is a full primitive (which is three vertices for a triangle, two vertices for a line, or a single vertex for a point). In addition, each primitive can also include the vertex data for any edge-adjacent primitives. This could include at most an additional three vertices for a triangle or an additional two vertices for a line. The Geometry Shader also supports limited geometry amplification and de-amplification. Given an input primitive, the Geometry Shader can discard the primitive, or emit one or more new primitives.
  • Stream-Output Stage - The stream-output stage is designed for streaming primitive data from the pipeline to memory on its way to the rasterizer. Data can be streamed out and/or passed into the rasterizer. Data streamed out to memory can be recirculated back into the pipeline as input data or read-back from the CPU.
  • Rasterizer Stage - The rasterizer is responsible for clipping primitives, preparing primitives for the pixel shader and determining how to invoke pixel shaders.
  • Pixel-Shader Stage - The pixel-shader stage receives interpolated data for a primitive and generates per-pixel data such as color.
  • Output-Merger Stage - The output-merger stage is responsible for combining various types of output data (pixel shader values, depth and stencil information) with the contents of the render target and depth/stencil buffers to generate the final pipeline result.

Related topics

Programming Guide for Direct3D 10

Graphics Pipeline(Direct3D 11)

The Direct3D 11 programmable pipeline is designed for generating graphics for realtime gaming applications. This section describes the Direct3D 11 programmable pipeline. The following diagram shows the data flow from input to output through each of the programmable stages.

Diagram of the data flow in the Direct3D 11 programmable pipeline

The graphics pipeline for Microsoft Direct3D 11 supports the same stages as the Direct3D 10 graphics pipeline, with additional stages to support advanced features.

You can use the Direct3D 11API to configure all of the stages. Stages that feature common shader cores (the rounded rectangular blocks) are programmable by using the HLSL programming language. As you will see, this makes the pipeline extremely flexible and adaptable. The following list specifies the purpose of each of the stages.

  • Input-Assembler Stage - The input-assembler stage supplies data (triangles, lines and points) to the pipeline.
  • Vertex-Shader Stage - The vertex-shader stage processes vertices, typically performing operations such as transformations, skinning, and lighting. A vertex shader always takes a single input vertex and produces a single output vertex.
  • Geometry-Shader Stage - The geometry-shader stage processes entire primitives. Its input is a full primitive (which is three vertices for a triangle, two vertices for a line, or a single vertex for a point). In addition, each primitive can also include the vertex data for any edge-adjacent primitives. This could include at most an additional three vertices for a triangle or an additional two vertices for a line. The geometry shader also supports limited geometry amplification and de-amplification. Given an input primitive, the geometry shader can discard the primitive, or emit one or more new primitives.
  • Stream-Output Stage - The stream-output stage streams primitive data from the pipeline to memory on its way to the rasterizer. Data can be streamed out and/or passed into the rasterizer. Data streamed out to memory can be recirculated back into the pipeline as input data or read-back from the CPU.
  • Rasterizer Stage - The rasterizer clips primitives, prepares primitives for the pixel shader, and determines how to invoke pixel shaders.
  • Pixel-Shader Stage - The pixel-shader stage receives interpolated data for a primitive and generates per-pixel data such as color.
  • Output-Merger Stage - The output-merger stage combines various types of output data (pixel shader values, depth and stencil information) with the contents of the render target and depth/stencil buffers to generate the final pipeline result.
  • Hull-shader, tessellator, and domain-shader stages, which comprise the tessellation stages - The tessellation stages convert higher-order surfaces to triangles for rendering within the Direct3D 11 pipeline.

The Direct3D 11 programmable pipeline is also designed for providing high-speed computing tasks. A compute shaderexpands Direct3D 11 beyond graphics to support general purpose GPU computing.

Related topics

Programming Guide for Direct3D 11


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值