Commit 6ef6d2af by Nicolas Capens

Always show the FPS when SwiftConfig is active.

Change-Id: Iec5aff6d73f9e20ba4bc6a95bc1e07d5e7b5930e Reviewed-on: https://swiftshader-review.googlesource.com/2490Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarMaxime Grégoire <mgregoire@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 31ad2aa7
......@@ -14,7 +14,6 @@
#include "Thread.hpp"
#include "Timer.hpp"
#if PERF_PROFILE
Profiler profiler;
Profiler::Profiler()
......@@ -28,33 +27,37 @@ void Profiler::reset()
framesTotal = 0;
FPS = 0;
for(int i = 0; i < PERF_TIMERS; i++)
{
cycles[i] = 0;
}
#if PERF_PROFILE
for(int i = 0; i < PERF_TIMERS; i++)
{
cycles[i] = 0;
}
ropOperations = 0;
ropOperationsTotal = 0;
ropOperationsFrame = 0;
ropOperations = 0;
ropOperationsTotal = 0;
ropOperationsFrame = 0;
texOperations = 0;
texOperationsTotal = 0;
texOperationsFrame = 0;
texOperations = 0;
texOperationsTotal = 0;
texOperationsFrame = 0;
compressedTex = 0;
compressedTexTotal = 0;
compressedTexFrame = 0;
compressedTex = 0;
compressedTexTotal = 0;
compressedTexFrame = 0;
#endif
};
void Profiler::nextFrame()
{
ropOperationsFrame = sw::atomicExchange(&ropOperations, 0);
texOperationsFrame = sw::atomicExchange(&texOperations, 0);
compressedTexFrame = sw::atomicExchange(&compressedTex, 0);
#if PERF_PROFILE
ropOperationsFrame = sw::atomicExchange(&ropOperations, 0);
texOperationsFrame = sw::atomicExchange(&texOperations, 0);
compressedTexFrame = sw::atomicExchange(&compressedTex, 0);
ropOperationsTotal += ropOperationsFrame;
texOperationsTotal += texOperationsFrame;
compressedTexTotal += compressedTexFrame;
ropOperationsTotal += ropOperationsFrame;
texOperationsTotal += texOperationsFrame;
compressedTexTotal += compressedTexFrame;
#endif
static double fpsTime = sw::Timer::seconds();
......@@ -71,4 +74,3 @@ void Profiler::nextFrame()
framesSec = 0;
}
}
#endif
\ No newline at end of file
......@@ -22,7 +22,6 @@
#define S3TC_SUPPORT 0
#endif
#if PERF_PROFILE
enum
{
PERF_PIXEL,
......@@ -45,6 +44,8 @@ struct Profiler
int framesSec;
int framesTotal;
double FPS;
#if PERF_PROFILE
double cycles[PERF_TIMERS];
int64_t ropOperations;
......@@ -58,10 +59,10 @@ struct Profiler
int64_t compressedTex;
int64_t compressedTexTotal;
int64_t compressedTexFrame;
#endif
};
extern Profiler profiler;
#endif
enum
{
......
......@@ -187,6 +187,8 @@ namespace sw
}
unlock();
profiler.nextFrame(); // Assumes every copy() is a full frame
}
void FrameBuffer::copyLocked()
......
......@@ -22,9 +22,7 @@
#include <sys/stat.h>
#include <string.h>
#if PERF_PROFILE
extern Profiler profiler;
#endif
namespace sw
{
......@@ -241,7 +239,6 @@ namespace sw
html += "<title>SwiftShader Configuration Panel</title>\n";
html += "</head>\n";
html += "<body>\n";
html += "<div id='profile'></div>\n";
html += "<script type='text/javascript'>\n";
html += "request();\n";
html += "function request()\n";
......@@ -261,6 +258,7 @@ namespace sw
html += "</script>\n";
html += "<form method='POST' action=''>\n";
html += "<h1>SwiftShader Configuration Panel</h1>\n";
html += "<div id='profile'>" + profile() + "</div>\n";
html += "<hr><p>\n";
html += "<input type='submit' value='Apply changes' title='Click to apply all settings.'>\n";
// html += "<input type='reset' value='Reset changes' title='Click to reset your changes to the previous value.'>\n";
......@@ -390,11 +388,11 @@ namespace sw
html += "<option value='15'" + (config.threadCount == 15 ? selected : empty) + ">15</option>\n";
html += "<option value='16'" + (config.threadCount == 16 ? selected : empty) + ">16</option>\n";
html += "</select></td></tr>\n";
html += "<tr><td>Enable SSE:</td><td><input name = 'enableSSE' type='checkbox'" + (config.enableSSE == true ? checked : empty) + " disabled='disabled' title='If checked enables the use of SSE instruction set extentions if supported by the CPU.'></td></tr>";
html += "<tr><td>Enable SSE2:</td><td><input name = 'enableSSE2' type='checkbox'" + (config.enableSSE2 == true ? checked : empty) + " title='If checked enables the use of SSE2 instruction set extentions if supported by the CPU.'></td></tr>";
html += "<tr><td>Enable SSE3:</td><td><input name = 'enableSSE3' type='checkbox'" + (config.enableSSE3 == true ? checked : empty) + " title='If checked enables the use of SSE3 instruction set extentions if supported by the CPU.'></td></tr>";
html += "<tr><td>Enable SSSE3:</td><td><input name = 'enableSSSE3' type='checkbox'" + (config.enableSSSE3 == true ? checked : empty) + " title='If checked enables the use of SSSE3 instruction set extentions if supported by the CPU.'></td></tr>";
html += "<tr><td>Enable SSE4.1:</td><td><input name = 'enableSSE4_1' type='checkbox'" + (config.enableSSE4_1 == true ? checked : empty) + " title='If checked enables the use of SSE4.1 instruction set extentions if supported by the CPU.'></td></tr>";
html += "<tr><td>Enable SSE:</td><td><input name = 'enableSSE' type='checkbox'" + (config.enableSSE ? checked : empty) + " disabled='disabled' title='If checked enables the use of SSE instruction set extentions if supported by the CPU.'></td></tr>";
html += "<tr><td>Enable SSE2:</td><td><input name = 'enableSSE2' type='checkbox'" + (config.enableSSE2 ? checked : empty) + " title='If checked enables the use of SSE2 instruction set extentions if supported by the CPU.'></td></tr>";
html += "<tr><td>Enable SSE3:</td><td><input name = 'enableSSE3' type='checkbox'" + (config.enableSSE3 ? checked : empty) + " title='If checked enables the use of SSE3 instruction set extentions if supported by the CPU.'></td></tr>";
html += "<tr><td>Enable SSSE3:</td><td><input name = 'enableSSSE3' type='checkbox'" + (config.enableSSSE3 ? checked : empty) + " title='If checked enables the use of SSSE3 instruction set extentions if supported by the CPU.'></td></tr>";
html += "<tr><td>Enable SSE4.1:</td><td><input name = 'enableSSE4_1' type='checkbox'" + (config.enableSSE4_1 ? checked : empty) + " title='If checked enables the use of SSE4.1 instruction set extentions if supported by the CPU.'></td></tr>";
html += "</table>\n";
html += "<h2><em>Compiler optimizations</em></h2>\n";
html += "<table>\n";
......@@ -453,9 +451,7 @@ namespace sw
html += "</body>\n";
html += "</html>\n";
#if PERF_PROFILE
profiler.reset();
#endif
profiler.reset();
return html;
}
......@@ -464,6 +460,9 @@ namespace sw
{
std::string html;
html += "<p>FPS: " + ftoa(profiler.FPS) + "</p>\n";
html += "<p>Frame: " + itoa(profiler.framesTotal) + "</p>\n";
#if PERF_PROFILE
int texTime = (int)(1000 * profiler.cycles[PERF_TEX] / profiler.cycles[PERF_PIXEL] + 0.5);
int shaderTime = (int)(1000 * profiler.cycles[PERF_SHADER] / profiler.cycles[PERF_PIXEL] + 0.5);
......@@ -486,8 +485,6 @@ namespace sw
double averageCompressedTex = profiler.compressedTexTotal / std::max(profiler.framesTotal, 1) / 1.0e6f;
double averageTexOperations = profiler.texOperationsTotal / std::max(profiler.framesTotal, 1) / 1.0e6f;
html += "<p>FPS: " + ftoa(profiler.FPS) + "</p>\n";
html += "<p>Frame: " + itoa(profiler.framesTotal) + "</p>\n";
html += "<p>Raster operations (million): " + ftoa(profiler.ropOperationsFrame / 1.0e6f) + " (current), " + ftoa(averageRopOperations) + " (average)</p>\n";
html += "<p>Texture operations (million): " + ftoa(profiler.texOperationsFrame / 1.0e6f) + " (current), " + ftoa(averageTexOperations) + " (average)</p>\n";
html += "<p>Compressed texture operations (million): " + ftoa(profiler.compressedTexFrame / 1.0e6f) + " (current), " + ftoa(averageCompressedTex) + " (average)</p>\n";
......
......@@ -176,10 +176,6 @@ EGLNativeWindowType Surface::getWindowHandle()
void Surface::swap()
{
#if PERF_PROFILE
profiler.nextFrame();
#endif
if(backBuffer)
{
void *source = backBuffer->lockInternal(0, 0, 0, sw::LOCK_READONLY, sw::PUBLIC);
......
......@@ -155,10 +155,6 @@ bool Surface::reset(int backBufferWidth, int backBufferHeight)
void Surface::swap()
{
#if PERF_PROFILE
profiler.nextFrame();
#endif
if(backBuffer)
{
void *source = backBuffer->lockInternal(0, 0, 0, sw::LOCK_READONLY, sw::PUBLIC);
......
......@@ -181,10 +181,6 @@ EGLNativeWindowType Surface::getWindowHandle()
void Surface::swap()
{
#if PERF_PROFILE
profiler.nextFrame();
#endif
if(backBuffer)
{
void *source = backBuffer->lockInternal(0, 0, 0, sw::LOCK_READONLY, sw::PUBLIC);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment