Commit 5cdbda17 by Jamie Madill Committed by Commit Bot

UniformsPerf: Properly limit maximum uniform vectors.

The uniforms check was not correctly validating vector count instead of uniform count. Fix this, and reduce the maximum maxtrix uniforms to fix a crash on the perf bots. BUG=angleproject:1385 BUG=angleproject:1390 BUG=angleproject:1671 Change-Id: I261477c33639ed516ff6a29b38ab87f89309a7f1 Reviewed-on: https://chromium-review.googlesource.com/422533Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 408293f8
...@@ -139,26 +139,33 @@ void UniformsBenchmark::initializeBenchmark() ...@@ -139,26 +139,33 @@ void UniformsBenchmark::initializeBenchmark()
ASSERT_GT(params.iterations, 0u); ASSERT_GT(params.iterations, 0u);
// Verify the uniform counts are within the limits // Verify the uniform counts are within the limits
GLint maxVertexUniforms, maxFragmentUniforms; GLint maxVertexUniformVectors, maxFragmentUniformVectors;
glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &maxVertexUniforms); glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &maxVertexUniformVectors);
glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &maxFragmentUniforms); glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &maxFragmentUniformVectors);
if (params.numVertexUniforms > static_cast<size_t>(maxVertexUniforms)) bool isMatrix = params.dataType == DataType::MAT4;
GLint numVertexUniformVectors = params.numVertexUniforms * (isMatrix ? 4 : 1);
GLint numFragmentUniformVectors = params.numFragmentUniforms * (isMatrix ? 4 : 1);
if (numVertexUniformVectors > maxVertexUniformVectors)
{ {
FAIL() << "Vertex uniform count (" << params.numVertexUniforms << ")" FAIL() << "Vertex uniform vector count (" << numVertexUniformVectors << ")"
<< " exceeds maximum vertex uniform count: " << maxVertexUniforms << std::endl; << " exceeds maximum vertex uniform vector count: " << maxVertexUniformVectors
<< std::endl;
} }
if (params.numFragmentUniforms > static_cast<size_t>(maxFragmentUniforms)) if (numFragmentUniformVectors > maxFragmentUniformVectors)
{ {
FAIL() << "Fragment uniform count (" << params.numFragmentUniforms << ")" FAIL() << "Fragment uniform vector count (" << numFragmentUniformVectors << ")"
<< " exceeds maximum fragment uniform count: " << maxFragmentUniforms << std::endl; << " exceeds maximum fragment uniform vector count: " << maxFragmentUniformVectors
<< std::endl;
} }
initShaders(); initShaders();
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight()); glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight());
if (params.dataType == DataType::MAT4) if (isMatrix)
{ {
size_t count = params.numVertexUniforms + params.numFragmentUniforms; size_t count = params.numVertexUniforms + params.numFragmentUniforms;
...@@ -311,6 +318,11 @@ UniformsParams MatrixUniforms(const EGLPlatformParameters &egl, DataMode dataMod ...@@ -311,6 +318,11 @@ UniformsParams MatrixUniforms(const EGLPlatformParameters &egl, DataMode dataMod
params.eglParameters = egl; params.eglParameters = egl;
params.dataType = DataType::MAT4; params.dataType = DataType::MAT4;
params.dataMode = dataMode; params.dataMode = dataMode;
// Reduce the number of uniforms to fit within smaller upper limis on some configs.
params.numVertexUniforms = 100;
params.numFragmentUniforms = 100;
return params; return params;
} }
......
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