diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-07-18 08:24:24 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-07-18 08:24:24 +0200 |
commit | fc61780b35af913801d72086456f493f63197da6 (patch) | |
tree | f85891288a7bd988da9f0f15ae64e5c63f00d493 /gfx/angle/src/tests/perf_tests/IndexDataManagerTest.cpp | |
parent | 69f7f9e5f1475891ce11cc4f431692f965b0cd30 (diff) | |
parent | 50d3e596bbe89c95615f96eb71f6bc5be737a1db (diff) | |
download | UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar.gz UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar.lz UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar.xz UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.zip |
Merge commit '50d3e596bbe89c95615f96eb71f6bc5be737a1db' into Basilisk-releasev2018.07.18
# Conflicts:
# browser/app/profile/firefox.js
# browser/components/preferences/jar.mn
Diffstat (limited to 'gfx/angle/src/tests/perf_tests/IndexDataManagerTest.cpp')
-rwxr-xr-x | gfx/angle/src/tests/perf_tests/IndexDataManagerTest.cpp | 57 |
1 files changed, 23 insertions, 34 deletions
diff --git a/gfx/angle/src/tests/perf_tests/IndexDataManagerTest.cpp b/gfx/angle/src/tests/perf_tests/IndexDataManagerTest.cpp index 696b81bb5..c89f1df94 100755 --- a/gfx/angle/src/tests/perf_tests/IndexDataManagerTest.cpp +++ b/gfx/angle/src/tests/perf_tests/IndexDataManagerTest.cpp @@ -11,7 +11,6 @@ #include <gmock/gmock.h> -#include "angle_unittests_utils.h" #include "libANGLE/renderer/d3d/BufferD3D.h" #include "libANGLE/renderer/d3d/IndexBuffer.h" #include "libANGLE/renderer/d3d/IndexDataManager.h" @@ -76,10 +75,14 @@ class MockBufferFactoryD3D : public rx::BufferFactoryD3D class MockBufferD3D : public rx::BufferD3D { public: - MockBufferD3D(rx::BufferFactoryD3D *factory) : BufferD3D(mockState, factory), mData() {} + MockBufferD3D(rx::BufferFactoryD3D *factory) + : BufferD3D(factory), + mData() + { + } // BufferImpl - gl::Error setData(GLenum target, const void *data, size_t size, GLenum) override + gl::Error setData(const void *data, size_t size, GLenum) override { mData.resize(size); if (data && size > 0) @@ -89,7 +92,7 @@ class MockBufferD3D : public rx::BufferD3D return gl::Error(GL_NO_ERROR); } - MOCK_METHOD4(setSubData, gl::Error(GLenum, const void *, size_t, size_t)); + MOCK_METHOD3(setSubData, gl::Error(const void*, size_t, size_t)); MOCK_METHOD4(copySubData, gl::Error(BufferImpl*, GLintptr, GLintptr, GLsizeiptr)); MOCK_METHOD2(map, gl::Error(GLenum, GLvoid **)); MOCK_METHOD4(mapRange, gl::Error(size_t, size_t, GLbitfield, GLvoid **)); @@ -109,30 +112,9 @@ class MockBufferD3D : public rx::BufferD3D } private: - gl::BufferState mockState; std::vector<uint8_t> mData; }; -class MockGLFactoryD3D : public rx::MockGLFactory -{ - public: - MockGLFactoryD3D(MockBufferFactoryD3D *bufferFactory) : mBufferFactory(bufferFactory) {} - - rx::BufferImpl *createBuffer(const gl::BufferState &state) override - { - MockBufferD3D *mockBufferD3D = new MockBufferD3D(mBufferFactory); - - EXPECT_CALL(*mBufferFactory, createVertexBuffer()) - .WillOnce(Return(nullptr)) - .RetiresOnSaturation(); - mockBufferD3D->initializeStaticData(); - - return mockBufferD3D; - } - - MockBufferFactoryD3D *mBufferFactory; -}; - class IndexDataManagerPerfTest : public ANGLEPerfTest { public: @@ -143,27 +125,34 @@ class IndexDataManagerPerfTest : public ANGLEPerfTest rx::IndexDataManager mIndexDataManager; GLsizei mIndexCount; unsigned int mBufferSize; - MockBufferFactoryD3D mMockBufferFactory; - MockGLFactoryD3D mMockGLFactory; + MockBufferFactoryD3D mMockFactory; gl::Buffer mIndexBuffer; }; +MockBufferD3D *InitMockBufferD3D(MockBufferFactoryD3D *mockFactory) +{ + MockBufferD3D *mockBufferD3D = new MockBufferD3D(mockFactory); + + EXPECT_CALL(*mockFactory, createVertexBuffer()).WillOnce(Return(nullptr)).RetiresOnSaturation(); + mockBufferD3D->initializeStaticData(); + + return mockBufferD3D; +} + IndexDataManagerPerfTest::IndexDataManagerPerfTest() : ANGLEPerfTest("IndexDataManger", "_run"), - mIndexDataManager(&mMockBufferFactory, rx::RENDERER_D3D11), + mIndexDataManager(&mMockFactory, rx::RENDERER_D3D11), mIndexCount(4000), mBufferSize(mIndexCount * sizeof(GLushort)), - mMockBufferFactory(mBufferSize, GL_UNSIGNED_SHORT), - mMockGLFactory(&mMockBufferFactory), - mIndexBuffer(&mMockGLFactory, 1) + mMockFactory(mBufferSize, GL_UNSIGNED_SHORT), + mIndexBuffer(InitMockBufferD3D(&mMockFactory), 1) { std::vector<GLushort> indexData(mIndexCount); for (GLsizei index = 0; index < mIndexCount; ++index) { indexData[index] = static_cast<GLushort>(index); } - mIndexBuffer.bufferData(GL_ARRAY_BUFFER, &indexData[0], indexData.size() * sizeof(GLushort), - GL_STATIC_DRAW); + mIndexBuffer.bufferData(&indexData[0], indexData.size() * sizeof(GLushort), GL_STATIC_DRAW); } void IndexDataManagerPerfTest::step() @@ -183,4 +172,4 @@ TEST_F(IndexDataManagerPerfTest, Run) run(); } -} // anonymous namespace +} |