zoukankan      html  css  js  c++  java
  • [zz]DirectX 11 and Shared Model 5.0

    先对比一下

    OpenGL
    Version
    GLSL
    Version
    2.0 1.10
    2.1 1.20
    3.0 1.30
    3.1 1.40
    3.2 1.50

    For all versions of OpenGL 3.3 and above, the corresponding GLSL version matches the OpenGL version. So GL 4.1 uses GLSL 4.10.

    Direct3D Shader Model 4.0 is equivalent to GLSL version 3.30. Earlier GLSL versions for OpenGL 3.x provide subsets of this functionality, based on the available functionality in the OpenGL version, though 1.50 is almost feature-identical to SM4.

    Direct3D Shader Model 5.0 is equivalent to GLSL version 4.30.

    DirectX 11 support

    Probably the biggest part of our theoretical section is devoted to the new version of this graphics API, which works in Windows 7 and Windows Vista (after Windows Update). There are a lot of new features in this version. They have to do with performance improvements and qualitative changes.

    Performance improvements include multithreaded rendering as well as new features of DirectCompute. Image quality improvements include: tessellation, order-independent rendering of transparent polygons, complex postprocessing, new features of shadow filtering. Running physics computations and AI algorithms on GPUs via DirectCompute looks very promising for games.

    DirectX 11 features software support for all previous levels of hardware, starting from DirectX 10. Although old DX10 GPUs can support only some of DirectX 11 features, several functions of the new API can make the life of game developers easier. However, sterling DirectX 11 GPUs, such as Cypress, are required to reveal full potential of this API version. Only such GPUs can provide support for DirectCompute11 and improved multithreaded rendering. Multithreading will work with old GPUs, if they are supported by new drivers, but performance may be lower than with DX11 GPUs.

    Shared Model 5.0

    Shader Model 5 offers a new set of instructions with a more flexible access to data and more convenience for developers. It's a unified set of instructions, the same for shaders of all types: Vertex, Hull, Domain, Geometry, Pixel, and Compute. It uses an object-oriented program model, functions and routines in shader code facilitate development of graphics applications.

    Let's enumerate some of the new instructions in Shader Model 5.0:

    • SV_Coverage provides information about sample coverage for pixel shaders, it's used to detect polygon edges in specific antialiasing algorithms.
    • Gather fetches four samples with a single instruction, it's used in algorithms of shadow filtering and ambient occlusion.
    • Instructions to convert data types between 32-bit and 16-bit floating-point formats, which facilitates programming in some cases.
    • Bit operations to accelerate data compression and decompression.

    DirectCompute

    One of the most important features of the new graphics API is DirectCompute, which gives access to general GPU computing technology (ATI Stream Technology). This feature is especially important, because DirectX API is the industrial standard, it will always be used.

    There are several levels of hardware support: DirectCompute10 for DirectX 10.0 GPUs, DirectCompute10.1 and DirectCompute11 correspondingly. DirectCompute can be used in image processing and filtering, rendering of semitransparent surfaces without preliminary sorting (Order Independent Transparency), shadow rendering, physics effects, artificial intelligence algorithms, ray tracing.

    DirectCompute11 supported by Cypress provides more features than DirectCompute10, here are some of them:

    • 3D Thread Dispatch -- replacing several 2D arrays of threads with one 3D array.
    • The maximum number of threads in DirectCompute11 has been increased from 768 to 1024, so it's possible to execute more threads simultaneously (by 33%).
    • Memory volume per group of threads has been increased from 16KB to 32KB, this memory is used to transfer data between threads.
    • Access to shared memory has been improved, instead of writing into the 256KB area it's now possible to read and write into the 32KB area.
    • Atomic operations allow each thread to use protected areas of memory, so they significantly facilitate porting algorithms from CPU to GPU.
    • Double precision computing required by some generic computing algorithms.
    • Gather4 -- fetching from video memory up to four times as fast (in certain conditions).

    Tessellation in DirectX 11

    New shader types have been added for more convenient tessellation in DirectX 11: Hull and Domain Shaders. Hardware-assisted tessellation in DX11 allows to use a wide range of algorithms and methods: Catmull-Clark Subdivison, Bezier and N-patches, Displacement Mapping, adaptive tessellation (dynamic Level of Detail).

    We've touched upon tessellation many times. In brief, it allows to obtain detailed models under light GPU load. Tessellation (breaking a model into triangles) is basically used to create ground and water surfaces, sometimes even for character modeling. You can see it in the next STALKER game -- smooth and round surfaces (and not very good textures):

    Order Independent Transparency (OIT)

    It's drawing semitransparent polygons without preliminary sorting to make rendering of overlapping semitransparent objects (shadow, fire, water, glass, etc) more efficient. Here is AMD's demonstration of the effect:

    We cannot say that it's a new feature. Rendering semitransparent surfaces requires preliminary sorting for correct output, as their blending requires a certain draw order. DirectCompute11 features only facilitate such rendering by sorting pixels in a single pass. Atomic operations and append buffers are used for this.

    Postprocessing

    DirectCompute can be used to accelerate image postprocessing and make it more complex. There are a lot of postfiltering types: depth of field, motion blur, edge detection, antialiasing, sharpening, etc.

    Postprocessing requires data about neighboring pixels. DirectCompute significantly facilitates the usage of complex postfilters, increasing their performance and improving image quality. For example, constant time filter spreading imitates the optical depth of field effect, this new technique was developed by AMD together with University of California in Berkeley. It does not require an alpha buffer, and the code uses access to shared memory. As a result, there are fewer artifacts (like halos and sharp silhouettes), higher processing speed compared to usual methods with pixel shaders.

    Postprocessing with DirectCompute can also improve shadow rendering algorithms, including ambient occlusion (AMD calls it HDAO -- High Definition Ambient Occlusion). We already described this algorithm, it's a global lighting (shadowing) model used in 3D graphics to make images look more realistic by calculating light intensity on the surface.

    DirectCompute11 gives extra features to render more realistic shadows, when a shadow becomes more blurry at the edges as it gets farther (that is half-shadows look more realistic). AMD provides the following pictures from STALKER: Call of Pripyat:

    Improvements and additional formats of texture compression

    DirectX 11 allows to compress 16-bit HDR textures, which compression ratio reaches 6:1. It will come in handy in modern games, as they often use such formats. Besides, this version of the graphics API offers improved texture compression quality (confirmed by the best SNR parameter -- signal-to-noise) and reduced pixelization artifacts in textures.

    Multithreaded rendering

    It's one of the long-awaited improvements in the DirectX API, which has been available in game consoles for a long time. Now not only an application, DirectX runtime code, and the driver are executed each in its own separate thread, but also such tasks as loading textures or compiling shaders can be started in parallel threads.

    This innovation will help eliminate bottlenecks in CPU performance in case of many draw calls -- some of them can finally be offloaded to another thread, which can be executed on another CPU core, different from the one running the main rendering thread. Don't confuse it with multithreaded game code!

    Games supporting DirectX 11

    All these improvements are useful, but when will they appear in games? BattleForge from EA Phenomic is already available, S.T.A.L.K.E.R.: Call of Pripyat from GSC Gameworld -- available, DiRT 2 from Codemasters -- December 31, 2009, Lord of the Rings Online from Turbine -- Q1 2010, Aliens vs Predator from Rebellion -- Q1, 2010.

    Besides, the Frostbite 2 Engine from EA DICE and the Vision Engine from Trinigy are also ready for DX11, but release dates of games based on these engines have not been officially announced yet. So it's clear that real hardware support for DirectX 11 will come in handy only in 2010, and you will probably have to look really hard to find any improvements at first. But on the whole, we are glad that AMD started to cooperate with game developers.

    Aliens vs Predator

    Aliens vs Predator is one of the long-awaited games. AMD and Rebellion unanimously say that it will be the first big-budget games with sterling support for DirectX 11. This game will support DX9 (probably console heritage) and DX11 API. It promises the following features of the latest API version to accelerate the game and improve the picture: tessellation of the character model and environment surfaces. They can be seen in the following pictures:



    These specially prepared pictures show the difference, but it's not that big (especially on the first one). Let's see what happens in reality, and whether such level of detail makes sense. Besides, Aliens vs Predator promises fast postprocessing of high quality using Compute Shaders and more realistic shaders (including ambient occlusion).

    This difference is hard to detect. We leave it up to you. Let's hope this difference will be bigger in the real game.

    Colin McRae DiRT 2

    That's another interesting game people are looking forward to, which uses the new features of DirectX 11. Its PC version seems to be delayed till the end of the year, while its console versions have been already released. Probably AMD tries hard to offer sterling DirectX 11 support.

    Representatives of the game developer announced that the game engine was ported to DirectX 11. It uses dynamic tessellation of water surfaces, cloth (flags, etc), animated characters. The screenshot below shows a wireframe render of the water surface through which a car is driving. It looks good, but you don't actually pay attention to such effects at full speed:

    The game also uses DirectCompute11 to optimize postprocessing effects. The new features of Shader Model 5.0 were used for shadow map filtering of higher quality and good depth of field. Besides, we are really happy to announce that the game will have a built-in benchmark! That's what the right support from the GPU manufacturer means.


    Read more at http://ixbtlabs.com/articles3/video/cypress-p3.html#w7ktJGvZ5XsMcU9C.99

  • 相关阅读:
    .NET Core 调用百度 PaddleOCR 识别图文
    ASP.NET Core 查看应用状态和统计
    锐浪报表 winform程序 数据源设置为excel时提示用户名密码隐藏
    单例
    WPF 设计器一直加载一分钟才显示
    .net 5 SignalR WPF 服务端+客户端
    WPF 使用Image 捕获摄像头数据,并将image改为圆形
    Vue Element-ui Table实现动态新增和删除
    Element-UI 中使用rules验证
    @Value读取不到配置文件的值
  • 原文地址:https://www.cnblogs.com/dearplain/p/2997675.html
Copyright © 2011-2022 走看看