]> git.sesse.net Git - narabu/commitdiff
Make the number of GPU iterations a named constant.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 24 Sep 2017 17:46:00 +0000 (19:46 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 24 Sep 2017 17:46:00 +0000 (19:46 +0200)
narabu.cpp

index a0e58717e6b32da507d8621d4b73e908769e4806..bb1209c7fc3ebe7c4bf66123567736cb6bff3854 100644 (file)
@@ -271,7 +271,8 @@ int main(int argc, char **argv)
 
 #define PARALLEL_SLICES 1
        steady_clock::time_point start = steady_clock::now();
-       for (int i = 0; i < 1000; ++i) {
+       unsigned num_iterations = 1000;
+       for (unsigned i = 0; i < num_iterations; ++i) {
                unsigned num_slices = (WIDTH/8)*(HEIGHT/8)/BLOCKS_PER_STREAM;
                glDispatchCompute(1, (num_slices+PARALLEL_SLICES-1)/PARALLEL_SLICES, 1);
        }
@@ -373,5 +374,5 @@ int main(int argc, char **argv)
        glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); // unbind
        
        printf("foo = 0x%x\n", glGetError());
-       printf("Each iteration took %.3f ms.\n", 1e3 * duration<double>(now - start).count() / 1000);
+       printf("Each iteration took %.3f ms.\n", 1e3 * duration<double>(now - start).count() / num_iterations);
 }