| 76 | } |
| 77 | |
| 78 | bool HistogramPass::Init() |
| 79 | { |
| 80 | _isSupported = GPUDevice::Instance->Limits.HasCompute; |
| 81 | if (!_isSupported) |
| 82 | return false; |
| 83 | |
| 84 | // Create buffer for histogram |
| 85 | _histogramBuffer = GPUDevice::Instance->CreateBuffer(TEXT("Histogram")); |
| 86 | if (_histogramBuffer->Init(GPUBufferDescription::Buffer(HISTOGRAM_SIZE * sizeof(uint32), GPUBufferFlags::Structured | GPUBufferFlags::ShaderResource | GPUBufferFlags::UnorderedAccess, PixelFormat::R32_UInt, nullptr, sizeof(uint32)))) |
| 87 | return true; |
| 88 | |
| 89 | // Load shaders |
| 90 | _shader = Content::LoadAsyncInternal<Shader>(TEXT("Shaders/Histogram")); |
| 91 | if (_shader == nullptr) |
| 92 | return true; |
| 93 | #if COMPILE_WITH_DEV_ENV |
| 94 | _shader.Get()->OnReloading.Bind<HistogramPass, &HistogramPass::OnShaderReloading>(this); |
| 95 | #endif |
| 96 | |
| 97 | return false; |
| 98 | } |
| 99 | |
| 100 | void HistogramPass::Dispose() |
| 101 | { |
nothing calls this directly
no test coverage detected