| 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, |
no test coverage detected