Commit 0ea96210 by Jamie Madill Committed by Commit Bot

Vulkan: Enable more perf tests.

Also fixes the check for the correct UINT index extension that wasn't available on Vulkan. Also includes a workaround for the mock ICD not implementing buffer state for index ranges. Bug: angleproject:2923 Change-Id: Iab35809d15f890525a9e658d4148272c46cf1320 Reviewed-on: https://chromium-review.googlesource.com/c/1308733Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 763cec07
...@@ -161,9 +161,19 @@ angle::Result BufferVk::getIndexRange(const gl::Context *context, ...@@ -161,9 +161,19 @@ angle::Result BufferVk::getIndexRange(const gl::Context *context,
gl::IndexRange *outRange) gl::IndexRange *outRange)
{ {
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
RendererVk *renderer = contextVk->getRenderer();
// This is a workaround for the mock ICD not implementing buffer memory state.
// Could be removed if https://github.com/KhronosGroup/Vulkan-Tools/issues/84 is fixed.
if (renderer->isMockICDEnabled())
{
outRange->start = 0;
outRange->end = 0;
return angle::Result::Continue();
}
// Needed before reading buffer or we could get stale data. // Needed before reading buffer or we could get stale data.
ANGLE_TRY(contextVk->getRenderer()->finish(contextVk)); ANGLE_TRY(renderer->finish(contextVk));
// TODO(jmadill): Consider keeping a shadow system memory copy in some cases. // TODO(jmadill): Consider keeping a shadow system memory copy in some cases.
ASSERT(mBuffer.valid()); ASSERT(mBuffer.valid());
......
...@@ -297,6 +297,7 @@ RendererVk::RendererVk() ...@@ -297,6 +297,7 @@ RendererVk::RendererVk()
: mCapsInitialized(false), : mCapsInitialized(false),
mInstance(VK_NULL_HANDLE), mInstance(VK_NULL_HANDLE),
mEnableValidationLayers(false), mEnableValidationLayers(false),
mEnableMockICD(false),
mDebugReportCallback(VK_NULL_HANDLE), mDebugReportCallback(VK_NULL_HANDLE),
mPhysicalDevice(VK_NULL_HANDLE), mPhysicalDevice(VK_NULL_HANDLE),
mQueue(VK_NULL_HANDLE), mQueue(VK_NULL_HANDLE),
...@@ -384,7 +385,7 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk, ...@@ -384,7 +385,7 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
ScopedVkLoaderEnvironment scopedEnvironment(ShouldUseDebugLayers(attribs), ScopedVkLoaderEnvironment scopedEnvironment(ShouldUseDebugLayers(attribs),
ShouldEnableMockICD(attribs)); ShouldEnableMockICD(attribs));
mEnableValidationLayers = scopedEnvironment.canEnableValidationLayers(); mEnableValidationLayers = scopedEnvironment.canEnableValidationLayers();
bool enableMockICD = scopedEnvironment.canEnableMockICD(); mEnableMockICD = scopedEnvironment.canEnableMockICD();
// Gather global layer properties. // Gather global layer properties.
uint32_t instanceLayerCount = 0; uint32_t instanceLayerCount = 0;
...@@ -481,7 +482,7 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk, ...@@ -481,7 +482,7 @@ angle::Result RendererVk::initialize(DisplayVk *displayVk,
std::vector<VkPhysicalDevice> physicalDevices(physicalDeviceCount); std::vector<VkPhysicalDevice> physicalDevices(physicalDeviceCount);
ANGLE_VK_TRY(displayVk, vkEnumeratePhysicalDevices(mInstance, &physicalDeviceCount, ANGLE_VK_TRY(displayVk, vkEnumeratePhysicalDevices(mInstance, &physicalDeviceCount,
physicalDevices.data())); physicalDevices.data()));
ChoosePhysicalDevice(physicalDevices, enableMockICD, &mPhysicalDevice, ChoosePhysicalDevice(physicalDevices, mEnableMockICD, &mPhysicalDevice,
&mPhysicalDeviceProperties); &mPhysicalDeviceProperties);
vkGetPhysicalDeviceFeatures(mPhysicalDevice, &mPhysicalDeviceFeatures); vkGetPhysicalDeviceFeatures(mPhysicalDevice, &mPhysicalDeviceFeatures);
......
...@@ -188,6 +188,8 @@ class RendererVk : angle::NonCopyable ...@@ -188,6 +188,8 @@ class RendererVk : angle::NonCopyable
return angle::Result::Continue(); return angle::Result::Continue();
} }
bool isMockICDEnabled() const { return mEnableMockICD; }
private: private:
// Number of semaphores for external entities to renderer to issue a wait, such as surface's // Number of semaphores for external entities to renderer to issue a wait, such as surface's
// image acquire. // image acquire.
...@@ -228,6 +230,7 @@ class RendererVk : angle::NonCopyable ...@@ -228,6 +230,7 @@ class RendererVk : angle::NonCopyable
VkInstance mInstance; VkInstance mInstance;
bool mEnableValidationLayers; bool mEnableValidationLayers;
bool mEnableMockICD;
VkDebugReportCallbackEXT mDebugReportCallback; VkDebugReportCallbackEXT mDebugReportCallback;
VkPhysicalDevice mPhysicalDevice; VkPhysicalDevice mPhysicalDevice;
VkPhysicalDeviceProperties mPhysicalDeviceProperties; VkPhysicalDeviceProperties mPhysicalDeviceProperties;
......
...@@ -97,6 +97,13 @@ DynamicBuffer::DynamicBuffer(VkBufferUsageFlags usage, size_t minSize) ...@@ -97,6 +97,13 @@ DynamicBuffer::DynamicBuffer(VkBufferUsageFlags usage, size_t minSize)
void DynamicBuffer::init(size_t alignment, RendererVk *renderer) void DynamicBuffer::init(size_t alignment, RendererVk *renderer)
{ {
// Workaround for the mock ICD not supporting allocations greater than 0x1000.
// Could be removed if https://github.com/KhronosGroup/Vulkan-Tools/issues/84 is fixed.
if (renderer->isMockICDEnabled())
{
mMinSize = std::min<size_t>(mMinSize, 0x1000);
}
ASSERT(alignment > 0); ASSERT(alignment > 0);
mAlignment = std::max( mAlignment = std::max(
alignment, alignment,
......
...@@ -244,23 +244,17 @@ ANGLERenderTest::ANGLERenderTest(const std::string &name, const RenderTestParams ...@@ -244,23 +244,17 @@ ANGLERenderTest::ANGLERenderTest(const std::string &name, const RenderTestParams
mTraceEventBuffer.reserve(kInitialTraceEventBufferSize); mTraceEventBuffer.reserve(kInitialTraceEventBufferSize);
} }
ANGLERenderTest::ANGLERenderTest(const std::string &name,
const RenderTestParams &testParams,
const std::vector<std::string> &extensionPrerequisites)
: ANGLEPerfTest(name, testParams.suffix()),
mTestParams(testParams),
mEGLWindow(createEGLWindow(testParams)),
mOSWindow(nullptr),
mExtensionPrerequisites(extensionPrerequisites)
{
}
ANGLERenderTest::~ANGLERenderTest() ANGLERenderTest::~ANGLERenderTest()
{ {
SafeDelete(mOSWindow); SafeDelete(mOSWindow);
SafeDelete(mEGLWindow); SafeDelete(mEGLWindow);
} }
void ANGLERenderTest::addExtensionPrerequisite(const char *extensionName)
{
mExtensionPrerequisites.push_back(extensionName);
}
void ANGLERenderTest::SetUp() void ANGLERenderTest::SetUp()
{ {
ANGLEPerfTest::SetUp(); ANGLEPerfTest::SetUp();
...@@ -374,11 +368,12 @@ OSWindow *ANGLERenderTest::getWindow() ...@@ -374,11 +368,12 @@ OSWindow *ANGLERenderTest::getWindow()
bool ANGLERenderTest::areExtensionPrerequisitesFulfilled() const bool ANGLERenderTest::areExtensionPrerequisitesFulfilled() const
{ {
for (const auto &extension : mExtensionPrerequisites) for (const char *extension : mExtensionPrerequisites)
{ {
if (!CheckExtensionExists(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)), if (!CheckExtensionExists(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)),
extension)) extension))
{ {
std::cout << "Test skipped due to missing extension: " << extension << std::endl;
return false; return false;
} }
} }
......
...@@ -106,11 +106,10 @@ class ANGLERenderTest : public ANGLEPerfTest ...@@ -106,11 +106,10 @@ class ANGLERenderTest : public ANGLEPerfTest
{ {
public: public:
ANGLERenderTest(const std::string &name, const RenderTestParams &testParams); ANGLERenderTest(const std::string &name, const RenderTestParams &testParams);
ANGLERenderTest(const std::string &name,
const RenderTestParams &testParams,
const std::vector<std::string> &extensionPrerequisites);
~ANGLERenderTest(); ~ANGLERenderTest();
void addExtensionPrerequisite(const char *extensionName);
virtual void initializeBenchmark() { } virtual void initializeBenchmark() { }
virtual void destroyBenchmark() { } virtual void destroyBenchmark() { }
...@@ -143,7 +142,7 @@ class ANGLERenderTest : public ANGLEPerfTest ...@@ -143,7 +142,7 @@ class ANGLERenderTest : public ANGLEPerfTest
EGLWindow *mEGLWindow; EGLWindow *mEGLWindow;
OSWindow *mOSWindow; OSWindow *mOSWindow;
std::vector<std::string> mExtensionPrerequisites; std::vector<const char *> mExtensionPrerequisites;
angle::PlatformMethods mPlatformMethods; angle::PlatformMethods mPlatformMethods;
// Trace event record that can be output. // Trace event record that can be output.
......
...@@ -259,6 +259,8 @@ DrawArraysPerfParams DrawArrays(const DrawCallPerfParams &base, StateChange stat ...@@ -259,6 +259,8 @@ DrawArraysPerfParams DrawArrays(const DrawCallPerfParams &base, StateChange stat
return params; return params;
} }
// TODO(jmadill): Fix tex change test on Vulkan. http://anglebug.com/2938
ANGLE_INSTANTIATE_TEST( ANGLE_INSTANTIATE_TEST(
DrawCallPerfBenchmark, DrawCallPerfBenchmark,
DrawArrays(DrawCallPerfD3D9Params(false, false), StateChange::NoChange), DrawArrays(DrawCallPerfD3D9Params(false, false), StateChange::NoChange),
...@@ -268,17 +270,19 @@ ANGLE_INSTANTIATE_TEST( ...@@ -268,17 +270,19 @@ ANGLE_INSTANTIATE_TEST(
DrawArrays(DrawCallPerfD3D11Params(true, true), StateChange::NoChange), DrawArrays(DrawCallPerfD3D11Params(true, true), StateChange::NoChange),
DrawArrays(DrawCallPerfD3D11Params(false, false), StateChange::VertexBuffer), DrawArrays(DrawCallPerfD3D11Params(false, false), StateChange::VertexBuffer),
DrawArrays(DrawCallPerfD3D11Params(true, false), StateChange::VertexBuffer), DrawArrays(DrawCallPerfD3D11Params(true, false), StateChange::VertexBuffer),
DrawArrays(DrawCallPerfD3D11Params(false, false), StateChange::Texture),
DrawArrays(DrawCallPerfD3D11Params(true, false), StateChange::Texture), DrawArrays(DrawCallPerfD3D11Params(true, false), StateChange::Texture),
DrawArrays(DrawCallPerfOpenGLOrGLESParams(false, false), StateChange::NoChange), DrawArrays(DrawCallPerfOpenGLOrGLESParams(false, false), StateChange::NoChange),
DrawArrays(DrawCallPerfOpenGLOrGLESParams(true, false), StateChange::NoChange), DrawArrays(DrawCallPerfOpenGLOrGLESParams(true, false), StateChange::NoChange),
DrawArrays(DrawCallPerfOpenGLOrGLESParams(true, true), StateChange::NoChange), DrawArrays(DrawCallPerfOpenGLOrGLESParams(true, true), StateChange::NoChange),
DrawArrays(DrawCallPerfOpenGLOrGLESParams(false, false), StateChange::VertexBuffer), DrawArrays(DrawCallPerfOpenGLOrGLESParams(false, false), StateChange::VertexBuffer),
DrawArrays(DrawCallPerfOpenGLOrGLESParams(true, false), StateChange::VertexBuffer), DrawArrays(DrawCallPerfOpenGLOrGLESParams(true, false), StateChange::VertexBuffer),
DrawArrays(DrawCallPerfOpenGLOrGLESParams(false, false), StateChange::Texture),
DrawArrays(DrawCallPerfOpenGLOrGLESParams(true, false), StateChange::Texture), DrawArrays(DrawCallPerfOpenGLOrGLESParams(true, false), StateChange::Texture),
DrawArrays(DrawCallPerfValidationOnly(), StateChange::NoChange), DrawArrays(DrawCallPerfValidationOnly(), StateChange::NoChange),
DrawArrays(DrawCallPerfVulkanParams(true, false), StateChange::VertexBuffer),
DrawArrays(DrawCallPerfVulkanParams(true, false), StateChange::NoChange),
DrawArrays(DrawCallPerfVulkanParams(false, false), StateChange::NoChange), DrawArrays(DrawCallPerfVulkanParams(false, false), StateChange::NoChange),
DrawArrays(DrawCallPerfVulkanParams(false, false), StateChange::VertexBuffer)); DrawArrays(DrawCallPerfVulkanParams(true, false), StateChange::NoChange),
DrawArrays(DrawCallPerfVulkanParams(false, false), StateChange::VertexBuffer),
DrawArrays(DrawCallPerfVulkanParams(true, false), StateChange::VertexBuffer));
} // namespace } // anonymous namespace
...@@ -91,6 +91,11 @@ DrawElementsPerfBenchmark::DrawElementsPerfBenchmark() ...@@ -91,6 +91,11 @@ DrawElementsPerfBenchmark::DrawElementsPerfBenchmark()
: ANGLERenderTest("DrawElementsPerf", GetParam()) : ANGLERenderTest("DrawElementsPerf", GetParam())
{ {
mRunTimeSeconds = GetParam().runTimeSeconds; mRunTimeSeconds = GetParam().runTimeSeconds;
if (GetParam().type == GL_UNSIGNED_INT)
{
addExtensionPrerequisite("GL_OES_element_index_uint");
}
} }
void DrawElementsPerfBenchmark::initializeBenchmark() void DrawElementsPerfBenchmark::initializeBenchmark()
...@@ -163,22 +168,25 @@ void DrawElementsPerfBenchmark::drawBenchmark() ...@@ -163,22 +168,25 @@ void DrawElementsPerfBenchmark::drawBenchmark()
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
} }
const auto &params = GetParam(); const DrawElementsPerfParams &params = GetParam();
for (unsigned int it = 0; it < params.iterations; it++) if (params.indexBufferChanged)
{
const void *bufferData = (params.type == GL_UNSIGNED_INT)
? static_cast<GLvoid *>(mIntIndexData.data())
: static_cast<GLvoid *>(mShortIndexData.data());
for (unsigned int it = 0; it < params.iterations; it++)
{
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, mBufferSize, bufferData);
glDrawElements(GL_TRIANGLES, static_cast<GLsizei>(mCount), params.type, 0);
}
}
else
{ {
if (params.indexBufferChanged) for (unsigned int it = 0; it < params.iterations; it++)
{ {
if (params.type == GL_UNSIGNED_INT) glDrawElements(GL_TRIANGLES, static_cast<GLsizei>(mCount), params.type, 0);
{
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, mBufferSize, mIntIndexData.data());
}
else
{
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, mBufferSize, mShortIndexData.data());
}
} }
glDrawElements(GL_TRIANGLES, static_cast<GLsizei>(mCount), params.type, 0);
} }
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
...@@ -204,11 +212,24 @@ DrawElementsPerfParams DrawElementsPerfD3D9Params(bool indexBufferChanged) ...@@ -204,11 +212,24 @@ DrawElementsPerfParams DrawElementsPerfD3D9Params(bool indexBufferChanged)
return params; return params;
} }
DrawElementsPerfParams DrawElementsPerfOpenGLOrGLESParams(bool indexBufferChanged) DrawElementsPerfParams DrawElementsPerfOpenGLOrGLESParams(bool indexBufferChanged, GLenum indexType)
{ {
DrawElementsPerfParams params; DrawElementsPerfParams params;
params.eglParameters = angle::egl_platform::OPENGL_OR_GLES(false); params.eglParameters = angle::egl_platform::OPENGL_OR_GLES(false);
params.indexBufferChanged = indexBufferChanged; params.indexBufferChanged = indexBufferChanged;
params.type = indexType;
return params;
}
DrawElementsPerfParams DrawElementsPerfVulkanParams(bool indexBufferChanged,
bool useNullDevice,
GLenum indexType)
{
DrawElementsPerfParams params;
params.eglParameters =
useNullDevice ? angle::egl_platform::VULKAN_NULL() : angle::egl_platform::VULKAN();
params.indexBufferChanged = indexBufferChanged;
params.type = indexType;
return params; return params;
} }
...@@ -224,8 +245,15 @@ ANGLE_INSTANTIATE_TEST(DrawElementsPerfBenchmark, ...@@ -224,8 +245,15 @@ ANGLE_INSTANTIATE_TEST(DrawElementsPerfBenchmark,
DrawElementsPerfD3D11Params(true, true, GL_UNSIGNED_INT), DrawElementsPerfD3D11Params(true, true, GL_UNSIGNED_INT),
DrawElementsPerfD3D11Params(false, false, GL_UNSIGNED_INT), DrawElementsPerfD3D11Params(false, false, GL_UNSIGNED_INT),
DrawElementsPerfD3D11Params(true, false, GL_UNSIGNED_INT), DrawElementsPerfD3D11Params(true, false, GL_UNSIGNED_INT),
DrawElementsPerfD3D11Params(false, false, GL_UNSIGNED_SHORT),
DrawElementsPerfD3D11Params(false, true, GL_UNSIGNED_SHORT), DrawElementsPerfD3D11Params(false, true, GL_UNSIGNED_SHORT),
DrawElementsPerfOpenGLOrGLESParams(false), DrawElementsPerfOpenGLOrGLESParams(false, GL_UNSIGNED_SHORT),
DrawElementsPerfOpenGLOrGLESParams(true)); DrawElementsPerfOpenGLOrGLESParams(true, GL_UNSIGNED_SHORT),
DrawElementsPerfOpenGLOrGLESParams(false, GL_UNSIGNED_INT),
} // namespace DrawElementsPerfOpenGLOrGLESParams(true, 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));
} // anonymous namespace
...@@ -109,9 +109,11 @@ class MultiviewBenchmark : public ANGLERenderTest, ...@@ -109,9 +109,11 @@ class MultiviewBenchmark : public ANGLERenderTest,
{ {
public: public:
MultiviewBenchmark(const std::string &testName) MultiviewBenchmark(const std::string &testName)
: ANGLERenderTest(testName, GetParam(), {"GL_ANGLE_multiview"}), mProgram(0) : ANGLERenderTest(testName, GetParam()), mProgram(0)
{ {
addExtensionPrerequisite("GL_ANGLE_multiview");
} }
virtual ~MultiviewBenchmark() virtual ~MultiviewBenchmark()
{ {
if (mProgram != 0) if (mProgram != 0)
......
...@@ -90,7 +90,7 @@ std::string TexSubImageParams::suffix() const ...@@ -90,7 +90,7 @@ std::string TexSubImageParams::suffix() const
} }
TexSubImageBenchmark::TexSubImageBenchmark() TexSubImageBenchmark::TexSubImageBenchmark()
: ANGLERenderTest("TexSubImage", GetParam(), {"GL_EXT_texture_storage"}), : ANGLERenderTest("TexSubImage", GetParam()),
mProgram(0), mProgram(0),
mPositionLoc(-1), mPositionLoc(-1),
mTexCoordLoc(-1), mTexCoordLoc(-1),
...@@ -100,6 +100,7 @@ TexSubImageBenchmark::TexSubImageBenchmark() ...@@ -100,6 +100,7 @@ TexSubImageBenchmark::TexSubImageBenchmark()
mIndexBuffer(0), mIndexBuffer(0),
mPixels(nullptr) mPixels(nullptr)
{ {
addExtensionPrerequisite("GL_EXT_texture_storage");
} }
GLuint TexSubImageBenchmark::createTexture() GLuint TexSubImageBenchmark::createTexture()
......
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