Line data Source code
1 : /*
2 : * Copyright 2017 Google Inc.
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 "GrContext.h"
9 : #include "GrContextPriv.h"
10 : #include "GrGpu.h"
11 : #include "GrResourceProvider.h"
12 : #include "GrSemaphore.h"
13 : #include "gl/GrGLTypes.h"
14 :
15 0 : GrGLExternalTextureData::GrGLExternalTextureData(const GrGLTextureInfo& info,
16 : sk_sp<GrSemaphore> semaphore,
17 0 : GrContext* context)
18 : : fInfo(info)
19 0 : , fSemaphore(std::move(semaphore)) {
20 0 : SkASSERT(fSemaphore->unique());
21 0 : context->resourceProvider()->releaseOwnershipOfSemaphore(fSemaphore);
22 0 : }
23 :
24 0 : void GrGLExternalTextureData::attachToContext(GrContext* context) {
25 0 : context->resourceProvider()->takeOwnershipOfSemaphore(fSemaphore);
26 : // Ideally we don't want to get the Gpu off of the context here. However, eventually this
27 : // semaphore will live on a GrTexture object and the wait will be called from there. At that
28 : // point we can use the GrGpu already stored directly on the GrTexture.
29 0 : context->getGpu()->waitSemaphore(fSemaphore);
30 0 : }
|