Commit Graph
130 Commits
Author SHA1 Message Date
MediaPipe TeamandCopybara-Service c895867427 Expose FrameBuffer view on GpuBufferStorageYuvImage.
PiperOrigin-RevId: 516546716
2023-03-14 09:30:25 -07:00
Sebastian SchmidtandCopybara-Service db779ba78f Use drishti_proto_library for libraries in mediapipe/gpu
PiperOrigin-RevId: 515708036
2023-03-10 12:27:06 -08:00
Sebastian SchmidtandCopybara-Service ef4a8cde42 Solve iOS build error for gpu_buffer.cc
PiperOrigin-RevId: 515473643
2023-03-09 16:28:58 -08:00
MediaPipe TeamandCopybara-Service c2a69ab476 Update ImageFrameToGpuBufferCalculator to use api2 and GpuBuffer conversions
PiperOrigin-RevId: 515407159
2023-03-09 12:21:00 -08:00
Sebastian SchmidtandCopybara-Service 09f63cbbe0 Internal change
PiperOrigin-RevId: 515094293
2023-03-08 11:33:38 -08:00
MediaPipe TeamandCopybara-Service 6c68d4c358 Internal change
PiperOrigin-RevId: 514421618
2023-03-06 08:42:19 -08:00
MediaPipe TeamandCopybara-Service 96b2958f18 Add ViewProvider for ImageFrame in GpuBufferStorageYuvImage.
PiperOrigin-RevId: 514344066
2023-03-06 07:53:02 -08:00
MediaPipe TeamandCopybara-Service c71f78c38f Internal change
PiperOrigin-RevId: 513607664
2023-03-02 12:24:51 -08:00
Sebastian SchmidtandCopybara-Service c2260e8877 Use mediapipe_proto_library for gl_context_options_proto
PiperOrigin-RevId: 509601125
2023-02-14 12:13:01 -08:00
MediaPipe TeamandCopybara-Service 386445c8dd Add ViewProvider<FrameBuffer> to YuvImage storage backend.
PiperOrigin-RevId: 506881556
2023-02-03 05:58:29 -08:00
MediaPipe TeamandCopybara-Service 1df4511e9d Add YuvImage as a GpuBuffer storage backend.
PiperOrigin-RevId: 505128789
2023-01-27 08:51:31 -08:00
Sebastian SchmidtandCopybara-Service ce9fec806c Internal change
PiperOrigin-RevId: 504341886
2023-01-24 12:18:15 -08:00
MediaPipe TeamandCopybara-Service 1683d572ed Internal change
PiperOrigin-RevId: 501600938
2023-01-12 10:22:00 -08:00
MediaPipe TeamandCopybara-Service 704964be33 Fix accidental suppressions of GLSL linker error reporting
PiperOrigin-RevId: 500802177
2023-01-09 14:05:47 -08:00
Camillo LugaresiandCopybara-Service 2f4bb5d545 Use utility framebuffer in ViewDoneWritingSimulatorWorkaround
This code needs a FBO to bind the texture.

Fixes invalid results when running under simulator.

