Home | History | Annotate | Download | only in perf_tests
      1 //
      2 // Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
      3 // Use of this source code is governed by a BSD-style license that can be
      4 // found in the LICENSE file.
      5 //
      6 
      7 #include "SimpleBenchmark.h"
      8 #include "BufferSubData.h"
      9 #include "TexSubImage.h"
     10 
     11 EGLint platforms[] =
     12 {
     13     EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE,
     14     EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE
     15 };
     16 
     17 GLenum vertexTypes[] = { GL_FLOAT };
     18 GLint componentCounts[] = { 4 };
     19 GLboolean vertexNorms[] = { GL_FALSE };
     20 GLsizeiptr updateSizes[] = { 0, 300 };
     21 GLsizeiptr bufferSizes[] = { 1024 * 1024 };
     22 unsigned int iterationCounts[] = { 10 };
     23 unsigned int updatesEveryNFrames[] = { 1, 4 };
     24 
     25 int main(int argc, char **argv)
     26 {
     27     std::vector<BufferSubDataParams> subDataParams;
     28 
     29     for (size_t platIt = 0; platIt < ArraySize(platforms); platIt++)
     30     {
     31         for (size_t typeIt = 0; typeIt < ArraySize(vertexTypes); typeIt++)
     32         {
     33             for (size_t compIt = 0; compIt < ArraySize(componentCounts); compIt++)
     34             {
     35                 for (size_t normIt = 0; normIt < ArraySize(vertexNorms); normIt++)
     36                 {
     37                     // No normalized float data
     38                     if (vertexTypes[typeIt] == GL_FLOAT && vertexNorms[normIt] == GL_TRUE)
     39                     {
     40                         continue;
     41                     }
     42 
     43                     for (size_t updateIt = 0; updateIt < ArraySize(updateSizes); updateIt++)
     44                     {
     45                         for (size_t bufszIt = 0; bufszIt < ArraySize(bufferSizes); bufszIt++)
     46                         {
     47                             for (size_t itIt = 0; itIt < ArraySize(iterationCounts); itIt++)
     48                             {
     49                                 for (size_t nfrIt = 0; nfrIt < ArraySize(updatesEveryNFrames); nfrIt++)
     50                                 {
     51                                     BufferSubDataParams params;
     52                                     params.requestedRenderer = platforms[platIt];
     53                                     params.vertexType = vertexTypes[typeIt];
     54                                     params.vertexComponentCount = componentCounts[compIt];
     55                                     params.vertexNormalized = vertexNorms[normIt];
     56                                     params.updateSize = updateSizes[updateIt];
     57                                     params.bufferSize = bufferSizes[bufszIt];
     58                                     params.iterations = iterationCounts[itIt];
     59                                     params.updatesEveryNFrames = updatesEveryNFrames[nfrIt];
     60 
     61                                     if (updateSizes[updateIt] == 0)
     62                                     {
     63                                         if (nfrIt > 0)
     64                                         {
     65                                             continue;
     66                                         }
     67                                         else
     68                                         {
     69                                             params.updatesEveryNFrames = 1;
     70                                         }
     71                                     }
     72 
     73                                     subDataParams.push_back(params);
     74                                 }
     75                             }
     76                         }
     77                     }
     78                 }
     79             }
     80         }
     81     }
     82 
     83     // Enumerates permutations
     84     RunBenchmarks<BufferSubDataBenchmark>(subDataParams);
     85 
     86     std::vector<TexSubImageParams> subImageParams;
     87 
     88     for (size_t platIt = 0; platIt < ArraySize(platforms); platIt++)
     89     {
     90         TexSubImageParams params;
     91 
     92         params.requestedRenderer = platforms[platIt];
     93         params.imageWidth = 1024;
     94         params.imageHeight = 1024;
     95         params.subImageHeight = 64;
     96         params.subImageWidth = 64;
     97         params.iterations = 10;
     98 
     99         subImageParams.push_back(params);
    100     }
    101 
    102     RunBenchmarks<TexSubImageBenchmark>(subImageParams);
    103 }
    104