Commit 90c253a6 by Jamie Madill

Add an instancing perf test.

BUG=526217 BUG=angleproject:1164 Change-Id: Ia353a3b2fa0ab0e8b7fd15d72bb63e5ecb7833b1 Reviewed-on: https://chromium-review.googlesource.com/301469Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tryjob-Request: Jamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 3215b207
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "random_utils.h" #include "random_utils.h"
#include "shader_utils.h" #include "shader_utils.h"
using namespace angle;
class MultiWindowSample : public SampleApplication class MultiWindowSample : public SampleApplication
{ {
public: public:
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include <math.h> #include <math.h>
using namespace angle;
class ParticleSystemSample : public SampleApplication class ParticleSystemSample : public SampleApplication
{ {
public: public:
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "SampleApplication.h" #include "SampleApplication.h"
#include "EGLWindow.h" #include "EGLWindow.h"
#include "random_utils.h"
SampleApplication::SampleApplication(const std::string &name, SampleApplication::SampleApplication(const std::string &name,
size_t width, size_t width,
...@@ -29,6 +30,8 @@ SampleApplication::SampleApplication(const std::string &name, ...@@ -29,6 +30,8 @@ SampleApplication::SampleApplication(const std::string &name,
// Disable vsync // Disable vsync
mEGLWindow->setSwapInterval(0); mEGLWindow->setSwapInterval(0);
angle::RandomInitFromTime();
} }
SampleApplication::~SampleApplication() SampleApplication::~SampleApplication()
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
'<(angle_path)/src/tests/perf_tests/DrawCallPerf.cpp', '<(angle_path)/src/tests/perf_tests/DrawCallPerf.cpp',
'<(angle_path)/src/tests/perf_tests/EGLInitializePerf.cpp', '<(angle_path)/src/tests/perf_tests/EGLInitializePerf.cpp',
'<(angle_path)/src/tests/perf_tests/IndexConversionPerf.cpp', '<(angle_path)/src/tests/perf_tests/IndexConversionPerf.cpp',
'<(angle_path)/src/tests/perf_tests/InstancingPerf.cpp',
'<(angle_path)/src/tests/perf_tests/InterleavedAttributeData.cpp', '<(angle_path)/src/tests/perf_tests/InterleavedAttributeData.cpp',
'<(angle_path)/src/tests/perf_tests/PointSprites.cpp', '<(angle_path)/src/tests/perf_tests/PointSprites.cpp',
'<(angle_path)/src/tests/perf_tests/TexSubImage.cpp', '<(angle_path)/src/tests/perf_tests/TexSubImage.cpp',
......
...@@ -3,20 +3,35 @@ ...@@ -3,20 +3,35 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// random_utils:
// Helper functions for random number generation.
//
#include "random_utils.h" #include "random_utils.h"
#include <time.h> #include <time.h>
#include <cstdlib> #include <cstdlib>
namespace angle
{
void RandomInitFromTime()
{
srand(static_cast<unsigned int>(time(NULL)));
}
float RandomFloat()
{
return static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
}
float RandomBetween(float min, float max) float RandomBetween(float min, float max)
{ {
static bool randInitialized = false; return min + RandomFloat() * (max - min);
if (!randInitialized) }
{
srand(static_cast<unsigned int>(time(NULL)));
randInitialized = true;
}
const size_t divisor = 10000; float RandomNegativeOneToOne()
return min + ((rand() % divisor) / static_cast<float>(divisor)) * (max - min); {
return RandomBetween(0.0f, 1.0f);
} }
} // namespace angle
...@@ -3,10 +3,22 @@ ...@@ -3,10 +3,22 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// random_utils:
// Helper functions for random number generation.
//
#ifndef UTIL_RANDOM_UTILS_H #ifndef UTIL_RANDOM_UTILS_H
#define UTIL_RANDOM_UTILS_H #define UTIL_RANDOM_UTILS_H
namespace angle
{
// TODO(jmadill): Should make this a class
void RandomInitFromTime();
float RandomFloat();
float RandomBetween(float min, float max); float RandomBetween(float min, float max);
float RandomNegativeOneToOne();
} // namespace angle
#endif // UTIL_RANDOM_UTILS_H #endif // UTIL_RANDOM_UTILS_H
...@@ -46,10 +46,16 @@ GLuint CompileShader(GLenum type, const std::string &source) ...@@ -46,10 +46,16 @@ GLuint CompileShader(GLenum type, const std::string &source)
GLint infoLogLength; GLint infoLogLength;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength); glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);
std::vector<GLchar> infoLog(infoLogLength); if (infoLogLength > 0)
glGetShaderInfoLog(shader, static_cast<GLsizei>(infoLog.size()), NULL, &infoLog[0]); {
std::vector<GLchar> infoLog(infoLogLength);
std::cerr << "shader compilation failed: " << &infoLog[0]; glGetShaderInfoLog(shader, static_cast<GLsizei>(infoLog.size()), NULL, &infoLog[0]);
std::cerr << "shader compilation failed: " << &infoLog[0];
}
else
{
std::cerr << "shader compilation failed. <Empty log message>";
}
glDeleteShader(shader); glDeleteShader(shader);
shader = 0; shader = 0;
......
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