/* * Copyright 2024 Google LLC * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "include/gpu/graphite/PrecompileContext.h" #include "src/gpu/graphite/ResourceProvider.h" #include "src/gpu/graphite/SharedContext.h" namespace skgpu::graphite { #define ASSERT_SINGLE_OWNER SKGPU_ASSERT_SINGLE_OWNER(&fSingleOwner) PrecompileContext::~PrecompileContext() { ASSERT_SINGLE_OWNER } PrecompileContext::PrecompileContext(sk_sp sharedContext) : fSharedContext(sharedContext) { // ResourceProviders are not thread-safe. Here we create a ResourceProvider // specifically for the thread on which precompilation will occur. static constexpr size_t kEmptyBudget = 0; fResourceProvider = fSharedContext->makeResourceProvider( &fSingleOwner, SK_InvalidGenID, kEmptyBudget, /* avoidBufferAlloc= */ true); } } // namespace skgpu::graphite