public override void DrawDetailsView(Rect position) { var selectedFrameIndex = (int)ProfilerWindow.selectedFrameIndex; if (selectedFrameIndex >= ProfilerDriver.firstFrameIndex && selectedFrameIndex <= ProfilerDriver.lastFrameIndex) { GpuProfilingStatisticsAvailabilityStates state = (GpuProfilingStatisticsAvailabilityStates)ProfilerDriver.GetGpuStatisticsAvailabilityState(selectedFrameIndex); if ((state & GpuProfilingStatisticsAvailabilityStates.Enabled) == 0) { m_FrameDataHierarchyView.dataAvailabilityMessage = k_GpuProfilingDisabled; } else if ((state & GpuProfilingStatisticsAvailabilityStates.Gathered) == 0) { m_FrameDataHierarchyView.dataAvailabilityMessage = GetStatisticsAvailabilityStateReason((int)state); } else { m_FrameDataHierarchyView.dataAvailabilityMessage = null; } } else { m_FrameDataHierarchyView.dataAvailabilityMessage = null; } base.DrawDetailsView(position); }
static string GetStatisticsAvailabilityStateReason(int statisticsAvailabilityState) { GpuProfilingStatisticsAvailabilityStates state = (GpuProfilingStatisticsAvailabilityStates)statisticsAvailabilityState; if ((state & GpuProfilingStatisticsAvailabilityStates.Enabled) == 0) { return(null); } if (!s_StatisticsAvailabilityStateReason.ContainsKey(state)) { string combinedReason = ""; for (int i = 0; i < sizeof(GpuProfilingStatisticsAvailabilityStates) * 8; i++) { if ((statisticsAvailabilityState >> i & 1) != 0) { GpuProfilingStatisticsAvailabilityStates currentBit = (GpuProfilingStatisticsAvailabilityStates)(1 << i); if (currentBit == GpuProfilingStatisticsAvailabilityStates.NotSupportedByGraphicsAPI && ((state & GpuProfilingStatisticsAvailabilityStates.NotSupportedWithMetal) != 0 || (state & GpuProfilingStatisticsAvailabilityStates.NotSupportedWithVulkan) != 0 ) ) { continue; // no need to war about the general case, when a more specific reason was given. } if (s_StatisticsAvailabilityStateReason.ContainsKey(currentBit)) { if (string.IsNullOrEmpty(combinedReason)) { combinedReason = s_StatisticsAvailabilityStateReason[currentBit]; } else { combinedReason += "\n\n" + s_StatisticsAvailabilityStateReason[currentBit]; } } } } s_StatisticsAvailabilityStateReason[state] = combinedReason; } return(s_StatisticsAvailabilityStateReason[state]); }