| 690 | } |
| 691 | |
| 692 | void GPUUnitTestContext::allocateStructuredBuffer(const std::string& name, uint32_t nElements, const void* pInitData, size_t initDataSize) |
| 693 | { |
| 694 | FALCOR_CHECK(mpVars != nullptr, "Program vars not created"); |
| 695 | mStructuredBuffers[name] = mpDevice->createStructuredBuffer(mpVars->getRootVar()[name], nElements); |
| 696 | if (pInitData) |
| 697 | { |
| 698 | ref<Buffer> buffer = mStructuredBuffers[name]; |
| 699 | size_t expectedDataSize = buffer->getStructSize() * buffer->getElementCount(); |
| 700 | if (initDataSize == 0) |
| 701 | initDataSize = expectedDataSize; |
| 702 | else if (initDataSize != expectedDataSize) |
| 703 | throw ErrorRunningTestException("StructuredBuffer '" + name + "' initial data size mismatch"); |
| 704 | buffer->setBlob(pInitData, 0, initDataSize); |
| 705 | } |
| 706 | } |
| 707 | |
| 708 | void GPUUnitTestContext::runProgram(const uint3& dimensions) |
| 709 | { |
no test coverage detected