void QmitkNavigationDataPlayerView::OnSetDisplay(){
  DestroyPipeline();
  if ( (m_Controls->m_ChkDisplay->isChecked()) && ( m_Player.IsNotNull() ))
  {
    CreatePipeline();
  }
}
Esempio n. 2
0
void GrVkPipeline::freeGPUData(const GrVkGpu* gpu) const {
    GR_VK_CALL(gpu->vkInterface(), DestroyPipeline(gpu->device(), fPipeline, nullptr));
}
void FVulkanPipelineStateCache::DestroyCache()
{
	VkDevice DeviceHandle = Device->GetInstanceHandle();
	auto DestroyDiskEntry = [DeviceHandle](FDiskEntry& DiskEntry)
	{
		for (int32 Index = 0; Index < ARRAY_COUNT(DiskEntry.ShaderModules); ++Index)
		{
			if (DiskEntry.ShaderModules[Index] != VK_NULL_HANDLE)
			{
				VulkanRHI::vkDestroyShaderModule(DeviceHandle, DiskEntry.ShaderModules[Index], nullptr);
			}
		}

		VulkanRHI::vkDestroyPipelineLayout(DeviceHandle, DiskEntry.PipelineLayout, nullptr);

		for (int32 Index = 0; Index < DiskEntry.DescriptorSetLayouts.Num(); ++Index)
		{
			VulkanRHI::vkDestroyDescriptorSetLayout(DeviceHandle, DiskEntry.DescriptorSetLayouts[Index], nullptr);
		}

		delete DiskEntry.RenderPass;
		DiskEntry.RenderPass = nullptr;
	};

	for (TLinkedList<FVulkanBoundShaderState*>::TIterator It(GetBSSList()); It; It.Next())
	{
		FVulkanBoundShaderState* BSS = *It;

		// toss the pipeline states
		for (auto& Pair : BSS->PipelineCache)
		{
			// Reference is decremented inside the Destroy function
			DestroyPipeline(Pair.Value);
		}

		BSS->PipelineCache.Empty(0);
	}

	for (FDiskEntry& Entry : DiskEntries)
	{
		if (Entry.bLoaded)
		{
			DestroyDiskEntry(Entry);
			Entry.bLoaded = false;

			FVulkanPipeline* Pipeline = CreatedPipelines.FindAndRemoveChecked(&Entry);
			if (Pipeline->GetRefCount() >= 1)
			{
				check(Pipeline->GetRefCount() == 1);
				Pipeline->Release();
			}
			else
			{
				delete Pipeline;
			}
		}
		else
		{
			Entry.RenderPass = nullptr;
		}
	}

	DiskEntries.Empty();

	KeyToPipelineMap.Empty();
	CreatedPipelines.Empty();
}