| 52 | |
| 53 | template <typename TBatcherCall> |
| 54 | void RunTest(float * vertexes, void * indexes, uint32_t vertexCount, uint8_t vertexComponentCount, |
| 55 | uint32_t indexCount, TBatcherCall const & fn) |
| 56 | { |
| 57 | uint32_t const vertexSize = vertexCount * vertexComponentCount; |
| 58 | MemoryComparer const dataCmp(vertexes, vertexSize * sizeof(float)); |
| 59 | MemoryComparer const indexCmp(indexes, indexCount * dp::IndexStorage::SizeOfIndex()); |
| 60 | |
| 61 | ExpectBufferCreation(vertexSize, indexCount, indexCmp, dataCmp); |
| 62 | |
| 63 | auto renderState = make_unique_dp<TestExtension>(); |
| 64 | auto state = RenderState(0, make_ref(renderState)); |
| 65 | |
| 66 | BindingInfo binding(1); |
| 67 | BindingDecl & decl = binding.GetBindingDecl(0); |
| 68 | decl.m_attributeName = "position"; |
| 69 | decl.m_componentCount = vertexComponentCount; |
| 70 | decl.m_componentType = gl_const::GLFloatType; |
| 71 | decl.m_offset = 0; |
| 72 | decl.m_stride = 0; |
| 73 | |
| 74 | AttributeProvider provider(1, vertexCount); |
| 75 | provider.InitStream(0, binding, make_ref(vertexes)); |
| 76 | |
| 77 | TestingGraphicsContext context; |
| 78 | VAOAcceptor vaoAcceptor; |
| 79 | Batcher batcher(65000, 65000); |
| 80 | batcher.StartSession(std::bind(&VAOAcceptor::FlushFullBucket, &vaoAcceptor, _1, _2)); |
| 81 | fn(&batcher, state, make_ref(&provider)); |
| 82 | batcher.EndSession(make_ref(&context)); |
| 83 | |
| 84 | ExpectBufferDeletion(); |
| 85 | |
| 86 | for (size_t i = 0; i < vaoAcceptor.m_vao.size(); ++i) |
| 87 | vaoAcceptor.m_vao[i].reset(); |
| 88 | } |
| 89 | |
| 90 | void ExpectBufferCreation(uint32_t vertexCount, uint32_t indexCount, MemoryComparer const & indexCmp, |
| 91 | MemoryComparer const & vertexCmp) |
no test coverage detected