把手机连到Xcode点击菜单的Product->RUn,启动游戏。或者直接打开手机后,启动游戏。
点击菜单的Debug->Capture GPU frame,会进行屏幕截取。
如图,但刚进去时,CommandBuffer是收缩的,下面的RenderCommandEncoder也是收缩的。我们要看草的shader编译后的代码,所以要打开每个RenderCommandEncoder,看下面的Camera.Render->Drawing,这里草这个的Drawing下面的Render.OpaqueGeometry,双击即可打开有左边的窗口和草的绿色格子的窗口,但右边的代码的窗口无法看到。
此时,点击菜单的View->Asistant Editor->Show Asistant Editor,即可打开右边的窗口,在右侧选择Bound GPu Objects->Functions-》Vertex和fragment,能分别查看编译后的metal或openGLES的vertex或fragment的代码。
note:有时候第一次打不开,重新插一次手机,或者product->Scheme->EditScheme,左边的Run签页,右边选择option选项,将GPU Frame Capture设为Automatically Enabled后试试。