//-------------------------------------------------------------------------------------- // Render the help and statistics text. This function uses the ID3DXFont interface for // efficient text rendering. //-------------------------------------------------------------------------------------- void RenderText() { g_pTxtHelper->Begin(); g_pTxtHelper->SetInsertionPos( 5, 5 ); g_pTxtHelper->SetForegroundColor( XMFLOAT4( 1.0f, 0.0f, 0.0f, 1.0f ) ); g_pTxtHelper->DrawTextLine( DXUTGetFrameStats( DXUTIsVsyncEnabled() ) ); g_pTxtHelper->DrawTextLine( DXUTGetDeviceStats() ); double fTotal = TIMER_GetTime(Gpu, L"Total") * 1000.0f; double fFoblin = TIMER_GetTime(Gpu, L"Total|FoblinMesh") * 1000.0f; double fLeftEye = TIMER_GetTime(Gpu, L"Total|FoblinMesh|LeftEye") * 1000.0f; double fRightEye = TIMER_GetTime(Gpu, L"Total|FoblinMesh|RightEye") * 1000.0f; double fTransfer = TIMER_GetTime(Gpu, L"Total|Transfer") * 1000.0f; double fPresent = TIMER_GetTime(Gpu, L"Present") * 1000.0f; double fPerFoblin = fFoblin / (double)(g_Character.GetTodoDraw() * 2) * 1000.0f; fTotal += fPresent; double fOverhead = fFoblin - fLeftEye - fRightEye; WCHAR wcbuf[256]; swprintf_s(wcbuf, 256, L"Cost in milliseconds( Total = %.2f, Left Eye = %.2f, Right Eye = %.2f, Transfer = %.2f, Present = %.2f, FoblinMesh = %.2f [each: %.2fus], Overhead = %.2f )", fTotal, fLeftEye, fRightEye, fTransfer, fPresent, fFoblin, fPerFoblin, fOverhead); g_pTxtHelper->DrawTextLine( wcbuf ); g_pTxtHelper->SetInsertionPos( 5, DXUTGetDXGIBackBufferSurfaceDesc()->Height - AMD::HUD::iElementDelta ); g_pTxtHelper->DrawTextLine( L"Toggle GUI : F1" ); g_pTxtHelper->End(); }
//-------------------------------------------------------------------------------------- // Initialize the app //-------------------------------------------------------------------------------------- void InitApp() { D3DCOLOR DlgColor = 0x88888888; // Semi-transparent background for the dialog g_SettingsDlg.Init( &g_DialogResourceManager ); g_HUD.m_GUI.Init( &g_DialogResourceManager ); g_HUD.m_GUI.SetBackgroundColors( DlgColor ); g_HUD.m_GUI.SetCallback( OnGUIEvent ); int iY = AMD::HUD::iElementDelta; g_HUD.m_GUI.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", AMD::HUD::iElementOffset, iY, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight ); g_HUD.m_GUI.AddButton(IDC_CHANGE_DEVICE, L"Change device (F2)", AMD::HUD::iElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, VK_F2); iY += AMD::HUD::iGroupDelta / 3; CDXUTStatic* pFrameRateStatic = nullptr; g_HUD.m_GUI.AddStatic(IDC_STATIC_FRAMERATE, L"", AMD::HUD::iElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, false, &pFrameRateStatic); D3DCOLOR frameRateColor = D3DCOLOR_RGBA(0xFF, 0, 0, 0xFF); pFrameRateStatic->SetTextColor(frameRateColor); g_HUD.m_GUI.AddCheckBox(IDC_CHECKBOX_ENABLE_MGPU, L"Enable MGPU", AMD::HUD::iElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, g_Context.m_Affinity.GetUseAffinity()); g_HUD.m_GUI.AddStatic(IDC_STATIC_SYNC_TYPE, L"Transfer Sync", AMD::HUD::iElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight); g_HUD.m_GUI.AddRadioButton(IDC_RADIO_SYNC_TYPE_AUTOMATIC, IDC_RADIO_SYNC_TYPE, L"Automatic", AMD::HUD::iElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, g_Context.m_Affinity.GetSyncType() == TRANSFER_SYNC_AUTOMATIC); g_HUD.m_GUI.AddRadioButton(IDC_RADIO_SYNC_TYPE_MANUAL, IDC_RADIO_SYNC_TYPE, L"Manual", AMD::HUD::iElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, g_Context.m_Affinity.GetSyncType() == TRANSFER_SYNC_MANUAL); g_HUD.m_GUI.AddRadioButton(IDC_RADIO_SYNC_TYPE_NONE, IDC_RADIO_SYNC_TYPE, L"None", AMD::HUD::iElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, g_Context.m_Affinity.GetSyncType() == TRANSFER_SYNC_NONE); iY += AMD::HUD::iGroupDelta / 3; g_HUD.m_GUI.AddCheckBox(IDC_CHECKBOX_DRAW_FOBLINMESH, L"Draw Foblin(s)", AMD::HUD::iElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, g_bDrawFoblinMeshes); g_HUD.m_GUI.AddCheckBox(IDC_CHECKBOX_ALPHA_FOBLINMESH, L"Alpha Foblin(s)", AMD::HUD::iElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, g_Character.GetAlpha()); g_HUD.m_GUI.AddCheckBox(IDC_CHECKBOX_CLEAR_FOBLINMESH, L"Clear Foblin(s) Bkgs", AMD::HUD::iElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, g_Character.GetClear()); g_HUD.m_GUI.AddCheckBox(IDC_CHECKBOX_SHIFT_FOBLINMESH, L"Shift Foblin(s)", AMD::HUD::iElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, g_Character.GetShift()); int minParam; int maxParam; g_Character.GetDrawLimits(&minParam, &maxParam); int currentParam = g_Character.GetTodoDraw(); WCHAR szTemp[256]; swprintf_s(szTemp, L"Number of Draw Calls: %i", currentParam); g_HUD.m_GUI.AddStatic(IDC_STATIC_NUM_DRAW_CALLS, szTemp, AMD::HUD::iElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight); g_HUD.m_GUI.AddSlider(IDC_SLIDER_NUM_DRAW_CALLS, AMD::HUD::iElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, minParam, maxParam, currentParam, false); iY += AMD::HUD::iGroupDelta; g_Context.m_ShaderCache.SetShowShaderISAFlag(false); AMD::InitApp(g_Context.m_ShaderCache, g_HUD, iY, false); }