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 , fGlobalCache() 24 , fShaderDictionary() {} 25 ~SharedContext()26SharedContext::~SharedContext() { 27 // TODO: add disconnect? 28 29 // TODO: destroyResources instead? 30 } 31 isProtected() const32Protected SharedContext::isProtected() const { return Protected(fCaps->protectedSupport()); } 33 setRendererProvider(std::unique_ptr<RendererProvider> rendererProvider)34void SharedContext::setRendererProvider(std::unique_ptr<RendererProvider> rendererProvider) { 35 // Should only be called once and be non-null 36 SkASSERT(rendererProvider && !fRendererProvider); 37 fRendererProvider = std::move(rendererProvider); 38 } 39 40 } // namespace skgpu::graphite 41