Hash :
e34564ba
Author :
Date :
2019-09-18T15:21:51
Revert "Suppress crashing perftests on Win Intel Exp Rel" This reverts commit f8e8fcf8828f42005b4410cc4500c63d8e9112ce. Reason for revert: ANGLE_SKIP_TEST_IF doesn't work in perftests and this skip is not needed since the whole suite is disabled now Original change's description: > Suppress crashing perftests on Win Intel Exp Rel > > Also moves ANGLE_SKIP_TEST_IF to a header shared between end2end and > perf tests. > > BUG=chromium:997674 > > Change-Id: I7c5968e6d861c4bff703ddc6ae0e4e021e47061f > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1768374 > Commit-Queue: Corentin Wallez <cwallez@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> TBR=geofflang@chromium.org,cwallez@chromium.org,jmadill@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: chromium:997674 Change-Id: I0a2124c93d1abd6c7efd2b29e942ee966982eed2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1810763 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
//
// Copyright 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// LinkProgramPerfTest:
// Performance tests compiling a lot of shaders.
//
#include "ANGLEPerfTest.h"
#include <array>
#include "common/vector_utils.h"
#include "util/shader_utils.h"
using namespace angle;
namespace
{
enum class TaskOption
{
CompileOnly,
CompileAndLink,
Unspecified
};
enum class ThreadOption
{
SingleThread,
MultiThread,
Unspecified
};
struct LinkProgramParams final : public RenderTestParams
{
LinkProgramParams(TaskOption taskOptionIn, ThreadOption threadOptionIn)
{
iterationsPerStep = 1;
majorVersion = 2;
minorVersion = 0;
windowWidth = 256;
windowHeight = 256;
taskOption = taskOptionIn;
threadOption = threadOptionIn;
}
std::string story() const override
{
std::stringstream strstr;
strstr << RenderTestParams::story();
if (taskOption == TaskOption::CompileOnly)
{
strstr << "_compile_only";
}
else if (taskOption == TaskOption::CompileAndLink)
{
strstr << "_compile_and_link";
}
if (threadOption == ThreadOption::SingleThread)
{
strstr << "_single_thread";
}
else if (threadOption == ThreadOption::MultiThread)
{
strstr << "_multi_thread";
}
if (eglParameters.deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE)
{
strstr << "_null";
}
return strstr.str();
}
TaskOption taskOption;
ThreadOption threadOption;
};
std::ostream &operator<<(std::ostream &os, const LinkProgramParams ¶ms)
{
os << params.backendAndStory().substr(1);
return os;
}
class LinkProgramBenchmark : public ANGLERenderTest,
public ::testing::WithParamInterface<LinkProgramParams>
{
public:
LinkProgramBenchmark();
void initializeBenchmark() override;
void destroyBenchmark() override;
void drawBenchmark() override;
protected:
GLuint mVertexBuffer = 0;
};
LinkProgramBenchmark::LinkProgramBenchmark() : ANGLERenderTest("LinkProgram", GetParam()) {}
void LinkProgramBenchmark::initializeBenchmark()
{
if (GetParam().threadOption == ThreadOption::SingleThread)
{
glMaxShaderCompilerThreadsKHR(0);
}
std::array<Vector3, 6> vertices = {{Vector3(-1.0f, 1.0f, 0.5f), Vector3(-1.0f, -1.0f, 0.5f),
Vector3(1.0f, -1.0f, 0.5f), Vector3(-1.0f, 1.0f, 0.5f),
Vector3(1.0f, -1.0f, 0.5f), Vector3(1.0f, 1.0f, 0.5f)}};
glGenBuffers(1, &mVertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, mVertexBuffer);
glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(Vector3), vertices.data(),
GL_STATIC_DRAW);
}
void LinkProgramBenchmark::destroyBenchmark()
{
glDeleteBuffers(1, &mVertexBuffer);
}
void LinkProgramBenchmark::drawBenchmark()
{
static const char *vertexShader =
"attribute vec2 position;\n"
"void main() {\n"
" gl_Position = vec4(position, 0, 1);\n"
"}";
static const char *fragmentShader =
"precision mediump float;\n"
"void main() {\n"
" gl_FragColor = vec4(1, 0, 0, 1);\n"
"}";
GLuint vs = CompileShader(GL_VERTEX_SHADER, vertexShader);
GLuint fs = CompileShader(GL_FRAGMENT_SHADER, fragmentShader);
ASSERT_NE(0u, vs);
ASSERT_NE(0u, fs);
if (GetParam().taskOption == TaskOption::CompileOnly)
{
glDeleteShader(vs);
glDeleteShader(fs);
return;
}
GLuint program = glCreateProgram();
ASSERT_NE(0u, program);
glAttachShader(program, vs);
glDeleteShader(vs);
glAttachShader(program, fs);
glDeleteShader(fs);
glLinkProgram(program);
glUseProgram(program);
GLint positionLoc = glGetAttribLocation(program, "position");
glVertexAttribPointer(positionLoc, 2, GL_FLOAT, GL_FALSE, 8, nullptr);
glEnableVertexAttribArray(positionLoc);
// Draw with the program to ensure the shader gets compiled and used.
glDrawArrays(GL_TRIANGLES, 0, 6);
glDeleteProgram(program);
}
using namespace egl_platform;
LinkProgramParams LinkProgramD3D11Params(TaskOption taskOption, ThreadOption threadOption)
{
LinkProgramParams params(taskOption, threadOption);
params.eglParameters = D3D11();
return params;
}
LinkProgramParams LinkProgramD3D9Params(TaskOption taskOption, ThreadOption threadOption)
{
LinkProgramParams params(taskOption, threadOption);
params.eglParameters = D3D9();
return params;
}
LinkProgramParams LinkProgramOpenGLOrGLESParams(TaskOption taskOption, ThreadOption threadOption)
{
LinkProgramParams params(taskOption, threadOption);
params.eglParameters = OPENGL_OR_GLES();
return params;
}
LinkProgramParams LinkProgramVulkanParams(TaskOption taskOption, ThreadOption threadOption)
{
LinkProgramParams params(taskOption, threadOption);
params.eglParameters = VULKAN();
return params;
}
TEST_P(LinkProgramBenchmark, Run)
{
run();
}
ANGLE_INSTANTIATE_TEST(
LinkProgramBenchmark,
LinkProgramD3D11Params(TaskOption::CompileOnly, ThreadOption::MultiThread),
LinkProgramD3D9Params(TaskOption::CompileOnly, ThreadOption::MultiThread),
LinkProgramOpenGLOrGLESParams(TaskOption::CompileOnly, ThreadOption::MultiThread),
LinkProgramVulkanParams(TaskOption::CompileOnly, ThreadOption::MultiThread),
LinkProgramD3D11Params(TaskOption::CompileAndLink, ThreadOption::MultiThread),
LinkProgramD3D9Params(TaskOption::CompileAndLink, ThreadOption::MultiThread),
LinkProgramOpenGLOrGLESParams(TaskOption::CompileAndLink, ThreadOption::MultiThread),
LinkProgramVulkanParams(TaskOption::CompileAndLink, ThreadOption::MultiThread),
LinkProgramD3D11Params(TaskOption::CompileOnly, ThreadOption::SingleThread),
LinkProgramD3D9Params(TaskOption::CompileOnly, ThreadOption::SingleThread),
LinkProgramOpenGLOrGLESParams(TaskOption::CompileOnly, ThreadOption::SingleThread),
LinkProgramVulkanParams(TaskOption::CompileOnly, ThreadOption::SingleThread),
LinkProgramD3D11Params(TaskOption::CompileAndLink, ThreadOption::SingleThread),
LinkProgramD3D9Params(TaskOption::CompileAndLink, ThreadOption::SingleThread),
LinkProgramOpenGLOrGLESParams(TaskOption::CompileAndLink, ThreadOption::SingleThread),
LinkProgramVulkanParams(TaskOption::CompileAndLink, ThreadOption::SingleThread));
} // anonymous namespace