Project import generated by Copybara.

GitOrigin-RevId: 612e50bb8db2ec3dc1c30049372d87a80c3848db
This commit is contained in:
MediaPipe Team
2020-08-30 19:52:55 -04:00
committed by chuoling
parent a7225b938a
commit c0124fb83c
248 changed files with 5225 additions and 1914 deletions
+13 -1
View File
@@ -50,6 +50,11 @@ class GlTextureBuffer {
GLenum target, GLuint name, int width, int height, GpuBufferFormat format,
DeletionCallback deletion_callback);
// Same as Wrap above, but saves the given context for future use.
static std::unique_ptr<GlTextureBuffer> Wrap(
GLenum target, GLuint name, int width, int height, GpuBufferFormat format,
std::shared_ptr<GlContext> context, DeletionCallback deletion_callback);
// Creates a texture of dimensions width x height and allocates space for it.
// If data is provided, it is uploaded to the texture; otherwise, it can be
// provided later via glTexSubImage2D.
@@ -63,7 +68,8 @@ class GlTextureBuffer {
// The commands producing the texture are assumed to be completed at the
// time of this call. If not, call Updated on the result.
GlTextureBuffer(GLenum target, GLuint name, int width, int height,
GpuBufferFormat format, DeletionCallback deletion_callback);
GpuBufferFormat format, DeletionCallback deletion_callback,
std::shared_ptr<GlContext> producer_context = nullptr);
~GlTextureBuffer();
// Included to support nativeGetGpuBuffer* in Java.
@@ -111,6 +117,11 @@ class GlTextureBuffer {
void WaitForConsumers();
void WaitForConsumersOnGpu();
// Returns the GL context this buffer was created with.
const std::shared_ptr<GlContext>& GetProducerContext() {
return producer_context_;
}
private:
// Creates a texture of dimensions width x height and allocates space for it.
// If data is provided, it is uploaded to the texture; otherwise, it can be
@@ -132,6 +143,7 @@ class GlTextureBuffer {
std::unique_ptr<GlMultiSyncPoint> consumer_multi_sync_ ABSL_GUARDED_BY(
consumer_sync_mutex_) = absl::make_unique<GlMultiSyncPoint>();
DeletionCallback deletion_callback_;
std::shared_ptr<GlContext> producer_context_;
};
using GlTextureBufferSharedPtr = std::shared_ptr<GlTextureBuffer>;