MCPcopy Create free account
hub / github.com/defold/defold / GetOrCreateComputePipeline

Function GetOrCreateComputePipeline

engine/graphics/src/vulkan/graphics_vulkan.cpp:2149–2177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2147 }
2148
2149 static Pipeline* GetOrCreateComputePipeline(VkDevice vk_device, VkPipelineCache vk_pipeline_cache, PipelineCache& pipelineCache, VulkanProgram* program)
2150 {
2151 HashState64 pipeline_hash_state;
2152 dmHashInit64(&pipeline_hash_state, false);
2153 dmHashUpdateBuffer64(&pipeline_hash_state, &program->m_Hash, sizeof(program->m_Hash));
2154
2155 uint64_t pipeline_hash = dmHashFinal64(&pipeline_hash_state);
2156 Pipeline* cached_pipeline = pipelineCache.Get(pipeline_hash);
2157
2158 if (!cached_pipeline)
2159 {
2160 Pipeline new_pipeline = {};
2161
2162 VkResult res = CreateComputePipeline(vk_device, vk_pipeline_cache, program, &new_pipeline);
2163 CHECK_VK_ERROR(res);
2164
2165 if (pipelineCache.Full())
2166 {
2167 pipelineCache.SetCapacity(32, pipelineCache.Capacity() + 4);
2168 }
2169
2170 pipelineCache.Put(pipeline_hash, new_pipeline);
2171 cached_pipeline = pipelineCache.Get(pipeline_hash);
2172
2173 dmLogDebug("Created new VK Compute Pipeline with hash %llu", (unsigned long long) pipeline_hash);
2174 }
2175
2176 return cached_pipeline;
2177 }
2178
2179 static Pipeline* GetOrCreatePipeline(VkDevice vk_device, VkPipelineCache vk_pipeline_cache, VkSampleCountFlagBits vk_sample_count,
2180 const PipelineState pipelineState, PipelineCache& pipelineCache,

Callers 1

DrawSetupComputeFunction · 0.70

Calls 9

dmHashInit64Function · 0.85
dmHashUpdateBuffer64Function · 0.85
dmHashFinal64Function · 0.85
CreateComputePipelineFunction · 0.70
GetMethod · 0.45
FullMethod · 0.45
SetCapacityMethod · 0.45
CapacityMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected