MCPcopy Create free account
hub / github.com/KomputeProject/kompute / destroy

Method destroy

src/Algorithm.cpp:23–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23void
24Algorithm::destroy()
25{
26 // We don't have to free memory on destroy as it's freed by the
27 // commandBuffer destructor if (this->mPushConstantsData) {
28 // free(this->mPushConstantsData);
29 // }
30 // if (this->mSpecializationConstantsData) {
31 // free(this->mSpecializationConstantsData);
32 // }
33
34 if (!this->mDevice) {
35 KP_LOG_WARN("Kompute Algorithm destroy function reached with null "
36 "Device pointer");
37 return;
38 }
39
40 if (this->mFreePipeline && this->mPipeline) {
41 KP_LOG_DEBUG("Kompute Algorithm Destroying pipeline");
42 if (!this->mPipeline) {
43 KP_LOG_WARN("Kompute Algorithm Error requested to destroy "
44 "pipeline but it is null");
45 }
46 this->mDevice->destroy(
47 *this->mPipeline,
48 (vk::Optional<const vk::AllocationCallbacks>)nullptr);
49 this->mPipeline = nullptr;
50 }
51
52 if (this->mFreePipelineCache && this->mPipelineCache) {
53 KP_LOG_DEBUG("Kompute Algorithm Destroying pipeline cache");
54 if (!this->mPipelineCache) {
55 KP_LOG_WARN("Kompute Algorithm Error requested to destroy "
56 "pipeline cache but it is null");
57 }
58 this->mDevice->destroy(
59 *this->mPipelineCache,
60 (vk::Optional<const vk::AllocationCallbacks>)nullptr);
61 this->mPipelineCache = nullptr;
62 }
63
64 if (this->mFreePipelineLayout && this->mPipelineLayout) {
65 KP_LOG_DEBUG("Kompute Algorithm Destroying pipeline layout");
66 if (!this->mPipelineLayout) {
67 KP_LOG_WARN("Kompute Algorithm Error requested to destroy "
68 "pipeline layout but it is null");
69 }
70 this->mDevice->destroy(
71 *this->mPipelineLayout,
72 (vk::Optional<const vk::AllocationCallbacks>)nullptr);
73 this->mPipelineLayout = nullptr;
74 }
75
76 if (this->mFreeShaderModule && this->mShaderModule) {
77 KP_LOG_DEBUG("Kompute Algorithm Destroying shader module");
78 if (!this->mShaderModule) {
79 KP_LOG_WARN("Kompute Algorithm Error requested to destroy shader "
80 "module but it is null");

Callers 2

~AlgorithmMethod · 0.95
rebuildMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected