From 63f4d2799fa47901ba0adc2c8ef482d830f125cb Mon Sep 17 00:00:00 2001 From: Sean Curtis Date: Wed, 26 Jun 2024 13:15:38 -0700 Subject: [PATCH] [workspace] Upgrade tinygltf to latest release v2.8.23 (#21569) --- .../patches/function_pointer.patch | 77 ------------------- .../tinygltf_internal/repository.bzl | 5 +- 2 files changed, 2 insertions(+), 80 deletions(-) delete mode 100644 tools/workspace/tinygltf_internal/patches/function_pointer.patch diff --git a/tools/workspace/tinygltf_internal/patches/function_pointer.patch b/tools/workspace/tinygltf_internal/patches/function_pointer.patch deleted file mode 100644 index 5a047df6d572..000000000000 --- a/tools/workspace/tinygltf_internal/patches/function_pointer.patch +++ /dev/null @@ -1,77 +0,0 @@ -Replaces the typedef of a function pointer (for the image loading callback) -with the equivalent std::function alias. - -This doesn't bind *all* function pointer typedefs, just the ones that Drake -cares about right now. We've submitted a PR to tinygltf upgrading all such -callbacks and can eliminate this patch when our upstream version adopts it and -releases a new version. See https://github.com/syoyo/tinygltf/pull/489. - ---- tiny_gltf.h -+++ tiny_gltf.h -@@ -43,6 +43,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -1292,10 +1293,9 @@ struct URICallbacks { - /// - /// LoadImageDataFunction type. Signature for custom image loading callbacks. - /// --typedef bool (*LoadImageDataFunction)(Image *, const int, std::string *, -- std::string *, int, int, -- const unsigned char *, int, -- void *user_pointer); -+using LoadImageDataFunction = -+ std::function; - - /// - /// WriteImageDataFunction type. Signature for custom image writing callbacks. -@@ -4218,7 +4218,7 @@ static bool ParseImage(Image *image, const int image_idx, std::string *err, - bool store_original_json_for_extras_and_extensions, - const std::string &basedir, const size_t max_file_size, - FsCallbacks *fs, const URICallbacks *uri_cb, -- LoadImageDataFunction *LoadImageData = nullptr, -+ LoadImageDataFunction LoadImageData = nullptr, - void *load_image_user_data = nullptr) { - // A glTF image must either reference a bufferView or an image uri - -@@ -4349,14 +4349,14 @@ static bool ParseImage(Image *image, const int image_idx, std::string *err, - #endif - } - -- if (*LoadImageData == nullptr) { -+ if (LoadImageData == nullptr) { - if (err) { - (*err) += "No LoadImageData callback specified.\n"; - } - return false; - } -- return (*LoadImageData)(image, image_idx, err, warn, 0, 0, &img.at(0), -- static_cast(img.size()), load_image_user_data); -+ return LoadImageData(image, image_idx, err, warn, 0, 0, &img.at(0), -+ static_cast(img.size()), load_image_user_data); - } - - static bool ParseTexture(Texture *texture, std::string *err, -@@ -6307,7 +6307,7 @@ bool TinyGLTF::LoadFromString(Model *model, std::string *err, std::string *warn, - if (!ParseImage(&image, idx, err, warn, o, - store_original_json_for_extras_and_extensions_, base_dir, - max_external_file_size_, &fs, &uri_cb, -- &this->LoadImageData, load_image_user_data)) { -+ this->LoadImageData, load_image_user_data)) { - return false; - } - -@@ -6336,7 +6336,7 @@ bool TinyGLTF::LoadFromString(Model *model, std::string *err, std::string *warn, - } - const Buffer &buffer = model->buffers[size_t(bufferView.buffer)]; - -- if (*LoadImageData == nullptr) { -+ if (LoadImageData == nullptr) { - if (err) { - (*err) += "No LoadImageData callback specified.\n"; - } diff --git a/tools/workspace/tinygltf_internal/repository.bzl b/tools/workspace/tinygltf_internal/repository.bzl index ecddcd440cde..6d8d0fe6ff7c 100644 --- a/tools/workspace/tinygltf_internal/repository.bzl +++ b/tools/workspace/tinygltf_internal/repository.bzl @@ -6,11 +6,10 @@ def tinygltf_internal_repository( github_archive( name = name, repository = "syoyo/tinygltf", - commit = "v2.8.22", - sha256 = "97c3eb1080c1657cd749d0b49af189c6a867d5af30689c48d5e19521e7b5a070", # noqa + commit = "v2.8.23", + sha256 = "e6dbbb0952cdefa1d9c87a99b686d1e67755fd9b0a5872b4008d042159e77de5", # noqa build_file = ":package.BUILD.bazel", patches = [ - ":patches/function_pointer.patch", ":patches/json.patch", ], mirrors = mirrors,