UDN
Search public documentation:

MobileGPUProfilingCH
English Translation
日本語訳
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3主页 > 移动设备主页>移动设备GPU分析

移动设备GPU分析


概述


(鼠标悬停来查看图片变化)

ProfileEx1.jpg

在移动设备的硬件机能下,渲染的表现面临比其他平台更为严峻的考验。 移动设备电量和低热的要求导致了内存带宽,CPU和GPU数字性能的更严格限制。 雪上加霜的是,好的分析工具稀有,移动硬件规格不一。 甚至OS版本也会影响特性的发挥。 此处我们通过提供简单的机制来分析效能并给出解决问题的总体提示以期对此情形能有所帮助。

测量移动设备上的GPU时间


移动设备不支持时间戳查询,而这个查询在其他平台被用来直接测量GPU时间,比如全部帧或某一特性的性能消耗。 比如,'profilegpu' 命令在D3D9 和D3D11里输出帧的不同处的GPU时间, 'stat unit'命令显示帧的GPU时间。 结果是我们唯一可使用的测量是总体帧时间。 现在CPU和GPU并行运行(游戏线程,渲染线程),帧时间将会是两者中较长的一个。 这意味着为了使用总体帧时间来测量帧的GPU时间,现有帧必须受GPU约束. 您可以查看'stat unit'来确认是否如此。 如果帧时间大于‘游戏’或‘描画’时间,那么即为受限于GPU。 注意当取消许多渲染功能时,不要造成受限于CPU的情况并随之造成错误的测量。 在上面的截图中,帧时间仅仅比描画时间多了2ms,所以当关闭GPU功能时,它会很快受限于CPU。

用变量ProfileEx来测算一些渲染特性对性能的影响


在没有更好的方法前,这里有一个很简单的办法来分析渲染特性。 您可以为您想要分析的特性定义蒙板,并且一旦开启蒙板,它会每5秒切换这些特性。 看帧时间,您可以看到此特性对帧时间的影响。 如果帧率变化很大,那么此方法就不是那么有用。 为得到稳定的帧率 您可以更多地暂停游戏,或创建没有任何移动的场景。

帧时间会自动显示(没有平滑过且每秒只更新一次)

为激活,您可以设置控制台变量 "ProfileEx".。

您从控制台得到的最新的帮助文本:

ProfileEx ?
        Profile experiment: to profile features only by looking at stat unit (alternating it on/off)
        This is useful on platforms that don't support any other profiling functionality.
        Make sure VSYNC is off and ideally you are in "pause".
        "Stat unit" and "StableFrameTime" are activated with the feature.
        FeatureMask in hex (add to combine, 0 is off, e.g. 0x1a = 0x10 0x08 0x02):
         0x001: Deferred shadow projection
         0x002: Depth of Field
         0x004: Bloom
         0x008: Shadows (shadow map generation and projection)
         0x010: Depth resolve (mobile only)
         0x020: Bloom/DOF blur (mobile only)
         0x040: Force Gaussian to blur with 4 samples at max
         0x080: Fog (mobile only)
         0x100: Translucency
         0x200: Skeletal meshes
         0x400: StaticMeshes
         0x800: Particles (only toggles rendering)

示例应用:

ProfileEx 0x100
        to profile translucency

ProfileEx 0x500
        to profile translucency and static meshes

在代码中,您可以使用很少的C++代码来测试这些位,如下所示:

if(!GetProfileExState(0x2, View.Family->CurrentRealTime))
{
    // we want to profile with the feature off
    OutSettings.bEnableDOF = FALSE;
}

在FINAL_RELEASE中此特性不可用。

如何调整通用设置功能以适应特定平台


许多设置文件在ini文件中(比如[系统设定]部分的BaseEngine.ini文件),那些可以由特定平台来重设(参见[移动平台系统设置] 或 [IPad系统设置] 一些例子:

MobileFog=True
MobileHeightFog=False
MobileSpecular=True
MobileBumpOffset=True
MobileNormalMapping=True
MobileEnvMapping=True
MobileRimLighting=True
MobileColorBlending=True
MobileColorGrading=False
MobileVertexMovement=True
MobileOcclusionQueries=False
; 0 means no sharpening, -0.5 results in sharper textures but slightly slower rendering and more shimmering
MobileLODBias=-0.5

这是我们最近介绍过的,也是更具有实验性质的:

MobileSceneDepthResolveForShadows= TRUE

通过防止深度缓冲解析,它可以节约不少性能损耗。 当开启此功能时,您可能会看到失真,因为它可能会从之前的帧中获取深度缓冲。 在一些游戏中,这可能是完全没问题的(比如看起来像2D的3d游戏:镜头不怎么移动,大多数和接受阴影处一样为平地)。