Deprecate a bunch of old stuff in GlCalculatorHelper

PiperOrigin-RevId: 488813296
This commit is contained in:
Camillo Lugaresi 2022-11-15 18:35:04 -08:00 committed by Copybara-Service
parent 1979801a92
commit 63e2089639
2 changed files with 8 additions and 0 deletions

View File

@ -784,6 +784,7 @@ cc_library(
":shader_util", ":shader_util",
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//mediapipe/framework:calculator_cc_proto", "//mediapipe/framework:calculator_cc_proto",
"@com_google_absl//absl/base:core_headers",
"//mediapipe/framework:calculator_context", "//mediapipe/framework:calculator_context",
"//mediapipe/framework:calculator_node", "//mediapipe/framework:calculator_node",
"//mediapipe/framework:calculator_contract", "//mediapipe/framework:calculator_contract",

View File

@ -17,6 +17,7 @@
#include <memory> #include <memory>
#include "absl/base/attributes.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "mediapipe/framework/calculator_context.h" #include "mediapipe/framework/calculator_context.h"
#include "mediapipe/framework/calculator_contract.h" #include "mediapipe/framework/calculator_contract.h"
@ -61,6 +62,7 @@ class GlCalculatorHelper {
// Can be used to initialize the helper outside of a calculator. Useful for // Can be used to initialize the helper outside of a calculator. Useful for
// testing. // testing.
void InitializeForTest(GpuResources* gpu_resources); void InitializeForTest(GpuResources* gpu_resources);
ABSL_DEPRECATED("Use InitializeForTest(GpuResources)")
void InitializeForTest(GpuSharedData* gpu_shared); void InitializeForTest(GpuSharedData* gpu_shared);
// This method can be called from GetContract to set up the needed GPU // This method can be called from GetContract to set up the needed GPU
@ -69,6 +71,7 @@ class GlCalculatorHelper {
// This method can be called from FillExpectations to set the correct types // This method can be called from FillExpectations to set the correct types
// for the shared GL input side packet(s). // for the shared GL input side packet(s).
ABSL_DEPRECATED("Use UpdateContract")
static absl::Status SetupInputSidePackets(PacketTypeSet* input_side_packets); static absl::Status SetupInputSidePackets(PacketTypeSet* input_side_packets);
// Execute the provided function within the helper's GL context. On some // Execute the provided function within the helper's GL context. On some
@ -235,12 +238,14 @@ class GlTexture {
// it is better to keep const-safety and accept having two versions of the // it is better to keep const-safety and accept having two versions of the
// same thing. // same thing.
template <typename T> template <typename T>
ABSL_DEPRECATED("Only for legacy calculators")
auto TagOrIndex(const T& collection, const std::string& tag, int index) auto TagOrIndex(const T& collection, const std::string& tag, int index)
-> decltype(collection.Tag(tag)) { -> decltype(collection.Tag(tag)) {
return collection.UsesTags() ? collection.Tag(tag) : collection.Index(index); return collection.UsesTags() ? collection.Tag(tag) : collection.Index(index);
} }
template <typename T> template <typename T>
ABSL_DEPRECATED("Only for legacy calculators")
auto TagOrIndex(T* collection, const std::string& tag, int index) auto TagOrIndex(T* collection, const std::string& tag, int index)
-> decltype(collection->Tag(tag)) { -> decltype(collection->Tag(tag)) {
return collection->UsesTags() ? collection->Tag(tag) return collection->UsesTags() ? collection->Tag(tag)
@ -248,12 +253,14 @@ auto TagOrIndex(T* collection, const std::string& tag, int index)
} }
template <typename T> template <typename T>
ABSL_DEPRECATED("Only for legacy calculators")
bool HasTagOrIndex(const T& collection, const std::string& tag, int index) { bool HasTagOrIndex(const T& collection, const std::string& tag, int index) {
return collection.UsesTags() ? collection.HasTag(tag) return collection.UsesTags() ? collection.HasTag(tag)
: index < collection.NumEntries(); : index < collection.NumEntries();
} }
template <typename T> template <typename T>
ABSL_DEPRECATED("Only for legacy calculators")
bool HasTagOrIndex(T* collection, const std::string& tag, int index) { bool HasTagOrIndex(T* collection, const std::string& tag, int index) {
return collection->UsesTags() ? collection->HasTag(tag) return collection->UsesTags() ? collection->HasTag(tag)
: index < collection->NumEntries(); : index < collection->NumEntries();