Commit 39087f4a by Jamie Madill Committed by Commit Bot

Refactor DrawCallPerf test parameters.

Use the new combiners functions added in an earlier CL. Makes it easy to maintain bigger lists of test combinations. Also a few other changes: - removes some D3D9 perf testing since we don't maintain this config - removes the "validation only" tests. these were mostly redundant - makes the tests permutation combinations more consistent Bug: angleproject:3630 Change-Id: I175d887a01b21123f83f9fa4f64dacaa2644147a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2059468Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent c4197713
......@@ -332,9 +332,11 @@ std::string RenderTestParams::backend() const
case angle::GLESDriverType::AngleEGL:
break;
case angle::GLESDriverType::SystemEGL:
return "_native";
strstr << "_native";
break;
case angle::GLESDriverType::SystemWGL:
return "_wgl";
strstr << "_wgl";
break;
default:
assert(0);
return "_unk";
......@@ -342,6 +344,8 @@ std::string RenderTestParams::backend() const
switch (getRenderer())
{
case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE:
break;
case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE:
strstr << "_d3d11";
break;
......@@ -354,9 +358,6 @@ std::string RenderTestParams::backend() const
case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE:
strstr << "_gles";
break;
case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE:
strstr << "_default";
break;
case EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE:
strstr << "_vulkan";
break;
......
......@@ -194,5 +194,11 @@ ParamsT NullDevice(const ParamsT &input)
output.trackGpuTime = false;
return output;
}
template <typename ParamsT>
ParamsT Passthrough(const ParamsT &input)
{
return input;
}
} // namespace params
#endif // PERF_TESTS_ANGLE_PERF_TEST_H_
......@@ -9,6 +9,7 @@
#include "ANGLEPerfTest.h"
#include "DrawCallPerfParams.h"
#include "common/PackedEnums.h"
#include "test_utils/draw_call_perf_utils.h"
#include "util/shader_utils.h"
......@@ -22,10 +23,12 @@ enum class StateChange
ManyVertexBuffers,
Texture,
Program,
InvalidEnum,
};
struct DrawArraysPerfParams : public DrawCallPerfParams
{
DrawArraysPerfParams() = default;
DrawArraysPerfParams(const DrawCallPerfParams &base) : DrawCallPerfParams(base) {}
std::string story() const override;
......@@ -377,6 +380,9 @@ void DrawCallPerfBenchmark::drawBenchmark()
JustDraw(params.iterationsPerStep, numElements);
}
break;
case StateChange::InvalidEnum:
FAIL() << "Invalid state change.";
break;
}
ASSERT_GL_NO_ERROR();
......@@ -387,70 +393,24 @@ TEST_P(DrawCallPerfBenchmark, Run)
run();
}
DrawArraysPerfParams DrawArrays(const DrawCallPerfParams &base, StateChange stateChange)
using namespace params;
DrawArraysPerfParams CombineStateChange(const DrawArraysPerfParams &in, StateChange stateChange)
{
DrawArraysPerfParams params(base);
params.stateChange = stateChange;
return params;
DrawArraysPerfParams out = in;
out.stateChange = stateChange;
return out;
}
using namespace params;
using P = DrawArraysPerfParams;
std::vector<P> gTestsWithStateChange =
CombineWithValues({P()}, angle::AllEnums<StateChange>(), CombineStateChange);
std::vector<P> gTestsWithRenderer =
CombineWithFuncs(gTestsWithStateChange, {D3D11<P>, GL<P>, Vulkan<P>, WGL<P>});
std::vector<P> gTestsWithDevice =
CombineWithFuncs(gTestsWithRenderer, {Passthrough<P>, Offscreen<P>, NullDevice<P>});
ANGLE_INSTANTIATE_TEST(DrawCallPerfBenchmark,
DrawArrays(DrawCallD3D9(), StateChange::NoChange),
DrawArrays(NullDevice(DrawCallD3D9()), StateChange::NoChange),
DrawArrays(DrawCallD3D11(), StateChange::NoChange),
DrawArrays(NullDevice(DrawCallD3D11()), StateChange::NoChange),
DrawArrays(NullDevice(Offscreen(DrawCallD3D11())), StateChange::NoChange),
DrawArrays(DrawCallD3D11(), StateChange::VertexAttrib),
DrawArrays(NullDevice(DrawCallD3D11()), StateChange::VertexAttrib),
DrawArrays(DrawCallD3D11(), StateChange::VertexBuffer),
DrawArrays(NullDevice(DrawCallD3D11()), StateChange::VertexBuffer),
DrawArrays(DrawCallD3D11(), StateChange::Texture),
DrawArrays(NullDevice(DrawCallD3D11()), StateChange::Texture),
DrawArrays(DrawCallD3D11(), StateChange::Program),
DrawArrays(NullDevice(DrawCallD3D11()), StateChange::Program),
DrawArrays(DrawCallOpenGL(), StateChange::NoChange),
DrawArrays(NullDevice(DrawCallOpenGL()), StateChange::NoChange),
DrawArrays(NullDevice(Offscreen(DrawCallOpenGL())), StateChange::NoChange),
DrawArrays(DrawCallOpenGL(), StateChange::VertexAttrib),
DrawArrays(NullDevice(DrawCallOpenGL()), StateChange::VertexAttrib),
DrawArrays(DrawCallOpenGL(), StateChange::VertexBuffer),
DrawArrays(NullDevice(DrawCallOpenGL()), StateChange::VertexBuffer),
DrawArrays(DrawCallOpenGL(), StateChange::ManyVertexBuffers),
DrawArrays(NullDevice(DrawCallOpenGL()), StateChange::ManyVertexBuffers),
DrawArrays(DrawCallOpenGL(), StateChange::Texture),
DrawArrays(NullDevice(DrawCallOpenGL()), StateChange::Texture),
DrawArrays(DrawCallOpenGL(), StateChange::Program),
DrawArrays(NullDevice(DrawCallOpenGL()), StateChange::Program),
DrawArrays(DrawCallValidation(), StateChange::NoChange),
DrawArrays(DrawCallVulkan(), StateChange::NoChange),
DrawArrays(Offscreen(DrawCallVulkan()), StateChange::NoChange),
DrawArrays(NullDevice(DrawCallVulkan()), StateChange::NoChange),
DrawArrays(DrawCallVulkan(), StateChange::VertexAttrib),
DrawArrays(Offscreen(DrawCallVulkan()), StateChange::VertexAttrib),
DrawArrays(NullDevice(DrawCallVulkan()), StateChange::VertexAttrib),
DrawArrays(DrawCallVulkan(), StateChange::VertexBuffer),
DrawArrays(Offscreen(DrawCallVulkan()), StateChange::VertexBuffer),
DrawArrays(NullDevice(DrawCallVulkan()), StateChange::VertexBuffer),
DrawArrays(DrawCallVulkan(), StateChange::ManyVertexBuffers),
DrawArrays(Offscreen(DrawCallVulkan()), StateChange::ManyVertexBuffers),
DrawArrays(NullDevice(DrawCallVulkan()), StateChange::ManyVertexBuffers),
DrawArrays(DrawCallVulkan(), StateChange::Texture),
DrawArrays(Offscreen(DrawCallVulkan()), StateChange::Texture),
DrawArrays(NullDevice(DrawCallVulkan()), StateChange::Texture),
DrawArrays(DrawCallVulkan(), StateChange::Program),
DrawArrays(Offscreen(DrawCallVulkan()), StateChange::Program),
DrawArrays(NullDevice(DrawCallVulkan()), StateChange::Program),
DrawArrays(DrawCallWGL(), StateChange::NoChange),
DrawArrays(Offscreen(DrawCallWGL()), StateChange::NoChange),
DrawArrays(DrawCallWGL(), StateChange::VertexAttrib),
DrawArrays(Offscreen(DrawCallWGL()), StateChange::VertexAttrib),
DrawArrays(DrawCallWGL(), StateChange::VertexBuffer),
DrawArrays(Offscreen(DrawCallWGL()), StateChange::VertexBuffer),
DrawArrays(DrawCallWGL(), StateChange::Texture),
DrawArrays(Offscreen(DrawCallWGL()), StateChange::Texture),
DrawArrays(DrawCallWGL(), StateChange::Program),
DrawArrays(Offscreen(DrawCallWGL()), StateChange::Program));
ANGLE_INSTANTIATE_TEST_ARRAY(DrawCallPerfBenchmark, gTestsWithDevice);
} // anonymous namespace
......@@ -37,11 +37,6 @@ std::string DrawCallPerfParams::story() const
strstr << RenderTestParams::story();
if (numTris == 0)
{
strstr << "_validation_only";
}
if (offscreen)
{
strstr << "_offscreen";
......@@ -49,52 +44,3 @@ std::string DrawCallPerfParams::story() const
return strstr.str();
}
using namespace angle::egl_platform;
namespace params
{
DrawCallPerfParams DrawCallD3D11()
{
DrawCallPerfParams params;
params.eglParameters = D3D11();
return params;
}
DrawCallPerfParams DrawCallD3D9()
{
DrawCallPerfParams params;
params.eglParameters = D3D9();
return params;
}
DrawCallPerfParams DrawCallOpenGL()
{
DrawCallPerfParams params;
params.eglParameters = OPENGL_OR_GLES();
return params;
}
DrawCallPerfParams DrawCallValidation()
{
DrawCallPerfParams params;
params.eglParameters = DEFAULT();
params.numTris = 0;
params.runTimeSeconds = 5.0;
return params;
}
DrawCallPerfParams DrawCallVulkan()
{
DrawCallPerfParams params;
params.eglParameters = VULKAN();
return params;
}
DrawCallPerfParams DrawCallWGL()
{
DrawCallPerfParams params;
params.driver = angle::GLESDriverType::SystemWGL;
return params;
}
} // namespace params
......@@ -13,6 +13,7 @@
#include <ostream>
#include "ANGLEPerfTest.h"
#include "test_utils/angle_test_configs.h"
struct DrawCallPerfParams : public RenderTestParams
{
......@@ -29,12 +30,46 @@ struct DrawCallPerfParams : public RenderTestParams
namespace params
{
DrawCallPerfParams DrawCallD3D11();
DrawCallPerfParams DrawCallD3D9();
DrawCallPerfParams DrawCallOpenGL();
DrawCallPerfParams DrawCallValidation();
DrawCallPerfParams DrawCallVulkan();
DrawCallPerfParams DrawCallWGL();
template <typename ParamsT>
ParamsT D3D9(const ParamsT &in)
{
ParamsT out = in;
out.eglParameters = angle::egl_platform::D3D9();
return out;
}
template <typename ParamsT>
ParamsT D3D11(const ParamsT &in)
{
ParamsT out = in;
out.eglParameters = angle::egl_platform::D3D11();
return out;
}
template <typename ParamsT>
ParamsT GL(const ParamsT &in)
{
ParamsT out = in;
out.eglParameters = angle::egl_platform::OPENGL_OR_GLES();
return out;
}
template <typename ParamsT>
ParamsT Vulkan(const ParamsT &in)
{
ParamsT out = in;
out.eglParameters = angle::egl_platform::VULKAN();
return out;
}
template <typename ParamsT>
ParamsT WGL(const ParamsT &in)
{
ParamsT out = in;
out.driver = angle::GLESDriverType::SystemWGL;
return out;
}
} // namespace params
#endif // TESTS_PERF_TESTS_DRAW_CALL_PERF_PARAMS_H_
......@@ -202,108 +202,42 @@ void DrawElementsPerfBenchmark::drawBenchmark()
ASSERT_GL_NO_ERROR();
}
DrawElementsPerfParams DrawElementsPerfD3D11Params(bool indexBufferChanged,
bool useNullDevice,
GLenum indexType)
{
DrawElementsPerfParams params;
params.eglParameters =
useNullDevice ? angle::egl_platform::D3D11_NULL() : angle::egl_platform::D3D11();
params.indexBufferChanged = indexBufferChanged;
params.type = indexType;
// Scale down iterations for slower tests.
if (indexBufferChanged)
params.iterationsPerStep /= 100;
return params;
}
DrawElementsPerfParams DrawElementsPerfD3D9Params(bool indexBufferChanged)
TEST_P(DrawElementsPerfBenchmark, Run)
{
DrawElementsPerfParams params;
params.eglParameters = angle::egl_platform::D3D9();
params.indexBufferChanged = indexBufferChanged;
// Scale down iterations for slower tests.
if (indexBufferChanged)
params.iterationsPerStep /= 100;
return params;
run();
}
DrawElementsPerfParams DrawElementsPerfOpenGLOrGLESParams(bool indexBufferChanged,
bool useNullDevice,
GLenum indexType)
{
DrawElementsPerfParams params;
params.eglParameters = useNullDevice ? angle::egl_platform::OPENGL_OR_GLES_NULL()
: angle::egl_platform::OPENGL_OR_GLES();
params.indexBufferChanged = indexBufferChanged;
params.type = indexType;
// Scale down iterations for slower tests.
if (indexBufferChanged)
params.iterationsPerStep /= 100;
using namespace angle;
using namespace params;
using P = DrawElementsPerfParams;
return params;
}
DrawElementsPerfParams DrawElementsPerfVulkanParams(bool indexBufferChanged,
bool useNullDevice,
GLenum indexType)
P CombineIndexType(const P &in, GLenum indexType)
{
DrawElementsPerfParams params;
params.eglParameters =
useNullDevice ? angle::egl_platform::VULKAN_NULL() : angle::egl_platform::VULKAN();
params.indexBufferChanged = indexBufferChanged;
params.type = indexType;
// Scale down iterations for slower tests.
if (indexBufferChanged)
params.iterationsPerStep /= 100;
return params;
P out = in;
out.type = indexType;
return out;
}
DrawElementsPerfParams DrawElementsPerfWGLParams(bool indexBufferChanged, GLenum indexType)
P CombineIndexBufferChanged(const P &in, bool indexBufferChanged)
{
DrawElementsPerfParams params;
params.driver = angle::GLESDriverType::SystemWGL;
params.indexBufferChanged = indexBufferChanged;
params.type = indexType;
P out = in;
out.indexBufferChanged = indexBufferChanged;
// Scale down iterations for slower tests.
if (indexBufferChanged)
params.iterationsPerStep /= 100;
out.iterationsPerStep /= 100;
return params;
return out;
}
TEST_P(DrawElementsPerfBenchmark, Run)
{
run();
}
std::vector<GLenum> gIndexTypes = {GL_UNSIGNED_INT, GL_UNSIGNED_SHORT};
std::vector<P> gWithIndexType = CombineWithValues({P()}, gIndexTypes, CombineIndexType);
std::vector<P> gWithRenderer =
CombineWithFuncs(gWithIndexType, {D3D11<P>, GL<P>, Vulkan<P>, WGL<P>});
std::vector<P> gWithChange =
CombineWithValues(gWithRenderer, {false, true}, CombineIndexBufferChanged);
std::vector<P> gWithDevice = CombineWithFuncs(gWithChange, {Passthrough<P>, NullDevice<P>});
ANGLE_INSTANTIATE_TEST(DrawElementsPerfBenchmark,
DrawElementsPerfD3D9Params(false),
DrawElementsPerfD3D9Params(true),
DrawElementsPerfD3D11Params(false, true, GL_UNSIGNED_INT),
DrawElementsPerfD3D11Params(true, true, GL_UNSIGNED_INT),
DrawElementsPerfD3D11Params(false, false, GL_UNSIGNED_INT),
DrawElementsPerfD3D11Params(true, false, GL_UNSIGNED_INT),
DrawElementsPerfD3D11Params(false, false, GL_UNSIGNED_SHORT),
DrawElementsPerfD3D11Params(false, true, GL_UNSIGNED_SHORT),
DrawElementsPerfOpenGLOrGLESParams(false, false, GL_UNSIGNED_SHORT),
DrawElementsPerfOpenGLOrGLESParams(false, true, GL_UNSIGNED_SHORT),
DrawElementsPerfOpenGLOrGLESParams(true, false, GL_UNSIGNED_SHORT),
DrawElementsPerfOpenGLOrGLESParams(false, false, GL_UNSIGNED_INT),
DrawElementsPerfOpenGLOrGLESParams(true, false, GL_UNSIGNED_INT),
DrawElementsPerfVulkanParams(false, false, GL_UNSIGNED_SHORT),
DrawElementsPerfVulkanParams(false, true, GL_UNSIGNED_SHORT),
DrawElementsPerfVulkanParams(false, false, GL_UNSIGNED_INT),
DrawElementsPerfVulkanParams(false, true, GL_UNSIGNED_INT),
DrawElementsPerfWGLParams(false, GL_UNSIGNED_SHORT));
ANGLE_INSTANTIATE_TEST_ARRAY(DrawElementsPerfBenchmark, gWithDevice);
} // anonymous namespace
......@@ -11,6 +11,7 @@
#include "common/PackedEnums.h"
#include "common/system_utils.h"
#include "tests/perf_tests/ANGLEPerfTest.h"
#include "tests/perf_tests/DrawCallPerfParams.h"
#include "util/egl_loader_autogen.h"
#include "restricted_traces/trex_1300_1310/trex_1300_1310_capture_context1.h"
......@@ -174,28 +175,6 @@ TEST_P(TracePerfTest, Run)
run();
}
TracePerfParams GL(const TracePerfParams &in)
{
TracePerfParams out = in;
out.eglParameters = OPENGL_OR_GLES();
return out;
}
TracePerfParams Vulkan(const TracePerfParams &in)
{
TracePerfParams out = in;
out.eglParameters = VULKAN();
return out;
}
// Note: WGL replay currently broken because interface locations are not remapped.
ANGLE_MAYBE_UNUSED TracePerfParams WGL(const TracePerfParams &in)
{
TracePerfParams out = in;
out.driver = angle::GLESDriverType::SystemWGL;
return out;
}
TracePerfParams CombineTestID(const TracePerfParams &in, TracePerfTestID id)
{
TracePerfParams out = in;
......@@ -203,9 +182,11 @@ TracePerfParams CombineTestID(const TracePerfParams &in, TracePerfTestID id)
return out;
}
std::vector<TracePerfParams> gTestsWithID =
CombineWithValues({TracePerfParams()}, AllEnums<TracePerfTestID>(), CombineTestID);
std::vector<TracePerfParams> gTestsWithRenderer = CombineWithFuncs(gTestsWithID, {GL, Vulkan});
using namespace params;
using P = TracePerfParams;
std::vector<P> gTestsWithID = CombineWithValues({P()}, AllEnums<TracePerfTestID>(), CombineTestID);
std::vector<P> gTestsWithRenderer = CombineWithFuncs(gTestsWithID, {GL<P>, Vulkan<P>});
ANGLE_INSTANTIATE_TEST_ARRAY(TracePerfTest, gTestsWithRenderer);
} // anonymous namespace
......@@ -481,6 +481,15 @@ bool IsConfigSupported(const PlatformParameters &param)
bool IsPlatformAvailable(const PlatformParameters &param)
{
// Disable "null" device when not on ANGLE or in D3D9.
if (param.getDeviceType() == EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE)
{
if (param.driver != GLESDriverType::AngleEGL)
return false;
if (param.getRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE)
return false;
}
switch (param.getRenderer())
{
case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE:
......
......@@ -260,21 +260,38 @@ std::vector<ParamsT> CombineWithFuncs(const std::vector<ParamsT> &in,
return out;
}
template <typename ParamT, typename ModifiersT, typename ModifierT>
template <typename ParamT, typename RangeT, typename ModifierT>
std::vector<ParamT> CombineWithValues(const std::vector<ParamT> &in,
const ModifiersT &modifiers,
RangeT begin,
RangeT end,
ParamT combine(const ParamT &, ModifierT))
{
std::vector<ParamT> out;
for (const ParamT &paramsIn : in)
{
for (ModifierT modifier : modifiers)
for (auto iter = begin; iter != end; ++iter)
{
out.push_back(combine(paramsIn, modifier));
out.push_back(combine(paramsIn, *iter));
}
}
return out;
}
template <typename ParamT, typename ModifierT>
std::vector<ParamT> CombineWithValues(const std::vector<ParamT> &in,
const std::initializer_list<ModifierT> &modifiers,
ParamT combine(const ParamT &, ModifierT))
{
return CombineWithValues(in, modifiers.begin(), modifiers.end(), combine);
}
template <typename ParamT, typename ModifiersT, typename ModifierT>
std::vector<ParamT> CombineWithValues(const std::vector<ParamT> &in,
const ModifiersT &modifiers,
ParamT combine(const ParamT &, ModifierT))
{
return CombineWithValues(in, std::begin(modifiers), std::end(modifiers), combine);
}
} // namespace angle
#define ANGLE_SKIP_TEST_IF(COND) \
......
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