src/third_party/angle/src/libANGLE/renderer/vulkan/vk_utils.cpp
// GarbageObject implementation
// Using c-style casts here to avoid conditional compile for MSVC 32-bit
//  which fails to compile with reinterpret_cast, requiring static_cast.
GarbageObject implementation
Using c-style casts here to avoid conditional compile for MSVC 32-bit
which fails to compile with reinterpret_cast, requiring static_cast.
GarbageObject implementation Using c - style casts here to avoid conditional compile for MSVC 32 - bit which fails to compile with reinterpret_cast requiring static_cast .
void GarbageObject::destroy(RendererVk *renderer)
{
    ANGLE_TRACE_EVENT0("gpu.angle", "GarbageObject::destroy");
    VkDevice device = renderer->getDevice();
    switch (mHandleType)
    {
        case HandleType::Semaphore:
            vkDestroySemaphore(device, (VkSemaphore)mHandle, nullptr);
            break;
        case HandleType::CommandBuffer:
            UNREACHABLE();
            break;
        case HandleType::Event:
            vkDestroyEvent(device, (VkEvent)mHandle, nullptr);
            break;
        case HandleType::Fence:
            vkDestroyFence(device, (VkFence)mHandle, nullptr);
            break;
        case HandleType::DeviceMemory:
            vkFreeMemory(device, (VkDeviceMemory)mHandle, nullptr);
            break;
        case HandleType::Buffer:
            vkDestroyBuffer(device, (VkBuffer)mHandle, nullptr);
            break;
        case HandleType::BufferView:
            vkDestroyBufferView(device, (VkBufferView)mHandle, nullptr);
            break;
        case HandleType::Image:
            vkDestroyImage(device, (VkImage)mHandle, nullptr);
            break;
        case HandleType::ImageView:
            vkDestroyImageView(device, (VkImageView)mHandle, nullptr);
            break;
        case HandleType::ShaderModule:
            vkDestroyShaderModule(device, (VkShaderModule)mHandle, nullptr);
            break;
        case HandleType::PipelineLayout:
            vkDestroyPipelineLayout(device, (VkPipelineLayout)mHandle, nullptr);
            break;
        case HandleType::RenderPass:
            vkDestroyRenderPass(device, (VkRenderPass)mHandle, nullptr);
            break;
        case HandleType::Pipeline:
            vkDestroyPipeline(device, (VkPipeline)mHandle, nullptr);
            break;
        case HandleType::DescriptorSetLayout:
            vkDestroyDescriptorSetLayout(device, (VkDescriptorSetLayout)mHandle, nullptr);
            break;
        case HandleType::Sampler:
            vkDestroySampler(device, (VkSampler)mHandle, nullptr);
            break;
        case HandleType::DescriptorPool:
            vkDestroyDescriptorPool(device, (VkDescriptorPool)mHandle, nullptr);
            break;
        case HandleType::Framebuffer:
            vkDestroyFramebuffer(device, (VkFramebuffer)mHandle, nullptr);
            break;
        case HandleType::CommandPool:
            vkDestroyCommandPool(device, (VkCommandPool)mHandle, nullptr);
            break;
        case HandleType::QueryPool:
            vkDestroyQueryPool(device, (VkQueryPool)mHandle, nullptr);
            break;
        case HandleType::Allocation:
            vma::FreeMemory(renderer->getAllocator().getHandle(), (VmaAllocation)mHandle);
            break;
        default:
            UNREACHABLE();
            break;
    }
    renderer->getActiveHandleCounts().onDeallocate(mHandleType);
}
void GarbageObject :: destroy ( RendererVk * renderer ) { ANGLE_TRACE_EVENT0 ( " " , " " ) ; VkDevice device = renderer -> getDevice ( ) ; switch ( mHandleType ) { case HandleType :: Semaphore : vkDestroySemaphore ( device , ( VkSemaphore ) mHandle , nullptr ) ; break ; case HandleType :: CommandBuffer : UNREACHABLE ( ) ; break ; case HandleType :: Event : vkDestroyEvent ( device , ( VkEvent ) mHandle , nullptr ) ; break ; case HandleType :: Fence : vkDestroyFence ( device , ( VkFence ) mHandle , nullptr ) ; break ; case HandleType :: DeviceMemory : vkFreeMemory ( device , ( VkDeviceMemory ) mHandle , nullptr ) ; break ; case HandleType :: Buffer : vkDestroyBuffer ( device , ( VkBuffer ) mHandle , nullptr ) ; break ; case HandleType :: BufferView : vkDestroyBufferView ( device , ( VkBufferView ) mHandle , nullptr ) ; break ; case HandleType :: Image : vkDestroyImage ( device , ( VkImage ) mHandle , nullptr ) ; break ; case HandleType :: ImageView : vkDestroyImageView ( device , ( VkImageView ) mHandle , nullptr ) ; break ; case HandleType :: ShaderModule : vkDestroyShaderModule ( device , ( VkShaderModule ) mHandle , nullptr ) ; break ; case HandleType :: PipelineLayout : vkDestroyPipelineLayout ( device , ( VkPipelineLayout ) mHandle , nullptr ) ; break ; case HandleType :: RenderPass : vkDestroyRenderPass ( device , ( VkRenderPass ) mHandle , nullptr ) ; break ; case HandleType :: Pipeline : vkDestroyPipeline ( device , ( VkPipeline ) mHandle , nullptr ) ; break ; case HandleType :: DescriptorSetLayout : vkDestroyDescriptorSetLayout ( device , ( VkDescriptorSetLayout ) mHandle , nullptr ) ; break ; case HandleType :: Sampler : vkDestroySampler ( device , ( VkSampler ) mHandle , nullptr ) ; break ; case HandleType :: DescriptorPool : vkDestroyDescriptorPool ( device , ( VkDescriptorPool ) mHandle , nullptr ) ; break ; case HandleType :: Framebuffer : vkDestroyFramebuffer ( device , ( VkFramebuffer ) mHandle , nullptr ) ; break ; case HandleType :: CommandPool : vkDestroyCommandPool ( device , ( VkCommandPool ) mHandle , nullptr ) ; break ; case HandleType :: QueryPool : vkDestroyQueryPool ( device , ( VkQueryPool ) mHandle , nullptr ) ; break ; case HandleType :: Allocation : vma :: FreeMemory ( renderer -> getAllocator ( ) . getHandle ( ) , ( VmaAllocation ) mHandle ) ; break ; default : UNREACHABLE ( ) ; break ; } renderer -> getActiveHandleCounts ( ) . onDeallocate ( mHandleType ) ; }
GarbageObject implementation
Using c-style casts here to avoid conditional compile for MSVC 32-bit
which fails to compile with reinterpret_cast, requiring static_cast.
GarbageObject implementation Using c - style casts here to avoid conditional compile for MSVC 32 - bit which fails to compile with reinterpret_cast requiring static_cast .
// Command buffers are pool allocated.