// // Copyright 2022 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // MemoryShaderCache: Stores compiled shader in memory so they don't // always have to be re-compiled. Can be used in conjunction with the platform // layer to warm up the cache from disk.
// Include the ShBuiltInResources, which represent the extensions and constants used by the // shader. const ShBuiltInResources resources = compilerInstance.getBuiltInResources();
hashStream.writeBytes(reinterpret_cast<const uint8_t *>(&resources), sizeof(resources));
angle::MemoryBuffer uncompressedData; switch (mBlobCache.getAndDecompress(context->getScratchBuffer(), *hashOut, &uncompressedData))
{ case egl::BlobCache::GetAndDecompressResult::DecompressFailure:
ANGLE_PERF_WARNING(context->getState().getDebug(), GL_DEBUG_SEVERITY_LOW, "Error decompressing shader binary data from cache."); return angle::Result::Incomplete;
case egl::BlobCache::GetAndDecompressResult::NotFound: return angle::Result::Incomplete;
case egl::BlobCache::GetAndDecompressResult::GetSuccess:
angle::Result result = shader->loadBinary(context, uncompressedData.data(), static_cast<int>(uncompressedData.size()));
{
std::scoped_lock<std::mutex> lock(mHistogramMutex);
ANGLE_HISTOGRAM_BOOLEAN("GPU.ANGLE.ShaderCache.LoadBinarySuccess",
result == angle::Result::Continue);
}
ANGLE_TRY(result);
if (result == angle::Result::Continue) return angle::Result::Continue;
// Cache load failed, evict.
ANGLE_PERF_WARNING(context->getState().getDebug(), GL_DEBUG_SEVERITY_LOW, "Failed to load shader binary from cache.");
mBlobCache.remove(*hashOut); return angle::Result::Incomplete;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.