MCPcopy Create free account
hub / github.com/GPUOpen-Effects/GeometryFX / RenderText

Function RenderText

amd_geometryfx_sample/src/GeometryFX_Sample.cpp:1071–1118  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------- Render the help and statistics text. This function uses the ID3DXFont interface for efficient text rendering. --------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1069// efficient text rendering.
1070//--------------------------------------------------------------------------------------
1071void RenderText()
1072{
1073 g_pTxtHelper->Begin();
1074 g_pTxtHelper->SetInsertionPos(5, 5);
1075 g_pTxtHelper->SetForegroundColor(XMVectorSet(1.0f, 1.0f, 0.0f, 1.0f));
1076 g_pTxtHelper->DrawTextLine(DXUTGetFrameStats(DXUTIsVsyncEnabled()));
1077 g_pTxtHelper->DrawTextLine(DXUTGetDeviceStats());
1078
1079 float fEffectTime = (float)TIMER_GetTime(Gpu, L"Depth pass") * 1000.0f;
1080 WCHAR wcbuf[512] = {};
1081 swprintf_s(wcbuf, 256, L"Depth pass time: Total = %.3f ms, %d meshes", fEffectTime,
1082 g_Application.GetMeshCount());
1083 g_pTxtHelper->DrawTextLine(wcbuf);
1084
1085 // Only display filter stats if the filter is actually running
1086 if (g_Application.instrumentIndirectRender && g_Application.enableFiltering)
1087 {
1088 wchar_t buffer[512] = {};
1089
1090 // We can have 0 triangles if the cluster culling got rid of all -
1091 // skip this line then
1092 if (g_Application.pipelineStatsTrianglesIn > 0)
1093 {
1094 swprintf_s(buffer, L"Triangle stats: In %I64d, out %I64d (filtered: %.2f%%) ",
1095 g_Application.pipelineStatsTrianglesIn, g_Application.pipelineStatsTrianglesOut,
1096 100 -
1097 static_cast<float>(g_Application.pipelineStatsTrianglesOut) /
1098 static_cast<float>(g_Application.pipelineStatsTrianglesIn) * 100.0f);
1099 g_pTxtHelper->DrawTextLine(buffer);
1100 }
1101
1102 if ((g_Application.enabledFilters & AMD::GeometryFX_ClusterFilterBackface) == AMD::GeometryFX_ClusterFilterBackface)
1103 {
1104 swprintf_s (buffer, L"Cluster stats: In %I64d, out %I64d (filtered: %.2f%%) ",
1105 g_Application.pipelineStatsClustersIn, g_Application.pipelineStatsClustersOut,
1106 100 -
1107 static_cast<float>(g_Application.pipelineStatsClustersOut) /
1108 static_cast<float>(g_Application.pipelineStatsClustersIn) * 100.0f);
1109 g_pTxtHelper->DrawTextLine (buffer);
1110 }
1111 }
1112
1113 g_pTxtHelper->SetInsertionPos(
1114 5, DXUTGetDXGIBackBufferSurfaceDesc()->Height - AMD::HUD::iElementDelta);
1115 g_pTxtHelper->DrawTextLine(L"Toggle GUI : F1");
1116
1117 g_pTxtHelper->End();
1118}
1119
1120//--------------------------------------------------------------------------------------
1121// Reject any D3D11 devices that aren't acceptable by returning false

Callers 1

OnD3D11FrameRenderFunction · 0.85

Calls 10

DXUTGetFrameStatsFunction · 0.85
DXUTIsVsyncEnabledFunction · 0.85
DXUTGetDeviceStatsFunction · 0.85
BeginMethod · 0.80
SetInsertionPosMethod · 0.80
SetForegroundColorMethod · 0.80
DrawTextLineMethod · 0.80
EndMethod · 0.80
GetMeshCountMethod · 0.45

Tested by

no test coverage detected