| 23 | } |
| 24 | |
| 25 | bool BitonicSort::Init() |
| 26 | { |
| 27 | // Draw indirect and compute shaders support is required for this implementation |
| 28 | const auto& limits = GPUDevice::Instance->Limits; |
| 29 | if (!limits.HasDrawIndirect || !limits.HasCompute) |
| 30 | return false; |
| 31 | |
| 32 | // Create indirect dispatch arguments buffer |
| 33 | _dispatchArgsBuffer = GPUDevice::Instance->CreateBuffer(TEXT("BitonicSortDispatchArgs")); |
| 34 | if (_dispatchArgsBuffer->Init(GPUBufferDescription::Raw(22 * 23 / 2 * sizeof(GPUDispatchIndirectArgs), GPUBufferFlags::Argument | GPUBufferFlags::UnorderedAccess))) |
| 35 | return true; |
| 36 | |
| 37 | // Load asset |
| 38 | _shader = Content::LoadAsyncInternal<Shader>(TEXT("Shaders/BitonicSort")); |
| 39 | if (_shader == nullptr) |
| 40 | return true; |
| 41 | #if COMPILE_WITH_DEV_ENV |
| 42 | _shader.Get()->OnReloading.Bind<BitonicSort, &BitonicSort::OnShaderReloading>(this); |
| 43 | #endif |
| 44 | |
| 45 | return false; |
| 46 | } |
| 47 | |
| 48 | bool BitonicSort::setupResources() |
| 49 | { |
nothing calls this directly
no test coverage detected