Hash :
ceb7190b
Author :
Date :
2018-02-05T15:18:47
Vulkan: Fix bug in reuse of vertex input bindings Fix bug that used previously used vertex bindings. Now we use the current program mask to only initialize the vulkan pipeline with the active vertex input bindings. + adjust dEQP expectations Bug: angleproject:2334 Change-Id: Ie6176eee99f87dc7a95f664d28e8312b9cb274bc Reviewed-on: https://chromium-review.googlesource.com/902434 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Luc Ferron <lucferron@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
//
// Copyright 2018 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.
//
// VulkanPipelineCachePerf:
// Performance benchmark for the Vulkan Pipeline cache.
#include "ANGLEPerfTest.h"
#include "libANGLE/renderer/vulkan/vk_cache_utils.h"
#include "random_utils.h"
using namespace rx;
namespace
{
class VulkanPipelineCachePerfTest : public ANGLEPerfTest
{
public:
VulkanPipelineCachePerfTest();
~VulkanPipelineCachePerfTest();
void SetUp() override;
void step() override;
PipelineCache mCache;
angle::RNG mRNG;
std::vector<vk::PipelineDesc> mCacheHits;
std::vector<vk::PipelineDesc> mCacheMisses;
size_t mMissIndex = 0;
private:
void randomizeDesc(vk::PipelineDesc *desc);
};
VulkanPipelineCachePerfTest::VulkanPipelineCachePerfTest()
: ANGLEPerfTest("VulkanPipelineCachePerf", "")
{
}
VulkanPipelineCachePerfTest::~VulkanPipelineCachePerfTest()
{
mCache.destroy(VK_NULL_HANDLE);
}
void VulkanPipelineCachePerfTest::SetUp()
{
// Insert a number of random pipeline states.
for (int pipelineCount = 0; pipelineCount < 100; ++pipelineCount)
{
vk::Pipeline pipeline;
vk::PipelineDesc desc;
randomizeDesc(&desc);
if (pipelineCount < 10)
{
mCacheHits.push_back(desc);
}
mCache.populate(desc, std::move(pipeline));
}
for (int missCount = 0; missCount < 10000; ++missCount)
{
vk::PipelineDesc desc;
randomizeDesc(&desc);
mCacheMisses.push_back(desc);
}
}
void VulkanPipelineCachePerfTest::randomizeDesc(vk::PipelineDesc *desc)
{
std::vector<uint8_t> bytes(sizeof(vk::PipelineDesc));
FillVectorWithRandomUBytes(&mRNG, &bytes);
memcpy(desc, bytes.data(), sizeof(vk::PipelineDesc));
}
void VulkanPipelineCachePerfTest::step()
{
vk::RenderPass rp;
vk::PipelineLayout pl;
vk::ShaderModule sm;
vk::PipelineAndSerial *result = nullptr;
gl::AttributesMask am;
for (int iteration = 0; iteration < 100; ++iteration)
{
for (const auto &hit : mCacheHits)
{
(void)mCache.getPipeline(VK_NULL_HANDLE, rp, pl, am, sm, sm, hit, &result);
}
}
for (int missCount = 0; missCount < 20 && mMissIndex < mCacheMisses.size();
++missCount, ++mMissIndex)
{
const auto &miss = mCacheMisses[mMissIndex];
(void)mCache.getPipeline(VK_NULL_HANDLE, rp, pl, am, sm, sm, miss, &result);
}
}
} // anonymous namespace
TEST_F(VulkanPipelineCachePerfTest, Run)
{
run();
}