Implemented KRSampler::destroy
This commit is contained in:
@@ -101,6 +101,7 @@ KRContext::KRContext(const KrInitializeInfo* initializeInfo)
|
||||
|
||||
m_pBundleManager = std::make_unique<KRBundleManager>(*this);
|
||||
m_deviceManager = std::make_unique<KRDeviceManager>(*this);
|
||||
m_deviceManager->initialize();
|
||||
m_surfaceManager = std::make_unique<KRSurfaceManager>(*this);
|
||||
m_pPipelineManager = std::make_unique<KRPipelineManager>(*this);
|
||||
m_pSamplerManager = std::make_unique<KRSamplerManager>(*this);
|
||||
@@ -134,8 +135,6 @@ KRContext::KRContext(const KrInitializeInfo* initializeInfo)
|
||||
#error Unsupported
|
||||
#endif
|
||||
|
||||
m_deviceManager->initialize();
|
||||
|
||||
m_presentationThread->start();
|
||||
m_streamerThread->start();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ KRSampler::~KRSampler()
|
||||
bool KRSampler::createSamplers(const SamplerInfo& info)
|
||||
{
|
||||
bool success = true;
|
||||
m_samplers.clear();
|
||||
destroy();
|
||||
KRDeviceManager* deviceManager = getContext().getDeviceManager();
|
||||
int iAllocation = 0;
|
||||
|
||||
@@ -82,5 +82,11 @@ VkSampler KRSampler::getSampler(KrDeviceHandle& handle)
|
||||
|
||||
void KRSampler::destroy()
|
||||
{
|
||||
|
||||
for (std::pair<KrDeviceHandle, VkSampler> sampler : m_samplers) {
|
||||
std::unique_ptr<KRDevice> &device = getContext().getDeviceManager()->getDevice(sampler.first);
|
||||
if (device) {
|
||||
vkDestroySampler(device->m_logicalDevice, sampler.second, nullptr);
|
||||
}
|
||||
}
|
||||
m_samplers.clear();
|
||||
}
|
||||
Reference in New Issue
Block a user