summaryrefslogtreecommitdiff
path: root/indra/newview/llglsandbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llglsandbox.cpp')
-rw-r--r--indra/newview/llglsandbox.cpp85
1 files changed, 47 insertions, 38 deletions
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index 112008172e..807ba1b3ed 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -728,8 +728,7 @@ void LLViewerObjectList::renderObjectBeacons()
S32 line_width = debug_beacon.mLineWidth;
if (line_width != last_line_width)
{
- gGL.flush();
- glLineWidth( (F32)line_width );
+ LLRender2D::setLineWidth(line_width);
last_line_width = line_width;
}
@@ -758,8 +757,7 @@ void LLViewerObjectList::renderObjectBeacons()
S32 line_width = debug_beacon.mLineWidth;
if (line_width != last_line_width)
{
- gGL.flush();
- glLineWidth( (F32)line_width );
+ LLRender2D::setLineWidth(line_width);
last_line_width = line_width;
}
@@ -772,8 +770,7 @@ void LLViewerObjectList::renderObjectBeacons()
gGL.end();
}
- gGL.flush();
- glLineWidth(1.f);
+ LLRender2D::setLineWidth(1.f);
for (std::vector<LLDebugBeacon>::iterator iter = mDebugBeacons.begin(); iter != mDebugBeacons.end(); ++iter)
{
@@ -808,7 +805,9 @@ void LLSky::renderSunMoonBeacons(const LLVector3& pos_agent, const LLVector3& di
{
pos_end.mV[i] = pos_agent.mV[i] + (50 * direction.mV[i]);
}
- glLineWidth((GLfloat)LLPipeline::DebugBeaconLineWidth);
+
+ LLRender2D::setLineWidth((GLfloat)LLPipeline::DebugBeaconLineWidth);
+
gGL.begin(LLRender::LINES);
color.mV[3] *= 0.5f;
gGL.color4fv(color.mV);
@@ -818,9 +817,7 @@ void LLSky::renderSunMoonBeacons(const LLVector3& pos_agent, const LLVector3& di
gGL.vertex3fv(pos_end.mV);
gGL.end();
- gGL.flush();
- glLineWidth(1.f);
-
+ LLRender2D::setLineWidth(1.f);
}
//-----------------------------------------------------------------------------
@@ -903,6 +900,39 @@ private:
};
+F32 shader_timer_benchmark(std::vector<LLRenderTarget> & dest, TextureHolder & texHolder, U32 textures_count, LLVertexBuffer * buff, F32 &seconds)
+{
+ // run GPU timer benchmark
+
+ //number of samples to take
+ const S32 samples = 64;
+
+ {
+ ShaderProfileHelper initProfile;
+ dest[0].bindTarget("benchmark", 1);
+ gBenchmarkProgram.bind();
+ for (S32 c = 0; c < samples; ++c)
+ {
+ for (U32 i = 0; i < textures_count; ++i)
+ {
+ texHolder.bind(i);
+ buff->setBuffer();
+ buff->drawArrays(LLRender::TRIANGLES, 0, 3);
+ }
+ }
+ gBenchmarkProgram.unbind();
+ dest[0].flush();
+ }
+
+ F32 ms = gBenchmarkProgram.mTimeElapsed / 1000000.f;
+ seconds = ms / 1000.f;
+
+ F64 samples_drawn = (F64)gBenchmarkProgram.mSamplesDrawn;
+ F64 gpixels_drawn = samples_drawn / 1000000000.0;
+ F32 samples_sec = (F32)(gpixels_drawn / seconds);
+ return samples_sec * 4; // 4 bytes per sample
+}
+
//-----------------------------------------------------------------------------
// gpu_benchmark()
// returns measured memory bandwidth of GPU in gigabytes per second
@@ -944,9 +974,6 @@ F32 gpu_benchmark()
//number of textures
const U32 count = 32;
- //number of samples to take
- const S32 samples = 64;
-
//time limit, allocation operations shouldn't take longer then 30 seconds, same for actual benchmark.
const F32 time_limit = 30;
@@ -977,7 +1004,7 @@ F32 gpu_benchmark()
delete[] pixels;
return -1.f;
}
- dest[i].bindTarget();
+ dest[i].bindTarget("", 1);
dest[i].clear();
dest[i].flush();
@@ -1036,33 +1063,15 @@ F32 gpu_benchmark()
LLGLSLShader::unbind();
- // run GPU timer benchmark
- {
- ShaderProfileHelper initProfile;
- dest[0].bindTarget();
- gBenchmarkProgram.bind();
- for (S32 c = 0; c < samples; ++c)
- {
- for (U32 i = 0; i < count; ++i)
- {
- texHolder.bind(i);
- buff->setBuffer();
- buff->drawArrays(LLRender::TRIANGLES, 0, 3);
- }
- }
- gBenchmarkProgram.unbind();
- dest[0].flush();
- }
+ // run GPU timer benchmark twice
+ F32 seconds = 0;
+ F32 gbps = shader_timer_benchmark(dest, texHolder, count, buff.get(), seconds);
- F32 ms = gBenchmarkProgram.mTimeElapsed/1000000.f;
- F32 seconds = ms/1000.f;
+ LL_INFOS("Benchmark") << "Memory bandwidth, 1st run is " << llformat("%.3f", gbps) << " GB/sec according to ARB_timer_query, total time " << seconds << " seconds" << LL_ENDL;
- F64 samples_drawn = (F64)gBenchmarkProgram.mSamplesDrawn;
- F64 gpixels_drawn = samples_drawn / 1000000000.0;
- F32 samples_sec = (F32)(gpixels_drawn/seconds);
- F32 gbps = samples_sec*4; // 4 bytes per sample
+ gbps = shader_timer_benchmark(dest, texHolder, count, buff.get(), seconds);
- LL_INFOS("Benchmark") << "Memory bandwidth is " << llformat("%.3f", gbps) << " GB/sec according to ARB_timer_query, total time " << seconds << " seconds" << LL_ENDL;
+ LL_INFOS("Benchmark") << "Memory bandwidth, final run is " << llformat("%.3f", gbps) << " GB/sec according to ARB_timer_query, total time " << seconds << " seconds" << LL_ENDL;
return gbps;
}