博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MOBILE GPU FLOATING POINT ACCURACY VARIANCES
阅读量:4551 次
发布时间:2019-06-08

本文共 3787 字,大约阅读时间需要 12 分钟。

MOBILE GPU FLOATING POINT ACCURACY VARIANCES  April 4, 2013

When coding GPU shaders for multiple target platforms it is important to consider the differences of the hardware 

implementations and their impact. This is especially true when creating Natural User Interfaces (NUIs) as the use of shaders for visual enhancement or experience augmentation is crucial, and cannot vary between OS platforms or devices.

One of the key differentiators between mobile GPU families is the capability of the computational units. These differences are normally seen with handling of code complexity or visual artifacts created by the rendering schemes, especially with tile-based systems. These can sometimes be overcome using simpler shader algorithms or creative approaches to the geometry constructs being used.

However, the more significant contributor to the quality of the shader output lies in the accuracy of the floating point calculations within the GPU. This contrasts greatly from CPU computational accuracy and variances are common between the different mobile GPU implementations from ARM Mali, Imagination Technology, Vivante and others.

Being able to compare the accuracy of various GPU models allows us to prepare for the lowest accuracy units to ensure the shader output is still acceptable while optimizing for incredible visual effects from the better performing hardware. Our uSwish NUI platform makes direct use of this information to ensure a consistent look and feel, a key differentiator in the User Interface market.

In a perfect world only one reference implementation would be needed. This is simply not viable with today’s hardware. At worst, we may need to do several implementations, targeting the various accuracy levels, to ensure a common visual effect and consistent user experience. If calculation errors occur when outside the usable range of the floating point units, then we must account for that to prevent undesirable effects.

Let’s compare some current mobile devices using some simple fragment shader code:

precision highp float;

uniform vec2 resolution;
void main( void )
{
      float x = ( 1.0 – ( gl_FragCoord.x / resolution.x ));

      float y = ( gl_FragCoord.y / resolution.y ) * 26.0;

      float yp = pow( 2.0, floor(y) );
      float fade = fract( yp + fract(x) );
      if(fract(y) < 0.9)
          gl_FragColor = vec4( vec3( fade ), 1.0 );
    else
          gl_FragColor = vec4( 0.0 );
}

 This example will calculate a varying fade level from bright white down to black over 26 iterations on the screen. The further down the screen the smooth blended line goes, the more precision we have in the floating point unit.

For reference we will use a desktop rendering of the shader, for our purposes this sample from a laptop nVidia GeForce GT 630M is more than enough:

YOUi Labs Shader Comparison

 

After comparing the output across different GPU chipsets we immediately see the difference in performance and usable range of the floating point units. It is important to note that this is not related to device performance or even GPU implementation differences by different manufacturers – it is simply the computation range of the GPU itself. Most comparisons are done through tests of pure performance: triangles per second or texel fill rate. Although these numbers are valuable, they do not tell the full story of the GPUs true capability. When applied to Natural User Interfaces these computational differences are even more important since, unlike games, there is no tolerance for any visual artifacts.

 

To see the effect of these computational differences, or to try some on your own device to examine performance, check out the following:

1) , showing the result of these calculation errors

2) , an Android application for viewing the shaders for comparison on a device

转载于:https://www.cnblogs.com/JonnyLulu/articles/3632343.html

你可能感兴趣的文章
H5离线缓存机制-manifest
查看>>
比较:I/O成员函数getline() 与 get()(第二种用法)的用法异同
查看>>
201671010118 2016-2017-2《Java程序设计》 第十一周学习心得
查看>>
Get Sauce(状压DP)
查看>>
Office2007 升级到 office2010
查看>>
Python+Selenium 自动化实现实例-Xpath捕捉元素的几种方法
查看>>
SpringBoot整合Hibernate
查看>>
PPT1 例2
查看>>
extern外部方法使用C#简单例子
查看>>
血液循环结构
查看>>
SQL Server统计数据库中表个数、视图个数、存储过程个数
查看>>
设计模式:观察者模式
查看>>
JVM体系结构之六:堆Heap之1
查看>>
TCP之二:TCP的三次握手与四次分手
查看>>
es的返回数据结构
查看>>
[ActionScript 3.0] as3处理xml的功能和遍历节点
查看>>
linux学习(6)-redhat安装xwindow环境
查看>>
6.28 加法作业
查看>>
CentOS6+nginx+uwsgi+mysql+django1.6.6+python2.6.6
查看>>
【bzoj2829】信用卡凸包 凸包
查看>>