/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/RendererFoundation/State/Implementation/PipelineCache_inl.h
38 строк
1 KB
Sanakan8472
Pipeline State Objects (#1551)
04 май 2025, 15:48
Не верифицирован
04 май 2025, 15:48
fe7179e
Код
Авторство
О чём код?
template <typename HandleType, typename DescType, typename KeyType> HandleType ezGALPipelineCache::TryGetPipeline(const DescType& description, ezHashTable<KeyType, HandleType, ezGALPipelineCache::CacheKeyHasher>& table) { EZ_ASSERT_DEV(m_pDevice != nullptr, "GAL device not initialized"); KeyType key; key.m_Desc = description; key.m_uiHash = description.CalculateHash(); { EZ_LOCK(m_Mutex); HandleType* pExistingPipeline = table.GetValue(key); if (pExistingPipeline != nullptr) { return *pExistingPipeline; } } return {}; } template <typename HandleType, typename DescType, typename KeyType> EZ_ALWAYS_INLINE ezResult ezGALPipelineCache::TryInsertPipeline(const DescType& description, HandleType hNewPipeline, ezHashTable<KeyType, HandleType, ezGALPipelineCache::CacheKeyHasher>& table) { KeyType key; key.m_Desc = description; key.m_uiHash = description.CalculateHash(); EZ_LOCK(m_Mutex); HandleType existingPipeline; if (table.Insert(key, hNewPipeline, &existingPipeline)) { EZ_ASSERT_DEBUG(existingPipeline == hNewPipeline, "On collision, both pipelines must be the same (create should have just increased the ref count)"); return EZ_FAILURE; } return EZ_SUCCESS; }