9ad1f92e2f
GrExternalTextureData is an API for exporting the backend-specific information about a texture in a type-safe way, and without pointing into the GrTexture. The new detachBackendTexture API lets us release ownership of a texture to the client. SkCrossContextImageData is the public API that lets clients upload textures on one thread/GrContext, then safely transfer ownership to another thread and GrContext for rendering. Only GL is implemented/supported right now. Vulkan support requires that we add thread-safe memory pools, or otherwise transfer the actual memory block containing the texture to the new context. BUG=skia: Change-Id: I784a3a74be69807df038c7d192eaed002c7e45ca Reviewed-on: https://skia-review.googlesource.com/8529 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
31 lines
670 B
C++
31 lines
670 B
C++
/*
|
|
* Copyright 2017 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
|
|
#ifndef GrExternalTextureData_DEFINED
|
|
#define GrExternalTextureData_DEFINED
|
|
|
|
#include "GrTypes.h"
|
|
#include "GrTypesPriv.h"
|
|
|
|
class SK_API GrExternalTextureData : SkNoncopyable {
|
|
public:
|
|
GrExternalTextureData(GrFence fence) : fFence(fence) {}
|
|
virtual ~GrExternalTextureData() {}
|
|
virtual GrBackend getBackend() const = 0;
|
|
GrFence getFence() const { return fFence; }
|
|
|
|
protected:
|
|
virtual GrBackendObject getBackendObject() const = 0;
|
|
|
|
GrFence fFence;
|
|
|
|
friend class SkCrossContextImageData;
|
|
};
|
|
|
|
#endif
|