PiperOrigin-RevId: 499241867
2023-01-03 09:38:19 -08:00
MediaPipe TeamandCopybara-Service 64406a9bf2 Internal change
PiperOrigin-RevId: 496781536
2022-12-20 16:41:49 -08:00
MediaPipe TeamandCopybara-Service 8c013647c8 Internal change
PiperOrigin-RevId: 496629682
2022-12-20 04:49:15 -08:00
MediaPipe TeamandCopybara-Service 4682416f0f Internal change
PiperOrigin-RevId: 496568835
2022-12-19 22:10:15 -08:00
Camillo LugaresiandCopybara-Service 523d16dffa Make GpuBuffer a shared_ptr to a storage collection
PiperOrigin-RevId: 493519590
2022-12-06 23:56:19 -08:00
Sebastian SchmidtandCopybara-Service fca0f5806b Create Build Rules for Apple Frameworks
PiperOrigin-RevId: 493426040
2022-12-06 15:18:45 -08:00
Camillo LugaresiandCopybara-Service b0b38a0013 Internal change
PiperOrigin-RevId: 493313240
2022-12-06 08:31:46 -08:00
Camillo LugaresiandCopybara-Service 40eb0e6385 Internal change
PiperOrigin-RevId: 492276913
2022-12-01 12:59:41 -08:00
Camillo LugaresiandCopybara-Service fcd2d2c5af Internal change
PiperOrigin-RevId: 491733850
2022-11-29 14:14:37 -08:00
Camillo LugaresiandCopybara-Service cc11b45228 Remove unneeded GPU_SHARED side packet for GlSurfaceSink
PiperOrigin-RevId: 491487092
2022-11-28 17:55:30 -08:00
Camillo LugaresiandCopybara-Service fc526374ab Use GpuResources in GpuTestBase and update GpuBufferMultiPoolTest
PiperOrigin-RevId: 491486495
2022-11-28 17:51:03 -08:00
Camillo LugaresiandCopybara-Service 0bdb48ceb1 Use kUtilityFramebuffer in GlCalculatorHelper
All calculators using the same context can share a single framebuffer object.

PiperOrigin-RevId: 490605074
2022-11-23 16:19:31 -08:00
Camillo LugaresiandCopybara-Service 54d1744c8f Remove DrishtiGraphGPUData, add MetalSharedResources
This class is unused except by the Metal helper; let's narrow it down and simplify gpu_shared_data.

PiperOrigin-RevId: 490531767
2022-11-23 10:15:17 -08:00
Camillo LugaresiandCopybara-Service 3c53ec2cdb Do not expose DrishtiGraphGPUData.h in public header
This class is an implementation detail.

PiperOrigin-RevId: 490530823
2022-11-23 10:11:32 -08:00
Camillo LugaresiandCopybara-Service a55839de51 This storage only needs a "done writing" callback on simulator, so only set it there
- When not on simulator, we pass nullptr instead of a do-nothing callback.
- The callback is no longer a method, but a function. Only the CVPixelBuffer is captured.

PiperOrigin-RevId: 490380248
2022-11-22 18:09:09 -08:00
Camillo LugaresiandCopybara-Service 8ba9d87e66 Update ImageFrameToGpuBufferCalculator to use api2 and GpuBuffer conversions
PiperOrigin-RevId: 490374387
2022-11-22 17:32:33 -08:00
Camillo LugaresiandCopybara-Service efa9e737f8 Use current context if available in ConvertToImageFrame
If we're already running in a GlContext, there's no need to go back to the producer context, which may be different.

PiperOrigin-RevId: 490373829
2022-11-22 17:24:03 -08:00
Camillo LugaresiandCopybara-Service d648926155 Just reset the fb binding to 0 in ReadTexture
This saves a get operation. We already have precedent in lots of other MediaPipe code where we just reset bindings to 0.

PiperOrigin-RevId: 490170691
2022-11-22 00:36:54 -08:00
Camillo LugaresiandCopybara-Service bacbac8d92 Use kUtilityFramebuffer in ReadTexture
This avoids creating a temporary framebuffer each time.

PiperOrigin-RevId: 490163892
2022-11-21 23:59:44 -08:00
Camillo LugaresiandCopybara-Service a8b7761022 Define a kUtilityFramebuffer context attachment
A framebuffer object is often needed to render to a texture or read data from it. Currently we create one in each GlCalculatorHelper, but that is redundant (we only need one per context, and multiple calculators can share the same context). Other times, the code that needs to use this doesn't own a helper. For both reasons, this should be attached to the context.

We could just make this a member of GlContext since it's so common. However, I figured we might as well use the attachment system.

PiperOrigin-RevId: 490160214
2022-11-21 23:29:27 -08:00
Camillo LugaresiandCopybara-Service 54a684717f Internal change
PiperOrigin-RevId: 490159674
2022-11-21 23:24:16 -08:00
Camillo LugaresiandCopybara-Service eb8ef1ace0 Use shared_from_this in GlTextureBuffer::GetReadView, GetWriteView
This ensures that the callbacks in GlTextureView won't call an expired object, even if user code holds a GlTextureView after releasing the buffer.

