Changes

Jump to: navigation, search

GPU610/OctoPig

900 bytes added, 00:34, 21 February 2013
Chad's Profiling Findings
</source>
<source lang="cpp">
void updateRender(tmach::Program* program) {
float startTime = tmach::getTimeMillis();
int startItrc = program->itrCount;
// Until the update time is exhausted
do {
// Update the program
program->update(5000);
 
float curTime = tmach::getTimeMillis();
int curItrc = program->itrCount;
 
if (curItrc - startItrc >= UPDATE_ITRS ||
curTime - startTime >= UPDATE_TIME)
break;
} while (true);
 
// Produce the image data
int* map = program->map;
int map_size = program->size_map;
unsigned char data [WIDTH * HEIGHT * 3];
for (int i = 0; i < program->size_map; ++i)
{
int sy = map[i];
 
int r = colorMap[3 * sy + 0];
int g = colorMap[3 * sy + 1];
int b = colorMap[3 * sy + 2];
 
data[3 * i + 0] = r;
data[3 * i + 1] = g;
data[3 * i + 2] = b;
}
 
// Show the image data
tmach::createBMP(WIDTH, HEIGHT, data, WIDTH*HEIGHT*4, "temp.bmp");
}
</source>
'''Analysis:'''
1
edit

Navigation menu