private void ExecuteShaderTextureSave(FrameDebuggerEventData frameInfo) { if (!(this.captureFlag.HasFlag(CaptureFlag.ShaderTexture))) { return; } var textureParams = frameInfo.convertedProperties.convertedTextures; foreach (var textureParam in textureParams) { TextureUtility.SaveTextureInfo saveTextureInfo = null; var texture = textureParam.value as Texture; if (texture == null) { continue; } // save texture string dir = System.IO.Path.Combine(this.saveDirectory, "shaderTexture"); if (!System.IO.Directory.Exists(dir)) { System.IO.Directory.CreateDirectory(dir); } if (texture.GetType() == typeof(Texture2D)) { saveTextureInfo = SaveTexture2D((Texture2D)texture, dir); } if (texture.GetType() == typeof(RenderTexture)) { saveTextureInfo = SaveRenderTexture((RenderTexture)texture, dir); } textureParam.saveTextureInfo = saveTextureInfo; } }
private void DrawStates(FrameDebuggerEventData curEventData) { FrameDebuggerBlendState blendState = curEventData.blendState; FrameDebuggerRasterState rasterState = curEventData.rasterState; FrameDebuggerDepthState depthState = curEventData.depthState; string str = string.Empty; if ((int)blendState.renderTargetWriteMask == 0) { str = "0"; } else { if (((int)blendState.renderTargetWriteMask & 2) != 0) { str += "R"; } if (((int)blendState.renderTargetWriteMask & 4) != 0) { str += "G"; } if (((int)blendState.renderTargetWriteMask & 8) != 0) { str += "B"; } if (((int)blendState.renderTargetWriteMask & 1) != 0) { str += "A"; } } GUILayout.Label(string.Format("Blend {0} {1}, {2} {3} ColorMask {4}", (object)blendState.srcBlend, (object)blendState.dstBlend, (object)blendState.srcBlendAlpha, (object)blendState.dstBlendAlpha, (object)str), EditorStyles.miniLabel, new GUILayoutOption[0]); GUILayout.Label(string.Format("ZTest {0} ZWrite {1} Cull {2} Offset {3}, {4}", (object)depthState.depthFunc, (object)(depthState.depthWrite != 0 ? "On" : "Off"), (object)rasterState.cullMode, (object)rasterState.slopeScaledDepthBias, (object)rasterState.depthBias), EditorStyles.miniLabel, new GUILayoutOption[0]); }
private void DrawMeshPreview(FrameDebuggerEventData curEventData, Rect previewRect, Rect meshInfoRect, Mesh mesh, int meshSubset) { if (this.m_PreviewUtility == null) { this.m_PreviewUtility = new PreviewRenderUtility(); this.m_PreviewUtility.m_CameraFieldOfView = 30f; } if ((UnityEngine.Object) this.m_Material == (UnityEngine.Object)null) { this.m_Material = EditorGUIUtility.GetBuiltinExtraResource(typeof(Material), "Default-Material.mat") as Material; } if ((UnityEngine.Object) this.m_WireMaterial == (UnityEngine.Object)null) { this.m_WireMaterial = ModelInspector.CreateWireframeMaterial(); } this.m_PreviewUtility.BeginPreview(previewRect, (GUIStyle)"preBackground"); ModelInspector.RenderMeshPreview(mesh, this.m_PreviewUtility, this.m_Material, this.m_WireMaterial, this.m_PreviewDir, meshSubset); this.m_PreviewUtility.EndAndDrawPreview(previewRect); string str = mesh.name; if (string.IsNullOrEmpty(str)) { str = "<no name>"; } string text = str + " subset " + (object)meshSubset + "\n" + (object)curEventData.vertexCount + " verts, " + (object)curEventData.indexCount + " indices"; EditorGUI.DropShadowLabel(meshInfoRect, text); }
private void DrawStates(FrameDebuggerEventData curEventData) { FrameDebuggerBlendState blendState = curEventData.blendState; FrameDebuggerRasterState rasterState = curEventData.rasterState; FrameDebuggerDepthState depthState = curEventData.depthState; string text = string.Format("Blend {0} {1}", blendState.srcBlend, blendState.dstBlend); if (blendState.srcBlendAlpha != blendState.srcBlend || blendState.dstBlendAlpha != blendState.dstBlend) { text += string.Format(", {0} {1}", blendState.srcBlendAlpha, blendState.dstBlendAlpha); } if (blendState.blendOp != BlendOp.Add || blendState.blendOpAlpha != BlendOp.Add) { if (blendState.blendOp == blendState.blendOpAlpha) { text += string.Format(" BlendOp {0}", blendState.blendOp); } else { text += string.Format(" BlendOp {0}, {1}", blendState.blendOp, blendState.blendOpAlpha); } } if (blendState.writeMask != 15u) { text += " ColorMask "; if (blendState.writeMask == 0u) { text += '0'; } else { if ((blendState.writeMask & 2u) != 0u) { text += 'R'; } if ((blendState.writeMask & 4u) != 0u) { text += 'G'; } if ((blendState.writeMask & 8u) != 0u) { text += 'B'; } if ((blendState.writeMask & 1u) != 0u) { text += 'A'; } } } GUILayout.Label(text, EditorStyles.miniLabel, new GUILayoutOption[0]); string text2 = string.Format("ZTest {0} ZWrite {1} Cull {2}", depthState.depthFunc, (depthState.depthWrite != 0) ? "On" : "Off", rasterState.cullMode); if (rasterState.slopeScaledDepthBias != 0f || rasterState.depthBias != 0) { text2 += string.Format(" Offset {0}, {1}", rasterState.slopeScaledDepthBias, rasterState.depthBias); } GUILayout.Label(text2, EditorStyles.miniLabel, new GUILayoutOption[0]); }
private bool DrawEventMesh(FrameDebuggerEventData curEventData) { Mesh mesh = curEventData.mesh; bool result; if (mesh == null) { result = false; } else { Rect rect = GUILayoutUtility.GetRect(10f, 10f, new GUILayoutOption[] { GUILayout.ExpandHeight(true) }); if (rect.width < 64f || rect.height < 64f) { result = true; } else { GameObject frameEventGameObject = FrameDebuggerUtility.GetFrameEventGameObject(curEventData.frameEventIndex); Rect rect2 = rect; rect2.yMin = rect2.yMax - EditorGUIUtility.singleLineHeight * 2f; Rect position = rect2; rect2.xMin = rect2.center.x; position.xMax = position.center.x; if (Event.current.type == EventType.MouseDown) { if (rect2.Contains(Event.current.mousePosition)) { EditorGUIUtility.PingObject(mesh); Event.current.Use(); } if (frameEventGameObject != null && position.Contains(Event.current.mousePosition)) { EditorGUIUtility.PingObject(frameEventGameObject.GetInstanceID()); Event.current.Use(); } } this.m_PreviewDir = PreviewGUI.Drag2D(this.m_PreviewDir, rect); if (Event.current.type == EventType.Repaint) { int meshSubset = curEventData.meshSubset; this.DrawMeshPreview(curEventData, rect, rect2, mesh, meshSubset); if (frameEventGameObject != null) { EditorGUI.DropShadowLabel(position, frameEventGameObject.name); } } result = true; } } return(result); }
private bool DrawEventMesh(FrameDebuggerEventData curEventData) { Mesh mesh = curEventData.mesh; if ((UnityEngine.Object)mesh == (UnityEngine.Object)null) { return(false); } Rect rect = GUILayoutUtility.GetRect(10f, 10f, new GUILayoutOption[1] { GUILayout.ExpandHeight(true) }); if ((double)rect.width < 64.0 || (double)rect.height < 64.0) { return(true); } GameObject frameEventGameObject = FrameDebuggerUtility.GetFrameEventGameObject(curEventData.frameEventIndex); Rect meshInfoRect = rect; meshInfoRect.yMin = meshInfoRect.yMax - EditorGUIUtility.singleLineHeight * 2f; Rect position = meshInfoRect; meshInfoRect.xMin = meshInfoRect.center.x; position.xMax = position.center.x; if (Event.current.type == EventType.MouseDown) { if (meshInfoRect.Contains(Event.current.mousePosition)) { EditorGUIUtility.PingObject((UnityEngine.Object)mesh); Event.current.Use(); } if ((UnityEngine.Object)frameEventGameObject != (UnityEngine.Object)null && position.Contains(Event.current.mousePosition)) { EditorGUIUtility.PingObject(frameEventGameObject.GetInstanceID()); Event.current.Use(); } } this.m_PreviewDir = PreviewGUI.Drag2D(this.m_PreviewDir, rect); if (Event.current.type == EventType.Repaint) { int meshSubset = curEventData.meshSubset; this.DrawMeshPreview(curEventData, rect, meshInfoRect, mesh, meshSubset); if ((UnityEngine.Object)frameEventGameObject != (UnityEngine.Object)null) { EditorGUI.DropShadowLabel(position, frameEventGameObject.name); } } return(true); }
private void DrawMeshPreview(FrameDebuggerEventData curEventData, Rect previewRect, Rect meshInfoRect, Mesh mesh, int meshSubset) { if (this.m_PreviewUtility == null) { this.m_PreviewUtility = new PreviewRenderUtility(); this.m_PreviewUtility.m_CameraFieldOfView = 30f; } if (this.m_Material == null) { this.m_Material = (EditorGUIUtility.GetBuiltinExtraResource(typeof(Material), "Default-Material.mat") as Material); } if (this.m_WireMaterial == null) { this.m_WireMaterial = ModelInspector.CreateWireframeMaterial(); } this.m_PreviewUtility.BeginPreview(previewRect, "preBackground"); ModelInspector.RenderMeshPreview(mesh, this.m_PreviewUtility, this.m_Material, this.m_WireMaterial, this.m_PreviewDir, meshSubset); this.m_PreviewUtility.EndAndDrawPreview(previewRect); string text = mesh.name; if (string.IsNullOrEmpty(text)) { text = "<no name>"; } string text2 = string.Concat(new object[] { text, " subset ", meshSubset, "\n", curEventData.vertexCount, " verts, ", curEventData.indexCount, " indices" }); if (curEventData.instanceCount > 1) { string text3 = text2; text2 = string.Concat(new object[] { text3, ", ", curEventData.instanceCount, " instances" }); } EditorGUI.DropShadowLabel(meshInfoRect, text2); }
private void CreateShaderPropInfos(FrameDebuggerEventData frameInfo) { var originProps = frameInfo.shaderProperties; var originPropType = this.reflectionCache.GetTypeObject(originProps.GetType()); var originPropReflection = new ReflectionClassWithObject(originPropType, originProps); frameInfo.convertedProperties = new ShaderProperties(); originPropReflection.CopyFieldsToObjectByVarName <ShaderProperties>(ref frameInfo.convertedProperties); var props = frameInfo.convertedProperties; props.convertedFloats = ReflectionClassWithObject.CopyToListFromArray <ShaderPropertyInfo>(this.reflectionCache, props.floats); props.convertedVectors = ReflectionClassWithObject.CopyToListFromArray <ShaderPropertyInfo>(this.reflectionCache, props.vectors); props.convertedMatricies = ReflectionClassWithObject.CopyToListFromArray <ShaderPropertyInfo>(this.reflectionCache, props.matrices); props.convertedTextures = ReflectionClassWithObject.CopyToListFromArray <ShaderPropertyInfo>(this.reflectionCache, props.textures); props.convertedBuffers = ReflectionClassWithObject.CopyToListFromArray <ShaderPropertyInfo>(this.reflectionCache, props.buffers); }
private void DrawStates(FrameDebuggerEventData curEventData) { FrameDebuggerBlendState blendState = curEventData.blendState; FrameDebuggerRasterState rasterState = curEventData.rasterState; FrameDebuggerDepthState depthState = curEventData.depthState; string text = string.Empty; if (blendState.renderTargetWriteMask == 0u) { text = "0"; } else { if ((blendState.renderTargetWriteMask & 2u) != 0u) { text += "R"; } if ((blendState.renderTargetWriteMask & 4u) != 0u) { text += "G"; } if ((blendState.renderTargetWriteMask & 8u) != 0u) { text += "B"; } if ((blendState.renderTargetWriteMask & 1u) != 0u) { text += "A"; } } GUILayout.Label(string.Format("Blend {0} {1}, {2} {3} ColorMask {4}", new object[] { blendState.srcBlend, blendState.dstBlend, blendState.srcBlendAlpha, blendState.dstBlendAlpha, text }), EditorStyles.miniLabel, new GUILayoutOption[0]); GUILayout.Label(string.Format("ZTest {0} ZWrite {1} Cull {2} Offset {3}, {4}", new object[] { depthState.depthFunc, (depthState.depthWrite != 0) ? "On" : "Off", rasterState.cullMode, rasterState.slopeScaledDepthBias, rasterState.depthBias }), EditorStyles.miniLabel, new GUILayoutOption[0]); }
private void SetRenderTextureLastChange(FrameDebuggerEventData frameInfo) { var rt = TextureUtility.GetTargetRenderTexture(frameInfo); if (rt == null) { return; } int instanceId = rt.GetInstanceID(); if (this.renderTextureLastChanged.ContainsKey(instanceId)) { renderTextureLastChanged[instanceId] = frameInfo.frameEventIndex; } else { renderTextureLastChanged.Add(instanceId, frameInfo.frameEventIndex); } }
private void ExecuteSaveScreenShot(FrameDebuggerEventData frameInfo, bool isFinalFrameEvent) { if (!(this.captureFlag.HasFlag(CaptureFlag.FinalTexture)) && !(this.captureFlag.HasFlag(CaptureFlag.ScreenShotBySteps))) { return; } if (!this.captureFlag.HasFlag(CaptureFlag.ScreenShotBySteps) && !isFinalFrameEvent) { return; } RenderTexture renderTexture = null; bool isGetFromTargetRT = this.captureFlag.HasFlag(CaptureFlag.CaptureFromOriginRT) && !isFinalFrameEvent; if (isGetFromTargetRT) { renderTexture = TextureUtility.GetTargetRenderTexture(frameInfo); } if (renderTexture == null) { renderTexture = TextureUtility.GetGameViewRT(); } if (renderTexture != null && renderTexture) { string dir = System.IO.Path.Combine(this.saveDirectory, "screenshot"); string path = null; if (!System.IO.Directory.Exists(dir)) { System.IO.Directory.CreateDirectory(dir); } if (isFinalFrameEvent) { path = System.IO.Path.Combine(dir, "final"); } else { path = System.IO.Path.Combine(dir, "ss-" + frameInfo.frameEventIndex); } frameInfo.savedScreenShotInfo = TextureUtility.SaveRenderTexture(renderTexture, path); } }
private void DrawEventDrawCallInfo(FrameDebuggerEventData curEventData) { string text = curEventData.shaderName + ", pass #" + curEventData.shaderPassIndex; EditorGUILayout.LabelField("Shader", text, new GUILayoutOption[0]); if (GUI.Button(GUILayoutUtility.GetLastRect(), FrameDebuggerWindow.Styles.selectShaderTooltip, GUI.skin.label)) { EditorGUIUtility.PingObject(curEventData.shaderInstanceID); Event.current.Use(); } if (!string.IsNullOrEmpty(curEventData.shaderKeywords)) { EditorGUILayout.LabelField("Keywords", curEventData.shaderKeywords, new GUILayoutOption[0]); if (GUI.Button(GUILayoutUtility.GetLastRect(), FrameDebuggerWindow.Styles.copyToClipboardTooltip, GUI.skin.label)) { EditorGUIUtility.systemCopyBuffer = text + Environment.NewLine + curEventData.shaderKeywords; } } this.DrawStates(curEventData); if (curEventData.batchBreakCause > 1) { GUILayout.Space(10f); GUILayout.Label(FrameDebuggerWindow.Styles.causeOfNewDrawCallLabel, EditorStyles.boldLabel, new GUILayoutOption[0]); GUILayout.Label(FrameDebuggerWindow.styles.batchBreakCauses[curEventData.batchBreakCause], EditorStyles.wordWrappedLabel, new GUILayoutOption[0]); } GUILayout.Space(15f); this.m_AdditionalInfo = (ShowAdditionalInfo)GUILayout.Toolbar((int)this.m_AdditionalInfo, this.m_AdditionalInfoGuiContents, new GUILayoutOption[0]); ShowAdditionalInfo additionalInfo = this.m_AdditionalInfo; if (additionalInfo != ShowAdditionalInfo.Preview) { if (additionalInfo == ShowAdditionalInfo.ShaderProperties) { this.DrawShaderProperties(curEventData.shaderProperties); } } else if (!this.DrawEventMesh(curEventData)) { EditorGUILayout.LabelField("Vertices", curEventData.vertexCount.ToString(), new GUILayoutOption[0]); EditorGUILayout.LabelField("Indices", curEventData.indexCount.ToString(), new GUILayoutOption[0]); } }
private void DrawEventComputeDispatchInfo(FrameDebuggerEventData curEventData) { EditorGUILayout.LabelField("Compute Shader", curEventData.csName, new GUILayoutOption[0]); if (GUI.Button(GUILayoutUtility.GetLastRect(), GUIContent.none, GUI.skin.label)) { EditorGUIUtility.PingObject(curEventData.csInstanceID); Event.current.Use(); } EditorGUILayout.LabelField("Kernel", curEventData.csKernel, new GUILayoutOption[0]); string label; if (curEventData.csThreadGroupsX != 0 || curEventData.csThreadGroupsY != 0 || curEventData.csThreadGroupsZ != 0) { label = string.Format("{0}x{1}x{2}", curEventData.csThreadGroupsX, curEventData.csThreadGroupsY, curEventData.csThreadGroupsZ); } else { label = "indirect dispatch"; } EditorGUILayout.LabelField("Thread Groups", label, new GUILayoutOption[0]); }
private void DrawStates(FrameDebuggerEventData curEventData) { FrameDebuggerBlendState blendState = curEventData.blendState; FrameDebuggerRasterState rasterState = curEventData.rasterState; FrameDebuggerDepthState depthState = curEventData.depthState; string text = string.Format("{0} {1}", blendState.srcBlend, blendState.dstBlend); if (blendState.srcBlendAlpha != blendState.srcBlend || blendState.dstBlendAlpha != blendState.dstBlend) { text += string.Format(", {0} {1}", blendState.srcBlendAlpha, blendState.dstBlendAlpha); } EditorGUILayout.LabelField("Blend", text, new GUILayoutOption[0]); if (blendState.blendOp != BlendOp.Add || blendState.blendOpAlpha != BlendOp.Add) { string label; if (blendState.blendOp == blendState.blendOpAlpha) { label = blendState.blendOp.ToString(); } else { label = string.Format("{0}, {1}", blendState.blendOp, blendState.blendOpAlpha); } EditorGUILayout.LabelField("BlendOp", label, new GUILayoutOption[0]); } if (blendState.writeMask != 15u) { string text2 = ""; if (blendState.writeMask == 0u) { text2 += '0'; } else { if ((blendState.writeMask & 2u) != 0u) { text2 += 'R'; } if ((blendState.writeMask & 4u) != 0u) { text2 += 'G'; } if ((blendState.writeMask & 8u) != 0u) { text2 += 'B'; } if ((blendState.writeMask & 1u) != 0u) { text2 += 'A'; } } EditorGUILayout.LabelField("ColorMask", text2, new GUILayoutOption[0]); } EditorGUILayout.LabelField("ZTest", depthState.depthFunc.ToString(), new GUILayoutOption[0]); EditorGUILayout.LabelField("ZWrite", (depthState.depthWrite != 0) ? "On" : "Off", new GUILayoutOption[0]); EditorGUILayout.LabelField("Cull", rasterState.cullMode.ToString(), new GUILayoutOption[0]); if (rasterState.slopeScaledDepthBias != 0f || rasterState.depthBias != 0) { string label2 = string.Format("{0}, {1}", rasterState.slopeScaledDepthBias, rasterState.depthBias); EditorGUILayout.LabelField("Offset", label2, new GUILayoutOption[0]); } }
private void DrawRenderTargetControls(FrameDebuggerEventData cur) { if (cur.rtWidth > 0 && cur.rtHeight > 0) { bool disabled = cur.rtFormat == 1 || cur.rtFormat == 3; bool flag = cur.rtHasDepthTexture != 0; short num = cur.rtCount; if (flag) { num += 1; } EditorGUILayout.LabelField("RenderTarget", cur.rtName, new GUILayoutOption[0]); GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); bool flag2; using (new EditorGUI.DisabledScope(num <= 1)) { GUIContent[] array = new GUIContent[(int)num]; for (int i = 0; i < (int)cur.rtCount; i++) { array[i] = FrameDebuggerWindow.Styles.mrtLabels[i]; } if (flag) { array[(int)cur.rtCount] = FrameDebuggerWindow.Styles.depthLabel; } int num2 = Mathf.Clamp(this.m_RTIndex, 0, (int)(num - 1)); flag2 = (num2 != this.m_RTIndex); this.m_RTIndex = num2; this.m_RTIndex = EditorGUILayout.Popup(this.m_RTIndex, array, EditorStyles.toolbarPopup, new GUILayoutOption[] { GUILayout.Width(70f) }); } GUILayout.Space(10f); using (new EditorGUI.DisabledScope(disabled)) { GUILayout.Label(FrameDebuggerWindow.Styles.channelHeader, EditorStyles.miniLabel, new GUILayoutOption[0]); this.m_RTChannel = GUILayout.Toolbar(this.m_RTChannel, FrameDebuggerWindow.Styles.channelLabels, EditorStyles.toolbarButton, new GUILayoutOption[0]); } GUILayout.Space(10f); GUILayout.Label(FrameDebuggerWindow.Styles.levelsHeader, EditorStyles.miniLabel, new GUILayoutOption[0]); EditorGUILayout.MinMaxSlider(ref this.m_RTBlackLevel, ref this.m_RTWhiteLevel, 0f, 1f, new GUILayoutOption[] { GUILayout.MaxWidth(200f) }); if (EditorGUI.EndChangeCheck() || flag2) { Vector4 channels = Vector4.zero; if (this.m_RTChannel == 1) { channels.x = 1f; } else if (this.m_RTChannel == 2) { channels.y = 1f; } else if (this.m_RTChannel == 3) { channels.z = 1f; } else if (this.m_RTChannel == 4) { channels.w = 1f; } else { channels = Vector4.one; } int num3 = this.m_RTIndex; if (num3 >= (int)cur.rtCount) { num3 = -1; } FrameDebuggerUtility.SetRenderTargetDisplayOptions(num3, channels, this.m_RTBlackLevel, this.m_RTWhiteLevel); this.RepaintAllNeededThings(); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Label(string.Format("{0}x{1} {2}", cur.rtWidth, cur.rtHeight, (RenderTextureFormat)cur.rtFormat), new GUILayoutOption[0]); if (cur.rtDim == 4) { GUILayout.Label("Rendering into cubemap", new GUILayoutOption[0]); } if (cur.rtFormat == 3 && SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9")) { EditorGUILayout.HelpBox("Rendering into shadowmap on DX9, can't visualize it in the game view properly", MessageType.Info, true); } } }
private void DrawRenderTargetControls(FrameDebuggerEventData cur) { if (cur.rtWidth <= 0 || cur.rtHeight <= 0) { return; } bool disabled = cur.rtFormat == 1 || cur.rtFormat == 3; bool flag1 = (int)cur.rtHasDepthTexture != 0; short rtCount = cur.rtCount; if (flag1) { ++rtCount; } GUILayout.Label("RenderTarget: " + cur.rtName, EditorStyles.boldLabel, new GUILayoutOption[0]); GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); EditorGUI.BeginChangeCheck(); EditorGUI.BeginDisabledGroup((int)rtCount <= 1); GUIContent[] displayedOptions = new GUIContent[(int)rtCount]; for (int index = 0; index < (int)cur.rtCount; ++index) { displayedOptions[index] = FrameDebuggerWindow.Styles.mrtLabels[index]; } if (flag1) { displayedOptions[(int)cur.rtCount] = FrameDebuggerWindow.Styles.depthLabel; } int num = Mathf.Clamp(this.m_RTIndex, 0, (int)rtCount - 1); bool flag2 = num != this.m_RTIndex; this.m_RTIndex = num; this.m_RTIndex = EditorGUILayout.Popup(this.m_RTIndex, displayedOptions, EditorStyles.toolbarPopup, new GUILayoutOption[1] { GUILayout.Width(70f) }); EditorGUI.EndDisabledGroup(); GUILayout.Space(10f); EditorGUI.BeginDisabledGroup(disabled); GUILayout.Label(FrameDebuggerWindow.Styles.channelHeader, EditorStyles.miniLabel, new GUILayoutOption[0]); this.m_RTChannel = GUILayout.Toolbar(this.m_RTChannel, FrameDebuggerWindow.Styles.channelLabels, EditorStyles.toolbarButton, new GUILayoutOption[0]); EditorGUI.EndDisabledGroup(); GUILayout.Space(10f); GUILayout.Label(FrameDebuggerWindow.Styles.levelsHeader, EditorStyles.miniLabel, new GUILayoutOption[0]); EditorGUILayout.MinMaxSlider(ref this.m_RTBlackLevel, ref this.m_RTWhiteLevel, 0.0f, 1f, GUILayout.MaxWidth(200f)); if (EditorGUI.EndChangeCheck() || flag2) { Vector4 channels = Vector4.zero; if (this.m_RTChannel == 1) { channels.x = 1f; } else if (this.m_RTChannel == 2) { channels.y = 1f; } else if (this.m_RTChannel == 3) { channels.z = 1f; } else if (this.m_RTChannel == 4) { channels.w = 1f; } else { channels = Vector4.one; } int rtIndex = this.m_RTIndex; if (rtIndex >= (int)cur.rtCount) { rtIndex = -1; } FrameDebuggerUtility.SetRenderTargetDisplayOptions(rtIndex, channels, this.m_RTBlackLevel, this.m_RTWhiteLevel); this.RepaintAllNeededThings(); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Label(string.Format("{0}x{1} {2}", (object)cur.rtWidth, (object)cur.rtHeight, (object)(RenderTextureFormat)cur.rtFormat)); if (cur.rtDim == 4) { GUILayout.Label("Rendering into cubemap"); } if (cur.rtFormat != 3 || !SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9")) { return; } EditorGUILayout.HelpBox("Rendering into shadowmap on DX9, can't visualize it in the game view properly", MessageType.Info, true); }
private IEnumerator Execute() { currentProgress = 0.0f; var waitForConnect = WaitForRemoteConnect(10.0); while (waitForConnect.MoveNext()) { yield return(null); } yield return(null); yield return(null); var r = this.reflectionCache; var frameEvents = frameDebuggeUtil.CallMethod <System.Array>("GetFrameEvents", null, null); var breakReasons = frameDebuggeUtil.CallMethod <string[]>("GetBatchBreakCauseStrings", null, null); var frameEventDatas = r.GetTypeObject("UnityEditorInternal.FrameDebuggerEventData"); var evtData = frameDebuggeUtil.CreateInstance(); int count = frameDebuggeUtil.GetPropertyValue <int>("count", null); this.CreateFrameDebuggerEventList(frameEvents); this.frameDebuggerEventDataList = new List <FrameDebuggerEventData>(count); for (int i = 0; i <= count; ++i) { yield return(null); this.frameDebuggerWindowObj.CallMethod <object>("ChangeFrameEventLimit", new object[] { i }); this.frameDebuggerWindowObj.CallMethod <object>("RepaintOnLimitChange", null); int targetFrameIdx = i - 1; if (targetFrameIdx < 0 || targetFrameIdx >= frameEvents.Length) { continue; } // getTargetFrameInfo var eventDataCoroutine = this.TryGetFrameEvnetData(targetFrameIdx, 2.0); while (eventDataCoroutine.MoveNext()) { yield return(null); } var frameData = currentFrameEventData; if (frameData == null) { UnityEngine.Debug.LogWarning("failed capture " + targetFrameIdx); continue; } FrameDebuggerEventData frameInfo = new FrameDebuggerEventData(); frameData.CopyFieldsToObjectByVarName <FrameDebuggerEventData>(ref frameInfo); frameInfo.batchBreakCauseStr = breakReasons[frameInfo.batchBreakCause]; this.CreateShaderPropInfos(frameInfo); frameDebuggerEventDataList.Add(frameInfo); bool isRemoteEnalbed = frameDebuggeUtil.CallMethod <bool>("IsRemoteEnabled", null, null); if (!isRemoteEnalbed) { SetRenderTextureLastChange(frameInfo); // save shader texture ExecuteShaderTextureSave(frameInfo); // capture screen shot ExecuteSaveScreenShot(frameInfo, (i == count)); } } yield return(null); }