Note that GlTextureBuffer is not always held by a shared_ptr, but it always is when GpuBuffer calls GetRead/WriteView on it. An alternative solution would have been to have GpuBuffer pass its shared_ptr<GlTextureBuffer> to the view method, which could have been implemented with some compile-time logic to detect whether the method expects such an argument. However, that doesn't seem necessary.

PiperOrigin-RevId: 489611843
2022-11-18 19:42:34 -08:00
Adam CozzetteandCopybara-Service ac212c1507 Internal change
PiperOrigin-RevId: 489502255
2022-11-18 10:08:26 -08:00
Camillo LugaresiandCopybara-Service efcdedbd59 Remove redundant _ios targets
PiperOrigin-RevId: 489355333
2022-11-17 18:16:58 -08:00
MediaPipe TeamandCopybara-Service a7bd725e65 Internal change
PiperOrigin-RevId: 489331826
2022-11-17 16:09:15 -08:00
Camillo LugaresiandCopybara-Service 6fc277ee1c Internal change
PiperOrigin-RevId: 489091534
2022-11-16 18:38:03 -08:00
Camillo LugaresiandCopybara-Service febfc2029b Annotate plane argument
PiperOrigin-RevId: 488813363
2022-11-15 18:53:09 -08:00
Camillo LugaresiandCopybara-Service 63e2089639 Deprecate a bunch of old stuff in GlCalculatorHelper
PiperOrigin-RevId: 488813296
2022-11-15 18:51:56 -08:00
Camillo LugaresiandCopybara-Service 1979801a92 Remove GlCalculatorHelperImpl; merge with GlCalculatorHelper
Originally, there were multiple implementations of GlCalculatorHelperImpl, depending on the platform and underlying GL APIs. These have all been refactored into other components, and the remaining code in this class is unified and much reduced in size. We can get rid of this implementation detail now.

PiperOrigin-RevId: 488813220
2022-11-15 18:50:45 -08:00
Camillo LugaresiandCopybara-Service 8b319e963a Add comment explaining ViewProvider
This was only documented via examples (e.g. ViewProvider<GlTextureView>), but it's better to explain it properly in the header where the base case is defined.

PiperOrigin-RevId: 488813144
2022-11-15 18:48:54 -08:00
Camillo LugaresiandCopybara-Service a28ccb0964 Remove unnecessary forward declarations
PiperOrigin-RevId: 488813066
2022-11-15 18:43:36 -08:00
Camillo LugaresiandCopybara-Service 13b4b825d7 Remove std::shared_ptr<GpuBuffer> argument from GetRead/WriteView
PiperOrigin-RevId: 488813004
2022-11-15 18:41:53 -08:00
Camillo LugaresiandCopybara-Service 1c0a1d0aab Remove shared_ptr<GpuBuffer> member from GlTextureView
This only exists to support GlTexture's GetFrame API. It can be moved into GlTexture.

PiperOrigin-RevId: 488812896
2022-11-15 18:40:15 -08:00
Camillo LugaresiandCopybara-Service 767cc2ee3c More comments on gpu_buffer_storage
This gives a basic explanation of the role of storages and views, and provides some details on how to implement a new storage type.

PiperOrigin-RevId: 488812807
2022-11-15 18:38:29 -08:00
Camillo LugaresiandCopybara-Service 4c874fe4cd Allow conversion of GlTextureBuffer to CVPixelBufferRef
This means that, if an iOS application sends in a GlTextureBuffer but expects a CVPixelBufferRef as output, everything will work even if the graph just forwards the same input. Also, access by Metal calculators will also work transparently.

PiperOrigin-RevId: 488812748
2022-11-15 18:36:45 -08:00
Camillo LugaresiandCopybara-Service fe66de3714 Internal change
PiperOrigin-RevId: 488812677
2022-11-15 18:32:54 -08:00