Skip to content

Commit 42ceac9

Browse files
committed
Revert "#2639 GPU test twice to fix misreported bandwidth (#3558)"
This reverts commit b0d8055.
1 parent bc02334 commit 42ceac9

File tree

1 file changed

+27
-39
lines changed

1 file changed

+27
-39
lines changed

indra/newview/llglsandbox.cpp

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -903,39 +903,6 @@ class ShaderBinder
903903
};
904904

905905

906-
F32 shader_timer_benchmark(std::vector<LLRenderTarget> & dest, TextureHolder & texHolder, U32 textures_count, LLVertexBuffer * buff, F32 &seconds)
907-
{
908-
// run GPU timer benchmark
909-
910-
//number of samples to take
911-
const S32 samples = 64;
912-
913-
{
914-
ShaderProfileHelper initProfile;
915-
dest[0].bindTarget();
916-
gBenchmarkProgram.bind();
917-
for (S32 c = 0; c < samples; ++c)
918-
{
919-
for (U32 i = 0; i < textures_count; ++i)
920-
{
921-
texHolder.bind(i);
922-
buff->setBuffer();
923-
buff->drawArrays(LLRender::TRIANGLES, 0, 3);
924-
}
925-
}
926-
gBenchmarkProgram.unbind();
927-
dest[0].flush();
928-
}
929-
930-
F32 ms = gBenchmarkProgram.mTimeElapsed / 1000000.f;
931-
seconds = ms / 1000.f;
932-
933-
F64 samples_drawn = (F64)gBenchmarkProgram.mSamplesDrawn;
934-
F64 gpixels_drawn = samples_drawn / 1000000000.0;
935-
F32 samples_sec = (F32)(gpixels_drawn / seconds);
936-
return samples_sec * 4; // 4 bytes per sample
937-
}
938-
939906
//-----------------------------------------------------------------------------
940907
// gpu_benchmark()
941908
// returns measured memory bandwidth of GPU in gigabytes per second
@@ -977,6 +944,9 @@ F32 gpu_benchmark()
977944
//number of textures
978945
const U32 count = 32;
979946

947+
//number of samples to take
948+
const S32 samples = 64;
949+
980950
//time limit, allocation operations shouldn't take longer then 30 seconds, same for actual benchmark.
981951
const F32 time_limit = 30;
982952

@@ -1066,15 +1036,33 @@ F32 gpu_benchmark()
10661036

10671037
LLGLSLShader::unbind();
10681038

1069-
// run GPU timer benchmark twice
1070-
F32 seconds = 0;
1071-
F32 gbps = shader_timer_benchmark(dest, texHolder, count, buff.get(), seconds);
1039+
// run GPU timer benchmark
1040+
{
1041+
ShaderProfileHelper initProfile;
1042+
dest[0].bindTarget();
1043+
gBenchmarkProgram.bind();
1044+
for (S32 c = 0; c < samples; ++c)
1045+
{
1046+
for (U32 i = 0; i < count; ++i)
1047+
{
1048+
texHolder.bind(i);
1049+
buff->setBuffer();
1050+
buff->drawArrays(LLRender::TRIANGLES, 0, 3);
1051+
}
1052+
}
1053+
gBenchmarkProgram.unbind();
1054+
dest[0].flush();
1055+
}
10721056

1073-
LL_INFOS("Benchmark") << "Memory bandwidth, 1st run is " << llformat("%.3f", gbps) << " GB/sec according to ARB_timer_query, total time " << seconds << " seconds" << LL_ENDL;
1057+
F32 ms = gBenchmarkProgram.mTimeElapsed/1000000.f;
1058+
F32 seconds = ms/1000.f;
10741059

1075-
gbps = shader_timer_benchmark(dest, texHolder, count, buff.get(), seconds);
1060+
F64 samples_drawn = (F64)gBenchmarkProgram.mSamplesDrawn;
1061+
F64 gpixels_drawn = samples_drawn / 1000000000.0;
1062+
F32 samples_sec = (F32)(gpixels_drawn/seconds);
1063+
F32 gbps = samples_sec*4; // 4 bytes per sample
10761064

1077-
LL_INFOS("Benchmark") << "Memory bandwidth, final run is " << llformat("%.3f", gbps) << " GB/sec according to ARB_timer_query, total time " << seconds << " seconds" << LL_ENDL;
1065+
LL_INFOS("Benchmark") << "Memory bandwidth is " << llformat("%.3f", gbps) << " GB/sec according to ARB_timer_query, total time " << seconds << " seconds" << LL_ENDL;
10781066

10791067
return gbps;
10801068
}

0 commit comments

Comments
 (0)