| 37 | } // namespace |
| 38 | |
| 39 | VulkanProgramParamsSetter::VulkanProgramParamsSetter(ref_ptr<dp::vulkan::VulkanBaseContext> context, |
| 40 | ref_ptr<VulkanProgramPool> programPool) |
| 41 | { |
| 42 | using namespace dp::vulkan; |
| 43 | m_objectManager = context->GetObjectManager(); |
| 44 | m_objectManager->SetMaxUniformBuffers(programPool->GetMaxUniformBuffers()); |
| 45 | m_objectManager->SetMaxImageSamplers(programPool->GetMaxImageSamplers()); |
| 46 | |
| 47 | for (auto & ub : m_uniformBuffers) |
| 48 | ub.emplace_back(CreateUniformBuffer(context->GetDevice(), m_objectManager, m_sizeAlignment, m_offsetAlignment)); |
| 49 | |
| 50 | m_flushHandlerId = |
| 51 | context->RegisterHandler(VulkanBaseContext::HandlerType::PrePresent, [this](uint32_t) { Flush(); }); |
| 52 | |
| 53 | m_finishHandlerId = |
| 54 | context->RegisterHandler(VulkanBaseContext::HandlerType::PostPresent, [this](uint32_t inflightFrameIndex) |
| 55 | { |
| 56 | CHECK_LESS(inflightFrameIndex, dp::vulkan::kMaxInflightFrames, ()); |
| 57 | Finish(inflightFrameIndex); |
| 58 | }); |
| 59 | |
| 60 | m_updateInflightFrameId = |
| 61 | context->RegisterHandler(VulkanBaseContext::HandlerType::UpdateInflightFrame, [this](uint32_t inflightFrameIndex) |
| 62 | { |
| 63 | CHECK_LESS(inflightFrameIndex, dp::vulkan::kMaxInflightFrames, ()); |
| 64 | m_currentInflightFrameIndex = inflightFrameIndex; |
| 65 | }); |
| 66 | } |
| 67 | |
| 68 | VulkanProgramParamsSetter::~VulkanProgramParamsSetter() |
| 69 | { |
nothing calls this directly
no test coverage detected