1 /* 2 * Copyright 2021 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "src/gpu/graphite/SharedContext.h" 9 10 #include "include/gpu/graphite/BackendTexture.h" 11 #include "include/gpu/graphite/TextureInfo.h" 12 #include "src/gpu/graphite/Caps.h" 13 #include "src/gpu/graphite/CommandBuffer.h" 14 #include "src/gpu/graphite/GpuWorkSubmission.h" 15 #include "src/gpu/graphite/RendererProvider.h" 16 #include "src/gpu/graphite/ResourceProvider.h" 17 18 namespace skgpu::graphite { 19 SharedContext(std::unique_ptr<const Caps> caps,BackendApi backend)20SharedContext::SharedContext(std::unique_ptr<const Caps> caps, BackendApi backend) 21 : fCaps(std::move(caps)) 22 , fBackend(backend) 23 , fProtected(Protected::kNo) 24 , fGlobalCache() 25 , fShaderDictionary() {} 26 ~SharedContext()27SharedContext::~SharedContext() { 28 // TODO: add disconnect? 29 30 // TODO: destroyResources instead? 31 } 32 setRendererProvider(std::unique_ptr<RendererProvider> rendererProvider)33void SharedContext::setRendererProvider(std::unique_ptr<RendererProvider> rendererProvider) { 34 // Should only be called once and be non-null 35 SkASSERT(rendererProvider && !fRendererProvider); 36 fRendererProvider = std::move(rendererProvider); 37 } 38 39 } // namespace skgpu::graphite 40