Newer
Older
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, source[i]);
Graham Linden
committed
buff->drawArrays(LLRender::TRIANGLES, 0, 12);
dest[i].flush();
}
//wait for current batch of copies to finish
David Parks
committed
if (busted_finish)
{
//read a pixel off the last target since some drivers seem to ignore glFinish
dest[count-1].bindTarget();
U32 pixel = 0;
glReadPixels(0,0,1,1,GL_RGBA, GL_UNSIGNED_BYTE, &pixel);
dest[count-1].flush();
}
else
{
glFinish();
}
F32 time = timer.getElapsedTimeF32();
if (c >= 0) // <-- ignore the first sample as it tends to be artificially slow
{
//store result in gigabytes per second
F32 gb = (F32) ((F64) (res*res*8*count))/(1000000000);
F32 gbps = gb/time;
David Parks
committed
if (!gGLManager.mHasTimerQuery && !busted_finish && gbps > 128.f)
{ //unrealistically high bandwidth for a card without timer queries, glFinish is probably ignored
busted_finish = true;
LL_INFOS() << "GPU BENCHMARK DETECTED GL DRIVER WITH NOT SO MUCH WORKING glFinish." << LL_ENDL;
David Parks
committed
}
else
{
LL_INFOS() << "GPU BENCHMARK ESTIMATE." << gbps << " Gbps" << LL_ENDL;
David Parks
committed
results.push_back(gbps);
}
}
}
gBenchmarkProgram.unbind();
if (gGLManager.mHasTimerQuery)
{
LLGLSLShader::finishProfile(false);
}
LLImageGL::deleteTextures(count, source);
std::sort(results.begin(), results.end());
F32 gbps = results[results.size()/2];
LL_INFOS() << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to CPU timers" << LL_ENDL;
davep
committed
#if LL_DARWIN
if (gbps > 512.f)
{
LL_INFOS() << "Memory bandwidth is improbably high and likely incorrect." << LL_ENDL;
//OSX is probably lying, discard result
gbps = -1.f;
}
#endif
if (gGLManager.mHasTimerQuery)
{
David Parks
committed
F32 ms = gBenchmarkProgram.mTimeElapsed/1000000.f;
F32 seconds = ms/1000.f;
F64 samples_drawn = res*res*count*samples;
F32 samples_sec = (samples_drawn/1000000000.0)/seconds;
gbps = samples_sec*8;
LL_INFOS() << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to ARB_timer_query" << LL_ENDL;
LL_INFOS() << "ARB_timer_query unavailable." << LL_ENDL;
return gbps;