Graphics Trace 使用主要是用来分析问题是出现在cpu还是gpu(个人理解 如果有误麻烦指出)
首先运行配置好你的执行exe路径(注意下面有三个按钮 需要点击第一个, 否则是执行Frame capture)
运行过程中使用快捷键ctrl+shift+T 过3秒左右会截取好数据 屏幕会有提示
这时打开Graphics Trace Analyzer 工具进行查看
选择一帧 然后点右上角的缩放
这里主要是看上下两部分 如上所示 如果在一帧的时间中 上面的UE4Game 游戏程序一直执行 说明瓶颈在cpu段
如果上面的cpu块只有一部分的话 那么瓶颈段在gpu
Gpu Frame查看的话是运行Monitor 然后快捷键ctrl + shift + C
Graphics Frame Analyze中部分参数的意义(可能有误)
CS Invocations:
表示计算着色器调用的次数。每个线程组的每个线程调用计算着色器一次。每个线程组中的线程数由计算着色器的 numthreads 属性(numthreads(tX, tY, tZ)
)定义。执行的线程组数由 Dispatch 调用的参数(Dispatch(gX, gY, gZ)
)确定。CS Invocations 等于 (gX*gY*gZ)*(tX*tY*tZ)
Clipper Invocations:
represents the number of primitives processed by the Clipper.
DS Invocations:
曲面细分数 ue4受Tessellation影像
GS Invocations:
Geometry shader
HS Onvocations:
Hull Shader
Pixels Rendered:
代表通过深度测试的像素的数量
Post-Clip Primitives:
shows the number of primitives that flowed out of the Clipper 大部分情况下不需要关注
Post-GS Primitives
represents the number of primitives that flowed out of the geometry shader (GS), if enabled, to the clipper. This metric is important if a geometry shader was associated with the selected rendering calls, and even more important if the number of primitives spawned by geometry shader code is dynamic.
Primitive Count:
渲染的Triangles个数
VS Invocations:
verten shader调用次数
Vertex Count:
顶点个数
右下方还有一些实时的优化测试按钮
Texture 2x2 是用来确认你的瓶颈是不是由texture map 引起的 如果点击后帧率提升的话 那么就需要优化texture
降低分辨率 减少材质中的图片 降低texture的fiter 设置
Simple PS 替换默认的fragment shader 如果帧率提升明显的话 那么需要优化你的材质
1x1scissor 如果选中后如果帧率没有提升明显的话 那么瓶颈就是几何网格或者vertex shader的问题,如果提升明显的话那就是vertex shader的问题