summaryrefslogtreecommitdiffstats
path: root/thirdparty
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty')
-rw-r--r--thirdparty/README.md4
-rw-r--r--thirdparty/amd-fsr2/shaders/ffx_fsr2_depth_clip_pass.glsl1
-rw-r--r--thirdparty/openxr/COPYING.adoc2
-rw-r--r--thirdparty/openxr/include/openxr/openxr.h439
-rw-r--r--thirdparty/openxr/include/openxr/openxr_loader_negotiation.h140
-rw-r--r--thirdparty/openxr/include/openxr/openxr_platform.h6
-rw-r--r--thirdparty/openxr/include/openxr/openxr_platform_defines.h2
-rw-r--r--thirdparty/openxr/include/openxr/openxr_reflection.h341
-rw-r--r--thirdparty/openxr/include/openxr/openxr_reflection_parent_structs.h3
-rw-r--r--thirdparty/openxr/include/openxr/openxr_reflection_structs.h18
-rw-r--r--thirdparty/openxr/src/common/extra_algorithms.h4
-rw-r--r--thirdparty/openxr/src/common/filesystem_utils.cpp2
-rw-r--r--thirdparty/openxr/src/common/filesystem_utils.hpp2
-rw-r--r--thirdparty/openxr/src/common/hex_and_handles.h4
-rw-r--r--thirdparty/openxr/src/common/loader_interfaces.h114
-rw-r--r--thirdparty/openxr/src/common/object_info.cpp4
-rw-r--r--thirdparty/openxr/src/common/object_info.h4
-rw-r--r--thirdparty/openxr/src/common/platform_utils.hpp2
-rw-r--r--thirdparty/openxr/src/common/stdfs_conditions.h2
-rw-r--r--thirdparty/openxr/src/common/unique_asset.h2
-rw-r--r--thirdparty/openxr/src/common/vulkan_debug_object_namer.hpp2
-rw-r--r--thirdparty/openxr/src/common/xr_dependencies.h2
-rw-r--r--thirdparty/openxr/src/common/xr_linear.h2
-rw-r--r--thirdparty/openxr/src/loader/android_utilities.cpp32
-rw-r--r--thirdparty/openxr/src/loader/android_utilities.h4
-rw-r--r--thirdparty/openxr/src/loader/api_layer_interface.cpp69
-rw-r--r--thirdparty/openxr/src/loader/api_layer_interface.hpp4
-rw-r--r--thirdparty/openxr/src/loader/exception_handling.hpp4
-rw-r--r--thirdparty/openxr/src/loader/loader_core.cpp5
-rw-r--r--thirdparty/openxr/src/loader/loader_init_data.cpp59
-rw-r--r--thirdparty/openxr/src/loader/loader_init_data.hpp92
-rw-r--r--thirdparty/openxr/src/loader/loader_instance.cpp6
-rw-r--r--thirdparty/openxr/src/loader/loader_instance.hpp4
-rw-r--r--thirdparty/openxr/src/loader/loader_logger.cpp2
-rw-r--r--thirdparty/openxr/src/loader/loader_logger.hpp2
-rw-r--r--thirdparty/openxr/src/loader/loader_logger_recorders.cpp2
-rw-r--r--thirdparty/openxr/src/loader/loader_logger_recorders.hpp4
-rw-r--r--thirdparty/openxr/src/loader/loader_platform.hpp2
-rw-r--r--thirdparty/openxr/src/loader/manifest_file.cpp7
-rw-r--r--thirdparty/openxr/src/loader/manifest_file.hpp2
-rw-r--r--thirdparty/openxr/src/loader/runtime_interface.cpp117
-rw-r--r--thirdparty/openxr/src/loader/runtime_interface.hpp14
-rw-r--r--thirdparty/openxr/src/loader/xr_generated_loader.cpp4
-rw-r--r--thirdparty/openxr/src/loader/xr_generated_loader.hpp7
-rw-r--r--thirdparty/openxr/src/xr_generated_dispatch_table_core.c4
-rw-r--r--thirdparty/openxr/src/xr_generated_dispatch_table_core.h4
-rw-r--r--thirdparty/thorvg/AUTHORS2
-rw-r--r--thirdparty/thorvg/LICENSE2
-rw-r--r--thirdparty/thorvg/inc/config.h2
-rw-r--r--thirdparty/thorvg/inc/thorvg.h355
-rw-r--r--thirdparty/thorvg/src/common/tvgArray.h7
-rw-r--r--thirdparty/thorvg/src/common/tvgBezier.cpp2
-rw-r--r--thirdparty/thorvg/src/common/tvgBezier.h2
-rw-r--r--thirdparty/thorvg/src/common/tvgCompressor.cpp2
-rw-r--r--thirdparty/thorvg/src/common/tvgCompressor.h2
-rw-r--r--thirdparty/thorvg/src/common/tvgInlist.h111
-rw-r--r--thirdparty/thorvg/src/common/tvgList.h90
-rw-r--r--thirdparty/thorvg/src/common/tvgMath.cpp2
-rw-r--r--thirdparty/thorvg/src/common/tvgMath.h14
-rw-r--r--thirdparty/thorvg/src/common/tvgStr.cpp2
-rw-r--r--thirdparty/thorvg/src/common/tvgStr.h2
-rw-r--r--thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.cpp62
-rw-r--r--thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.h12
-rw-r--r--thirdparty/thorvg/src/loaders/jpg/tvgJpgLoader.cpp67
-rw-r--r--thirdparty/thorvg/src/loaders/jpg/tvgJpgLoader.h12
-rw-r--r--thirdparty/thorvg/src/loaders/jpg/tvgJpgd.cpp2
-rw-r--r--thirdparty/thorvg/src/loaders/jpg/tvgJpgd.h2
-rw-r--r--thirdparty/thorvg/src/loaders/png/tvgLodePng.cpp2
-rw-r--r--thirdparty/thorvg/src/loaders/png/tvgLodePng.h2
-rw-r--r--thirdparty/thorvg/src/loaders/png/tvgPngLoader.cpp91
-rw-r--r--thirdparty/thorvg/src/loaders/png/tvgPngLoader.h12
-rw-r--r--thirdparty/thorvg/src/loaders/raw/tvgRawLoader.cpp55
-rw-r--r--thirdparty/thorvg/src/loaders/raw/tvgRawLoader.h11
-rw-r--r--thirdparty/thorvg/src/loaders/svg/tvgSvgCssStyle.cpp2
-rw-r--r--thirdparty/thorvg/src/loaders/svg/tvgSvgCssStyle.h2
-rw-r--r--thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp24
-rw-r--r--thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.h9
-rw-r--r--thirdparty/thorvg/src/loaders/svg/tvgSvgLoaderCommon.h2
-rw-r--r--thirdparty/thorvg/src/loaders/svg/tvgSvgPath.cpp10
-rw-r--r--thirdparty/thorvg/src/loaders/svg/tvgSvgPath.h4
-rw-r--r--thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.cpp16
-rw-r--r--thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.h4
-rw-r--r--thirdparty/thorvg/src/loaders/svg/tvgSvgUtil.cpp2
-rw-r--r--thirdparty/thorvg/src/loaders/svg/tvgSvgUtil.h2
-rw-r--r--thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp2
-rw-r--r--thirdparty/thorvg/src/loaders/svg/tvgXmlParser.h2
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwCommon.h17
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwFill.cpp3
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwImage.cpp2
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp2
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwMemPool.cpp2
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwRaster.cpp13
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterAvx.h2
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterC.h2
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterNeon.h2
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterTexmap.h2
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwRenderer.cpp19
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwRenderer.h2
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwRle.cpp2
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwShape.cpp2
-rw-r--r--thirdparty/thorvg/src/renderer/sw_engine/tvgSwStroke.cpp2
-rw-r--r--thirdparty/thorvg/src/renderer/tvgAccessor.cpp2
-rw-r--r--thirdparty/thorvg/src/renderer/tvgAnimation.cpp10
-rw-r--r--thirdparty/thorvg/src/renderer/tvgBinaryDesc.h4
-rw-r--r--thirdparty/thorvg/src/renderer/tvgCanvas.cpp2
-rw-r--r--thirdparty/thorvg/src/renderer/tvgCanvas.h11
-rw-r--r--thirdparty/thorvg/src/renderer/tvgCommon.h5
-rw-r--r--thirdparty/thorvg/src/renderer/tvgFill.cpp2
-rw-r--r--thirdparty/thorvg/src/renderer/tvgFill.h2
-rw-r--r--thirdparty/thorvg/src/renderer/tvgFrameModule.h5
-rw-r--r--thirdparty/thorvg/src/renderer/tvgGlCanvas.cpp2
-rw-r--r--thirdparty/thorvg/src/renderer/tvgInitializer.cpp35
-rw-r--r--thirdparty/thorvg/src/renderer/tvgIteratorAccessor.h2
-rw-r--r--thirdparty/thorvg/src/renderer/tvgLoadModule.h74
-rw-r--r--thirdparty/thorvg/src/renderer/tvgLoader.cpp184
-rw-r--r--thirdparty/thorvg/src/renderer/tvgLoader.h11
-rw-r--r--thirdparty/thorvg/src/renderer/tvgPaint.cpp4
-rw-r--r--thirdparty/thorvg/src/renderer/tvgPaint.h2
-rw-r--r--thirdparty/thorvg/src/renderer/tvgPicture.cpp99
-rw-r--r--thirdparty/thorvg/src/renderer/tvgPicture.h124
-rw-r--r--thirdparty/thorvg/src/renderer/tvgRender.cpp2
-rw-r--r--thirdparty/thorvg/src/renderer/tvgRender.h37
-rw-r--r--thirdparty/thorvg/src/renderer/tvgSaveModule.h4
-rw-r--r--thirdparty/thorvg/src/renderer/tvgSaver.cpp18
-rw-r--r--thirdparty/thorvg/src/renderer/tvgScene.cpp2
-rw-r--r--thirdparty/thorvg/src/renderer/tvgScene.h21
-rw-r--r--thirdparty/thorvg/src/renderer/tvgShape.cpp2
-rw-r--r--thirdparty/thorvg/src/renderer/tvgShape.h17
-rw-r--r--thirdparty/thorvg/src/renderer/tvgSwCanvas.cpp2
-rw-r--r--thirdparty/thorvg/src/renderer/tvgTaskScheduler.cpp62
-rw-r--r--thirdparty/thorvg/src/renderer/tvgTaskScheduler.h5
-rw-r--r--thirdparty/thorvg/src/renderer/tvgText.cpp109
-rw-r--r--thirdparty/thorvg/src/renderer/tvgText.h191
-rw-r--r--thirdparty/thorvg/src/renderer/tvgWgCanvas.cpp81
-rwxr-xr-xthirdparty/thorvg/update-thorvg.sh3
135 files changed, 2746 insertions, 1024 deletions
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 510219194b..51ba9f1df4 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -727,7 +727,7 @@ with the provided patch.
## openxr
- Upstream: https://github.com/KhronosGroup/OpenXR-SDK
-- Version: 1.0.31 (95fe35ffb383710a6e0567e958ead9a3b66e930c, 2023)
+- Version: 1.0.33 (dc1e23937fe45eabcce80f6588cf47449edb29d1, 2024)
- License: Apache 2.0
Files extracted from upstream source:
@@ -861,7 +861,7 @@ instead of `miniz.h` as an external dependency.
## thorvg
- Upstream: https://github.com/thorvg/thorvg
-- Version: 0.11.6 (3dba4f12f8f05f86acbc51096ca3a15f5d96bc06, 2023)
+- Version: 0.12.0 (25ea242d3867ed66807714f5a52d080984d3c8cc, 2024)
- License: MIT
Files extracted from upstream source:
diff --git a/thirdparty/amd-fsr2/shaders/ffx_fsr2_depth_clip_pass.glsl b/thirdparty/amd-fsr2/shaders/ffx_fsr2_depth_clip_pass.glsl
index 65cc8b67ef..d989416eb3 100644
--- a/thirdparty/amd-fsr2/shaders/ffx_fsr2_depth_clip_pass.glsl
+++ b/thirdparty/amd-fsr2/shaders/ffx_fsr2_depth_clip_pass.glsl
@@ -29,7 +29,6 @@
#define FSR2_BIND_SRV_DILATED_DEPTH 2
#define FSR2_BIND_SRV_REACTIVE_MASK 3
#define FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK 4
-#define FSR2_BIND_SRV_PREPARED_INPUT_COLOR 5
#define FSR2_BIND_SRV_PREVIOUS_DILATED_MOTION_VECTORS 6
#define FSR2_BIND_SRV_INPUT_MOTION_VECTORS 7
#define FSR2_BIND_SRV_INPUT_COLOR 8
diff --git a/thirdparty/openxr/COPYING.adoc b/thirdparty/openxr/COPYING.adoc
index 473e7fdc5d..18c85fa6c7 100644
--- a/thirdparty/openxr/COPYING.adoc
+++ b/thirdparty/openxr/COPYING.adoc
@@ -1,6 +1,6 @@
= COPYING.adoc for the Khronos Group OpenXR projects
-// Copyright (c) 2020-2023, The Khronos Group Inc.
+// Copyright (c) 2020-2024, The Khronos Group Inc.
//
// SPDX-License-Identifier: CC-BY-4.0
diff --git a/thirdparty/openxr/include/openxr/openxr.h b/thirdparty/openxr/include/openxr/openxr.h
index 9ba17cbe06..3e9d6599bb 100644
--- a/thirdparty/openxr/include/openxr/openxr.h
+++ b/thirdparty/openxr/include/openxr/openxr.h
@@ -2,7 +2,7 @@
#define OPENXR_H_ 1
/*
-** Copyright 2017-2023 The Khronos Group Inc.
+** Copyright 2017-2024, The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0 OR MIT
*/
@@ -25,7 +25,7 @@ extern "C" {
((((major) & 0xffffULL) << 48) | (((minor) & 0xffffULL) << 32) | ((patch) & 0xffffffffULL))
// OpenXR current version number.
-#define XR_CURRENT_API_VERSION XR_MAKE_VERSION(1, 0, 31)
+#define XR_CURRENT_API_VERSION XR_MAKE_VERSION(1, 0, 33)
#define XR_VERSION_MAJOR(version) (uint16_t)(((uint64_t)(version) >> 48)& 0xffffULL)
#define XR_VERSION_MINOR(version) (uint16_t)(((uint64_t)(version) >> 32) & 0xffffULL)
@@ -218,6 +218,18 @@ typedef enum XrResult {
XR_RENDER_MODEL_UNAVAILABLE_FB = 1000119020,
XR_ERROR_MARKER_NOT_TRACKED_VARJO = -1000124000,
XR_ERROR_MARKER_ID_INVALID_VARJO = -1000124001,
+ XR_ERROR_MARKER_DETECTOR_PERMISSION_DENIED_ML = -1000138000,
+ XR_ERROR_MARKER_DETECTOR_LOCATE_FAILED_ML = -1000138001,
+ XR_ERROR_MARKER_DETECTOR_INVALID_DATA_QUERY_ML = -1000138002,
+ XR_ERROR_MARKER_DETECTOR_INVALID_CREATE_INFO_ML = -1000138003,
+ XR_ERROR_MARKER_INVALID_ML = -1000138004,
+ XR_ERROR_LOCALIZATION_MAP_INCOMPATIBLE_ML = -1000139000,
+ XR_ERROR_LOCALIZATION_MAP_UNAVAILABLE_ML = -1000139001,
+ XR_ERROR_LOCALIZATION_MAP_FAIL_ML = -1000139002,
+ XR_ERROR_LOCALIZATION_MAP_IMPORT_EXPORT_PERMISSION_DENIED_ML = -1000139003,
+ XR_ERROR_LOCALIZATION_MAP_PERMISSION_DENIED_ML = -1000139004,
+ XR_ERROR_LOCALIZATION_MAP_ALREADY_EXISTS_ML = -1000139005,
+ XR_ERROR_LOCALIZATION_MAP_CANNOT_EXPORT_CLOUD_MAP_ML = -1000139006,
XR_ERROR_SPATIAL_ANCHOR_NAME_NOT_FOUND_MSFT = -1000142001,
XR_ERROR_SPATIAL_ANCHOR_NAME_INVALID_MSFT = -1000142002,
XR_SCENE_MARKER_DATA_NOT_STRING_MSFT = 1000147000,
@@ -228,6 +240,7 @@ typedef enum XrResult {
XR_ERROR_SPACE_CLOUD_STORAGE_DISABLED_FB = -1000169004,
XR_ERROR_PASSTHROUGH_COLOR_LUT_BUFFER_SIZE_MISMATCH_META = -1000266000,
XR_ERROR_HINT_ALREADY_SET_QCOM = -1000306000,
+ XR_ERROR_NOT_AN_ANCHOR_HTC = -1000319000,
XR_ERROR_SPACE_NOT_LOCATABLE_EXT = -1000429000,
XR_ERROR_PLANE_DETECTION_PERMISSION_DENIED_EXT = -1000429001,
XR_RESULT_MAX_ENUM = 0x7FFFFFFF
@@ -445,6 +458,20 @@ typedef enum XrStructureType {
XR_TYPE_FRAME_END_INFO_ML = 1000135000,
XR_TYPE_GLOBAL_DIMMER_FRAME_END_INFO_ML = 1000136000,
XR_TYPE_COORDINATE_SPACE_CREATE_INFO_ML = 1000137000,
+ XR_TYPE_SYSTEM_MARKER_UNDERSTANDING_PROPERTIES_ML = 1000138000,
+ XR_TYPE_MARKER_DETECTOR_CREATE_INFO_ML = 1000138001,
+ XR_TYPE_MARKER_DETECTOR_ARUCO_INFO_ML = 1000138002,
+ XR_TYPE_MARKER_DETECTOR_SIZE_INFO_ML = 1000138003,
+ XR_TYPE_MARKER_DETECTOR_APRIL_TAG_INFO_ML = 1000138004,
+ XR_TYPE_MARKER_DETECTOR_CUSTOM_PROFILE_INFO_ML = 1000138005,
+ XR_TYPE_MARKER_DETECTOR_SNAPSHOT_INFO_ML = 1000138006,
+ XR_TYPE_MARKER_DETECTOR_STATE_ML = 1000138007,
+ XR_TYPE_MARKER_SPACE_CREATE_INFO_ML = 1000138008,
+ XR_TYPE_LOCALIZATION_MAP_ML = 1000139000,
+ XR_TYPE_EVENT_DATA_LOCALIZATION_CHANGED_ML = 1000139001,
+ XR_TYPE_MAP_LOCALIZATION_REQUEST_INFO_ML = 1000139002,
+ XR_TYPE_LOCALIZATION_MAP_IMPORT_INFO_ML = 1000139003,
+ XR_TYPE_LOCALIZATION_ENABLE_EVENTS_INFO_ML = 1000139004,
XR_TYPE_EVENT_DATA_HEADSET_FIT_CHANGED_ML = 1000472000,
XR_TYPE_EVENT_DATA_EYE_CALIBRATION_CHANGED_ML = 1000472001,
XR_TYPE_USER_CALIBRATION_ENABLE_EVENTS_INFO_ML = 1000472002,
@@ -534,6 +561,8 @@ typedef enum XrStructureType {
XR_TYPE_FOVEATION_APPLY_INFO_HTC = 1000318000,
XR_TYPE_FOVEATION_DYNAMIC_MODE_INFO_HTC = 1000318001,
XR_TYPE_FOVEATION_CUSTOM_MODE_INFO_HTC = 1000318002,
+ XR_TYPE_SYSTEM_ANCHOR_PROPERTIES_HTC = 1000319000,
+ XR_TYPE_SPATIAL_ANCHOR_CREATE_INFO_HTC = 1000319001,
XR_TYPE_ACTIVE_ACTION_SET_PRIORITIES_EXT = 1000373000,
XR_TYPE_SYSTEM_FORCE_FEEDBACK_CURL_PROPERTIES_MNDX = 1000375000,
XR_TYPE_FORCE_FEEDBACK_CURL_APPLY_LOCATIONS_MNDX = 1000375001,
@@ -580,6 +609,7 @@ typedef enum XrReferenceSpaceType {
XR_REFERENCE_SPACE_TYPE_STAGE = 3,
XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT = 1000038000,
XR_REFERENCE_SPACE_TYPE_COMBINED_EYE_VARJO = 1000121000,
+ XR_REFERENCE_SPACE_TYPE_LOCALIZATION_MAP_ML = 1000139000,
XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT = 1000426000,
XR_REFERENCE_SPACE_TYPE_MAX_ENUM = 0x7FFFFFFF
} XrReferenceSpaceType;
@@ -634,6 +664,8 @@ typedef enum XrObjectType {
XR_OBJECT_TYPE_PASSTHROUGH_FB = 1000118000,
XR_OBJECT_TYPE_PASSTHROUGH_LAYER_FB = 1000118002,
XR_OBJECT_TYPE_GEOMETRY_INSTANCE_FB = 1000118004,
+ XR_OBJECT_TYPE_MARKER_DETECTOR_ML = 1000138000,
+ XR_OBJECT_TYPE_EXPORTED_LOCALIZATION_MAP_ML = 1000139000,
XR_OBJECT_TYPE_SPATIAL_ANCHOR_STORE_CONNECTION_MSFT = 1000142000,
XR_OBJECT_TYPE_FACE_TRACKER_FB = 1000201000,
XR_OBJECT_TYPE_EYE_TRACKER_FB = 1000202000,
@@ -1677,7 +1709,7 @@ typedef struct XrCompositionLayerColorScaleBiasKHR {
#define XR_KHR_loader_init 1
-#define XR_KHR_loader_init_SPEC_VERSION 1
+#define XR_KHR_loader_init_SPEC_VERSION 2
#define XR_KHR_LOADER_INIT_EXTENSION_NAME "XR_KHR_loader_init"
typedef struct XR_MAY_ALIAS XrLoaderInitInfoBaseHeaderKHR {
XrStructureType type;
@@ -4342,6 +4374,360 @@ typedef struct XrGlobalDimmerFrameEndInfoML {
+#define XR_ML_marker_understanding 1
+XR_DEFINE_ATOM(XrMarkerML)
+XR_DEFINE_HANDLE(XrMarkerDetectorML)
+#define XR_ML_marker_understanding_SPEC_VERSION 1
+#define XR_ML_MARKER_UNDERSTANDING_EXTENSION_NAME "XR_ML_marker_understanding"
+
+typedef enum XrMarkerDetectorProfileML {
+ XR_MARKER_DETECTOR_PROFILE_DEFAULT_ML = 0,
+ XR_MARKER_DETECTOR_PROFILE_SPEED_ML = 1,
+ XR_MARKER_DETECTOR_PROFILE_ACCURACY_ML = 2,
+ XR_MARKER_DETECTOR_PROFILE_SMALL_TARGETS_ML = 3,
+ XR_MARKER_DETECTOR_PROFILE_LARGE_FOV_ML = 4,
+ XR_MARKER_DETECTOR_PROFILE_CUSTOM_ML = 5,
+ XR_MARKER_DETECTOR_PROFILE_MAX_ENUM_ML = 0x7FFFFFFF
+} XrMarkerDetectorProfileML;
+
+typedef enum XrMarkerTypeML {
+ XR_MARKER_TYPE_ARUCO_ML = 0,
+ XR_MARKER_TYPE_APRIL_TAG_ML = 1,
+ XR_MARKER_TYPE_QR_ML = 2,
+ XR_MARKER_TYPE_EAN_13_ML = 3,
+ XR_MARKER_TYPE_UPC_A_ML = 4,
+ XR_MARKER_TYPE_CODE_128_ML = 5,
+ XR_MARKER_TYPE_MAX_ENUM_ML = 0x7FFFFFFF
+} XrMarkerTypeML;
+
+typedef enum XrMarkerArucoDictML {
+ XR_MARKER_ARUCO_DICT_4X4_50_ML = 0,
+ XR_MARKER_ARUCO_DICT_4X4_100_ML = 1,
+ XR_MARKER_ARUCO_DICT_4X4_250_ML = 2,
+ XR_MARKER_ARUCO_DICT_4X4_1000_ML = 3,
+ XR_MARKER_ARUCO_DICT_5X5_50_ML = 4,
+ XR_MARKER_ARUCO_DICT_5X5_100_ML = 5,
+ XR_MARKER_ARUCO_DICT_5X5_250_ML = 6,
+ XR_MARKER_ARUCO_DICT_5X5_1000_ML = 7,
+ XR_MARKER_ARUCO_DICT_6X6_50_ML = 8,
+ XR_MARKER_ARUCO_DICT_6X6_100_ML = 9,
+ XR_MARKER_ARUCO_DICT_6X6_250_ML = 10,
+ XR_MARKER_ARUCO_DICT_6X6_1000_ML = 11,
+ XR_MARKER_ARUCO_DICT_7X7_50_ML = 12,
+ XR_MARKER_ARUCO_DICT_7X7_100_ML = 13,
+ XR_MARKER_ARUCO_DICT_7X7_250_ML = 14,
+ XR_MARKER_ARUCO_DICT_7X7_1000_ML = 15,
+ XR_MARKER_ARUCO_DICT_MAX_ENUM_ML = 0x7FFFFFFF
+} XrMarkerArucoDictML;
+
+typedef enum XrMarkerAprilTagDictML {
+ XR_MARKER_APRIL_TAG_DICT_16H5_ML = 0,
+ XR_MARKER_APRIL_TAG_DICT_25H9_ML = 1,
+ XR_MARKER_APRIL_TAG_DICT_36H10_ML = 2,
+ XR_MARKER_APRIL_TAG_DICT_36H11_ML = 3,
+ XR_MARKER_APRIL_TAG_DICT_MAX_ENUM_ML = 0x7FFFFFFF
+} XrMarkerAprilTagDictML;
+
+typedef enum XrMarkerDetectorFpsML {
+ XR_MARKER_DETECTOR_FPS_LOW_ML = 0,
+ XR_MARKER_DETECTOR_FPS_MEDIUM_ML = 1,
+ XR_MARKER_DETECTOR_FPS_HIGH_ML = 2,
+ XR_MARKER_DETECTOR_FPS_MAX_ML = 3,
+ XR_MARKER_DETECTOR_FPS_MAX_ENUM_ML = 0x7FFFFFFF
+} XrMarkerDetectorFpsML;
+
+typedef enum XrMarkerDetectorResolutionML {
+ XR_MARKER_DETECTOR_RESOLUTION_LOW_ML = 0,
+ XR_MARKER_DETECTOR_RESOLUTION_MEDIUM_ML = 1,
+ XR_MARKER_DETECTOR_RESOLUTION_HIGH_ML = 2,
+ XR_MARKER_DETECTOR_RESOLUTION_MAX_ENUM_ML = 0x7FFFFFFF
+} XrMarkerDetectorResolutionML;
+
+typedef enum XrMarkerDetectorCameraML {
+ XR_MARKER_DETECTOR_CAMERA_RGB_CAMERA_ML = 0,
+ XR_MARKER_DETECTOR_CAMERA_WORLD_CAMERAS_ML = 1,
+ XR_MARKER_DETECTOR_CAMERA_MAX_ENUM_ML = 0x7FFFFFFF
+} XrMarkerDetectorCameraML;
+
+typedef enum XrMarkerDetectorCornerRefineMethodML {
+ XR_MARKER_DETECTOR_CORNER_REFINE_METHOD_NONE_ML = 0,
+ XR_MARKER_DETECTOR_CORNER_REFINE_METHOD_SUBPIX_ML = 1,
+ XR_MARKER_DETECTOR_CORNER_REFINE_METHOD_CONTOUR_ML = 2,
+ XR_MARKER_DETECTOR_CORNER_REFINE_METHOD_APRIL_TAG_ML = 3,
+ XR_MARKER_DETECTOR_CORNER_REFINE_METHOD_MAX_ENUM_ML = 0x7FFFFFFF
+} XrMarkerDetectorCornerRefineMethodML;
+
+typedef enum XrMarkerDetectorFullAnalysisIntervalML {
+ XR_MARKER_DETECTOR_FULL_ANALYSIS_INTERVAL_MAX_ML = 0,
+ XR_MARKER_DETECTOR_FULL_ANALYSIS_INTERVAL_FAST_ML = 1,
+ XR_MARKER_DETECTOR_FULL_ANALYSIS_INTERVAL_MEDIUM_ML = 2,
+ XR_MARKER_DETECTOR_FULL_ANALYSIS_INTERVAL_SLOW_ML = 3,
+ XR_MARKER_DETECTOR_FULL_ANALYSIS_INTERVAL_MAX_ENUM_ML = 0x7FFFFFFF
+} XrMarkerDetectorFullAnalysisIntervalML;
+
+typedef enum XrMarkerDetectorStatusML {
+ XR_MARKER_DETECTOR_STATUS_PENDING_ML = 0,
+ XR_MARKER_DETECTOR_STATUS_READY_ML = 1,
+ XR_MARKER_DETECTOR_STATUS_ERROR_ML = 2,
+ XR_MARKER_DETECTOR_STATUS_MAX_ENUM_ML = 0x7FFFFFFF
+} XrMarkerDetectorStatusML;
+// XrSystemMarkerUnderstandingPropertiesML extends XrSystemProperties
+typedef struct XrSystemMarkerUnderstandingPropertiesML {
+ XrStructureType type;
+ void* XR_MAY_ALIAS next;
+ XrBool32 supportsMarkerUnderstanding;
+} XrSystemMarkerUnderstandingPropertiesML;
+
+typedef struct XrMarkerDetectorCreateInfoML {
+ XrStructureType type;
+ const void* XR_MAY_ALIAS next;
+ XrMarkerDetectorProfileML profile;
+ XrMarkerTypeML markerType;
+} XrMarkerDetectorCreateInfoML;
+
+// XrMarkerDetectorArucoInfoML extends XrMarkerDetectorCreateInfoML
+typedef struct XrMarkerDetectorArucoInfoML {
+ XrStructureType type;
+ const void* XR_MAY_ALIAS next;
+ XrMarkerArucoDictML arucoDict;
+} XrMarkerDetectorArucoInfoML;
+
+// XrMarkerDetectorSizeInfoML extends XrMarkerDetectorCreateInfoML
+typedef struct XrMarkerDetectorSizeInfoML {
+ XrStructureType type;
+ const void* XR_MAY_ALIAS next;
+ float markerLength;
+} XrMarkerDetectorSizeInfoML;
+
+// XrMarkerDetectorAprilTagInfoML extends XrMarkerDetectorCreateInfoML
+typedef struct XrMarkerDetectorAprilTagInfoML {
+ XrStructureType type;
+ const void* XR_MAY_ALIAS next;
+ XrMarkerAprilTagDictML aprilTagDict;
+} XrMarkerDetectorAprilTagInfoML;
+
+// XrMarkerDetectorCustomProfileInfoML extends XrMarkerDetectorCreateInfoML
+typedef struct XrMarkerDetectorCustomProfileInfoML {
+ XrStructureType type;
+ const void* XR_MAY_ALIAS next;
+ XrMarkerDetectorFpsML fpsHint;
+ XrMarkerDetectorResolutionML resolutionHint;
+ XrMarkerDetectorCameraML cameraHint;
+ XrMarkerDetectorCornerRefineMethodML cornerRefineMethod;
+ XrBool32 useEdgeRefinement;
+ XrMarkerDetectorFullAnalysisIntervalML fullAnalysisIntervalHint;
+} XrMarkerDetectorCustomProfileInfoML;
+
+typedef struct XrMarkerDetectorSnapshotInfoML {
+ XrStructureType type;
+ const void* XR_MAY_ALIAS next;
+} XrMarkerDetectorSnapshotInfoML;
+
+typedef struct XrMarkerDetectorStateML {
+ XrStructureType type;
+ void* XR_MAY_ALIAS next;
+ XrMarkerDetectorStatusML state;
+} XrMarkerDetectorStateML;
+
+typedef struct XrMarkerSpaceCreateInfoML {
+ XrStructureType type;
+ const void* XR_MAY_ALIAS next;
+ XrMarkerDetectorML markerDetector;
+ XrMarkerML marker;
+ XrPosef poseInMarkerSpace;
+} XrMarkerSpaceCreateInfoML;
+
+typedef XrResult (XRAPI_PTR *PFN_xrCreateMarkerDetectorML)(XrSession session, const XrMarkerDetectorCreateInfoML* createInfo, XrMarkerDetectorML* markerDetector);
+typedef XrResult (XRAPI_PTR *PFN_xrDestroyMarkerDetectorML)(XrMarkerDetectorML markerDetector);
+typedef XrResult (XRAPI_PTR *PFN_xrSnapshotMarkerDetectorML)(XrMarkerDetectorML markerDetector, XrMarkerDetectorSnapshotInfoML* snapshotInfo);
+typedef XrResult (XRAPI_PTR *PFN_xrGetMarkerDetectorStateML)(XrMarkerDetectorML markerDetector, XrMarkerDetectorStateML* state);
+typedef XrResult (XRAPI_PTR *PFN_xrGetMarkersML)(XrMarkerDetectorML markerDetector, uint32_t markerCapacityInput, uint32_t* markerCountOutput, XrMarkerML* markers);
+typedef XrResult (XRAPI_PTR *PFN_xrGetMarkerReprojectionErrorML)(XrMarkerDetectorML markerDetector, XrMarkerML marker, float* reprojectionErrorMeters);
+typedef XrResult (XRAPI_PTR *PFN_xrGetMarkerLengthML)(XrMarkerDetectorML markerDetector, XrMarkerML marker, float* meters);
+typedef XrResult (XRAPI_PTR *PFN_xrGetMarkerNumberML)(XrMarkerDetectorML markerDetector, XrMarkerML marker, uint64_t* number);
+typedef XrResult (XRAPI_PTR *PFN_xrGetMarkerStringML)(XrMarkerDetectorML markerDetector, XrMarkerML marker, uint32_t bufferCapacityInput, uint32_t* bufferCountOutput, char* buffer);
+typedef XrResult (XRAPI_PTR *PFN_xrCreateMarkerSpaceML)(XrSession session, const XrMarkerSpaceCreateInfoML* createInfo, XrSpace* space);
+
+#ifndef XR_NO_PROTOTYPES
+#ifdef XR_EXTENSION_PROTOTYPES
+XRAPI_ATTR XrResult XRAPI_CALL xrCreateMarkerDetectorML(
+ XrSession session,
+ const XrMarkerDetectorCreateInfoML* createInfo,
+ XrMarkerDetectorML* markerDetector);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrDestroyMarkerDetectorML(
+ XrMarkerDetectorML markerDetector);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrSnapshotMarkerDetectorML(
+ XrMarkerDetectorML markerDetector,
+ XrMarkerDetectorSnapshotInfoML* snapshotInfo);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrGetMarkerDetectorStateML(
+ XrMarkerDetectorML markerDetector,
+ XrMarkerDetectorStateML* state);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrGetMarkersML(
+ XrMarkerDetectorML markerDetector,
+ uint32_t markerCapacityInput,
+ uint32_t* markerCountOutput,
+ XrMarkerML* markers);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrGetMarkerReprojectionErrorML(
+ XrMarkerDetectorML markerDetector,
+ XrMarkerML marker,
+ float* reprojectionErrorMeters);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrGetMarkerLengthML(
+ XrMarkerDetectorML markerDetector,
+ XrMarkerML marker,
+ float* meters);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrGetMarkerNumberML(
+ XrMarkerDetectorML markerDetector,
+ XrMarkerML marker,
+ uint64_t* number);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrGetMarkerStringML(
+ XrMarkerDetectorML markerDetector,
+ XrMarkerML marker,
+ uint32_t bufferCapacityInput,
+ uint32_t* bufferCountOutput,
+ char* buffer);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrCreateMarkerSpaceML(
+ XrSession session,
+ const XrMarkerSpaceCreateInfoML* createInfo,
+ XrSpace* space);
+#endif /* XR_EXTENSION_PROTOTYPES */
+#endif /* !XR_NO_PROTOTYPES */
+
+
+#define XR_ML_localization_map 1
+XR_DEFINE_HANDLE(XrExportedLocalizationMapML)
+#define XR_MAX_LOCALIZATION_MAP_NAME_LENGTH_ML 64
+#define XR_ML_localization_map_SPEC_VERSION 1
+#define XR_ML_LOCALIZATION_MAP_EXTENSION_NAME "XR_ML_localization_map"
+
+typedef enum XrLocalizationMapStateML {
+ XR_LOCALIZATION_MAP_STATE_NOT_LOCALIZED_ML = 0,
+ XR_LOCALIZATION_MAP_STATE_LOCALIZED_ML = 1,
+ XR_LOCALIZATION_MAP_STATE_LOCALIZATION_PENDING_ML = 2,
+ XR_LOCALIZATION_MAP_STATE_LOCALIZATION_SLEEPING_BEFORE_RETRY_ML = 3,
+ XR_LOCALIZATION_MAP_STATE_MAX_ENUM_ML = 0x7FFFFFFF
+} XrLocalizationMapStateML;
+
+typedef enum XrLocalizationMapTypeML {
+ XR_LOCALIZATION_MAP_TYPE_ON_DEVICE_ML = 0,
+ XR_LOCALIZATION_MAP_TYPE_CLOUD_ML = 1,
+ XR_LOCALIZATION_MAP_TYPE_MAX_ENUM_ML = 0x7FFFFFFF
+} XrLocalizationMapTypeML;
+
+typedef enum XrLocalizationMapConfidenceML {
+ XR_LOCALIZATION_MAP_CONFIDENCE_POOR_ML = 0,
+ XR_LOCALIZATION_MAP_CONFIDENCE_FAIR_ML = 1,
+ XR_LOCALIZATION_MAP_CONFIDENCE_GOOD_ML = 2,
+ XR_LOCALIZATION_MAP_CONFIDENCE_EXCELLENT_ML = 3,
+ XR_LOCALIZATION_MAP_CONFIDENCE_MAX_ENUM_ML = 0x7FFFFFFF
+} XrLocalizationMapConfidenceML;
+typedef XrFlags64 XrLocalizationMapErrorFlagsML;
+
+// Flag bits for XrLocalizationMapErrorFlagsML
+static const XrLocalizationMapErrorFlagsML XR_LOCALIZATION_MAP_ERROR_UNKNOWN_BIT_ML = 0x00000001;
+static const XrLocalizationMapErrorFlagsML XR_LOCALIZATION_MAP_ERROR_OUT_OF_MAPPED_AREA_BIT_ML = 0x00000002;
+static const XrLocalizationMapErrorFlagsML XR_LOCALIZATION_MAP_ERROR_LOW_FEATURE_COUNT_BIT_ML = 0x00000004;
+static const XrLocalizationMapErrorFlagsML XR_LOCALIZATION_MAP_ERROR_EXCESSIVE_MOTION_BIT_ML = 0x00000008;
+static const XrLocalizationMapErrorFlagsML XR_LOCALIZATION_MAP_ERROR_LOW_LIGHT_BIT_ML = 0x00000010;
+static const XrLocalizationMapErrorFlagsML XR_LOCALIZATION_MAP_ERROR_HEADPOSE_BIT_ML = 0x00000020;
+
+typedef struct XrLocalizationMapML {
+ XrStructureType type;
+ void* XR_MAY_ALIAS next;
+ char name[XR_MAX_LOCALIZATION_MAP_NAME_LENGTH_ML];
+ XrUuidEXT mapUuid;
+ XrLocalizationMapTypeML mapType;
+} XrLocalizationMapML;
+
+typedef struct XrEventDataLocalizationChangedML {
+ XrStructureType type;
+ const void* XR_MAY_ALIAS next;
+ XrSession session;
+ XrLocalizationMapStateML state;
+ XrLocalizationMapML map;
+ XrLocalizationMapConfidenceML confidence;
+ XrLocalizationMapErrorFlagsML errorFlags;
+} XrEventDataLocalizationChangedML;
+
+typedef struct XrLocalizationMapQueryInfoBaseHeaderML {
+ XrStructureType type;
+ const void* XR_MAY_ALIAS next;
+} XrLocalizationMapQueryInfoBaseHeaderML;
+
+typedef struct XrMapLocalizationRequestInfoML {
+ XrStructureType type;
+ const void* XR_MAY_ALIAS next;
+ XrUuidEXT mapUuid;
+} XrMapLocalizationRequestInfoML;
+
+typedef struct XrLocalizationMapImportInfoML {
+ XrStructureType type;
+ const void* XR_MAY_ALIAS next;
+ uint32_t size;
+ char* data;
+} XrLocalizationMapImportInfoML;
+
+typedef struct XrLocalizationEnableEventsInfoML {
+ XrStructureType type;
+ const void* XR_MAY_ALIAS next;
+ XrBool32 enabled;
+} XrLocalizationEnableEventsInfoML;
+
+typedef XrResult (XRAPI_PTR *PFN_xrEnableLocalizationEventsML)(XrSession session, const XrLocalizationEnableEventsInfoML * info);
+typedef XrResult (XRAPI_PTR *PFN_xrQueryLocalizationMapsML)(XrSession session, const XrLocalizationMapQueryInfoBaseHeaderML* queryInfo, uint32_t mapCapacityInput, uint32_t * mapCountOutput, XrLocalizationMapML* maps);
+typedef XrResult (XRAPI_PTR *PFN_xrRequestMapLocalizationML)(XrSession session, const XrMapLocalizationRequestInfoML* requestInfo);
+typedef XrResult (XRAPI_PTR *PFN_xrImportLocalizationMapML)(XrSession session, const XrLocalizationMapImportInfoML* importInfo, XrUuidEXT* mapUuid);
+typedef XrResult (XRAPI_PTR *PFN_xrCreateExportedLocalizationMapML)(XrSession session, const XrUuidEXT* mapUuid, XrExportedLocalizationMapML* map);
+typedef XrResult (XRAPI_PTR *PFN_xrDestroyExportedLocalizationMapML)(XrExportedLocalizationMapML map);
+typedef XrResult (XRAPI_PTR *PFN_xrGetExportedLocalizationMapDataML)(XrExportedLocalizationMapML map, uint32_t bufferCapacityInput, uint32_t* bufferCountOutput, char* buffer);
+
+#ifndef XR_NO_PROTOTYPES
+#ifdef XR_EXTENSION_PROTOTYPES
+XRAPI_ATTR XrResult XRAPI_CALL xrEnableLocalizationEventsML(
+ XrSession session,
+ const XrLocalizationEnableEventsInfoML * info);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrQueryLocalizationMapsML(
+ XrSession session,
+ const XrLocalizationMapQueryInfoBaseHeaderML* queryInfo,
+ uint32_t mapCapacityInput,
+ uint32_t * mapCountOutput,
+ XrLocalizationMapML* maps);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrRequestMapLocalizationML(
+ XrSession session,
+ const XrMapLocalizationRequestInfoML* requestInfo);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrImportLocalizationMapML(
+ XrSession session,
+ const XrLocalizationMapImportInfoML* importInfo,
+ XrUuidEXT* mapUuid);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrCreateExportedLocalizationMapML(
+ XrSession session,
+ const XrUuidEXT* mapUuid,
+ XrExportedLocalizationMapML* map);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrDestroyExportedLocalizationMapML(
+ XrExportedLocalizationMapML map);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrGetExportedLocalizationMapDataML(
+ XrExportedLocalizationMapML map,
+ uint32_t bufferCapacityInput,
+ uint32_t* bufferCountOutput,
+ char* buffer);
+#endif /* XR_EXTENSION_PROTOTYPES */
+#endif /* !XR_NO_PROTOTYPES */
+
+
#define XR_MSFT_spatial_anchor_persistence 1
XR_DEFINE_HANDLE(XrSpatialAnchorStoreConnectionMSFT)
#define XR_MAX_SPATIAL_ANCHOR_NAME_SIZE_MSFT 256
@@ -5814,6 +6200,11 @@ XRAPI_ATTR XrResult XRAPI_CALL xrUpdatePassthroughColorLutMETA(
#endif /* !XR_NO_PROTOTYPES */
+#define XR_META_touch_controller_plus 1
+#define XR_META_touch_controller_plus_SPEC_VERSION 1
+#define XR_META_TOUCH_CONTROLLER_PLUS_EXTENSION_NAME "XR_META_touch_controller_plus"
+
+
#define XR_EXT_uuid 1
#define XR_EXT_uuid_SPEC_VERSION 1
#define XR_EXT_UUID_EXTENSION_NAME "XR_EXT_uuid"
@@ -5980,6 +6371,46 @@ XRAPI_ATTR XrResult XRAPI_CALL xrApplyFoveationHTC(
#endif /* !XR_NO_PROTOTYPES */
+#define XR_HTC_anchor 1
+#define XR_MAX_SPATIAL_ANCHOR_NAME_SIZE_HTC 256
+#define XR_HTC_anchor_SPEC_VERSION 1
+#define XR_HTC_ANCHOR_EXTENSION_NAME "XR_HTC_anchor"
+// XrSystemAnchorPropertiesHTC extends XrSystemProperties
+typedef struct XrSystemAnchorPropertiesHTC {
+ XrStructureType type;
+ void* XR_MAY_ALIAS next;
+ XrBool32 supportsAnchor;
+} XrSystemAnchorPropertiesHTC;
+
+typedef struct XrSpatialAnchorNameHTC {
+ char name[XR_MAX_SPATIAL_ANCHOR_NAME_SIZE_HTC];
+} XrSpatialAnchorNameHTC;
+
+typedef struct XrSpatialAnchorCreateInfoHTC {
+ XrStructureType type;
+ const void* XR_MAY_ALIAS next;
+ XrSpace space;
+ XrPosef poseInSpace;
+ XrSpatialAnchorNameHTC name;
+} XrSpatialAnchorCreateInfoHTC;
+
+typedef XrResult (XRAPI_PTR *PFN_xrCreateSpatialAnchorHTC)(XrSession session, const XrSpatialAnchorCreateInfoHTC* createInfo, XrSpace* anchor);
+typedef XrResult (XRAPI_PTR *PFN_xrGetSpatialAnchorNameHTC)(XrSpace anchor, XrSpatialAnchorNameHTC* name);
+
+#ifndef XR_NO_PROTOTYPES
+#ifdef XR_EXTENSION_PROTOTYPES
+XRAPI_ATTR XrResult XRAPI_CALL xrCreateSpatialAnchorHTC(
+ XrSession session,
+ const XrSpatialAnchorCreateInfoHTC* createInfo,
+ XrSpace* anchor);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrGetSpatialAnchorNameHTC(
+ XrSpace anchor,
+ XrSpatialAnchorNameHTC* name);
+#endif /* XR_EXTENSION_PROTOTYPES */
+#endif /* !XR_NO_PROTOTYPES */
+
+
#define XR_EXT_active_action_set_priority 1
#define XR_EXT_active_action_set_priority_SPEC_VERSION 1
#define XR_EXT_ACTIVE_ACTION_SET_PRIORITY_EXTENSION_NAME "XR_EXT_active_action_set_priority"
@@ -6274,7 +6705,7 @@ typedef struct XrUserCalibrationEnableEventsInfoML {
XrBool32 enabled;
} XrUserCalibrationEnableEventsInfoML;
-typedef XrResult (XRAPI_PTR *PFN_xrEnableUserCalibrationEventsML)(XrInstance instance, const XrUserCalibrationEnableEventsInfoML* enableInfo);
+typedef XrResult (XRAPI_PTR *PFN_xrEnableUserCalibrationEventsML)(XrInstance instance, const XrUserCalibrationEnableEventsInfoML* enableInfo);
#ifndef XR_NO_PROTOTYPES
#ifdef XR_EXTENSION_PROTOTYPES
diff --git a/thirdparty/openxr/include/openxr/openxr_loader_negotiation.h b/thirdparty/openxr/include/openxr/openxr_loader_negotiation.h
new file mode 100644
index 0000000000..619b226760
--- /dev/null
+++ b/thirdparty/openxr/include/openxr/openxr_loader_negotiation.h
@@ -0,0 +1,140 @@
+#ifndef OPENXR_LOADER_NEGOTIATION_H_
+#define OPENXR_LOADER_NEGOTIATION_H_ 1
+
+/*
+** Copyright 2017-2024, The Khronos Group Inc.
+**
+** SPDX-License-Identifier: Apache-2.0 OR MIT
+*/
+
+/*
+** This header is generated from the Khronos OpenXR XML API Registry.
+**
+*/
+
+#include "openxr.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define XR_LOADER_VERSION_1_0 1
+
+#define XR_CURRENT_LOADER_API_LAYER_VERSION 1
+
+
+#define XR_CURRENT_LOADER_RUNTIME_VERSION 1
+
+
+#define XR_LOADER_INFO_STRUCT_VERSION 1
+
+
+#define XR_API_LAYER_INFO_STRUCT_VERSION 1
+
+
+#define XR_RUNTIME_INFO_STRUCT_VERSION 1
+
+
+#define XR_API_LAYER_NEXT_INFO_STRUCT_VERSION 1
+
+
+#define XR_API_LAYER_CREATE_INFO_STRUCT_VERSION 1
+
+
+#define XR_API_LAYER_MAX_SETTINGS_PATH_SIZE 512
+
+
+typedef enum XrLoaderInterfaceStructs {
+ XR_LOADER_INTERFACE_STRUCT_UNINTIALIZED = 0,
+ XR_LOADER_INTERFACE_STRUCT_LOADER_INFO = 1,
+ XR_LOADER_INTERFACE_STRUCT_API_LAYER_REQUEST = 2,
+ XR_LOADER_INTERFACE_STRUCT_RUNTIME_REQUEST = 3,
+ XR_LOADER_INTERFACE_STRUCT_API_LAYER_CREATE_INFO = 4,
+ XR_LOADER_INTERFACE_STRUCT_API_LAYER_NEXT_INFO = 5,
+ XR_LOADER_INTERFACE_STRUCTS_MAX_ENUM = 0x7FFFFFFF
+} XrLoaderInterfaceStructs;
+typedef XrResult (XRAPI_PTR *PFN_xrGetInstanceProcAddr)(XrInstance instance, const char* name, PFN_xrVoidFunction* function);
+
+typedef struct XrApiLayerCreateInfo XrApiLayerCreateInfo;
+typedef XrResult (XRAPI_PTR *PFN_xrCreateApiLayerInstance)(
+ const XrInstanceCreateInfo* info,
+ const XrApiLayerCreateInfo* apiLayerInfo,
+ XrInstance* instance);
+
+typedef struct XrApiLayerNextInfo {
+ XrLoaderInterfaceStructs structType;
+ uint32_t structVersion;
+ size_t structSize;
+ char layerName[XR_MAX_API_LAYER_NAME_SIZE];
+ PFN_xrGetInstanceProcAddr nextGetInstanceProcAddr;
+ PFN_xrCreateApiLayerInstance nextCreateApiLayerInstance;
+ struct XrApiLayerNextInfo* next;
+} XrApiLayerNextInfo;
+
+typedef struct XrApiLayerCreateInfo {
+ XrLoaderInterfaceStructs structType;
+ uint32_t structVersion;
+ size_t structSize;
+ void* XR_MAY_ALIAS loaderInstance;
+ char settings_file_location[XR_API_LAYER_MAX_SETTINGS_PATH_SIZE];
+ XrApiLayerNextInfo* nextInfo;
+} XrApiLayerCreateInfo;
+
+typedef struct XrNegotiateLoaderInfo {
+ XrLoaderInterfaceStructs structType;
+ uint32_t structVersion;
+ size_t structSize;
+ uint32_t minInterfaceVersion;
+ uint32_t maxInterfaceVersion;
+ XrVersion minApiVersion;
+ XrVersion maxApiVersion;
+} XrNegotiateLoaderInfo;
+
+typedef struct XrNegotiateRuntimeRequest {
+ XrLoaderInterfaceStructs structType;
+ uint32_t structVersion;
+ size_t structSize;
+ uint32_t runtimeInterfaceVersion;
+ XrVersion runtimeApiVersion;
+ PFN_xrGetInstanceProcAddr getInstanceProcAddr;
+} XrNegotiateRuntimeRequest;
+
+typedef struct XrNegotiateApiLayerRequest {
+ XrLoaderInterfaceStructs structType;
+ uint32_t structVersion;
+ size_t structSize;
+ uint32_t layerInterfaceVersion;
+ XrVersion layerApiVersion;
+ PFN_xrGetInstanceProcAddr getInstanceProcAddr;
+ PFN_xrCreateApiLayerInstance createApiLayerInstance;
+} XrNegotiateApiLayerRequest;
+
+typedef XrResult (XRAPI_PTR *PFN_xrCreateApiLayerInstance)(const XrInstanceCreateInfo* info, const XrApiLayerCreateInfo* layerInfo, XrInstance* instance);
+typedef XrResult (XRAPI_PTR *PFN_xrNegotiateLoaderRuntimeInterface)(const XrNegotiateLoaderInfo* loaderInfo, XrNegotiateRuntimeRequest* runtimeRequest);
+typedef XrResult (XRAPI_PTR *PFN_xrNegotiateLoaderApiLayerInterface)(const XrNegotiateLoaderInfo* loaderInfo, const char* layerName, XrNegotiateApiLayerRequest* apiLayerRequest);
+
+#ifndef XR_NO_PROTOTYPES
+#ifdef XR_EXTENSION_PROTOTYPES
+XRAPI_ATTR XrResult XRAPI_CALL xrCreateApiLayerInstance(
+ const XrInstanceCreateInfo* info,
+ const XrApiLayerCreateInfo* layerInfo,
+ XrInstance* instance);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrNegotiateLoaderRuntimeInterface(
+ const XrNegotiateLoaderInfo* loaderInfo,
+ XrNegotiateRuntimeRequest* runtimeRequest);
+
+XRAPI_ATTR XrResult XRAPI_CALL xrNegotiateLoaderApiLayerInterface(
+ const XrNegotiateLoaderInfo* loaderInfo,
+ const char* layerName,
+ XrNegotiateApiLayerRequest* apiLayerRequest);
+#endif /* XR_EXTENSION_PROTOTYPES */
+#endif /* !XR_NO_PROTOTYPES */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/openxr/include/openxr/openxr_platform.h b/thirdparty/openxr/include/openxr/openxr_platform.h
index e4ddfcbb7d..1f47428676 100644
--- a/thirdparty/openxr/include/openxr/openxr_platform.h
+++ b/thirdparty/openxr/include/openxr/openxr_platform.h
@@ -2,7 +2,7 @@
#define OPENXR_PLATFORM_H_ 1
/*
-** Copyright 2017-2023 The Khronos Group Inc.
+** Copyright 2017-2024, The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0 OR MIT
*/
@@ -22,7 +22,7 @@ extern "C" {
#ifdef XR_USE_PLATFORM_ANDROID
#define XR_KHR_android_thread_settings 1
-#define XR_KHR_android_thread_settings_SPEC_VERSION 5
+#define XR_KHR_android_thread_settings_SPEC_VERSION 6
#define XR_KHR_ANDROID_THREAD_SETTINGS_EXTENSION_NAME "XR_KHR_android_thread_settings"
typedef enum XrAndroidThreadTypeKHR {
@@ -489,7 +489,7 @@ XRAPI_ATTR XrResult XRAPI_CALL xrGetVulkanGraphicsRequirements2KHR(
#ifdef XR_USE_PLATFORM_EGL
#define XR_MNDX_egl_enable 1
-#define XR_MNDX_egl_enable_SPEC_VERSION 1
+#define XR_MNDX_egl_enable_SPEC_VERSION 2
#define XR_MNDX_EGL_ENABLE_EXTENSION_NAME "XR_MNDX_egl_enable"
typedef PFN_xrVoidFunction (*PFN_xrEglGetProcAddressMNDX)(const char *name);
// XrGraphicsBindingEGLMNDX extends XrSessionCreateInfo
diff --git a/thirdparty/openxr/include/openxr/openxr_platform_defines.h b/thirdparty/openxr/include/openxr/openxr_platform_defines.h
index 820b7b3e1e..cd07c91360 100644
--- a/thirdparty/openxr/include/openxr/openxr_platform_defines.h
+++ b/thirdparty/openxr/include/openxr/openxr_platform_defines.h
@@ -1,5 +1,5 @@
/*
-** Copyright (c) 2017-2023, The Khronos Group Inc.
+** Copyright (c) 2017-2024, The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0 OR MIT
*/
diff --git a/thirdparty/openxr/include/openxr/openxr_reflection.h b/thirdparty/openxr/include/openxr/openxr_reflection.h
index 8f49323417..f6d66363bf 100644
--- a/thirdparty/openxr/include/openxr/openxr_reflection.h
+++ b/thirdparty/openxr/include/openxr/openxr_reflection.h
@@ -2,7 +2,7 @@
#define OPENXR_REFLECTION_H_ 1
/*
-** Copyright (c) 2017-2023, The Khronos Group Inc.
+** Copyright (c) 2017-2024, The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0 OR MIT
*/
@@ -114,6 +114,18 @@ XR_ENUM_STR(XrResult);
_(XR_RENDER_MODEL_UNAVAILABLE_FB, 1000119020) \
_(XR_ERROR_MARKER_NOT_TRACKED_VARJO, -1000124000) \
_(XR_ERROR_MARKER_ID_INVALID_VARJO, -1000124001) \
+ _(XR_ERROR_MARKER_DETECTOR_PERMISSION_DENIED_ML, -1000138000) \
+ _(XR_ERROR_MARKER_DETECTOR_LOCATE_FAILED_ML, -1000138001) \
+ _(XR_ERROR_MARKER_DETECTOR_INVALID_DATA_QUERY_ML, -1000138002) \
+ _(XR_ERROR_MARKER_DETECTOR_INVALID_CREATE_INFO_ML, -1000138003) \
+ _(XR_ERROR_MARKER_INVALID_ML, -1000138004) \
+ _(XR_ERROR_LOCALIZATION_MAP_INCOMPATIBLE_ML, -1000139000) \
+ _(XR_ERROR_LOCALIZATION_MAP_UNAVAILABLE_ML, -1000139001) \
+ _(XR_ERROR_LOCALIZATION_MAP_FAIL_ML, -1000139002) \
+ _(XR_ERROR_LOCALIZATION_MAP_IMPORT_EXPORT_PERMISSION_DENIED_ML, -1000139003) \
+ _(XR_ERROR_LOCALIZATION_MAP_PERMISSION_DENIED_ML, -1000139004) \
+ _(XR_ERROR_LOCALIZATION_MAP_ALREADY_EXISTS_ML, -1000139005) \
+ _(XR_ERROR_LOCALIZATION_MAP_CANNOT_EXPORT_CLOUD_MAP_ML, -1000139006) \
_(XR_ERROR_SPATIAL_ANCHOR_NAME_NOT_FOUND_MSFT, -1000142001) \
_(XR_ERROR_SPATIAL_ANCHOR_NAME_INVALID_MSFT, -1000142002) \
_(XR_SCENE_MARKER_DATA_NOT_STRING_MSFT, 1000147000) \
@@ -124,6 +136,7 @@ XR_ENUM_STR(XrResult);
_(XR_ERROR_SPACE_CLOUD_STORAGE_DISABLED_FB, -1000169004) \
_(XR_ERROR_PASSTHROUGH_COLOR_LUT_BUFFER_SIZE_MISMATCH_META, -1000266000) \
_(XR_ERROR_HINT_ALREADY_SET_QCOM, -1000306000) \
+ _(XR_ERROR_NOT_AN_ANCHOR_HTC, -1000319000) \
_(XR_ERROR_SPACE_NOT_LOCATABLE_EXT, -1000429000) \
_(XR_ERROR_PLANE_DETECTION_PERMISSION_DENIED_EXT, -1000429001) \
_(XR_RESULT_MAX_ENUM, 0x7FFFFFFF)
@@ -340,6 +353,20 @@ XR_ENUM_STR(XrResult);
_(XR_TYPE_FRAME_END_INFO_ML, 1000135000) \
_(XR_TYPE_GLOBAL_DIMMER_FRAME_END_INFO_ML, 1000136000) \
_(XR_TYPE_COORDINATE_SPACE_CREATE_INFO_ML, 1000137000) \
+ _(XR_TYPE_SYSTEM_MARKER_UNDERSTANDING_PROPERTIES_ML, 1000138000) \
+ _(XR_TYPE_MARKER_DETECTOR_CREATE_INFO_ML, 1000138001) \
+ _(XR_TYPE_MARKER_DETECTOR_ARUCO_INFO_ML, 1000138002) \
+ _(XR_TYPE_MARKER_DETECTOR_SIZE_INFO_ML, 1000138003) \
+ _(XR_TYPE_MARKER_DETECTOR_APRIL_TAG_INFO_ML, 1000138004) \
+ _(XR_TYPE_MARKER_DETECTOR_CUSTOM_PROFILE_INFO_ML, 1000138005) \
+ _(XR_TYPE_MARKER_DETECTOR_SNAPSHOT_INFO_ML, 1000138006) \
+ _(XR_TYPE_MARKER_DETECTOR_STATE_ML, 1000138007) \
+ _(XR_TYPE_MARKER_SPACE_CREATE_INFO_ML, 1000138008) \
+ _(XR_TYPE_LOCALIZATION_MAP_ML, 1000139000) \
+ _(XR_TYPE_EVENT_DATA_LOCALIZATION_CHANGED_ML, 1000139001) \
+ _(XR_TYPE_MAP_LOCALIZATION_REQUEST_INFO_ML, 1000139002) \
+ _(XR_TYPE_LOCALIZATION_MAP_IMPORT_INFO_ML, 1000139003) \
+ _(XR_TYPE_LOCALIZATION_ENABLE_EVENTS_INFO_ML, 1000139004) \
_(XR_TYPE_EVENT_DATA_HEADSET_FIT_CHANGED_ML, 1000472000) \
_(XR_TYPE_EVENT_DATA_EYE_CALIBRATION_CHANGED_ML, 1000472001) \
_(XR_TYPE_USER_CALIBRATION_ENABLE_EVENTS_INFO_ML, 1000472002) \
@@ -429,6 +456,8 @@ XR_ENUM_STR(XrResult);
_(XR_TYPE_FOVEATION_APPLY_INFO_HTC, 1000318000) \
_(XR_TYPE_FOVEATION_DYNAMIC_MODE_INFO_HTC, 1000318001) \
_(XR_TYPE_FOVEATION_CUSTOM_MODE_INFO_HTC, 1000318002) \
+ _(XR_TYPE_SYSTEM_ANCHOR_PROPERTIES_HTC, 1000319000) \
+ _(XR_TYPE_SPATIAL_ANCHOR_CREATE_INFO_HTC, 1000319001) \
_(XR_TYPE_ACTIVE_ACTION_SET_PRIORITIES_EXT, 1000373000) \
_(XR_TYPE_SYSTEM_FORCE_FEEDBACK_CURL_PROPERTIES_MNDX, 1000375000) \
_(XR_TYPE_FORCE_FEEDBACK_CURL_APPLY_LOCATIONS_MNDX, 1000375001) \
@@ -467,6 +496,7 @@ XR_ENUM_STR(XrResult);
_(XR_REFERENCE_SPACE_TYPE_STAGE, 3) \
_(XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT, 1000038000) \
_(XR_REFERENCE_SPACE_TYPE_COMBINED_EYE_VARJO, 1000121000) \
+ _(XR_REFERENCE_SPACE_TYPE_LOCALIZATION_MAP_ML, 1000139000) \
_(XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT, 1000426000) \
_(XR_REFERENCE_SPACE_TYPE_MAX_ENUM, 0x7FFFFFFF)
@@ -517,6 +547,8 @@ XR_ENUM_STR(XrResult);
_(XR_OBJECT_TYPE_PASSTHROUGH_FB, 1000118000) \
_(XR_OBJECT_TYPE_PASSTHROUGH_LAYER_FB, 1000118002) \
_(XR_OBJECT_TYPE_GEOMETRY_INSTANCE_FB, 1000118004) \
+ _(XR_OBJECT_TYPE_MARKER_DETECTOR_ML, 1000138000) \
+ _(XR_OBJECT_TYPE_EXPORTED_LOCALIZATION_MAP_ML, 1000139000) \
_(XR_OBJECT_TYPE_SPATIAL_ANCHOR_STORE_CONNECTION_MSFT, 1000142000) \
_(XR_OBJECT_TYPE_FACE_TRACKER_FB, 1000201000) \
_(XR_OBJECT_TYPE_EYE_TRACKER_FB, 1000202000) \
@@ -527,6 +559,15 @@ XR_ENUM_STR(XrResult);
_(XR_OBJECT_TYPE_PLANE_DETECTOR_EXT, 1000429000) \
_(XR_OBJECT_TYPE_MAX_ENUM, 0x7FFFFFFF)
+#define XR_LIST_ENUM_XrLoaderInterfaceStructs(_) \
+ _(XR_LOADER_INTERFACE_STRUCT_UNINTIALIZED, 0) \
+ _(XR_LOADER_INTERFACE_STRUCT_LOADER_INFO, 1) \
+ _(XR_LOADER_INTERFACE_STRUCT_API_LAYER_REQUEST, 2) \
+ _(XR_LOADER_INTERFACE_STRUCT_RUNTIME_REQUEST, 3) \
+ _(XR_LOADER_INTERFACE_STRUCT_API_LAYER_CREATE_INFO, 4) \
+ _(XR_LOADER_INTERFACE_STRUCT_API_LAYER_NEXT_INFO, 5) \
+ _(XR_LOADER_INTERFACE_STRUCTS_MAX_ENUM, 0x7FFFFFFF)
+
#define XR_LIST_ENUM_XrAndroidThreadTypeKHR(_) \
_(XR_ANDROID_THREAD_TYPE_APPLICATION_MAIN_KHR, 1) \
_(XR_ANDROID_THREAD_TYPE_APPLICATION_WORKER_KHR, 2) \
@@ -877,6 +918,107 @@ XR_ENUM_STR(XrResult);
_(XR_PASSTHROUGH_LAYER_PURPOSE_TRACKED_KEYBOARD_MASKED_HANDS_FB, 1000203002) \
_(XR_PASSTHROUGH_LAYER_PURPOSE_MAX_ENUM_FB, 0x7FFFFFFF)
+#define XR_LIST_ENUM_XrMarkerDetectorProfileML(_) \
+ _(XR_MARKER_DETECTOR_PROFILE_DEFAULT_ML, 0) \
+ _(XR_MARKER_DETECTOR_PROFILE_SPEED_ML, 1) \
+ _(XR_MARKER_DETECTOR_PROFILE_ACCURACY_ML, 2) \
+ _(XR_MARKER_DETECTOR_PROFILE_SMALL_TARGETS_ML, 3) \
+ _(XR_MARKER_DETECTOR_PROFILE_LARGE_FOV_ML, 4) \
+ _(XR_MARKER_DETECTOR_PROFILE_CUSTOM_ML, 5) \
+ _(XR_MARKER_DETECTOR_PROFILE_MAX_ENUM_ML, 0x7FFFFFFF)
+
+#define XR_LIST_ENUM_XrMarkerTypeML(_) \
+ _(XR_MARKER_TYPE_ARUCO_ML, 0) \
+ _(XR_MARKER_TYPE_APRIL_TAG_ML, 1) \
+ _(XR_MARKER_TYPE_QR_ML, 2) \
+ _(XR_MARKER_TYPE_EAN_13_ML, 3) \
+ _(XR_MARKER_TYPE_UPC_A_ML, 4) \
+ _(XR_MARKER_TYPE_CODE_128_ML, 5) \
+ _(XR_MARKER_TYPE_MAX_ENUM_ML, 0x7FFFFFFF)
+
+#define XR_LIST_ENUM_XrMarkerArucoDictML(_) \
+ _(XR_MARKER_ARUCO_DICT_4X4_50_ML, 0) \
+ _(XR_MARKER_ARUCO_DICT_4X4_100_ML, 1) \
+ _(XR_MARKER_ARUCO_DICT_4X4_250_ML, 2) \
+ _(XR_MARKER_ARUCO_DICT_4X4_1000_ML, 3) \
+ _(XR_MARKER_ARUCO_DICT_5X5_50_ML, 4) \
+ _(XR_MARKER_ARUCO_DICT_5X5_100_ML, 5) \
+ _(XR_MARKER_ARUCO_DICT_5X5_250_ML, 6) \
+ _(XR_MARKER_ARUCO_DICT_5X5_1000_ML, 7) \
+ _(XR_MARKER_ARUCO_DICT_6X6_50_ML, 8) \
+ _(XR_MARKER_ARUCO_DICT_6X6_100_ML, 9) \
+ _(XR_MARKER_ARUCO_DICT_6X6_250_ML, 10) \
+ _(XR_MARKER_ARUCO_DICT_6X6_1000_ML, 11) \
+ _(XR_MARKER_ARUCO_DICT_7X7_50_ML, 12) \
+ _(XR_MARKER_ARUCO_DICT_7X7_100_ML, 13) \
+ _(XR_MARKER_ARUCO_DICT_7X7_250_ML, 14) \
+ _(XR_MARKER_ARUCO_DICT_7X7_1000_ML, 15) \
+ _(XR_MARKER_ARUCO_DICT_MAX_ENUM_ML, 0x7FFFFFFF)
+
+#define XR_LIST_ENUM_XrMarkerAprilTagDictML(_) \
+ _(XR_MARKER_APRIL_TAG_DICT_16H5_ML, 0) \
+ _(XR_MARKER_APRIL_TAG_DICT_25H9_ML, 1) \
+ _(XR_MARKER_APRIL_TAG_DICT_36H10_ML, 2) \
+ _(XR_MARKER_APRIL_TAG_DICT_36H11_ML, 3) \
+ _(XR_MARKER_APRIL_TAG_DICT_MAX_ENUM_ML, 0x7FFFFFFF)
+
+#define XR_LIST_ENUM_XrMarkerDetectorFpsML(_) \
+ _(XR_MARKER_DETECTOR_FPS_LOW_ML, 0) \
+ _(XR_MARKER_DETECTOR_FPS_MEDIUM_ML, 1) \
+ _(XR_MARKER_DETECTOR_FPS_HIGH_ML, 2) \
+ _(XR_MARKER_DETECTOR_FPS_MAX_ML, 3) \
+ _(XR_MARKER_DETECTOR_FPS_MAX_ENUM_ML, 0x7FFFFFFF)
+
+#define XR_LIST_ENUM_XrMarkerDetectorResolutionML(_) \
+ _(XR_MARKER_DETECTOR_RESOLUTION_LOW_ML, 0) \
+ _(XR_MARKER_DETECTOR_RESOLUTION_MEDIUM_ML, 1) \
+ _(XR_MARKER_DETECTOR_RESOLUTION_HIGH_ML, 2) \
+ _(XR_MARKER_DETECTOR_RESOLUTION_MAX_ENUM_ML, 0x7FFFFFFF)
+
+#define XR_LIST_ENUM_XrMarkerDetectorCameraML(_) \
+ _(XR_MARKER_DETECTOR_CAMERA_RGB_CAMERA_ML, 0) \
+ _(XR_MARKER_DETECTOR_CAMERA_WORLD_CAMERAS_ML, 1) \
+ _(XR_MARKER_DETECTOR_CAMERA_MAX_ENUM_ML, 0x7FFFFFFF)
+
+#define XR_LIST_ENUM_XrMarkerDetectorCornerRefineMethodML(_) \
+ _(XR_MARKER_DETECTOR_CORNER_REFINE_METHOD_NONE_ML, 0) \
+ _(XR_MARKER_DETECTOR_CORNER_REFINE_METHOD_SUBPIX_ML, 1) \
+ _(XR_MARKER_DETECTOR_CORNER_REFINE_METHOD_CONTOUR_ML, 2) \
+ _(XR_MARKER_DETECTOR_CORNER_REFINE_METHOD_APRIL_TAG_ML, 3) \
+ _(XR_MARKER_DETECTOR_CORNER_REFINE_METHOD_MAX_ENUM_ML, 0x7FFFFFFF)
+
+#define XR_LIST_ENUM_XrMarkerDetectorFullAnalysisIntervalML(_) \
+ _(XR_MARKER_DETECTOR_FULL_ANALYSIS_INTERVAL_MAX_ML, 0) \
+ _(XR_MARKER_DETECTOR_FULL_ANALYSIS_INTERVAL_FAST_ML, 1) \
+ _(XR_MARKER_DETECTOR_FULL_ANALYSIS_INTERVAL_MEDIUM_ML, 2) \
+ _(XR_MARKER_DETECTOR_FULL_ANALYSIS_INTERVAL_SLOW_ML, 3) \
+ _(XR_MARKER_DETECTOR_FULL_ANALYSIS_INTERVAL_MAX_ENUM_ML, 0x7FFFFFFF)
+
+#define XR_LIST_ENUM_XrMarkerDetectorStatusML(_) \
+ _(XR_MARKER_DETECTOR_STATUS_PENDING_ML, 0) \
+ _(XR_MARKER_DETECTOR_STATUS_READY_ML, 1) \
+ _(XR_MARKER_DETECTOR_STATUS_ERROR_ML, 2) \
+ _(XR_MARKER_DETECTOR_STATUS_MAX_ENUM_ML, 0x7FFFFFFF)
+
+#define XR_LIST_ENUM_XrLocalizationMapStateML(_) \
+ _(XR_LOCALIZATION_MAP_STATE_NOT_LOCALIZED_ML, 0) \
+ _(XR_LOCALIZATION_MAP_STATE_LOCALIZED_ML, 1) \
+ _(XR_LOCALIZATION_MAP_STATE_LOCALIZATION_PENDING_ML, 2) \
+ _(XR_LOCALIZATION_MAP_STATE_LOCALIZATION_SLEEPING_BEFORE_RETRY_ML, 3) \
+ _(XR_LOCALIZATION_MAP_STATE_MAX_ENUM_ML, 0x7FFFFFFF)
+
+#define XR_LIST_ENUM_XrLocalizationMapTypeML(_) \
+ _(XR_LOCALIZATION_MAP_TYPE_ON_DEVICE_ML, 0) \
+ _(XR_LOCALIZATION_MAP_TYPE_CLOUD_ML, 1) \
+ _(XR_LOCALIZATION_MAP_TYPE_MAX_ENUM_ML, 0x7FFFFFFF)
+
+#define XR_LIST_ENUM_XrLocalizationMapConfidenceML(_) \
+ _(XR_LOCALIZATION_MAP_CONFIDENCE_POOR_ML, 0) \
+ _(XR_LOCALIZATION_MAP_CONFIDENCE_FAIR_ML, 1) \
+ _(XR_LOCALIZATION_MAP_CONFIDENCE_GOOD_ML, 2) \
+ _(XR_LOCALIZATION_MAP_CONFIDENCE_EXCELLENT_ML, 3) \
+ _(XR_LOCALIZATION_MAP_CONFIDENCE_MAX_ENUM_ML, 0x7FFFFFFF)
+
#define XR_LIST_ENUM_XrSceneMarkerTypeMSFT(_) \
_(XR_SCENE_MARKER_TYPE_QR_CODE_MSFT, 1) \
_(XR_SCENE_MARKER_TYPE_MAX_ENUM_MSFT, 0x7FFFFFFF)
@@ -1281,6 +1423,14 @@ XR_ENUM_STR(XrResult);
#define XR_LIST_BITS_XrGlobalDimmerFrameEndInfoFlagsML(_) \
_(XR_GLOBAL_DIMMER_FRAME_END_INFO_ENABLED_BIT_ML, 0x00000001) \
+#define XR_LIST_BITS_XrLocalizationMapErrorFlagsML(_) \
+ _(XR_LOCALIZATION_MAP_ERROR_UNKNOWN_BIT_ML, 0x00000001) \
+ _(XR_LOCALIZATION_MAP_ERROR_OUT_OF_MAPPED_AREA_BIT_ML, 0x00000002) \
+ _(XR_LOCALIZATION_MAP_ERROR_LOW_FEATURE_COUNT_BIT_ML, 0x00000004) \
+ _(XR_LOCALIZATION_MAP_ERROR_EXCESSIVE_MOTION_BIT_ML, 0x00000008) \
+ _(XR_LOCALIZATION_MAP_ERROR_LOW_LIGHT_BIT_ML, 0x00000010) \
+ _(XR_LOCALIZATION_MAP_ERROR_HEADPOSE_BIT_ML, 0x00000020) \
+
#define XR_LIST_BITS_XrCompositionLayerSpaceWarpInfoFlagsFB(_) \
_(XR_COMPOSITION_LAYER_SPACE_WARP_INFO_FRAME_SKIP_BIT_FB, 0x00000001) \
@@ -1851,6 +2001,54 @@ XR_ENUM_STR(XrResult);
_(b) \
_(a) \
+/// Calls your macro with the name of each member of XrApiLayerNextInfo, in order.
+#define XR_LIST_STRUCT_XrApiLayerNextInfo(_) \
+ _(structType) \
+ _(structVersion) \
+ _(structSize) \
+ _(layerName) \
+ _(nextGetInstanceProcAddr) \
+ _(nextCreateApiLayerInstance) \
+ _(next) \
+
+/// Calls your macro with the name of each member of XrApiLayerCreateInfo, in order.
+#define XR_LIST_STRUCT_XrApiLayerCreateInfo(_) \
+ _(structType) \
+ _(structVersion) \
+ _(structSize) \
+ _(loaderInstance) \
+ _(settings_file_location) \
+ _(nextInfo) \
+
+/// Calls your macro with the name of each member of XrNegotiateLoaderInfo, in order.
+#define XR_LIST_STRUCT_XrNegotiateLoaderInfo(_) \
+ _(structType) \
+ _(structVersion) \
+ _(structSize) \
+ _(minInterfaceVersion) \
+ _(maxInterfaceVersion) \
+ _(minApiVersion) \
+ _(maxApiVersion) \
+
+/// Calls your macro with the name of each member of XrNegotiateRuntimeRequest, in order.
+#define XR_LIST_STRUCT_XrNegotiateRuntimeRequest(_) \
+ _(structType) \
+ _(structVersion) \
+ _(structSize) \
+ _(runtimeInterfaceVersion) \
+ _(runtimeApiVersion) \
+ _(getInstanceProcAddr) \
+
+/// Calls your macro with the name of each member of XrNegotiateApiLayerRequest, in order.
+#define XR_LIST_STRUCT_XrNegotiateApiLayerRequest(_) \
+ _(structType) \
+ _(structVersion) \
+ _(structSize) \
+ _(layerInterfaceVersion) \
+ _(layerApiVersion) \
+ _(getInstanceProcAddr) \
+ _(createApiLayerInstance) \
+
/// Calls your macro with the name of each member of XrCompositionLayerCubeKHR, in order.
#define XR_LIST_STRUCT_XrCompositionLayerCubeKHR(_) \
_(type) \
@@ -3212,6 +3410,109 @@ XR_ENUM_STR(XrResult);
_(cfuid) \
_(poseInCoordinateSpace) \
+/// Calls your macro with the name of each member of XrSystemMarkerUnderstandingPropertiesML, in order.
+#define XR_LIST_STRUCT_XrSystemMarkerUnderstandingPropertiesML(_) \
+ _(type) \
+ _(next) \
+ _(supportsMarkerUnderstanding) \
+
+/// Calls your macro with the name of each member of XrMarkerDetectorCreateInfoML, in order.
+#define XR_LIST_STRUCT_XrMarkerDetectorCreateInfoML(_) \
+ _(type) \
+ _(next) \
+ _(profile) \
+ _(markerType) \
+
+/// Calls your macro with the name of each member of XrMarkerDetectorArucoInfoML, in order.
+#define XR_LIST_STRUCT_XrMarkerDetectorArucoInfoML(_) \
+ _(type) \
+ _(next) \
+ _(arucoDict) \
+
+/// Calls your macro with the name of each member of XrMarkerDetectorSizeInfoML, in order.
+#define XR_LIST_STRUCT_XrMarkerDetectorSizeInfoML(_) \
+ _(type) \
+ _(next) \
+ _(markerLength) \
+
+/// Calls your macro with the name of each member of XrMarkerDetectorAprilTagInfoML, in order.
+#define XR_LIST_STRUCT_XrMarkerDetectorAprilTagInfoML(_) \
+ _(type) \
+ _(next) \
+ _(aprilTagDict) \
+
+/// Calls your macro with the name of each member of XrMarkerDetectorCustomProfileInfoML, in order.
+#define XR_LIST_STRUCT_XrMarkerDetectorCustomProfileInfoML(_) \
+ _(type) \
+ _(next) \
+ _(fpsHint) \
+ _(resolutionHint) \
+ _(cameraHint) \
+ _(cornerRefineMethod) \
+ _(useEdgeRefinement) \
+ _(fullAnalysisIntervalHint) \
+
+/// Calls your macro with the name of each member of XrMarkerDetectorSnapshotInfoML, in order.
+#define XR_LIST_STRUCT_XrMarkerDetectorSnapshotInfoML(_) \
+ _(type) \
+ _(next) \
+
+/// Calls your macro with the name of each member of XrMarkerDetectorStateML, in order.
+#define XR_LIST_STRUCT_XrMarkerDetectorStateML(_) \
+ _(type) \
+ _(next) \
+ _(state) \
+
+/// Calls your macro with the name of each member of XrMarkerSpaceCreateInfoML, in order.
+#define XR_LIST_STRUCT_XrMarkerSpaceCreateInfoML(_) \
+ _(type) \
+ _(next) \
+ _(markerDetector) \
+ _(marker) \
+ _(poseInMarkerSpace) \
+
+/// Calls your macro with the name of each member of XrLocalizationMapML, in order.
+#define XR_LIST_STRUCT_XrLocalizationMapML(_) \
+ _(type) \
+ _(next) \
+ _(name) \
+ _(mapUuid) \
+ _(mapType) \
+
+/// Calls your macro with the name of each member of XrEventDataLocalizationChangedML, in order.
+#define XR_LIST_STRUCT_XrEventDataLocalizationChangedML(_) \
+ _(type) \
+ _(next) \
+ _(session) \
+ _(state) \
+ _(map) \
+ _(confidence) \
+ _(errorFlags) \
+
+/// Calls your macro with the name of each member of XrLocalizationMapQueryInfoBaseHeaderML, in order.
+#define XR_LIST_STRUCT_XrLocalizationMapQueryInfoBaseHeaderML(_) \
+ _(type) \
+ _(next) \
+
+/// Calls your macro with the name of each member of XrMapLocalizationRequestInfoML, in order.
+#define XR_LIST_STRUCT_XrMapLocalizationRequestInfoML(_) \
+ _(type) \
+ _(next) \
+ _(mapUuid) \
+
+/// Calls your macro with the name of each member of XrLocalizationMapImportInfoML, in order.
+#define XR_LIST_STRUCT_XrLocalizationMapImportInfoML(_) \
+ _(type) \
+ _(next) \
+ _(size) \
+ _(data) \
+
+/// Calls your macro with the name of each member of XrLocalizationEnableEventsInfoML, in order.
+#define XR_LIST_STRUCT_XrLocalizationEnableEventsInfoML(_) \
+ _(type) \
+ _(next) \
+ _(enabled) \
+
/// Calls your macro with the name of each member of XrSpatialAnchorPersistenceNameMSFT, in order.
#define XR_LIST_STRUCT_XrSpatialAnchorPersistenceNameMSFT(_) \
_(name) \
@@ -3941,6 +4242,24 @@ XR_ENUM_STR(XrResult);
_(configCount) \
_(configs) \
+/// Calls your macro with the name of each member of XrSystemAnchorPropertiesHTC, in order.
+#define XR_LIST_STRUCT_XrSystemAnchorPropertiesHTC(_) \
+ _(type) \
+ _(next) \
+ _(supportsAnchor) \
+
+/// Calls your macro with the name of each member of XrSpatialAnchorNameHTC, in order.
+#define XR_LIST_STRUCT_XrSpatialAnchorNameHTC(_) \
+ _(name) \
+
+/// Calls your macro with the name of each member of XrSpatialAnchorCreateInfoHTC, in order.
+#define XR_LIST_STRUCT_XrSpatialAnchorCreateInfoHTC(_) \
+ _(type) \
+ _(next) \
+ _(space) \
+ _(poseInSpace) \
+ _(name) \
+
/// Calls your macro with the name of each member of XrActiveActionSetPriorityEXT, in order.
#define XR_LIST_STRUCT_XrActiveActionSetPriorityEXT(_) \
_(actionSet) \
@@ -4278,6 +4597,20 @@ XR_ENUM_STR(XrResult);
_(XrMarkerSpaceCreateInfoVARJO, XR_TYPE_MARKER_SPACE_CREATE_INFO_VARJO) \
_(XrFrameEndInfoML, XR_TYPE_FRAME_END_INFO_ML) \
_(XrGlobalDimmerFrameEndInfoML, XR_TYPE_GLOBAL_DIMMER_FRAME_END_INFO_ML) \
+ _(XrSystemMarkerUnderstandingPropertiesML, XR_TYPE_SYSTEM_MARKER_UNDERSTANDING_PROPERTIES_ML) \
+ _(XrMarkerDetectorCreateInfoML, XR_TYPE_MARKER_DETECTOR_CREATE_INFO_ML) \
+ _(XrMarkerDetectorArucoInfoML, XR_TYPE_MARKER_DETECTOR_ARUCO_INFO_ML) \
+ _(XrMarkerDetectorSizeInfoML, XR_TYPE_MARKER_DETECTOR_SIZE_INFO_ML) \
+ _(XrMarkerDetectorAprilTagInfoML, XR_TYPE_MARKER_DETECTOR_APRIL_TAG_INFO_ML) \
+ _(XrMarkerDetectorCustomProfileInfoML, XR_TYPE_MARKER_DETECTOR_CUSTOM_PROFILE_INFO_ML) \
+ _(XrMarkerDetectorSnapshotInfoML, XR_TYPE_MARKER_DETECTOR_SNAPSHOT_INFO_ML) \
+ _(XrMarkerDetectorStateML, XR_TYPE_MARKER_DETECTOR_STATE_ML) \
+ _(XrMarkerSpaceCreateInfoML, XR_TYPE_MARKER_SPACE_CREATE_INFO_ML) \
+ _(XrLocalizationMapML, XR_TYPE_LOCALIZATION_MAP_ML) \
+ _(XrEventDataLocalizationChangedML, XR_TYPE_EVENT_DATA_LOCALIZATION_CHANGED_ML) \
+ _(XrMapLocalizationRequestInfoML, XR_TYPE_MAP_LOCALIZATION_REQUEST_INFO_ML) \
+ _(XrLocalizationMapImportInfoML, XR_TYPE_LOCALIZATION_MAP_IMPORT_INFO_ML) \
+ _(XrLocalizationEnableEventsInfoML, XR_TYPE_LOCALIZATION_ENABLE_EVENTS_INFO_ML) \
_(XrSpatialAnchorPersistenceInfoMSFT, XR_TYPE_SPATIAL_ANCHOR_PERSISTENCE_INFO_MSFT) \
_(XrSpatialAnchorFromPersistedAnchorCreateInfoMSFT, XR_TYPE_SPATIAL_ANCHOR_FROM_PERSISTED_ANCHOR_CREATE_INFO_MSFT) \
_(XrSceneMarkersMSFT, XR_TYPE_SCENE_MARKERS_MSFT) \
@@ -4359,6 +4692,8 @@ XR_ENUM_STR(XrResult);
_(XrFoveationApplyInfoHTC, XR_TYPE_FOVEATION_APPLY_INFO_HTC) \
_(XrFoveationDynamicModeInfoHTC, XR_TYPE_FOVEATION_DYNAMIC_MODE_INFO_HTC) \
_(XrFoveationCustomModeInfoHTC, XR_TYPE_FOVEATION_CUSTOM_MODE_INFO_HTC) \
+ _(XrSystemAnchorPropertiesHTC, XR_TYPE_SYSTEM_ANCHOR_PROPERTIES_HTC) \
+ _(XrSpatialAnchorCreateInfoHTC, XR_TYPE_SPATIAL_ANCHOR_CREATE_INFO_HTC) \
_(XrActiveActionSetPrioritiesEXT, XR_TYPE_ACTIVE_ACTION_SET_PRIORITIES_EXT) \
_(XrSystemForceFeedbackCurlPropertiesMNDX, XR_TYPE_SYSTEM_FORCE_FEEDBACK_CURL_PROPERTIES_MNDX) \
_(XrForceFeedbackCurlApplyLocationsMNDX, XR_TYPE_FORCE_FEEDBACK_CURL_APPLY_LOCATIONS_MNDX) \
@@ -4629,6 +4964,8 @@ XR_ENUM_STR(XrResult);
_(XR_ML_frame_end_info, 136) \
_(XR_ML_global_dimmer, 137) \
_(XR_ML_compat, 138) \
+ _(XR_ML_marker_understanding, 139) \
+ _(XR_ML_localization_map, 140) \
_(XR_MSFT_spatial_anchor_persistence, 143) \
_(XR_MSFT_scene_marker, 148) \
_(XR_ULTRALEAP_hand_tracking_forearm, 150) \
@@ -4667,11 +5004,13 @@ XR_ENUM_STR(XrResult);
_(XR_FB_spatial_entity_user, 242) \
_(XR_META_headset_id, 246) \
_(XR_META_passthrough_color_lut, 267) \
+ _(XR_META_touch_controller_plus, 280) \
_(XR_EXT_uuid, 300) \
_(XR_EXT_hand_interaction, 303) \
_(XR_QCOM_tracking_optimization_settings, 307) \
_(XR_HTC_passthrough, 318) \
_(XR_HTC_foveation, 319) \
+ _(XR_HTC_anchor, 320) \
_(XR_EXT_active_action_set_priority, 374) \
_(XR_MNDX_force_feedback_curl, 376) \
_(XR_BD_controller_interaction, 385) \
diff --git a/thirdparty/openxr/include/openxr/openxr_reflection_parent_structs.h b/thirdparty/openxr/include/openxr/openxr_reflection_parent_structs.h
index f410ddcf79..4241682e0b 100644
--- a/thirdparty/openxr/include/openxr/openxr_reflection_parent_structs.h
+++ b/thirdparty/openxr/include/openxr/openxr_reflection_parent_structs.h
@@ -2,7 +2,7 @@
#define OPENXR_REFLECTION_PARENT_STRUCTS_H_ 1
/*
-** Copyright (c) 2017-2023, The Khronos Group Inc.
+** Copyright (c) 2017-2024, The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0 OR MIT
*/
@@ -58,6 +58,7 @@ This file contains expansion macros (X Macros) for OpenXR structures that have a
_avail(XrEventDataSpatialAnchorCreateCompleteFB, XR_TYPE_EVENT_DATA_SPATIAL_ANCHOR_CREATE_COMPLETE_FB) \
_avail(XrEventDataSpaceSetStatusCompleteFB, XR_TYPE_EVENT_DATA_SPACE_SET_STATUS_COMPLETE_FB) \
_avail(XrEventDataMarkerTrackingUpdateVARJO, XR_TYPE_EVENT_DATA_MARKER_TRACKING_UPDATE_VARJO) \
+ _avail(XrEventDataLocalizationChangedML, XR_TYPE_EVENT_DATA_LOCALIZATION_CHANGED_ML) \
_avail(XrEventDataSpaceQueryResultsAvailableFB, XR_TYPE_EVENT_DATA_SPACE_QUERY_RESULTS_AVAILABLE_FB) \
_avail(XrEventDataSpaceQueryCompleteFB, XR_TYPE_EVENT_DATA_SPACE_QUERY_COMPLETE_FB) \
_avail(XrEventDataSpaceSaveCompleteFB, XR_TYPE_EVENT_DATA_SPACE_SAVE_COMPLETE_FB) \
diff --git a/thirdparty/openxr/include/openxr/openxr_reflection_structs.h b/thirdparty/openxr/include/openxr/openxr_reflection_structs.h
index 2d23ac15ca..bcc1333e29 100644
--- a/thirdparty/openxr/include/openxr/openxr_reflection_structs.h
+++ b/thirdparty/openxr/include/openxr/openxr_reflection_structs.h
@@ -2,7 +2,7 @@
#define OPENXR_REFLECTION_STRUCTS_H_ 1
/*
-** Copyright (c) 2017-2023, The Khronos Group Inc.
+** Copyright (c) 2017-2024, The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0 OR MIT
*/
@@ -225,6 +225,20 @@ This file contains expansion macros (X Macros) for OpenXR structures.
_avail(XrMarkerSpaceCreateInfoVARJO, XR_TYPE_MARKER_SPACE_CREATE_INFO_VARJO) \
_avail(XrFrameEndInfoML, XR_TYPE_FRAME_END_INFO_ML) \
_avail(XrGlobalDimmerFrameEndInfoML, XR_TYPE_GLOBAL_DIMMER_FRAME_END_INFO_ML) \
+ _avail(XrSystemMarkerUnderstandingPropertiesML, XR_TYPE_SYSTEM_MARKER_UNDERSTANDING_PROPERTIES_ML) \
+ _avail(XrMarkerDetectorCreateInfoML, XR_TYPE_MARKER_DETECTOR_CREATE_INFO_ML) \
+ _avail(XrMarkerDetectorArucoInfoML, XR_TYPE_MARKER_DETECTOR_ARUCO_INFO_ML) \
+ _avail(XrMarkerDetectorSizeInfoML, XR_TYPE_MARKER_DETECTOR_SIZE_INFO_ML) \
+ _avail(XrMarkerDetectorAprilTagInfoML, XR_TYPE_MARKER_DETECTOR_APRIL_TAG_INFO_ML) \
+ _avail(XrMarkerDetectorCustomProfileInfoML, XR_TYPE_MARKER_DETECTOR_CUSTOM_PROFILE_INFO_ML) \
+ _avail(XrMarkerDetectorSnapshotInfoML, XR_TYPE_MARKER_DETECTOR_SNAPSHOT_INFO_ML) \
+ _avail(XrMarkerDetectorStateML, XR_TYPE_MARKER_DETECTOR_STATE_ML) \
+ _avail(XrMarkerSpaceCreateInfoML, XR_TYPE_MARKER_SPACE_CREATE_INFO_ML) \
+ _avail(XrLocalizationMapML, XR_TYPE_LOCALIZATION_MAP_ML) \
+ _avail(XrEventDataLocalizationChangedML, XR_TYPE_EVENT_DATA_LOCALIZATION_CHANGED_ML) \
+ _avail(XrMapLocalizationRequestInfoML, XR_TYPE_MAP_LOCALIZATION_REQUEST_INFO_ML) \
+ _avail(XrLocalizationMapImportInfoML, XR_TYPE_LOCALIZATION_MAP_IMPORT_INFO_ML) \
+ _avail(XrLocalizationEnableEventsInfoML, XR_TYPE_LOCALIZATION_ENABLE_EVENTS_INFO_ML) \
_avail(XrSpatialAnchorPersistenceInfoMSFT, XR_TYPE_SPATIAL_ANCHOR_PERSISTENCE_INFO_MSFT) \
_avail(XrSpatialAnchorFromPersistedAnchorCreateInfoMSFT, XR_TYPE_SPATIAL_ANCHOR_FROM_PERSISTED_ANCHOR_CREATE_INFO_MSFT) \
_avail(XrSceneMarkersMSFT, XR_TYPE_SCENE_MARKERS_MSFT) \
@@ -306,6 +320,8 @@ This file contains expansion macros (X Macros) for OpenXR structures.
_avail(XrFoveationApplyInfoHTC, XR_TYPE_FOVEATION_APPLY_INFO_HTC) \
_avail(XrFoveationDynamicModeInfoHTC, XR_TYPE_FOVEATION_DYNAMIC_MODE_INFO_HTC) \
_avail(XrFoveationCustomModeInfoHTC, XR_TYPE_FOVEATION_CUSTOM_MODE_INFO_HTC) \
+ _avail(XrSystemAnchorPropertiesHTC, XR_TYPE_SYSTEM_ANCHOR_PROPERTIES_HTC) \
+ _avail(XrSpatialAnchorCreateInfoHTC, XR_TYPE_SPATIAL_ANCHOR_CREATE_INFO_HTC) \
_avail(XrActiveActionSetPrioritiesEXT, XR_TYPE_ACTIVE_ACTION_SET_PRIORITIES_EXT) \
_avail(XrSystemForceFeedbackCurlPropertiesMNDX, XR_TYPE_SYSTEM_FORCE_FEEDBACK_CURL_PROPERTIES_MNDX) \
_avail(XrForceFeedbackCurlApplyLocationsMNDX, XR_TYPE_FORCE_FEEDBACK_CURL_APPLY_LOCATIONS_MNDX) \
diff --git a/thirdparty/openxr/src/common/extra_algorithms.h b/thirdparty/openxr/src/common/extra_algorithms.h
index eec429e12a..bdaa420e9f 100644
--- a/thirdparty/openxr/src/common/extra_algorithms.h
+++ b/thirdparty/openxr/src/common/extra_algorithms.h
@@ -1,11 +1,11 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
// Copyright (c) 2019 Collabora, Ltd.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
-// Initial Author: Ryan Pavlik <ryan.pavlik@collabora.com>
+// Initial Author: Rylie Pavlik <rylie.pavlik@collabora.com>
//
/*!
diff --git a/thirdparty/openxr/src/common/filesystem_utils.cpp b/thirdparty/openxr/src/common/filesystem_utils.cpp
index 16e6ff3292..063c4c4cee 100644
--- a/thirdparty/openxr/src/common/filesystem_utils.cpp
+++ b/thirdparty/openxr/src/common/filesystem_utils.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017 Valve Corporation
// Copyright (c) 2017 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/common/filesystem_utils.hpp b/thirdparty/openxr/src/common/filesystem_utils.hpp
index 3dea1b2c3e..2a923fac4c 100644
--- a/thirdparty/openxr/src/common/filesystem_utils.hpp
+++ b/thirdparty/openxr/src/common/filesystem_utils.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017 Valve Corporation
// Copyright (c) 2017 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/common/hex_and_handles.h b/thirdparty/openxr/src/common/hex_and_handles.h
index 300669033f..12bdb3670c 100644
--- a/thirdparty/openxr/src/common/hex_and_handles.h
+++ b/thirdparty/openxr/src/common/hex_and_handles.h
@@ -1,11 +1,11 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
// Copyright (c) 2019 Collabora, Ltd.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
-// Initial Author: Ryan Pavlik <ryan.pavlik@collabora.com>
+// Initial Author: Rylie Pavlik <rylie.pavlik@collabora.com>
//
/*!
diff --git a/thirdparty/openxr/src/common/loader_interfaces.h b/thirdparty/openxr/src/common/loader_interfaces.h
deleted file mode 100644
index 020c3456ea..0000000000
--- a/thirdparty/openxr/src/common/loader_interfaces.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
-// Copyright (c) 2017 Valve Corporation
-// Copyright (c) 2017 LunarG, Inc.
-//
-// SPDX-License-Identifier: Apache-2.0 OR MIT
-//
-// Initial Author: Mark Young <marky@lunarg.com>
-//
-
-#pragma once
-
-#include <openxr/openxr.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Forward declare.
-typedef struct XrApiLayerCreateInfo XrApiLayerCreateInfo;
-
-// Function pointer prototype for the xrCreateApiLayerInstance function used in place of xrCreateInstance.
-// This function allows us to pass special API layer information to each layer during the process of creating an Instance.
-typedef XrResult(XRAPI_PTR *PFN_xrCreateApiLayerInstance)(const XrInstanceCreateInfo *info,
- const XrApiLayerCreateInfo *apiLayerInfo, XrInstance *instance);
-
-// Loader/API Layer Interface versions
-// 1 - First version, introduces negotiation structure and functions
-#define XR_CURRENT_LOADER_API_LAYER_VERSION 1
-
-// Loader/Runtime Interface versions
-// 1 - First version, introduces negotiation structure and functions
-#define XR_CURRENT_LOADER_RUNTIME_VERSION 1
-
-// Version negotiation values
-typedef enum XrLoaderInterfaceStructs {
- XR_LOADER_INTERFACE_STRUCT_UNINTIALIZED = 0,
- XR_LOADER_INTERFACE_STRUCT_LOADER_INFO,
- XR_LOADER_INTERFACE_STRUCT_API_LAYER_REQUEST,
- XR_LOADER_INTERFACE_STRUCT_RUNTIME_REQUEST,
- XR_LOADER_INTERFACE_STRUCT_API_LAYER_CREATE_INFO,
- XR_LOADER_INTERFACE_STRUCT_API_LAYER_NEXT_INFO,
-} XrLoaderInterfaceStructs;
-
-#define XR_LOADER_INFO_STRUCT_VERSION 1
-typedef struct XrNegotiateLoaderInfo {
- XrLoaderInterfaceStructs structType; // XR_LOADER_INTERFACE_STRUCT_LOADER_INFO
- uint32_t structVersion; // XR_LOADER_INFO_STRUCT_VERSION
- size_t structSize; // sizeof(XrNegotiateLoaderInfo)
- uint32_t minInterfaceVersion;
- uint32_t maxInterfaceVersion;
- XrVersion minApiVersion;
- XrVersion maxApiVersion;
-} XrNegotiateLoaderInfo;
-
-#define XR_API_LAYER_INFO_STRUCT_VERSION 1
-typedef struct XrNegotiateApiLayerRequest {
- XrLoaderInterfaceStructs structType; // XR_LOADER_INTERFACE_STRUCT_API_LAYER_REQUEST
- uint32_t structVersion; // XR_API_LAYER_INFO_STRUCT_VERSION
- size_t structSize; // sizeof(XrNegotiateApiLayerRequest)
- uint32_t layerInterfaceVersion; // CURRENT_LOADER_API_LAYER_VERSION
- XrVersion layerApiVersion;
- PFN_xrGetInstanceProcAddr getInstanceProcAddr;
- PFN_xrCreateApiLayerInstance createApiLayerInstance;
-} XrNegotiateApiLayerRequest;
-
-#define XR_RUNTIME_INFO_STRUCT_VERSION 1
-typedef struct XrNegotiateRuntimeRequest {
- XrLoaderInterfaceStructs structType; // XR_LOADER_INTERFACE_STRUCT_RUNTIME_REQUEST
- uint32_t structVersion; // XR_RUNTIME_INFO_STRUCT_VERSION
- size_t structSize; // sizeof(XrNegotiateRuntimeRequest)
- uint32_t runtimeInterfaceVersion; // CURRENT_LOADER_RUNTIME_VERSION
- XrVersion runtimeApiVersion;
- PFN_xrGetInstanceProcAddr getInstanceProcAddr;
-} XrNegotiateRuntimeRequest;
-
-// Function used to negotiate an interface betewen the loader and an API layer. Each library exposing one or
-// more API layers needs to expose at least this function.
-typedef XrResult(XRAPI_PTR *PFN_xrNegotiateLoaderApiLayerInterface)(const XrNegotiateLoaderInfo *loaderInfo,
- const char *apiLayerName,
- XrNegotiateApiLayerRequest *apiLayerRequest);
-
-// Function used to negotiate an interface betewen the loader and a runtime. Each runtime should expose
-// at least this function.
-typedef XrResult(XRAPI_PTR *PFN_xrNegotiateLoaderRuntimeInterface)(const XrNegotiateLoaderInfo *loaderInfo,
- XrNegotiateRuntimeRequest *runtimeRequest);
-
-// Forward declare.
-typedef struct XrApiLayerNextInfo XrApiLayerNextInfo;
-
-#define XR_API_LAYER_NEXT_INFO_STRUCT_VERSION 1
-struct XrApiLayerNextInfo {
- XrLoaderInterfaceStructs structType; // XR_LOADER_INTERFACE_STRUCT_API_LAYER_NEXT_INFO
- uint32_t structVersion; // XR_API_LAYER_NEXT_INFO_STRUCT_VERSION
- size_t structSize; // sizeof(XrApiLayerNextInfo)
- char layerName[XR_MAX_API_LAYER_NAME_SIZE]; // Name of API layer which should receive this info
- PFN_xrGetInstanceProcAddr nextGetInstanceProcAddr; // Pointer to next API layer's xrGetInstanceProcAddr
- PFN_xrCreateApiLayerInstance nextCreateApiLayerInstance; // Pointer to next API layer's xrCreateApiLayerInstance
- XrApiLayerNextInfo *next; // Pointer to the next API layer info in the sequence
-};
-
-#define XR_API_LAYER_MAX_SETTINGS_PATH_SIZE 512
-#define XR_API_LAYER_CREATE_INFO_STRUCT_VERSION 1
-typedef struct XrApiLayerCreateInfo {
- XrLoaderInterfaceStructs structType; // XR_LOADER_INTERFACE_STRUCT_API_LAYER_CREATE_INFO
- uint32_t structVersion; // XR_API_LAYER_CREATE_INFO_STRUCT_VERSION
- size_t structSize; // sizeof(XrApiLayerCreateInfo)
- void *loaderInstance; // Pointer to the LoaderInstance class
- char settings_file_location[XR_API_LAYER_MAX_SETTINGS_PATH_SIZE]; // Location to the found settings file (or empty '\0')
- XrApiLayerNextInfo *nextInfo; // Pointer to the next API layer's Info
-} XrApiLayerCreateInfo;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/thirdparty/openxr/src/common/object_info.cpp b/thirdparty/openxr/src/common/object_info.cpp
index 3f8f96bc6e..d45430a609 100644
--- a/thirdparty/openxr/src/common/object_info.cpp
+++ b/thirdparty/openxr/src/common/object_info.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
// Copyright (c) 2019 Collabora, Ltd.
@@ -6,7 +6,7 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
// Initial Authors: Mark Young <marky@lunarg.com>
-// Ryan Pavlik <ryan.pavlik@collabora.com>
+// Rylie Pavlik <rylie.pavlik@collabora.com>
// Dave Houlton <daveh@lunarg.com>
//
diff --git a/thirdparty/openxr/src/common/object_info.h b/thirdparty/openxr/src/common/object_info.h
index 247ede0dcc..572f06ab15 100644
--- a/thirdparty/openxr/src/common/object_info.h
+++ b/thirdparty/openxr/src/common/object_info.h
@@ -1,11 +1,11 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
// Copyright (c) 2019 Collabora, Ltd.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
-// Initial Authors: Mark Young <marky@lunarg.com>, Ryan Pavlik <ryan.pavlik@collabora.com
+// Initial Authors: Mark Young <marky@lunarg.com>, Rylie Pavlik <rylie.pavlik@collabora.com
//
/*!
* @file
diff --git a/thirdparty/openxr/src/common/platform_utils.hpp b/thirdparty/openxr/src/common/platform_utils.hpp
index 0b295f5cc9..c4d75bf259 100644
--- a/thirdparty/openxr/src/common/platform_utils.hpp
+++ b/thirdparty/openxr/src/common/platform_utils.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/common/stdfs_conditions.h b/thirdparty/openxr/src/common/stdfs_conditions.h
index 0a551f08cd..9e2ba70d42 100644
--- a/thirdparty/openxr/src/common/stdfs_conditions.h
+++ b/thirdparty/openxr/src/common/stdfs_conditions.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017 Valve Corporation
// Copyright (c) 2017 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/common/unique_asset.h b/thirdparty/openxr/src/common/unique_asset.h
index a8ae8077bc..fd5f8868e3 100644
--- a/thirdparty/openxr/src/common/unique_asset.h
+++ b/thirdparty/openxr/src/common/unique_asset.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
#pragma once
diff --git a/thirdparty/openxr/src/common/vulkan_debug_object_namer.hpp b/thirdparty/openxr/src/common/vulkan_debug_object_namer.hpp
index 451219d20f..885389ce8e 100644
--- a/thirdparty/openxr/src/common/vulkan_debug_object_namer.hpp
+++ b/thirdparty/openxr/src/common/vulkan_debug_object_namer.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
//
// SPDX-License-Identifier: Apache-2.0
diff --git a/thirdparty/openxr/src/common/xr_dependencies.h b/thirdparty/openxr/src/common/xr_dependencies.h
index 6c9cf2d05f..55d93bfbac 100644
--- a/thirdparty/openxr/src/common/xr_dependencies.h
+++ b/thirdparty/openxr/src/common/xr_dependencies.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2023, The Khronos Group Inc.
+// Copyright (c) 2018-2024, The Khronos Group Inc.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
diff --git a/thirdparty/openxr/src/common/xr_linear.h b/thirdparty/openxr/src/common/xr_linear.h
index ce65f8ddfb..2b295ed304 100644
--- a/thirdparty/openxr/src/common/xr_linear.h
+++ b/thirdparty/openxr/src/common/xr_linear.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2016, Oculus VR, LLC.
//
// SPDX-License-Identifier: Apache-2.0
diff --git a/thirdparty/openxr/src/loader/android_utilities.cpp b/thirdparty/openxr/src/loader/android_utilities.cpp
index 9a3ad76ce0..5c9b846b5a 100644
--- a/thirdparty/openxr/src/loader/android_utilities.cpp
+++ b/thirdparty/openxr/src/loader/android_utilities.cpp
@@ -1,9 +1,9 @@
-// Copyright (c) 2020-2023, The Khronos Group Inc.
+// Copyright (c) 2020-2024, The Khronos Group Inc.
// Copyright (c) 2020-2021, Collabora, Ltd.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
-// Initial Author: Ryan Pavlik <ryan.pavlik@collabora.com>
+// Initial Author: Rylie Pavlik <rylie.pavlik@collabora.com>
#include "android_utilities.h"
@@ -245,18 +245,38 @@ static int populateFunctions(wrap::android::content::Context const &context, boo
return 0;
}
+// The current file relies on android-jni-wrappers and jnipp, which may throw on failure.
+// This is problematic when the loader is compiled with exception handling disabled - the consumers can reasonably
+// expect that the compilation with -fno-exceptions will succeed, but the compiler will not accept the code that
+// uses `try` & `catch` keywords. We cannot use the `exception_handling.hpp` here since we're not at an ABI boundary,
+// so we define helper macros here. This is fine for now since the only occurrence of exception-handling code is in this file.
+#ifdef XRLOADER_DISABLE_EXCEPTION_HANDLING
+
+#define ANDROID_UTILITIES_TRY
+#define ANDROID_UTILITIES_CATCH_FALLBACK(...)
+
+#else
+
+#define ANDROID_UTILITIES_TRY try
+#define ANDROID_UTILITIES_CATCH_FALLBACK(...) \
+ catch (const std::exception &e) { \
+ __VA_ARGS__ \
+ }
+
+#endif // XRLOADER_DISABLE_EXCEPTION_HANDLING
+
/// Get cursor for active runtime, parameterized by whether or not we use the system broker
static bool getActiveRuntimeCursor(wrap::android::content::Context const &context, jni::Array<std::string> const &projection,
bool systemBroker, Cursor &cursor) {
auto uri = active_runtime::makeContentUri(systemBroker, XR_VERSION_MAJOR(XR_CURRENT_API_VERSION), ABI);
ALOGI("getActiveRuntimeCursor: Querying URI: %s", uri.toString().c_str());
- try {
- cursor = context.getContentResolver().query(uri, projection);
- } catch (const std::exception &e) {
+
+ ANDROID_UTILITIES_TRY { cursor = context.getContentResolver().query(uri, projection); }
+ ANDROID_UTILITIES_CATCH_FALLBACK({
ALOGW("Exception when querying %s content resolver: %s", getBrokerTypeName(systemBroker), e.what());
cursor = {};
return false;
- }
+ })
if (cursor.isNull()) {
ALOGW("Null cursor when querying %s content resolver.", getBrokerTypeName(systemBroker));
diff --git a/thirdparty/openxr/src/loader/android_utilities.h b/thirdparty/openxr/src/loader/android_utilities.h
index f66c9bf1d0..582a65056e 100644
--- a/thirdparty/openxr/src/loader/android_utilities.h
+++ b/thirdparty/openxr/src/loader/android_utilities.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2020-2023, The Khronos Group Inc.
+// Copyright (c) 2020-2024, The Khronos Group Inc.
// Copyright (c) 2020-2021, Collabora, Ltd.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
-// Initial Author: Ryan Pavlik <ryan.pavlik@collabora.com>
+// Initial Author: Rylie Pavlik <rylie.pavlik@collabora.com>
#pragma once
#ifdef __ANDROID__
diff --git a/thirdparty/openxr/src/loader/api_layer_interface.cpp b/thirdparty/openxr/src/loader/api_layer_interface.cpp
index c9e24ec40b..fb509de270 100644
--- a/thirdparty/openxr/src/loader/api_layer_interface.cpp
+++ b/thirdparty/openxr/src/loader/api_layer_interface.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -9,13 +9,14 @@
#include "api_layer_interface.hpp"
-#include "loader_interfaces.h"
+#include "loader_init_data.hpp"
#include "loader_logger.hpp"
#include "loader_platform.hpp"
#include "manifest_file.hpp"
#include "platform_utils.hpp"
#include <openxr/openxr.h>
+#include <openxr/openxr_loader_negotiation.h>
#include <cstring>
#include <memory>
@@ -282,6 +283,38 @@ XrResult ApiLayerInterface::LoadApiLayers(const std::string& openxr_command, uin
LoaderLogger::LogWarningMessage(openxr_command, warning_message);
continue;
}
+#ifdef XR_KHR_LOADER_INIT_SUPPORT
+ if (!LoaderInitData::instance().initialized()) {
+ LoaderLogger::LogErrorMessage(openxr_command, "ApiLayerInterface::LoadApiLayers skipping manifest file " +
+ manifest_file->Filename() +
+ " because xrInitializeLoaderKHR was not yet called.");
+
+ LoaderPlatformLibraryClose(layer_library);
+ return XR_ERROR_VALIDATION_FAILURE;
+ }
+ bool forwardedInitLoader = false;
+ {
+ // If we have xrInitializeLoaderKHR exposed as an export, forward call to it.
+ const auto function_name = manifest_file->GetFunctionName("xrInitializeLoaderKHR");
+ auto initLoader =
+ reinterpret_cast<PFN_xrInitializeLoaderKHR>(LoaderPlatformLibraryGetProcAddr(layer_library, function_name));
+ if (initLoader != nullptr) {
+ // we found the entry point one way or another.
+ LoaderLogger::LogInfoMessage(openxr_command,
+ "ApiLayerInterface::LoadApiLayers forwarding xrInitializeLoaderKHR call to API layer "
+ "before calling xrNegotiateLoaderApiLayerInterface.");
+ XrResult res = initLoader(LoaderInitData::instance().getParam());
+ if (!XR_SUCCEEDED(res)) {
+ LoaderLogger::LogErrorMessage(
+ openxr_command, "ApiLayerInterface::LoadApiLayers forwarded call to xrInitializeLoaderKHR failed.");
+
+ LoaderPlatformLibraryClose(layer_library);
+ return res;
+ }
+ forwardedInitLoader = true;
+ }
+ }
+#endif
// Get and settle on an layer interface version (using any provided name if required).
std::string function_name = manifest_file->GetFunctionName("xrNegotiateLoaderApiLayerInterface");
@@ -324,6 +357,38 @@ XrResult ApiLayerInterface::LoadApiLayers(const std::string& openxr_command, uin
LoaderLogger::LogWarningMessage(openxr_command, warning_message);
res = XR_ERROR_FILE_CONTENTS_INVALID;
}
+
+#ifdef XR_KHR_LOADER_INIT_SUPPORT
+ if (XR_SUCCEEDED(res) && !forwardedInitLoader) {
+ // Forward initialize loader call, where possible and if we did not do so before.
+ PFN_xrVoidFunction initializeVoid = nullptr;
+ PFN_xrInitializeLoaderKHR initialize = nullptr;
+
+ // Now we may try asking xrGetInstanceProcAddr on the API layer
+ if (XR_SUCCEEDED(api_layer_info.getInstanceProcAddr(XR_NULL_HANDLE, "xrInitializeLoaderKHR", &initializeVoid))) {
+ if (initializeVoid == nullptr) {
+ LoaderLogger::LogErrorMessage(openxr_command,
+ "ApiLayerInterface::LoadApiLayers got success from xrGetInstanceProcAddr "
+ "for xrInitializeLoaderKHR, but output a null pointer.");
+ res = XR_ERROR_RUNTIME_FAILURE;
+ } else {
+ initialize = reinterpret_cast<PFN_xrInitializeLoaderKHR>(initializeVoid);
+ }
+ }
+ if (initialize != nullptr) {
+ // we found the entry point one way or another.
+ LoaderLogger::LogInfoMessage(openxr_command,
+ "ApiLayerInterface::LoadApiLayers forwarding xrInitializeLoaderKHR call to API layer "
+ "after calling xrNegotiateLoaderApiLayerInterface.");
+ res = initialize(LoaderInitData::instance().getParam());
+ if (!XR_SUCCEEDED(res)) {
+ LoaderLogger::LogErrorMessage(
+ openxr_command, "ApiLayerInterface::LoadApiLayers forwarded call to xrInitializeLoaderKHR failed.");
+ }
+ }
+ }
+#endif
+
if (XR_FAILED(res)) {
if (!any_loaded) {
last_error = res;
diff --git a/thirdparty/openxr/src/loader/api_layer_interface.hpp b/thirdparty/openxr/src/loader/api_layer_interface.hpp
index 98685b0c32..43758b31a4 100644
--- a/thirdparty/openxr/src/loader/api_layer_interface.hpp
+++ b/thirdparty/openxr/src/loader/api_layer_interface.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -14,9 +14,9 @@
#include <memory>
#include <openxr/openxr.h>
+#include <openxr/openxr_loader_negotiation.h>
#include "loader_platform.hpp"
-#include "loader_interfaces.h"
struct XrGeneratedDispatchTable;
diff --git a/thirdparty/openxr/src/loader/exception_handling.hpp b/thirdparty/openxr/src/loader/exception_handling.hpp
index bc0d9b65e3..62395fdf69 100644
--- a/thirdparty/openxr/src/loader/exception_handling.hpp
+++ b/thirdparty/openxr/src/loader/exception_handling.hpp
@@ -1,8 +1,8 @@
-// Copyright (c) 2019-2023, The Khronos Group Inc.
+// Copyright (c) 2019-2024, The Khronos Group Inc.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
-// Initial Author: Ryan Pavlik <ryan.pavlik@collabora.com>
+// Initial Author: Rylie Pavlik <rylie.pavlik@collabora.com>
//
// Provides protection for C ABI functions if standard library functions may throw.
diff --git a/thirdparty/openxr/src/loader/loader_core.cpp b/thirdparty/openxr/src/loader/loader_core.cpp
index 06e6870053..8bf2609a08 100644
--- a/thirdparty/openxr/src/loader/loader_core.cpp
+++ b/thirdparty/openxr/src/loader/loader_core.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -14,6 +14,7 @@
#include "api_layer_interface.hpp"
#include "exception_handling.hpp"
#include "hex_and_handles.h"
+#include "loader_init_data.hpp"
#include "loader_instance.hpp"
#include "loader_logger_recorders.hpp"
#include "loader_logger.hpp"
@@ -77,7 +78,7 @@ inline bool IsMissingNullTerminator(const char (&str)[max_length]) {
#ifdef XR_KHR_LOADER_INIT_SUPPORT // platforms that support XR_KHR_loader_init.
XRAPI_ATTR XrResult XRAPI_CALL LoaderXrInitializeLoaderKHR(const XrLoaderInitInfoBaseHeaderKHR *loaderInitInfo) XRLOADER_ABI_TRY {
LoaderLogger::LogVerboseMessage("xrInitializeLoaderKHR", "Entering loader trampoline");
- return InitializeLoader(loaderInitInfo);
+ return InitializeLoaderInitData(loaderInitInfo);
}
XRLOADER_ABI_CATCH_FALLBACK
#endif
diff --git a/thirdparty/openxr/src/loader/loader_init_data.cpp b/thirdparty/openxr/src/loader/loader_init_data.cpp
new file mode 100644
index 0000000000..11d3c4e77b
--- /dev/null
+++ b/thirdparty/openxr/src/loader/loader_init_data.cpp
@@ -0,0 +1,59 @@
+// Copyright (c) 2017-2024, The Khronos Group Inc.
+// Copyright (c) 2017-2019 Valve Corporation
+// Copyright (c) 2017-2019 LunarG, Inc.
+//
+// SPDX-License-Identifier: Apache-2.0 OR MIT
+//
+// Initial Author: Mark Young <marky@lunarg.com>
+//
+
+#include "loader_init_data.hpp"
+
+#ifdef XR_KHR_LOADER_INIT_SUPPORT
+
+#ifdef XR_USE_PLATFORM_ANDROID
+// Check and copy the Android-specific init data.
+XrResult LoaderInitData::initialize(const XrLoaderInitInfoBaseHeaderKHR* info) {
+ if (info->type != XR_TYPE_LOADER_INIT_INFO_ANDROID_KHR) {
+ return XR_ERROR_VALIDATION_FAILURE;
+ }
+ auto cast_info = reinterpret_cast<XrLoaderInitInfoAndroidKHR const*>(info);
+
+ if (cast_info->applicationVM == nullptr) {
+ return XR_ERROR_VALIDATION_FAILURE;
+ }
+ if (cast_info->applicationContext == nullptr) {
+ return XR_ERROR_VALIDATION_FAILURE;
+ }
+
+ // Copy and store the JVM pointer and Android Context, ensuring the JVM is initialised.
+ _data = *cast_info;
+ _data.next = nullptr;
+ jni::init(static_cast<jni::JavaVM*>(_data.applicationVM));
+ const jni::Object context = jni::Object{static_cast<jni::jobject>(_data.applicationContext)};
+
+ // Retrieve a reference to the Android AssetManager.
+ const auto assetManager = context.call<jni::Object>("getAssets()Landroid/content/res/AssetManager;");
+ _android_asset_manager = AAssetManager_fromJava(jni::env(), assetManager.getHandle());
+
+ // Retrieve the path to the native libraries.
+ const auto applicationContext = context.call<jni::Object>("getApplicationContext()Landroid/content/Context;");
+ const auto applicationInfo = context.call<jni::Object>("getApplicationInfo()Landroid/content/pm/ApplicationInfo;");
+ _native_library_path = applicationInfo.get<std::string>("nativeLibraryDir");
+
+ _initialized = true;
+ return XR_SUCCESS;
+}
+#endif // XR_USE_PLATFORM_ANDROID
+
+XrResult InitializeLoaderInitData(const XrLoaderInitInfoBaseHeaderKHR* loaderInitInfo) {
+ return LoaderInitData::instance().initialize(loaderInitInfo);
+}
+
+#ifdef XR_USE_PLATFORM_ANDROID
+std::string GetAndroidNativeLibraryDir() { return LoaderInitData::instance()._native_library_path; }
+
+void* Android_Get_Asset_Manager() { return LoaderInitData::instance()._android_asset_manager; }
+#endif // XR_USE_PLATFORM_ANDROID
+
+#endif // XR_KHR_LOADER_INIT_SUPPORT
diff --git a/thirdparty/openxr/src/loader/loader_init_data.hpp b/thirdparty/openxr/src/loader/loader_init_data.hpp
new file mode 100644
index 0000000000..fe6bc134d3
--- /dev/null
+++ b/thirdparty/openxr/src/loader/loader_init_data.hpp
@@ -0,0 +1,92 @@
+// Copyright (c) 2017-2024, The Khronos Group Inc.
+// Copyright (c) 2017-2019 Valve Corporation
+// Copyright (c) 2017-2019 LunarG, Inc.
+//
+// SPDX-License-Identifier: Apache-2.0 OR MIT
+//
+// Initial Author: Mark Young <marky@lunarg.com>
+//
+
+#pragma once
+
+#include <xr_dependencies.h>
+#include <openxr/openxr_platform.h>
+
+#ifdef XR_USE_PLATFORM_ANDROID
+#include <json/value.h>
+#include <android/asset_manager_jni.h>
+#include "android_utilities.h"
+#endif // XR_USE_PLATFORM_ANDROID
+
+#ifdef XR_KHR_LOADER_INIT_SUPPORT
+
+/*!
+ * Stores a copy of the data passed to the xrInitializeLoaderKHR function in a singleton.
+ */
+class LoaderInitData {
+ public:
+ /*!
+ * Singleton accessor.
+ */
+ static LoaderInitData& instance() {
+ static LoaderInitData obj;
+ return obj;
+ }
+
+#ifdef XR_USE_PLATFORM_ANDROID
+ /*!
+ * Type alias for the platform-specific structure type.
+ */
+ using StructType = XrLoaderInitInfoAndroidKHR;
+ /*!
+ * Native library path.
+ */
+ std::string _native_library_path;
+ /*!
+ * Android asset manager.
+ */
+ AAssetManager* _android_asset_manager;
+#else
+#error "Platform specific XR_KHR_loader_init structure is not defined for this platform."
+#endif
+
+ /*!
+ * Get our copy of the data, casted to pass to the runtime's matching method.
+ */
+ const XrLoaderInitInfoBaseHeaderKHR* getParam() const { return reinterpret_cast<const XrLoaderInitInfoBaseHeaderKHR*>(&_data); }
+
+ /*!
+ * Get the data via its real structure type.
+ */
+ const StructType& getData() const { return _data; }
+
+ /*!
+ * Has this been correctly initialized?
+ */
+ bool initialized() const noexcept { return _initialized; }
+
+ /*!
+ * Initialize loader data - called by InitializeLoaderInitData() and thus ultimately by the loader's xrInitializeLoaderKHR
+ * implementation. Each platform that needs this extension will provide an implementation of this.
+ */
+ XrResult initialize(const XrLoaderInitInfoBaseHeaderKHR* info);
+
+ private:
+ //! Private constructor, forces use of singleton accessor.
+ LoaderInitData() = default;
+ //! Platform-specific init data
+ StructType _data = {};
+ //! Flag for indicating whether _data is valid.
+ bool _initialized = false;
+};
+
+//! Initialize loader init data, where required.
+XrResult InitializeLoaderInitData(const XrLoaderInitInfoBaseHeaderKHR* loaderInitInfo);
+
+#ifdef XR_USE_PLATFORM_ANDROID
+XrResult GetPlatformRuntimeVirtualManifest(Json::Value& out_manifest);
+std::string GetAndroidNativeLibraryDir();
+void* Android_Get_Asset_Manager();
+#endif // XR_USE_PLATFORM_ANDROID
+
+#endif // XR_KHR_LOADER_INIT_SUPPORT
diff --git a/thirdparty/openxr/src/loader/loader_instance.cpp b/thirdparty/openxr/src/loader/loader_instance.cpp
index ce5c205505..f18230087f 100644
--- a/thirdparty/openxr/src/loader/loader_instance.cpp
+++ b/thirdparty/openxr/src/loader/loader_instance.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -15,13 +15,13 @@
#include "api_layer_interface.hpp"
#include "hex_and_handles.h"
-#include "loader_interfaces.h"
#include "loader_logger.hpp"
#include "runtime_interface.hpp"
#include "xr_generated_dispatch_table_core.h"
#include "xr_generated_loader.hpp"
#include <openxr/openxr.h>
+#include <openxr/openxr_loader_negotiation.h>
#include <cstring>
#include <memory>
@@ -60,7 +60,7 @@ XrResult Get(LoaderInstance** loader_instance, const char* log_function_name) {
bool IsAvailable() { return GetSetCurrentLoaderInstance() != nullptr; }
-void Remove() { GetSetCurrentLoaderInstance().release(); }
+void Remove() { GetSetCurrentLoaderInstance().reset(nullptr); }
} // namespace ActiveLoaderInstance
// Extensions that are supported by the loader, but may not be supported
diff --git a/thirdparty/openxr/src/loader/loader_instance.hpp b/thirdparty/openxr/src/loader/loader_instance.hpp
index a0268a855c..b99e6b047f 100644
--- a/thirdparty/openxr/src/loader/loader_instance.hpp
+++ b/thirdparty/openxr/src/loader/loader_instance.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -10,9 +10,9 @@
#pragma once
#include "extra_algorithms.h"
-#include "loader_interfaces.h"
#include <openxr/openxr.h>
+#include <openxr/openxr_loader_negotiation.h>
#include <array>
#include <cmath>
diff --git a/thirdparty/openxr/src/loader/loader_logger.cpp b/thirdparty/openxr/src/loader/loader_logger.cpp
index 1c8d64f394..593e19a3ba 100644
--- a/thirdparty/openxr/src/loader/loader_logger.cpp
+++ b/thirdparty/openxr/src/loader/loader_logger.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/loader/loader_logger.hpp b/thirdparty/openxr/src/loader/loader_logger.hpp
index d31fac093a..964aa47962 100644
--- a/thirdparty/openxr/src/loader/loader_logger.hpp
+++ b/thirdparty/openxr/src/loader/loader_logger.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/loader/loader_logger_recorders.cpp b/thirdparty/openxr/src/loader/loader_logger_recorders.cpp
index 32e4687b2f..00392c27bd 100644
--- a/thirdparty/openxr/src/loader/loader_logger_recorders.cpp
+++ b/thirdparty/openxr/src/loader/loader_logger_recorders.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/loader/loader_logger_recorders.hpp b/thirdparty/openxr/src/loader/loader_logger_recorders.hpp
index 7b934202d5..b676c37e93 100644
--- a/thirdparty/openxr/src/loader/loader_logger_recorders.hpp
+++ b/thirdparty/openxr/src/loader/loader_logger_recorders.hpp
@@ -1,10 +1,10 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
-// Initial Author: Ryan Pavlik <ryan.pavlik@collabora.com>
+// Initial Author: Rylie Pavlik <rylie.pavlik@collabora.com>
//
#pragma once
diff --git a/thirdparty/openxr/src/loader/loader_platform.hpp b/thirdparty/openxr/src/loader/loader_platform.hpp
index 0ea80c05b8..964116caa4 100644
--- a/thirdparty/openxr/src/loader/loader_platform.hpp
+++ b/thirdparty/openxr/src/loader/loader_platform.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/loader/manifest_file.cpp b/thirdparty/openxr/src/loader/manifest_file.cpp
index 0683bc166a..f9699ece40 100644
--- a/thirdparty/openxr/src/loader/manifest_file.cpp
+++ b/thirdparty/openxr/src/loader/manifest_file.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -18,6 +18,7 @@
#endif // OPENXR_HAVE_COMMON_CONFIG
#include "filesystem_utils.hpp"
+#include "loader_init_data.hpp"
#include "loader_platform.hpp"
#include "platform_utils.hpp"
#include "loader_logger.hpp"
@@ -666,14 +667,14 @@ XrResult RuntimeManifestFile::FindManifestFiles(std::vector<std::unique_ptr<Runt
}
#else
-#if defined(XR_KHR_LOADER_INIT_SUPPORT)
+#if defined(XR_USE_PLATFORM_ANDROID)
Json::Value virtualManifest;
result = GetPlatformRuntimeVirtualManifest(virtualManifest);
if (XR_SUCCESS == result) {
RuntimeManifestFile::CreateIfValid(virtualManifest, "", manifest_files);
return result;
}
-#endif // defined(XR_KHR_LOADER_INIT_SUPPORT)
+#endif // defined(XR_USE_PLATFORM_ANDROID)
if (!PlatformGetGlobalRuntimeFileName(XR_VERSION_MAJOR(XR_CURRENT_API_VERSION), filename)) {
LoaderLogger::LogErrorMessage(
"", "RuntimeManifestFile::FindManifestFiles - failed to determine active runtime file path for this environment");
diff --git a/thirdparty/openxr/src/loader/manifest_file.hpp b/thirdparty/openxr/src/loader/manifest_file.hpp
index 46b842c663..52fe3134b0 100644
--- a/thirdparty/openxr/src/loader/manifest_file.hpp
+++ b/thirdparty/openxr/src/loader/manifest_file.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017 Valve Corporation
// Copyright (c) 2017 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/loader/runtime_interface.cpp b/thirdparty/openxr/src/loader/runtime_interface.cpp
index 8312b15ba4..7812aca987 100644
--- a/thirdparty/openxr/src/loader/runtime_interface.cpp
+++ b/thirdparty/openxr/src/loader/runtime_interface.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -9,14 +9,15 @@
#include "runtime_interface.hpp"
+#include <openxr/openxr.h>
+#include <openxr/openxr_loader_negotiation.h>
+
#include "manifest_file.hpp"
-#include "loader_interfaces.h"
+#include "loader_init_data.hpp"
#include "loader_logger.hpp"
#include "loader_platform.hpp"
#include "xr_generated_dispatch_table_core.h"
-#include <openxr/openxr.h>
-
#include <cstring>
#include <memory>
#include <mutex>
@@ -26,8 +27,6 @@
#include <vector>
#ifdef XR_USE_PLATFORM_ANDROID
-#include "android_utilities.h"
-#include <android/asset_manager_jni.h>
#include <json/value.h>
// Needed for the loader init struct
@@ -35,112 +34,6 @@
#include <openxr/openxr_platform.h>
#endif // XR_USE_PLATFORM_ANDROID
-#ifdef XR_KHR_LOADER_INIT_SUPPORT
-namespace {
-/*!
- * Stores a copy of the data passed to the xrInitializeLoaderKHR function in a singleton.
- */
-class LoaderInitData {
- public:
- /*!
- * Singleton accessor.
- */
- static LoaderInitData& instance() {
- static LoaderInitData obj;
- return obj;
- }
-
-#ifdef XR_USE_PLATFORM_ANDROID
- /*!
- * Type alias for the platform-specific structure type.
- */
- using StructType = XrLoaderInitInfoAndroidKHR;
- /*!
- * Native library path.
- */
- std::string _native_library_path;
- /*!
- * Android asset manager.
- */
- AAssetManager* _android_asset_manager;
-#endif
-
- /*!
- * Get our copy of the data, casted to pass to the runtime's matching method.
- */
- const XrLoaderInitInfoBaseHeaderKHR* getParam() const { return reinterpret_cast<const XrLoaderInitInfoBaseHeaderKHR*>(&_data); }
-
- /*!
- * Get the data via its real structure type.
- */
- const StructType& getData() const { return _data; }
-
- /*!
- * Has this been correctly initialized?
- */
- bool initialized() const noexcept { return _initialized; }
-
- /*!
- * Initialize loader data - called by InitializeLoader() and thus ultimately by the loader's xrInitializeLoaderKHR
- * implementation. Each platform that needs this extension will provide an implementation of this.
- */
- XrResult initialize(const XrLoaderInitInfoBaseHeaderKHR* info);
-
- private:
- //! Private constructor, forces use of singleton accessor.
- LoaderInitData() = default;
- //! Platform-specific init data
- StructType _data = {};
- //! Flag for indicating whether _data is valid.
- bool _initialized = false;
-};
-
-#ifdef XR_USE_PLATFORM_ANDROID
-// Check and copy the Android-specific init data.
-XrResult LoaderInitData::initialize(const XrLoaderInitInfoBaseHeaderKHR* info) {
- if (info->type != XR_TYPE_LOADER_INIT_INFO_ANDROID_KHR) {
- return XR_ERROR_VALIDATION_FAILURE;
- }
- auto cast_info = reinterpret_cast<XrLoaderInitInfoAndroidKHR const*>(info);
-
- if (cast_info->applicationVM == nullptr) {
- return XR_ERROR_VALIDATION_FAILURE;
- }
- if (cast_info->applicationContext == nullptr) {
- return XR_ERROR_VALIDATION_FAILURE;
- }
-
- // Copy and store the JVM pointer and Android Context, ensuring the JVM is initialised.
- _data = *cast_info;
- _data.next = nullptr;
- jni::init(static_cast<jni::JavaVM*>(_data.applicationVM));
- const jni::Object context = jni::Object{static_cast<jni::jobject>(_data.applicationContext)};
-
- // Retrieve a reference to the Android AssetManager.
- const auto assetManager = context.call<jni::Object>("getAssets()Landroid/content/res/AssetManager;");
- _android_asset_manager = AAssetManager_fromJava(jni::env(), assetManager.getHandle());
-
- // Retrieve the path to the native libraries.
- const auto applicationContext = context.call<jni::Object>("getApplicationContext()Landroid/content/Context;");
- const auto applicationInfo = context.call<jni::Object>("getApplicationInfo()Landroid/content/pm/ApplicationInfo;");
- _native_library_path = applicationInfo.get<std::string>("nativeLibraryDir");
-
- _initialized = true;
- return XR_SUCCESS;
-}
-#endif // XR_USE_PLATFORM_ANDROID
-} // namespace
-
-XrResult InitializeLoader(const XrLoaderInitInfoBaseHeaderKHR* loaderInitInfo) {
- return LoaderInitData::instance().initialize(loaderInitInfo);
-}
-
-std::string GetAndroidNativeLibraryDir() { return LoaderInitData::instance()._native_library_path; }
-
-void* Android_Get_Asset_Manager() { return LoaderInitData::instance()._android_asset_manager; }
-
-#endif // XR_KHR_LOADER_INIT_SUPPORT
-
#ifdef XR_USE_PLATFORM_ANDROID
XrResult GetPlatformRuntimeVirtualManifest(Json::Value& out_manifest) {
using wrap::android::content::Context;
diff --git a/thirdparty/openxr/src/loader/runtime_interface.hpp b/thirdparty/openxr/src/loader/runtime_interface.hpp
index 8d55ec674a..093f8ba767 100644
--- a/thirdparty/openxr/src/loader/runtime_interface.hpp
+++ b/thirdparty/openxr/src/loader/runtime_interface.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -19,22 +19,10 @@
#include <mutex>
#include <memory>
-#ifdef XR_USE_PLATFORM_ANDROID
-#define XR_KHR_LOADER_INIT_SUPPORT
-#endif
-
namespace Json {
class Value;
}
-#ifdef XR_KHR_LOADER_INIT_SUPPORT
-//! Initialize loader, where required.
-XrResult InitializeLoader(const XrLoaderInitInfoBaseHeaderKHR* loaderInitInfo);
-XrResult GetPlatformRuntimeVirtualManifest(Json::Value& out_manifest);
-std::string GetAndroidNativeLibraryDir();
-void* Android_Get_Asset_Manager();
-#endif
-
class RuntimeManifestFile;
struct XrGeneratedDispatchTable;
diff --git a/thirdparty/openxr/src/loader/xr_generated_loader.cpp b/thirdparty/openxr/src/loader/xr_generated_loader.cpp
index 8c79afddc5..7bddbdc3ea 100644
--- a/thirdparty/openxr/src/loader/xr_generated_loader.cpp
+++ b/thirdparty/openxr/src/loader/xr_generated_loader.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
// SPDX-License-Identifier: Apache-2.0 OR MIT
@@ -6,7 +6,7 @@
// See loader_source_generator.py for modifications
// ************************************************************
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/loader/xr_generated_loader.hpp b/thirdparty/openxr/src/loader/xr_generated_loader.hpp
index e28e35bbcf..68a6b9470d 100644
--- a/thirdparty/openxr/src/loader/xr_generated_loader.hpp
+++ b/thirdparty/openxr/src/loader/xr_generated_loader.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
// SPDX-License-Identifier: Apache-2.0 OR MIT
@@ -6,7 +6,7 @@
// See loader_source_generator.py for modifications
// ************************************************************
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -34,10 +34,9 @@
#include "xr_dependencies.h"
#include "openxr/openxr.h"
+#include "openxr/openxr_loader_negotiation.h"
#include "openxr/openxr_platform.h"
-#include "loader_interfaces.h"
-
#include "loader_instance.hpp"
#include "loader_platform.hpp"
diff --git a/thirdparty/openxr/src/xr_generated_dispatch_table_core.c b/thirdparty/openxr/src/xr_generated_dispatch_table_core.c
index de88ef7e6c..e73e8b2b95 100644
--- a/thirdparty/openxr/src/xr_generated_dispatch_table_core.c
+++ b/thirdparty/openxr/src/xr_generated_dispatch_table_core.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019, Valve Corporation
// Copyright (c) 2017-2019, LunarG, Inc.
@@ -8,7 +8,7 @@
// See utility_source_generator.py for modifications
// ************************************************************
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/xr_generated_dispatch_table_core.h b/thirdparty/openxr/src/xr_generated_dispatch_table_core.h
index 0f3e7e0502..5871231267 100644
--- a/thirdparty/openxr/src/xr_generated_dispatch_table_core.h
+++ b/thirdparty/openxr/src/xr_generated_dispatch_table_core.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019, Valve Corporation
// Copyright (c) 2017-2019, LunarG, Inc.
@@ -8,7 +8,7 @@
// See utility_source_generator.py for modifications
// ************************************************************
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/thorvg/AUTHORS b/thirdparty/thorvg/AUTHORS
index 3a459e9bb4..d5d5e9be97 100644
--- a/thirdparty/thorvg/AUTHORS
+++ b/thirdparty/thorvg/AUTHORS
@@ -23,3 +23,5 @@ Rafał Mikrut <mikrutrafal@protonmail.com>
Martin Capitanio <capnm@capitanio.org>
RuiwenTang <tangruiwen1989@gmail.com>
YouJin Lee <ol-of@naver.com>
+SergeyLebedkin <sergii@lottiefiles.com>
+Jinny You <jinny@lottiefiles.com>
diff --git a/thirdparty/thorvg/LICENSE b/thirdparty/thorvg/LICENSE
index d056ff6cbf..f97be65005 100644
--- a/thirdparty/thorvg/LICENSE
+++ b/thirdparty/thorvg/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2020 - 2023 notice for the ThorVG Project (see AUTHORS)
+Copyright (c) 2020 - 2024 notice for the ThorVG Project (see AUTHORS)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
diff --git a/thirdparty/thorvg/inc/config.h b/thirdparty/thorvg/inc/config.h
index 98f35a6e45..d1abc5a290 100644
--- a/thirdparty/thorvg/inc/config.h
+++ b/thirdparty/thorvg/inc/config.h
@@ -9,5 +9,5 @@
// For internal debugging:
//#define THORVG_LOG_ENABLED
-#define THORVG_VERSION_STRING "0.11.6"
+#define THORVG_VERSION_STRING "0.12.0"
#endif
diff --git a/thirdparty/thorvg/inc/thorvg.h b/thirdparty/thorvg/inc/thorvg.h
index 20acda7667..6aee53f7e0 100644
--- a/thirdparty/thorvg/inc/thorvg.h
+++ b/thirdparty/thorvg/inc/thorvg.h
@@ -1,17 +1,3 @@
-/*!
- * @file thorvg.h
- *
- * The main APIs enabling the TVG initialization, preparation of the canvas and provisioning of its content:
- * - drawing shapes: line, arc, curve, path, polygon...
- * - drawing pictures: tvg, svg, png, jpg, bitmap...
- * - drawing fillings: solid, linear and radial gradient...
- * - drawing stroking: continuous stroking with arbitrary width, join, cap, dash styles.
- * - drawing composition: blending, masking, path clipping...
- * - drawing scene graph & affine transformation (translation, rotation, scale, ...)
- * and finally drawing the canvas and TVG termination.
- */
-
-
#ifndef _THORVG_H_
#define _THORVG_H_
@@ -172,10 +158,10 @@ enum class CompositeMethod
InvAlphaMask, ///< Alpha Masking using the complement to the compositing target's pixels as an alpha value.
LumaMask, ///< Alpha Masking using the grayscale (0.2125R + 0.7154G + 0.0721*B) of the compositing target's pixels. @since 0.9
InvLumaMask, ///< Alpha Masking using the grayscale (0.2125R + 0.7154G + 0.0721*B) of the complement to the compositing target's pixels.
- AddMask, ///< Combines the target and source objects pixels using target alpha. (T * TA) + (S * (255 - TA)) @BETA_API
- SubtractMask, ///< Subtracts the source color from the target color while considering their respective target alpha. (T * TA) - (S * (255 - TA)) @BETA_API
- IntersectMask, ///< Computes the result by taking the minimum value between the target alpha and the source alpha and multiplies it with the target color. (T * min(TA, SA)) @BETA_API
- DifferenceMask ///< Calculates the absolute difference between the target color and the source color multiplied by the complement of the target alpha. abs(T - S * (255 - TA)) @BETA_API
+ AddMask, ///< Combines the target and source objects pixels using target alpha. (T * TA) + (S * (255 - TA)) (Experimental API)
+ SubtractMask, ///< Subtracts the source color from the target color while considering their respective target alpha. (T * TA) - (S * (255 - TA)) (Experimental API)
+ IntersectMask, ///< Computes the result by taking the minimum value between the target alpha and the source alpha and multiplies it with the target color. (T * min(TA, SA)) (Experimental API)
+ DifferenceMask ///< Calculates the absolute difference between the target color and the source color multiplied by the complement of the target alpha. abs(T - S * (255 - TA)) (Experimental API)
};
@@ -186,7 +172,7 @@ enum class CompositeMethod
*
* @see Paint::blend()
*
- * @BETA_API
+ * @note Experimental API
*/
enum class BlendMethod : uint8_t
{
@@ -213,7 +199,8 @@ enum class BlendMethod : uint8_t
enum class CanvasEngine
{
Sw = (1 << 1), ///< CPU rasterizer.
- Gl = (1 << 2) ///< OpenGL rasterizer.
+ Gl = (1 << 2), ///< OpenGL rasterizer.
+ Wg = (1 << 3), ///< WebGPU rasterizer. (Experimental API)
};
@@ -247,7 +234,7 @@ struct Matrix
* @param pt The vertex coordinate
* @param uv The normalized texture coordinate in the range (0.0..1.0, 0.0..1.0)
*
- * @BETA_API
+ * @note Experimental API
*/
struct Vertex
{
@@ -261,7 +248,7 @@ struct Vertex
*
* @param vertex The three vertices that make up the polygon
*
- * @BETA_API
+ * @note Experimental API
*/
struct Polygon
{
@@ -291,7 +278,7 @@ public:
*
* @param[in] degree The value of the angle in degrees.
*
- * @return Result::Success when succeed, Result::FailedAllocation otherwise.
+ * @retval Result::Success when succeed, Result::FailedAllocation otherwise.
*/
Result rotate(float degree) noexcept;
@@ -300,7 +287,7 @@ public:
*
* @param[in] factor The value of the scaling factor. The default value is 1.
*
- * @return Result::Success when succeed, Result::FailedAllocation otherwise.
+ * @retval Result::Success when succeed, Result::FailedAllocation otherwise.
*/
Result scale(float factor) noexcept;
@@ -313,7 +300,7 @@ public:
* @param[in] x The value of the horizontal shift.
* @param[in] y The value of the vertical shift.
*
- * @return Result::Success when succeed, Result::FailedAllocation otherwise.
+ * @retval Result::Success when succeed, Result::FailedAllocation otherwise.
*/
Result translate(float x, float y) noexcept;
@@ -324,7 +311,7 @@ public:
*
* @param[in] m The 3x3 augmented matrix.
*
- * @return Result::Success when succeed, Result::FailedAllocation otherwise.
+ * @retval Result::Success when succeed, Result::FailedAllocation otherwise.
*/
Result transform(const Matrix& m) noexcept;
@@ -345,7 +332,7 @@ public:
*
* @param[in] o The opacity value in the range [0 ~ 255], where 0 is completely transparent and 255 is opaque.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*
* @note Setting the opacity with this API may require multiple render pass for composition. It is recommended to avoid changing the opacity if possible.
* @note ClipPath won't use the opacity value. (see: enum class CompositeMethod::ClipPath)
@@ -358,7 +345,7 @@ public:
* @param[in] target The paint of the target object.
* @param[in] method The method used to composite the source object with the target.
*
- * @return Result::Success when succeed, Result::InvalidArguments otherwise.
+ * @retval Result::Success when succeed, Result::InvalidArguments otherwise.
*/
Result composite(std::unique_ptr<Paint> target, CompositeMethod method) noexcept;
@@ -371,9 +358,9 @@ public:
*
* @param[in] method The blending method to be set.
*
- * @return Result::Success when the blending method is successfully set.
+ * @retval Result::Success when the blending method is successfully set.
*
- * @BETA_API
+ * @note Experimental API
*/
Result blend(BlendMethod method) const noexcept;
@@ -404,7 +391,7 @@ public:
* @param[out] h The height of the object.
* @param[in] transformed If @c true, the paint's transformations are taken into account, otherwise they aren't.
*
- * @return Result::Success when succeed, Result::InsufficientCondition otherwise.
+ * @retval Result::Success when succeed, Result::InsufficientCondition otherwise.
*
* @note The bounding box doesn't indicate the actual drawing region. It's the smallest rectangle that encloses the object.
*/
@@ -442,7 +429,7 @@ public:
*
* @return The blending method
*
- * @BETA_API
+ * @note Experimental API
*/
BlendMethod blend() const noexcept;
@@ -493,7 +480,7 @@ public:
* @param[in] colorStops An array of ColorStop data structure.
* @param[in] cnt The count of the @p colorStops array equal to the colors number used in the gradient.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*/
Result colorStops(const ColorStop* colorStops, uint32_t cnt) noexcept;
@@ -502,7 +489,7 @@ public:
*
* @param[in] s The FillSpread value.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*/
Result spread(FillSpread s) noexcept;
@@ -513,7 +500,7 @@ public:
*
* @param[in] m The 3x3 augmented matrix.
*
- * @return Result::Success when succeed, Result::FailedAllocation otherwise.
+ * @retval Result::Success when succeed, Result::FailedAllocation otherwise.
*/
Result transform(const Matrix& m) noexcept;
@@ -538,7 +525,7 @@ public:
*
* In case no transformation was applied, the identity matrix is returned.
*
- * @retval The augmented transformation matrix.
+ * @return The augmented transformation matrix.
*/
Matrix transform() const noexcept;
@@ -600,7 +587,7 @@ public:
* @warning Please avoid accessing the paints during Canvas update/draw. You can access them after calling sync().
* @see Canvas::sync()
*
- * @BETA_API
+ * @note Experimental API
*/
std::list<Paint*>& paints() noexcept;
@@ -631,7 +618,7 @@ public:
*
* @param[in] free If @c true, the memory occupied by paints is deallocated, otherwise it is not.
*
- * @return Result::Success when succeed, Result::InsufficientCondition otherwise.
+ * @retval Result::Success when succeed, Result::InsufficientCondition otherwise.
*
* @see Canvas::push()
* @see Canvas::paints()
@@ -646,7 +633,7 @@ public:
*
* @param[in] paint A pointer to the Paint object or @c nullptr.
*
- * @return Result::Success when succeed, Result::InsufficientCondition otherwise.
+ * @retval Result::Success when succeed, Result::InsufficientCondition otherwise.
*
* @note The Update behavior can be asynchronous if the assigned thread number is greater than zero.
*/
@@ -655,7 +642,7 @@ public:
/**
* @brief Requests the canvas to draw the Paint objects.
*
- * @return Result::Success when succeed, Result::InsufficientCondition otherwise.
+ * @retval Result::Success when succeed, Result::InsufficientCondition otherwise.
*
* @note Drawing can be asynchronous if the assigned thread number is greater than zero. To guarantee the drawing is done, call sync() afterwards.
* @see Canvas::sync()
@@ -668,7 +655,7 @@ public:
* The Canvas rendering can be performed asynchronously. To make sure that rendering is finished,
* the sync() must be called after the draw() regardless of threading.
*
- * @return Result::Success when succeed, Result::InsufficientCondition otherwise.
+ * @retval Result::Success when succeed, Result::InsufficientCondition otherwise.
* @see Canvas::draw()
*/
virtual Result sync() noexcept;
@@ -702,7 +689,7 @@ public:
* @param[in] x2 The horizontal coordinate of the second point used to determine the gradient bounds.
* @param[in] y2 The vertical coordinate of the second point used to determine the gradient bounds.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*
* @note In case the first and the second points are equal, an object filled with such a gradient fill is not rendered.
*/
@@ -720,7 +707,7 @@ public:
* @param[out] x2 The horizontal coordinate of the second point used to determine the gradient bounds.
* @param[out] y2 The vertical coordinate of the second point used to determine the gradient bounds.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*/
Result linear(float* x1, float* y1, float* x2, float* y2) const noexcept;
@@ -764,7 +751,7 @@ public:
* @param[in] cy The vertical coordinate of the center of the bounding circle.
* @param[in] radius The radius of the bounding circle.
*
- * @return Result::Success when succeed, Result::InvalidArguments in case the @p radius value is zero or less.
+ * @retval Result::Success when succeed, Result::InvalidArguments in case the @p radius value is zero or less.
*/
Result radial(float cx, float cy, float radius) noexcept;
@@ -777,7 +764,7 @@ public:
* @param[out] cy The vertical coordinate of the center of the bounding circle.
* @param[out] radius The radius of the bounding circle.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*/
Result radial(float* cx, float* cy, float* radius) const noexcept;
@@ -823,7 +810,7 @@ public:
*
* The transformation matrix, the color, the fill and the stroke properties are retained.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*
* @note The memory, where the path data is stored, is not deallocated at this stage for caching effect.
*/
@@ -837,7 +824,7 @@ public:
* @param[in] x The horizontal coordinate of the initial point of the sub-path.
* @param[in] y The vertical coordinate of the initial point of the sub-path.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*/
Result moveTo(float x, float y) noexcept;
@@ -849,7 +836,7 @@ public:
* @param[in] x The horizontal coordinate of the end-point of the line.
* @param[in] y The vertical coordinate of the end-point of the line.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*
* @note In case this is the first command in the path, it corresponds to the moveTo() call.
*/
@@ -868,7 +855,7 @@ public:
* @param[in] x The horizontal coordinate of the end-point of the curve.
* @param[in] y The vertical coordinate of the end-point of the curve.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*
* @note In case this is the first command in the path, no data from the path are rendered.
*/
@@ -879,7 +866,7 @@ public:
*
* The value of the current point is set to the initial point of the closed sub-path.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*
* @note In case the sub-path does not contain any points, this function has no effect.
*/
@@ -905,7 +892,7 @@ public:
* @param[in] rx The x-axis radius of the ellipse defining the rounded corners of the rectangle.
* @param[in] ry The y-axis radius of the ellipse defining the rounded corners of the rectangle.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*
* @note For @p rx and @p ry greater than or equal to the half of @p w and the half of @p h, respectively, the shape become an ellipse.
*/
@@ -925,7 +912,7 @@ public:
* @param[in] rx The x-axis radius of the ellipse.
* @param[in] ry The y-axis radius of the ellipse.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*/
Result appendCircle(float cx, float cy, float rx, float ry) noexcept;
@@ -942,7 +929,7 @@ public:
* @param[in] sweep The central angle of the arc given in degrees, measured counter-clockwise from @p startAngle.
* @param[in] pie Specifies whether to draw radii from the arc's center to both of its end-point - drawn if @c true.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*
* @note Setting @p sweep value greater than 360 degrees, is equivalent to calling appendCircle(cx, cy, radius, radius).
*/
@@ -960,7 +947,7 @@ public:
* @param[in] pts The array of the two-dimensional points.
* @param[in] ptsCnt The number of the points in the @p pts array.
*
- * @return Result::Success when succeed, Result::InvalidArguments otherwise.
+ * @retval Result::Success when succeed, Result::InvalidArguments otherwise.
*
* @note The interface is designed for optimal path setting if the caller has a completed path commands already.
*/
@@ -971,7 +958,7 @@ public:
*
* @param[in] width The width of the stroke. The default value is 0.
*
- * @return Result::Success when succeed, Result::FailedAllocation otherwise.
+ * @retval Result::Success when succeed, Result::FailedAllocation otherwise.
*/
Result stroke(float width) noexcept;
@@ -983,7 +970,7 @@ public:
* @param[in] b The blue color channel value in the range [0 ~ 255]. The default value is 0.
* @param[in] a The alpha channel value in the range [0 ~ 255], where 0 is completely transparent and 255 is opaque. The default value is 0.
*
- * @return Result::Success when succeed, Result::FailedAllocation otherwise.
+ * @retval Result::Success when succeed, Result::FailedAllocation otherwise.
*/
Result stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) noexcept;
@@ -1018,7 +1005,7 @@ public:
*
* @param[in] cap The cap style value. The default value is @c StrokeCap::Square.
*
- * @return Result::Success when succeed, Result::FailedAllocation otherwise.
+ * @retval Result::Success when succeed, Result::FailedAllocation otherwise.
*/
Result stroke(StrokeCap cap) noexcept;
@@ -1029,7 +1016,7 @@ public:
*
* @param[in] join The join style value. The default value is @c StrokeJoin::Bevel.
*
- * @return Result::Success when succeed, Result::FailedAllocation otherwise.
+ * @retval Result::Success when succeed, Result::FailedAllocation otherwise.
*/
Result stroke(StrokeJoin join) noexcept;
@@ -1039,7 +1026,7 @@ public:
*
* @param[in] miterlimit The miterlimit imposes a limit on the extent of the stroke join, when the @c StrokeJoin::Miter join style is set. The default value is 4.
*
- * @return Result::Success when succeed, Result::NonSupport unsupported value, Result::FailedAllocation otherwise.
+ * @retval Result::Success when succeed, Result::NonSupport unsupported value, Result::FailedAllocation otherwise.
*
* @since 0.11
*/
@@ -1055,7 +1042,7 @@ public:
* @param[in] b The blue color channel value in the range [0 ~ 255]. The default value is 0.
* @param[in] a The alpha channel value in the range [0 ~ 255], where 0 is completely transparent and 255 is opaque. The default value is 0.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*
* @note Either a solid color or a gradient fill is applied, depending on what was set as last.
* @note ClipPath won't use the fill values. (see: enum class CompositeMethod::ClipPath)
@@ -1069,7 +1056,7 @@ public:
*
* @param[in] f The unique pointer to the gradient fill.
*
- * @return Result::Success when succeed, Result::MemoryCorruption otherwise.
+ * @retval Result::Success when succeed, Result::MemoryCorruption otherwise.
*
* @note Either a solid color or a gradient fill is applied, depending on what was set as last.
*/
@@ -1080,7 +1067,7 @@ public:
*
* @param[in] r The fill rule value. The default value is @c FillRule::Winding.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*/
Result fill(FillRule r) noexcept;
@@ -1090,7 +1077,7 @@ public:
*
* @param[in] strokeFirst If @c true the stroke is rendered before the fill, otherwise the stroke is rendered as the second one (the default option).
*
- * @return Result::Success when succeed, Result::FailedAllocation otherwise.
+ * @retval Result::Success when succeed, Result::FailedAllocation otherwise.
*
* @since 0.10
*/
@@ -1156,7 +1143,7 @@ public:
* @param[out] b The blue color channel value in the range [0 ~ 255].
* @param[out] a The alpha channel value in the range [0 ~ 255], where 0 is completely transparent and 255 is opaque.
*
- * @return Result::Success when succeed, Result::InsufficientCondition otherwise.
+ * @retval Result::Success when succeed, Result::InsufficientCondition otherwise.
*/
Result strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a = nullptr) const noexcept;
@@ -1295,7 +1282,7 @@ public:
* @param[in] w A new width of the image in pixels.
* @param[in] h A new height of the image in pixels.
*
- * @return Result::Success when succeed, Result::InsufficientCondition otherwise.
+ * @retval Result::Success when succeed, Result::InsufficientCondition otherwise.
*/
Result size(float w, float h) noexcept;
@@ -1305,13 +1292,20 @@ public:
* @param[out] w The width of the image in pixels.
* @param[out] h The height of the image in pixels.
*
- * @return Result::Success when succeed.
+ * @retval Result::Success when succeed.
*/
Result size(float* w, float* h) const noexcept;
/**
* @brief Loads a raw data from a memory block with a given size.
*
+ * @param[in] paint A Tvg_Paint pointer to the picture object.
+ * @param[in] data A pointer to a memory location where the content of the picture raw data is stored.
+ * @param[in] w The width of the image @p data in pixels.
+ * @param[in] h The height of the image @p data in pixels.
+ * @param[in] premultiplied If @c true, the given image data is alpha-premultiplied.
+ * @param[in] copy If @c true the data are copied into the engine local buffer, otherwise they are not.
+ *
* @retval Result::Success When succeed, Result::InsufficientCondition otherwise.
* @retval Result::FailedAllocation An internal error possibly with memory allocation.
*
@@ -1339,7 +1333,7 @@ public:
* @note The Polygons are copied internally, so modifying them after calling Mesh::mesh has no affect.
* @warning Please do not use it, this API is not official one. It could be modified in the next version.
*
- * @BETA_API
+ * @note Experimental API
*/
Result mesh(const Polygon* triangles, uint32_t triangleCnt) noexcept;
@@ -1348,12 +1342,12 @@ public:
*
* @param[out] triangles Optional. A pointer to the array of Polygons used by this mesh.
*
- * @return uint32_t The number of polygons in the array.
+ * @return The number of polygons in the array.
*
* @note Modifying the triangles returned by this method will modify them directly within the mesh.
* @warning Please do not use it, this API is not official one. It could be modified in the next version.
*
- * @BETA_API
+ * @note Experimental API
*/
uint32_t mesh(const Polygon** triangles) const noexcept;
@@ -1402,7 +1396,7 @@ public:
*
* @param[in] paint A Paint object to be drawn.
*
- * @return Result::Success when succeed, Result::MemoryCorruption otherwise.
+ * @retval Result::Success when succeed, Result::MemoryCorruption otherwise.
*
* @note The rendering order of the paints is the same as the order as they were pushed. Consider sorting the paints before pushing them if you intend to use layering.
* @see Scene::paints()
@@ -1432,7 +1426,7 @@ public:
* @see Scene::push()
* @see Scene::clear()
*
- * @BETA_API
+ * @note Experimental API
*/
std::list<Paint*>& paints() noexcept;
@@ -1442,7 +1436,7 @@ public:
*
* @param[in] free If @c true, the memory occupied by paints is deallocated, otherwise it is not.
*
- * @return Result::Success when succeed
+ * @retval Result::Success when succeed
*
* @warning If you don't free the paints they become dangled. They are supposed to be reused, otherwise you are responsible for their lives. Thus please use the @p free argument only when you know how it works, otherwise it's not recommended.
*
@@ -1471,6 +1465,138 @@ public:
/**
+ * @class Text
+ *
+ * @brief A class to represent text objects in a graphical context, allowing for rendering and manipulation of unicode text.
+ *
+ * @note Experimental API
+ */
+class TVG_API Text final : public Paint
+{
+public:
+ ~Text();
+
+ /**
+ * @brief Sets the font properties for the text.
+ *
+ * This function allows you to define the font characteristics used for text rendering.
+ * It sets the font name, size and optionally the style.
+ *
+ * @param[in] name The name of the font. This should correspond to a font available in the canvas.
+ * @param[in] size The size of the font in points. This determines how large the text will appear.
+ * @param[in] style The style of the font. It can be used to set the font to 'italic'.
+ * If not specified, the default style is used. Only 'italic' style is supported currently.
+ *
+ * @retval Result::Success when the font properties are set successfully.
+ * @retval Result::InsufficientCondition when the specified @p name cannot be found.
+ *
+ * @note Experimental API
+ */
+ Result font(const char* name, float size, const char* style = nullptr) noexcept;
+
+ /**
+ * @brief Assigns the given unicode text to be rendered.
+ *
+ * This function sets the unicode string that will be displayed by the rendering system.
+ * The text is set according to the specified UTF encoding method, which defaults to UTF-8.
+ *
+ * @param[in] text The multi-byte text encoded with utf8 string to be rendered.
+ *
+ * @retval Result::Success when succeed.
+ *
+ * @note Experimental API
+ */
+ Result text(const char* text) noexcept;
+
+ /**
+ * @brief Sets the text color.
+ *
+ * @param[in] r The red color channel value in the range [0 ~ 255]. The default value is 0.
+ * @param[in] g The green color channel value in the range [0 ~ 255]. The default value is 0.
+ * @param[in] b The blue color channel value in the range [0 ~ 255]. The default value is 0.
+ *
+ * @retval Result::Success when succeed.
+ * @retval Result::InsufficientCondition when the font has not been set up prior to this operation.
+ *
+ * @see Text::font()
+ *
+ * @note Experimental API
+ */
+ Result fill(uint8_t r, uint8_t g, uint8_t b) noexcept;
+
+ /**
+ * @brief Sets the gradient fill for all of the figures from the text.
+ *
+ * The parts of the text defined as inner are filled.
+ *
+ * @param[in] f The unique pointer to the gradient fill.
+ *
+ * @retval Result::Success when succeed, Result::MemoryCorruption otherwise.
+ * @retval Result::InsufficientCondition when the font has not been set up prior to this operation.
+ *
+ * @note Either a solid color or a gradient fill is applied, depending on what was set as last.
+ * @note Experimental API
+ *
+ * @see Text::font()
+ */
+ Result fill(std::unique_ptr<Fill> f) noexcept;
+
+ /**
+ * @brief Loads a scalable font data(ttf) from a file.
+ *
+ * @param[in] path The path to the font file.
+ *
+ * @retval Result::Success When succeed.
+ * @retval Result::InvalidArguments In case the @p path is invalid.
+ * @retval Result::NonSupport When trying to load a file with an unknown extension.
+ * @retval Result::Unknown If an error occurs at a later stage.
+ *
+ * @note Experimental API
+ *
+ * @see Text::unload(const std::string& path)
+ */
+ static Result load(const std::string& path) noexcept;
+
+ /**
+ * @brief Unloads the specified scalable font data (TTF) that was previously loaded.
+ *
+ * This function is used to release resources associated with a font file that has been loaded into memory.
+ *
+ * @param[in] path The file path of the loaded font.
+ *
+ * @retval Result::Success Successfully unloads the font data.
+ * @retval Result::InsufficientCondition Fails if the loader is not initialized.
+ *
+ * @note If the font data is currently in use, it will not be immediately unloaded.
+ * @note Experimental API
+ *
+ * @see Text::load(const std::string& path)
+ */
+ static Result unload(const std::string& path) noexcept;
+
+ /**
+ * @brief Creates a new Text object.
+ *
+ * @return A new Text object.
+ *
+ * @note Experimental API
+ */
+ static std::unique_ptr<Text> gen() noexcept;
+
+ /**
+ * @brief Return the unique id value of this class.
+ *
+ * This method can be referred for identifying the Text class type.
+ *
+ * @return The type id of the Text class.
+ */
+ static uint32_t identifier() noexcept;
+
+ _TVG_DECLARE_PRIVATE(Text);
+};
+
+
+/**
* @class SwCanvas
*
* @brief A class for the rendering graphical elements with a software raster engine.
@@ -1487,8 +1613,8 @@ public:
{
ABGR8888 = 0, ///< The channels are joined in the order: alpha, blue, green, red. Colors are alpha-premultiplied. (a << 24 | b << 16 | g << 8 | r)
ARGB8888, ///< The channels are joined in the order: alpha, red, green, blue. Colors are alpha-premultiplied. (a << 24 | r << 16 | g << 8 | b)
- ABGR8888S, ///< @BETA_API The channels are joined in the order: alpha, blue, green, red. Colors are un-alpha-premultiplied.
- ARGB8888S, ///< @BETA_API The channels are joined in the order: alpha, red, green, blue. Colors are un-alpha-premultiplied.
+ ABGR8888S, ///< The channels are joined in the order: alpha, blue, green, red. Colors are un-alpha-premultiplied. @since 0.12
+ ARGB8888S, ///< The channels are joined in the order: alpha, red, green, blue. Colors are un-alpha-premultiplied. @since 0.12
};
/**
@@ -1564,7 +1690,7 @@ public:
*
* @warning Please do not use it. This class is not fully supported yet.
*
- * @BETA_API
+ * @note Experimental API
*/
class TVG_API GlCanvas final : public Canvas
{
@@ -1576,7 +1702,7 @@ public:
*
* @warning Please do not use it, this API is not official one. It could be modified in the next version.
*
- * @BETA_API
+ * @note Experimental API
*/
Result target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t h) noexcept;
@@ -1585,7 +1711,7 @@ public:
*
* @return A new GlCanvas object.
*
- * @BETA_API
+ * @note Experimental API
*/
static std::unique_ptr<GlCanvas> gen() noexcept;
@@ -1594,6 +1720,42 @@ public:
/**
+ * @class WgCanvas
+ *
+ * @brief A class for the rendering graphic elements with a WebGPU raster engine.
+ *
+ * @warning Please do not use it. This class is not fully supported yet.
+ *
+ * @note Experimental API
+ */
+class TVG_API WgCanvas final : public Canvas
+{
+public:
+ ~WgCanvas();
+
+ /**
+ * @brief Sets the target window for the rasterization.
+ *
+ * @warning Please do not use it, this API is not official one. It could be modified in the next version.
+ *
+ * @note Experimental API
+ */
+ Result target(void* window, uint32_t w, uint32_t h) noexcept;
+
+ /**
+ * @brief Creates a new WgCanvas object.
+ *
+ * @return A new WgCanvas object.
+ *
+ * @note Experimental API
+ */
+ static std::unique_ptr<WgCanvas> gen() noexcept;
+
+ _TVG_DECLARE_PRIVATE(WgCanvas);
+};
+
+
+/**
* @class Initializer
*
* @brief A class that enables initialization and termination of the TVG engines.
@@ -1650,7 +1812,7 @@ public:
*
* This class supports the display and control of animation frames.
*
- * @BETA_API
+ * @note Experimental API
*/
class TVG_API Animation
@@ -1669,7 +1831,7 @@ public:
*
* @see totalFrame()
*
- * @BETA_API
+ * @note Experimental API
*/
Result frame(float no) noexcept;
@@ -1684,7 +1846,7 @@ public:
*
* @warning The picture instance is owned by Animation. It should not be deleted manually.
*
- * @BETA_API
+ * @note Experimental API
*/
Picture* picture() const noexcept;
@@ -1698,7 +1860,7 @@ public:
* @see Animation::frame(float no)
* @see Animation::totalFrame()
*
- * @BETA_API
+ * @note Experimental API
*/
float curFrame() const noexcept;
@@ -1710,7 +1872,7 @@ public:
* @note Frame numbering starts from 0.
* @note If the Picture is not properly configured, this function will return 0.
*
- * @BETA_API
+ * @note Experimental API
*/
float totalFrame() const noexcept;
@@ -1721,7 +1883,7 @@ public:
*
* @note If the Picture is not properly configured, this function will return 0.
*
- * @BETA_API
+ * @% Experimental API
*/
float duration() const noexcept;
@@ -1730,7 +1892,7 @@ public:
*
* @return A new Animation object.
*
- * @BETA_API
+ * @note Experimental API
*/
static std::unique_ptr<Animation> gen() noexcept;
@@ -1761,6 +1923,15 @@ public:
~Saver();
/**
+ * @brief Sets the base background content for the saved image.
+ *
+ * @param[in] paint The paint to be drawn as the background image for the saving paint.
+ *
+ * @note Experimental API
+ */
+ Result background(std::unique_ptr<Paint> paint) noexcept;
+
+ /**
* @brief Exports the given @p paint data to the given @p path
*
* If the saver module supports any compression mechanism, it will optimize the data size.
@@ -1794,18 +1965,18 @@ public:
* @param[in] quality The encoded quality level. @c 0 is the minimum, @c 100 is the maximum value(recommended).
* @param[in] fps The desired frames per second (FPS). For example, to encode data at 60 FPS, pass 60. Pass 0 to keep the original frame data.
*
- * @return Result::Success if the export succeeds.
- * @return Result::InsufficientCondition if there are ongoing resource-saving operations.
- * @return Result::NonSupport if an attempt is made to save the file with an unknown extension or in an unsupported format.
- * @return Result::MemoryCorruption in case of an internal error.
- * @return Result::Unknown if attempting to save an empty paint.
+ * @retval Result::Success if the export succeeds.
+ * @retval Result::InsufficientCondition if there are ongoing resource-saving operations.
+ * @retval Result::NonSupport if an attempt is made to save the file with an unknown extension or in an unsupported format.
+ * @retval Result::MemoryCorruption in case of an internal error.
+ * @retval Result::Unknown if attempting to save an empty paint.
*
* @note A higher frames per second (FPS) would result in a larger file size. It is recommended to use the default value.
* @note Saving can be asynchronous if the assigned thread number is greater than zero. To guarantee the saving is done, call sync() afterwards.
*
* @see Saver::sync()
*
- * @note: Experimental API
+ * @note Experimental API
*/
Result save(std::unique_ptr<Animation> animation, const std::string& path, uint32_t quality = 100, uint32_t fps = 0) noexcept;
@@ -1882,7 +2053,7 @@ public:
* @brief The cast() function is a utility function used to cast a 'Paint' to type 'T'.
* @since 0.11
*/
-template<typename T>
+template<typename T = tvg::Paint>
std::unique_ptr<T> cast(Paint* paint)
{
return std::unique_ptr<T>(static_cast<T*>(paint));
@@ -1893,7 +2064,7 @@ std::unique_ptr<T> cast(Paint* paint)
* @brief The cast() function is a utility function used to cast a 'Fill' to type 'T'.
* @since 0.11
*/
-template<typename T>
+template<typename T = tvg::Fill>
std::unique_ptr<T> cast(Fill* fill)
{
return std::unique_ptr<T>(static_cast<T*>(fill));
diff --git a/thirdparty/thorvg/src/common/tvgArray.h b/thirdparty/thorvg/src/common/tvgArray.h
index 1afc647b68..acb3a41b97 100644
--- a/thirdparty/thorvg/src/common/tvgArray.h
+++ b/thirdparty/thorvg/src/common/tvgArray.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -39,6 +39,11 @@ struct Array
Array(){}
+ Array(int32_t size)
+ {
+ reserve(size);
+ }
+
Array(const Array& rhs)
{
reset();
diff --git a/thirdparty/thorvg/src/common/tvgBezier.cpp b/thirdparty/thorvg/src/common/tvgBezier.cpp
index f9daf07b84..5fb501721e 100644
--- a/thirdparty/thorvg/src/common/tvgBezier.cpp
+++ b/thirdparty/thorvg/src/common/tvgBezier.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/common/tvgBezier.h b/thirdparty/thorvg/src/common/tvgBezier.h
index 539a63bdd3..cb2766c505 100644
--- a/thirdparty/thorvg/src/common/tvgBezier.h
+++ b/thirdparty/thorvg/src/common/tvgBezier.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/common/tvgCompressor.cpp b/thirdparty/thorvg/src/common/tvgCompressor.cpp
index e38940f3d0..778fc4d0a2 100644
--- a/thirdparty/thorvg/src/common/tvgCompressor.cpp
+++ b/thirdparty/thorvg/src/common/tvgCompressor.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/common/tvgCompressor.h b/thirdparty/thorvg/src/common/tvgCompressor.h
index 05d23f4293..0756127ec6 100644
--- a/thirdparty/thorvg/src/common/tvgCompressor.h
+++ b/thirdparty/thorvg/src/common/tvgCompressor.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/common/tvgInlist.h b/thirdparty/thorvg/src/common/tvgInlist.h
new file mode 100644
index 0000000000..ff28cfd48e
--- /dev/null
+++ b/thirdparty/thorvg/src/common/tvgInlist.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2023 - 2024 the ThorVG project. All rights reserved.
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef _TVG_INLIST_H_
+#define _TVG_INLIST_H_
+
+namespace tvg {
+
+//NOTE: declare this in your list item
+#define INLIST_ITEM(T) \
+ T* prev; \
+ T* next
+
+template<typename T>
+struct Inlist
+{
+ T* head = nullptr;
+ T* tail = nullptr;
+
+ void free()
+ {
+ while (head) {
+ auto t = head;
+ head = t->next;
+ delete(t);
+ }
+ head = tail = nullptr;
+ }
+
+ void back(T* element)
+ {
+ if (tail) {
+ tail->next = element;
+ element->prev = tail;
+ element->next = nullptr;
+ tail = element;
+ } else {
+ head = tail = element;
+ element->prev = nullptr;
+ element->next = nullptr;
+ }
+ }
+
+ void front(T* element)
+ {
+ if (head) {
+ head->prev = element;
+ element->prev = nullptr;
+ element->next = head;
+ head = element;
+ } else {
+ head = tail = element;
+ element->prev = nullptr;
+ element->next = nullptr;
+ }
+ }
+
+ T* back()
+ {
+ if (!tail) return nullptr;
+ auto t = tail;
+ tail = t->prev;
+ if (!tail) head = nullptr;
+ return t;
+ }
+
+ T* front()
+ {
+ if (!head) return nullptr;
+ auto t = head;
+ head = t->next;
+ if (!head) tail = nullptr;
+ return t;
+ }
+
+ void remove(T* element)
+ {
+ if (element->prev) element->prev->next = element->next;
+ if (element->next) element->next->prev = element->prev;
+ if (element == head) head = element->next;
+ if (element == tail) tail = element->prev;
+ }
+
+ bool empty()
+ {
+ return head ? false : true;
+ }
+};
+
+}
+
+#endif // _TVG_INLIST_H_
diff --git a/thirdparty/thorvg/src/common/tvgList.h b/thirdparty/thorvg/src/common/tvgList.h
deleted file mode 100644
index 01e87a840f..0000000000
--- a/thirdparty/thorvg/src/common/tvgList.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2023 the ThorVG project. All rights reserved.
-
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
-
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
-
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef _TVG_LIST_H_
-#define _TVG_LIST_H_
-
-namespace tvg {
-
-template<typename T>
-struct LinkedList
-{
- T *head = nullptr;
- T *tail = nullptr;
-
- LinkedList() = default;
- LinkedList(T *head, T *tail) : head(head), tail(tail)
- {
- }
-
- template<T *T::*Prev, T *T::*Next>
- static void insert(T *t, T *prev, T *next, T **head, T **tail)
- {
- t->*Prev = prev;
- t->*Next = next;
-
- if (prev) {
- prev->*Next = t;
- } else if (head) {
- *head = t;
- }
-
- if (next) {
- next->*Prev = t;
- } else if (tail) {
- *tail = t;
- }
- }
-
- template<T *T::*Prev, T *T::*Next>
- static void remove(T *t, T **head, T **tail)
- {
- if (t->*Prev) {
- t->*Prev->*Next = t->*Next;
- } else if (head) {
- *head = t->*Next;
- }
-
- if (t->*Next) {
- t->*Next->*Prev = t->*Prev;
- } else if (tail) {
- *tail = t->*Prev;
- }
-
- t->*Prev = t->*Next = nullptr;
- }
-
- template <T* T::*Next>
- static bool contains(T *t, T **head, T **tail) {
- for (T *it = *head; it; it = it->*Next) {
- if (it == t) {
- return true;
- }
- }
-
- return false;
- }
-};
-
-}
-
-#endif // _TVG_LIST_H_
diff --git a/thirdparty/thorvg/src/common/tvgMath.cpp b/thirdparty/thorvg/src/common/tvgMath.cpp
index a9463c8077..42bc2cf4aa 100644
--- a/thirdparty/thorvg/src/common/tvgMath.cpp
+++ b/thirdparty/thorvg/src/common/tvgMath.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/common/tvgMath.h b/thirdparty/thorvg/src/common/tvgMath.h
index 004fff1e7b..50c3458efc 100644
--- a/thirdparty/thorvg/src/common/tvgMath.h
+++ b/thirdparty/thorvg/src/common/tvgMath.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -174,6 +174,18 @@ static inline Point operator*(const Point& lhs, float rhs)
}
+static inline Point operator*(const float& lhs, const Point& rhs)
+{
+ return {lhs * rhs.x, lhs * rhs.y};
+}
+
+
+static inline Point operator/(const Point& lhs, const float rhs)
+{
+ return {lhs.x / rhs, lhs.y / rhs};
+}
+
+
template <typename T>
static inline T mathLerp(const T &start, const T &end, float t)
{
diff --git a/thirdparty/thorvg/src/common/tvgStr.cpp b/thirdparty/thorvg/src/common/tvgStr.cpp
index eeed4fc404..311b986511 100644
--- a/thirdparty/thorvg/src/common/tvgStr.cpp
+++ b/thirdparty/thorvg/src/common/tvgStr.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/common/tvgStr.h b/thirdparty/thorvg/src/common/tvgStr.h
index 448cc69336..9e5f9ba9b5 100644
--- a/thirdparty/thorvg/src/common/tvgStr.h
+++ b/thirdparty/thorvg/src/common/tvgStr.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.cpp b/thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.cpp
index 30a66f9cad..10277f846d 100644
--- a/thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.cpp
+++ b/thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -20,19 +20,25 @@
* SOFTWARE.
*/
-#include "tvgLoader.h"
#include "tvgPngLoader.h"
/************************************************************************/
/* Internal Class Implementation */
/************************************************************************/
+void PngLoader::clear()
+{
+ png_image_free(image);
+ free(image);
+ image = nullptr;
+}
+
/************************************************************************/
/* External Class Implementation */
/************************************************************************/
-PngLoader::PngLoader()
+PngLoader::PngLoader() : ImageLoader(FileType::Png)
{
image = static_cast<png_imagep>(calloc(1, sizeof(png_image)));
image->version = PNG_IMAGE_VERSION;
@@ -41,13 +47,11 @@ PngLoader::PngLoader()
PngLoader::~PngLoader()
{
- if (content) {
- free((void*)content);
- content = nullptr;
- }
- free(image);
+ clear();
+ free((void*)surface.buf32);
}
+
bool PngLoader::open(const string& path)
{
image->opaque = NULL;
@@ -56,11 +60,11 @@ bool PngLoader::open(const string& path)
w = (float)image->width;
h = (float)image->height;
- cs = ColorSpace::ARGB8888;
return true;
}
+
bool PngLoader::open(const char* data, uint32_t size, bool copy)
{
image->opaque = NULL;
@@ -69,7 +73,6 @@ bool PngLoader::open(const char* data, uint32_t size, bool copy)
w = (float)image->width;
h = (float)image->height;
- cs = ColorSpace::ARGB8888;
return true;
}
@@ -77,6 +80,10 @@ bool PngLoader::open(const char* data, uint32_t size, bool copy)
bool PngLoader::read()
{
+ if (!LoadModule::read()) return true;
+
+ if (w == 0 || h == 0) return false;
+
png_bytep buffer;
image->format = PNG_FORMAT_BGRA;
buffer = static_cast<png_bytep>(malloc(PNG_IMAGE_SIZE((*image))));
@@ -89,32 +96,17 @@ bool PngLoader::read()
free(buffer);
return false;
}
- content = reinterpret_cast<uint32_t*>(buffer);
- return true;
-}
+ //setup the surface
+ surface.buf32 = reinterpret_cast<uint32_t*>(buffer);
+ surface.stride = (uint32_t)w;
+ surface.w = (uint32_t)w;
+ surface.h = (uint32_t)h;
+ surface.channelSize = sizeof(uint32_t);
+ surface.cs = ColorSpace::ARGB8888;
+ surface.premultiplied = false;
-bool PngLoader::close()
-{
- png_image_free(image);
- return true;
-}
+ clear();
-unique_ptr<Surface> PngLoader::bitmap()
-{
- if (!content) return nullptr;
-
- //TODO: It's better to keep this surface instance in the loader side
- auto surface = new Surface;
- surface->buf32 = content;
- surface->stride = (uint32_t)w;
- surface->w = (uint32_t)w;
- surface->h = (uint32_t)h;
- surface->cs = cs;
- surface->channelSize = sizeof(uint32_t);
- surface->owner = true;
- surface->premultiplied = false;
-
- return unique_ptr<Surface>(surface);
+ return true;
}
-
diff --git a/thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.h b/thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.h
index 5354e1bdd6..c45544eb07 100644
--- a/thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.h
+++ b/thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -24,24 +24,22 @@
#define _TVG_PNG_LOADER_H_
#include <png.h>
+#include "tvgLoader.h"
-class PngLoader : public LoadModule
+class PngLoader : public ImageLoader
{
public:
PngLoader();
~PngLoader();
- using LoadModule::open;
bool open(const string& path) override;
bool open(const char* data, uint32_t size, bool copy) override;
bool read() override;
- bool close() override;
-
- unique_ptr<Surface> bitmap() override;
private:
+ void clear();
+
png_imagep image = nullptr;
- uint32_t* content = nullptr;
};
#endif //_TVG_PNG_LOADER_H_
diff --git a/thirdparty/thorvg/src/loaders/jpg/tvgJpgLoader.cpp b/thirdparty/thorvg/src/loaders/jpg/tvgJpgLoader.cpp
index 6edda86cc1..86a46245d9 100644
--- a/thirdparty/thorvg/src/loaders/jpg/tvgJpgLoader.cpp
+++ b/thirdparty/thorvg/src/loaders/jpg/tvgJpgLoader.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -21,7 +21,6 @@
*/
#include <memory.h>
-#include "tvgLoader.h"
#include "tvgJpgLoader.h"
/************************************************************************/
@@ -38,30 +37,45 @@ void JpgLoader::clear()
}
+void JpgLoader::run(unsigned tid)
+{
+ surface.buf8 = jpgdDecompress(decoder);
+ surface.stride = static_cast<uint32_t>(w);
+ surface.w = static_cast<uint32_t>(w);
+ surface.h = static_cast<uint32_t>(h);
+ surface.cs = ColorSpace::ARGB8888;
+ surface.channelSize = sizeof(uint32_t);
+ surface.premultiplied = true;
+
+ clear();
+}
+
+
/************************************************************************/
/* External Class Implementation */
/************************************************************************/
+JpgLoader::JpgLoader() : ImageLoader(FileType::Jpg)
+{
+
+}
+
JpgLoader::~JpgLoader()
{
- jpgdDelete(decoder);
- if (freeData) free(data);
- free(image);
+ clear();
+ free(surface.buf8);
}
bool JpgLoader::open(const string& path)
{
- clear();
-
int width, height;
decoder = jpgdHeader(path.c_str(), &width, &height);
if (!decoder) return false;
w = static_cast<float>(width);
h = static_cast<float>(height);
- cs = ColorSpace::ARGB8888;
return true;
}
@@ -69,8 +83,6 @@ bool JpgLoader::open(const string& path)
bool JpgLoader::open(const char* data, uint32_t size, bool copy)
{
- clear();
-
if (copy) {
this->data = (char *) malloc(size);
if (!this->data) return false;
@@ -87,7 +99,6 @@ bool JpgLoader::open(const char* data, uint32_t size, bool copy)
w = static_cast<float>(width);
h = static_cast<float>(height);
- cs = ColorSpace::ARGB8888;
return true;
}
@@ -96,7 +107,9 @@ bool JpgLoader::open(const char* data, uint32_t size, bool copy)
bool JpgLoader::read()
{
- if (!decoder || w <= 0 || h <= 0) return false;
+ if (!LoadModule::read()) return true;
+
+ if (!decoder || w == 0 || h == 0) return false;
TaskScheduler::request(this);
@@ -106,38 +119,14 @@ bool JpgLoader::read()
bool JpgLoader::close()
{
+ if (!LoadModule::close()) return false;
this->done();
- clear();
return true;
}
-unique_ptr<Surface> JpgLoader::bitmap()
+Surface* JpgLoader::bitmap()
{
this->done();
-
- if (!image) return nullptr;
-
- //TODO: It's better to keep this surface instance in the loader side
- auto surface = new Surface;
- surface->buf8 = image;
- surface->stride = static_cast<uint32_t>(w);
- surface->w = static_cast<uint32_t>(w);
- surface->h = static_cast<uint32_t>(h);
- surface->cs = cs;
- surface->channelSize = sizeof(uint32_t);
- surface->premultiplied = true;
- surface->owner = true;
-
- return unique_ptr<Surface>(surface);
-}
-
-
-void JpgLoader::run(unsigned tid)
-{
- if (image) {
- free(image);
- image = nullptr;
- }
- image = jpgdDecompress(decoder);
+ return ImageLoader::bitmap();
}
diff --git a/thirdparty/thorvg/src/loaders/jpg/tvgJpgLoader.h b/thirdparty/thorvg/src/loaders/jpg/tvgJpgLoader.h
index 6d2febe94f..05cbb54c85 100644
--- a/thirdparty/thorvg/src/loaders/jpg/tvgJpgLoader.h
+++ b/thirdparty/thorvg/src/loaders/jpg/tvgJpgLoader.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -23,30 +23,30 @@
#ifndef _TVG_JPG_LOADER_H_
#define _TVG_JPG_LOADER_H_
+#include "tvgLoader.h"
#include "tvgTaskScheduler.h"
#include "tvgJpgd.h"
-class JpgLoader : public LoadModule, public Task
+class JpgLoader : public ImageLoader, public Task
{
private:
jpeg_decoder* decoder = nullptr;
char* data = nullptr;
- unsigned char *image = nullptr;
bool freeData = false;
void clear();
+ void run(unsigned tid) override;
public:
+ JpgLoader();
~JpgLoader();
- using LoadModule::open;
bool open(const string& path) override;
bool open(const char* data, uint32_t size, bool copy) override;
bool read() override;
bool close() override;
- unique_ptr<Surface> bitmap() override;
- void run(unsigned tid) override;
+ Surface* bitmap() override;
};
#endif //_TVG_JPG_LOADER_H_
diff --git a/thirdparty/thorvg/src/loaders/jpg/tvgJpgd.cpp b/thirdparty/thorvg/src/loaders/jpg/tvgJpgd.cpp
index 3cd852a4bb..6f2bd916d5 100644
--- a/thirdparty/thorvg/src/loaders/jpg/tvgJpgd.cpp
+++ b/thirdparty/thorvg/src/loaders/jpg/tvgJpgd.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/loaders/jpg/tvgJpgd.h b/thirdparty/thorvg/src/loaders/jpg/tvgJpgd.h
index 030fdc2946..e1fe35f488 100644
--- a/thirdparty/thorvg/src/loaders/jpg/tvgJpgd.h
+++ b/thirdparty/thorvg/src/loaders/jpg/tvgJpgd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/loaders/png/tvgLodePng.cpp b/thirdparty/thorvg/src/loaders/png/tvgLodePng.cpp
index fc4cce4061..fb7527f045 100644
--- a/thirdparty/thorvg/src/loaders/png/tvgLodePng.cpp
+++ b/thirdparty/thorvg/src/loaders/png/tvgLodePng.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/loaders/png/tvgLodePng.h b/thirdparty/thorvg/src/loaders/png/tvgLodePng.h
index 7254a55477..cd3efacf98 100644
--- a/thirdparty/thorvg/src/loaders/png/tvgLodePng.h
+++ b/thirdparty/thorvg/src/loaders/png/tvgLodePng.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/loaders/png/tvgPngLoader.cpp b/thirdparty/thorvg/src/loaders/png/tvgPngLoader.cpp
index 32ff57c5c3..111180b657 100644
--- a/thirdparty/thorvg/src/loaders/png/tvgPngLoader.cpp
+++ b/thirdparty/thorvg/src/loaders/png/tvgPngLoader.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,14 +29,22 @@
/* Internal Class Implementation */
/************************************************************************/
-void PngLoader::clear()
+
+void PngLoader::run(unsigned tid)
{
- lodepng_state_cleanup(&state);
+ auto width = static_cast<unsigned>(w);
+ auto height = static_cast<unsigned>(h);
- if (freeData) free(data);
- data = nullptr;
- size = 0;
- freeData = false;
+ if (lodepng_decode(&surface.buf8, &width, &height, &state, data, size)) {
+ TVGERR("PNG", "Failed to decode image");
+ }
+
+ //setup the surface
+ surface.stride = width;
+ surface.w = width;
+ surface.h = height;
+ surface.channelSize = sizeof(uint32_t);
+ surface.premultiplied = false;
}
@@ -44,7 +52,7 @@ void PngLoader::clear()
/* External Class Implementation */
/************************************************************************/
-PngLoader::PngLoader()
+PngLoader::PngLoader() : ImageLoader(FileType::Png)
{
lodepng_state_init(&state);
}
@@ -53,14 +61,13 @@ PngLoader::PngLoader()
PngLoader::~PngLoader()
{
if (freeData) free(data);
- free(image);
+ free(surface.buf8);
+ lodepng_state_cleanup(&state);
}
bool PngLoader::open(const string& path)
{
- clear();
-
auto pngFile = fopen(path.c_str(), "rb");
if (!pngFile) return false;
@@ -76,26 +83,23 @@ bool PngLoader::open(const string& path)
freeData = true;
- if (fread(data, size, 1, pngFile) < 1) goto failure;
+ if (fread(data, size, 1, pngFile) < 1) goto finalize;
lodepng_state_init(&state);
unsigned int width, height;
- if (lodepng_inspect(&width, &height, &state, data, size) > 0) goto failure;
+ if (lodepng_inspect(&width, &height, &state, data, size) > 0) goto finalize;
w = static_cast<float>(width);
h = static_cast<float>(height);
- if (state.info_png.color.colortype == LCT_RGBA) cs = ColorSpace::ABGR8888;
- else cs = ColorSpace::ARGB8888;
+ if (state.info_png.color.colortype == LCT_RGBA) surface.cs = ColorSpace::ABGR8888;
+ else surface.cs = ColorSpace::ARGB8888;
ret = true;
goto finalize;
-failure:
- clear();
-
finalize:
fclose(pngFile);
return ret;
@@ -104,10 +108,6 @@ finalize:
bool PngLoader::open(const char* data, uint32_t size, bool copy)
{
- clear();
-
- lodepng_state_init(&state);
-
unsigned int width, height;
if (lodepng_inspect(&width, &height, &state, (unsigned char*)(data), size) > 0) return false;
@@ -125,7 +125,7 @@ bool PngLoader::open(const char* data, uint32_t size, bool copy)
h = static_cast<float>(height);
this->size = size;
- cs = ColorSpace::ABGR8888;
+ surface.cs = ColorSpace::ABGR8888;
return true;
}
@@ -133,53 +133,18 @@ bool PngLoader::open(const char* data, uint32_t size, bool copy)
bool PngLoader::read()
{
- if (!data || w <= 0 || h <= 0) return false;
-
- TaskScheduler::request(this);
+ if (!data || w == 0 || h == 0) return false;
- return true;
-}
+ if (!LoadModule::read()) return true;
+ TaskScheduler::request(this);
-bool PngLoader::close()
-{
- this->done();
- clear();
return true;
}
-unique_ptr<Surface> PngLoader::bitmap()
+Surface* PngLoader::bitmap()
{
this->done();
-
- if (!image) return nullptr;
-
- //TODO: It's better to keep this surface instance in the loader side
- auto surface = new Surface;
- surface->buf8 = image;
- surface->stride = static_cast<uint32_t>(w);
- surface->w = static_cast<uint32_t>(w);
- surface->h = static_cast<uint32_t>(h);
- surface->cs = cs;
- surface->channelSize = sizeof(uint32_t);
- surface->premultiplied = false;
- surface->owner = true;
-
- return unique_ptr<Surface>(surface);
-}
-
-
-void PngLoader::run(unsigned tid)
-{
- if (image) {
- free(image);
- image = nullptr;
- }
- auto width = static_cast<unsigned>(w);
- auto height = static_cast<unsigned>(h);
-
- if (lodepng_decode(&image, &width, &height, &state, data, size)) {
- TVGERR("PNG", "Failed to decode image");
- }
+ return ImageLoader::bitmap();
}
diff --git a/thirdparty/thorvg/src/loaders/png/tvgPngLoader.h b/thirdparty/thorvg/src/loaders/png/tvgPngLoader.h
index 579d197ad6..06fbbf7349 100644
--- a/thirdparty/thorvg/src/loaders/png/tvgPngLoader.h
+++ b/thirdparty/thorvg/src/loaders/png/tvgPngLoader.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -27,29 +27,25 @@
#include "tvgTaskScheduler.h"
-class PngLoader : public LoadModule, public Task
+class PngLoader : public ImageLoader, public Task
{
private:
LodePNGState state;
unsigned char* data = nullptr;
- unsigned char *image = nullptr;
unsigned long size = 0;
bool freeData = false;
- void clear();
+ void run(unsigned tid) override;
public:
PngLoader();
~PngLoader();
- using LoadModule::open;
bool open(const string& path) override;
bool open(const char* data, uint32_t size, bool copy) override;
bool read() override;
- bool close() override;
- unique_ptr<Surface> bitmap() override;
- void run(unsigned tid) override;
+ Surface* bitmap() override;
};
#endif //_TVG_PNG_LOADER_H_
diff --git a/thirdparty/thorvg/src/loaders/raw/tvgRawLoader.cpp b/thirdparty/thorvg/src/loaders/raw/tvgRawLoader.cpp
index 5f5e72b0dd..b797f98218 100644
--- a/thirdparty/thorvg/src/loaders/raw/tvgRawLoader.cpp
+++ b/thirdparty/thorvg/src/loaders/raw/tvgRawLoader.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -34,17 +34,21 @@
/* External Class Implementation */
/************************************************************************/
+RawLoader::RawLoader() : ImageLoader(FileType::Raw)
+{
+}
+
+
RawLoader::~RawLoader()
{
- if (copy && content) {
- free((void*)content);
- content = nullptr;
- }
+ if (copy) free(surface.buf32);
}
bool RawLoader::open(const uint32_t* data, uint32_t w, uint32_t h, bool copy)
{
+ if (!LoadModule::read()) return true;
+
if (!data || w == 0 || h == 0) return false;
this->w = (float)w;
@@ -52,13 +56,19 @@ bool RawLoader::open(const uint32_t* data, uint32_t w, uint32_t h, bool copy)
this->copy = copy;
if (copy) {
- content = (uint32_t*)malloc(sizeof(uint32_t) * w * h);
- if (!content) return false;
- memcpy((void*)content, data, sizeof(uint32_t) * w * h);
+ surface.buf32 = (uint32_t*)malloc(sizeof(uint32_t) * w * h);
+ if (!surface.buf32) return false;
+ memcpy((void*)surface.buf32, data, sizeof(uint32_t) * w * h);
}
- else content = const_cast<uint32_t*>(data);
+ else surface.buf32 = const_cast<uint32_t*>(data);
- cs = ColorSpace::ARGB8888;
+ //setup the surface
+ surface.stride = w;
+ surface.w = w;
+ surface.h = h;
+ surface.cs = ColorSpace::ARGB8888;
+ surface.channelSize = sizeof(uint32_t);
+ surface.premultiplied = true;
return true;
}
@@ -66,30 +76,7 @@ bool RawLoader::open(const uint32_t* data, uint32_t w, uint32_t h, bool copy)
bool RawLoader::read()
{
- return true;
-}
-
+ LoadModule::read();
-bool RawLoader::close()
-{
return true;
}
-
-
-unique_ptr<Surface> RawLoader::bitmap()
-{
- if (!content) return nullptr;
-
- //TODO: It's better to keep this surface instance in the loader side
- auto surface = new Surface;
- surface->buf32 = content;
- surface->stride = static_cast<uint32_t>(w);
- surface->w = static_cast<uint32_t>(w);
- surface->h = static_cast<uint32_t>(h);
- surface->cs = cs;
- surface->channelSize = sizeof(uint32_t);
- surface->premultiplied = true;
- surface->owner = true;
-
- return unique_ptr<Surface>(surface);
-}
diff --git a/thirdparty/thorvg/src/loaders/raw/tvgRawLoader.h b/thirdparty/thorvg/src/loaders/raw/tvgRawLoader.h
index 69f9bdc47a..970cdd9c83 100644
--- a/thirdparty/thorvg/src/loaders/raw/tvgRawLoader.h
+++ b/thirdparty/thorvg/src/loaders/raw/tvgRawLoader.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -23,20 +23,17 @@
#ifndef _TVG_RAW_LOADER_H_
#define _TVG_RAW_LOADER_H_
-class RawLoader : public LoadModule
+class RawLoader : public ImageLoader
{
public:
- uint32_t* content = nullptr;
bool copy = false;
+ RawLoader();
~RawLoader();
using LoadModule::open;
- bool open(const uint32_t* data, uint32_t w, uint32_t h, bool copy) override;
+ bool open(const uint32_t* data, uint32_t w, uint32_t h, bool copy);
bool read() override;
- bool close() override;
-
- unique_ptr<Surface> bitmap() override;
};
diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgCssStyle.cpp b/thirdparty/thorvg/src/loaders/svg/tvgSvgCssStyle.cpp
index c3c477a263..2826dc9134 100644
--- a/thirdparty/thorvg/src/loaders/svg/tvgSvgCssStyle.cpp
+++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgCssStyle.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2022 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgCssStyle.h b/thirdparty/thorvg/src/loaders/svg/tvgSvgCssStyle.h
index 228c5996da..7d8dcfa94a 100644
--- a/thirdparty/thorvg/src/loaders/svg/tvgSvgCssStyle.h
+++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgCssStyle.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2022 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp b/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp
index be99ec085c..6e52476625 100644
--- a/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp
+++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -3528,6 +3528,10 @@ void SvgLoader::clear(bool all)
loaderData.images.reset();
if (copy) free((char*)content);
+
+ delete(root);
+ root = nullptr;
+
size = 0;
content = nullptr;
copy = false;
@@ -3538,14 +3542,15 @@ void SvgLoader::clear(bool all)
/* External Class Implementation */
/************************************************************************/
-SvgLoader::SvgLoader()
+SvgLoader::SvgLoader() : ImageLoader(FileType::Svg)
{
}
SvgLoader::~SvgLoader()
{
- close();
+ this->done();
+ clear();
}
@@ -3554,7 +3559,7 @@ void SvgLoader::run(unsigned tid)
//According to the SVG standard the value of the width/height of the viewbox set to 0 disables rendering
if ((viewFlag & SvgViewFlag::Viewbox) && (fabsf(vw) <= FLT_EPSILON || fabsf(vh) <= FLT_EPSILON)) {
TVGLOG("SVG", "The <viewBox> width and/or height set to 0 - rendering disabled.");
- root = Scene::gen();
+ root = Scene::gen().release();
return;
}
@@ -3727,6 +3732,8 @@ bool SvgLoader::read()
{
if (!content || size == 0) return false;
+ if (!LoadModule::read()) return true;
+
//the loading has been already completed in header()
if (root) return true;
@@ -3738,16 +3745,17 @@ bool SvgLoader::read()
bool SvgLoader::close()
{
+ if (!LoadModule::close()) return false;
this->done();
-
clear();
-
return true;
}
-unique_ptr<Paint> SvgLoader::paint()
+Paint* SvgLoader::paint()
{
this->done();
- return std::move(root);
+ auto ret = root;
+ root = nullptr;
+ return ret;
}
diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.h b/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.h
index 4bac52e0b9..e0cba8b11e 100644
--- a/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.h
+++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgLoader.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -26,7 +26,7 @@
#include "tvgTaskScheduler.h"
#include "tvgSvgLoaderCommon.h"
-class SvgLoader : public LoadModule, public Task
+class SvgLoader : public ImageLoader, public Task
{
public:
string filePath;
@@ -35,21 +35,20 @@ public:
uint32_t size = 0;
SvgLoaderData loaderData;
- unique_ptr<Scene> root;
+ Scene* root = nullptr;
bool copy = false;
SvgLoader();
~SvgLoader();
- using LoadModule::open;
bool open(const string& path) override;
bool open(const char* data, uint32_t size, bool copy) override;
bool resize(Paint* paint, float w, float h) override;
bool read() override;
bool close() override;
- unique_ptr<Paint> paint() override;
+ Paint* paint() override;
private:
SvgViewFlag viewFlag = SvgViewFlag::None;
diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgLoaderCommon.h b/thirdparty/thorvg/src/loaders/svg/tvgSvgLoaderCommon.h
index b4ee3e8e0d..d6febd6825 100644
--- a/thirdparty/thorvg/src/loaders/svg/tvgSvgLoaderCommon.h
+++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgLoaderCommon.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgPath.cpp b/thirdparty/thorvg/src/loaders/svg/tvgSvgPath.cpp
index 79a9c0771d..f618a3c827 100644
--- a/thirdparty/thorvg/src/loaders/svg/tvgSvgPath.cpp
+++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgPath.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -53,6 +53,7 @@
#include <cstring>
#include <math.h>
#include <ctype.h>
+#include "tvgShape.h"
#include "tvgSvgLoaderCommon.h"
#include "tvgSvgPath.h"
#include "tvgStr.h"
@@ -534,7 +535,7 @@ static char* _nextCommand(char* path, char* cmd, float* arr, int* count)
/************************************************************************/
-bool svgPathToTvgPath(const char* svgPath, Array<PathCommand>& cmds, Array<Point>& pts)
+bool svgPathToShape(const char* svgPath, Shape* shape)
{
float numberArray[7];
int numberCount = 0;
@@ -545,11 +546,16 @@ bool svgPathToTvgPath(const char* svgPath, Array<PathCommand>& cmds, Array<Point
bool isQuadratic = false;
char* path = (char*)svgPath;
+ auto& pts = P(shape)->rs.path.pts;
+ auto& cmds = P(shape)->rs.path.cmds;
+ auto lastCmds = cmds.count;
+
while ((path[0] != '\0')) {
path = _nextCommand(path, &cmd, numberArray, &numberCount);
if (!path) break;
if (!_processCommand(&cmds, &pts, cmd, numberArray, numberCount, &cur, &curCtl, &startPoint, &isQuadratic)) break;
}
+ if (cmds.count > lastCmds && cmds[lastCmds] != PathCommand::MoveTo) return false;
return true;
}
diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgPath.h b/thirdparty/thorvg/src/loaders/svg/tvgSvgPath.h
index 4199088dc1..b8641dd165 100644
--- a/thirdparty/thorvg/src/loaders/svg/tvgSvgPath.h
+++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgPath.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,6 @@
#include <tvgCommon.h>
-bool svgPathToTvgPath(const char* svgPath, Array<PathCommand>& cmds, Array<Point>& pts);
+bool svgPathToShape(const char* svgPath, Shape* shape);
#endif //_TVG_SVG_PATH_H_
diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.cpp b/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.cpp
index 1791df57f0..674c30f5bd 100644
--- a/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.cpp
+++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -396,10 +396,9 @@ static bool _recognizeShape(SvgNode* node, Shape* shape)
switch (node->type) {
case SvgNodeType::Path: {
if (node->node.path.path) {
- Array<PathCommand> cmds;
- Array<Point> pts;
- if (svgPathToTvgPath(node->node.path.path, cmds, pts)) {
- shape->appendPath(cmds.data, cmds.count, pts.data, pts.count);
+ if (!svgPathToShape(node->node.path.path, shape)) {
+ TVGERR("SVG", "Invalid path information.");
+ return false;
}
}
break;
@@ -845,7 +844,7 @@ static void _updateInvalidViewSize(const Scene* scene, Box& vBox, float& w, floa
/* External Class Implementation */
/************************************************************************/
-unique_ptr<Scene> svgSceneBuild(SvgLoaderData& loaderData, Box vBox, float w, float h, AspectRatioAlign align, AspectRatioMeetOrSlice meetOrSlice, const string& svgPath, SvgViewFlag viewFlag)
+Scene* svgSceneBuild(SvgLoaderData& loaderData, Box vBox, float w, float h, AspectRatioAlign align, AspectRatioMeetOrSlice meetOrSlice, const string& svgPath, SvgViewFlag viewFlag)
{
//TODO: aspect ratio is valid only if viewBox was set
@@ -863,8 +862,7 @@ unique_ptr<Scene> svgSceneBuild(SvgLoaderData& loaderData, Box vBox, float w, fl
}
auto viewBoxClip = Shape::gen();
- viewBoxClip->appendRect(0, 0, w, h, 0, 0);
- viewBoxClip->fill(0, 0, 0);
+ viewBoxClip->appendRect(0, 0, w, h);
auto compositeLayer = Scene::gen();
compositeLayer->composite(std::move(viewBoxClip), CompositeMethod::ClipPath);
@@ -880,5 +878,5 @@ unique_ptr<Scene> svgSceneBuild(SvgLoaderData& loaderData, Box vBox, float w, fl
loaderData.doc->node.doc.w = w;
loaderData.doc->node.doc.h = h;
- return root;
+ return root.release();
}
diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.h b/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.h
index f6a60f850d..0663a37f05 100644
--- a/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.h
+++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgSceneBuilder.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,6 @@
#include "tvgCommon.h"
-unique_ptr<Scene> svgSceneBuild(SvgLoaderData& loaderData, Box vBox, float w, float h, AspectRatioAlign align, AspectRatioMeetOrSlice meetOrSlice, const string& svgPath, SvgViewFlag viewFlag);
+Scene* svgSceneBuild(SvgLoaderData& loaderData, Box vBox, float w, float h, AspectRatioAlign align, AspectRatioMeetOrSlice meetOrSlice, const string& svgPath, SvgViewFlag viewFlag);
#endif //_TVG_SVG_SCENE_BUILDER_H_
diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgUtil.cpp b/thirdparty/thorvg/src/loaders/svg/tvgSvgUtil.cpp
index 7940188ade..32affd04c6 100644
--- a/thirdparty/thorvg/src/loaders/svg/tvgSvgUtil.cpp
+++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgUtil.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/loaders/svg/tvgSvgUtil.h b/thirdparty/thorvg/src/loaders/svg/tvgSvgUtil.h
index ee0e3f8861..220a4b3e55 100644
--- a/thirdparty/thorvg/src/loaders/svg/tvgSvgUtil.h
+++ b/thirdparty/thorvg/src/loaders/svg/tvgSvgUtil.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp b/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp
index dbc3b17b70..aec30d2384 100644
--- a/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp
+++ b/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.h b/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.h
index 7333bb09fb..30ca23b565 100644
--- a/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.h
+++ b/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwCommon.h b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwCommon.h
index 8fe7b77edd..3d73075a4a 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwCommon.h
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwCommon.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -261,13 +261,26 @@ struct SwSurface : Surface
SwAlpha alphas[4]; //Alpha:2, InvAlpha:3, Luma:4, InvLuma:5
SwBlender blender = nullptr; //blender (optional)
SwCompositor* compositor = nullptr; //compositor (optional)
- BlendMethod blendMethod; //blending method (uint8_t)
+ BlendMethod blendMethod; //blending method (uint8_t)
SwAlpha alpha(CompositeMethod method)
{
auto idx = (int)(method) - 2; //0: None, 1: ClipPath
return alphas[idx > 3 ? 0 : idx]; //CompositeMethod has only four Matting methods.
}
+
+ SwSurface()
+ {
+ }
+
+ SwSurface(const SwSurface* rhs) : Surface(rhs)
+ {
+ join = rhs->join;
+ memcpy(alphas, rhs->alphas, sizeof(alphas));
+ blender = rhs->blender;
+ compositor = rhs->compositor;
+ blendMethod = rhs->blendMethod;
+ }
};
struct SwCompositor : Compositor
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwFill.cpp b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwFill.cpp
index cede9e6eb7..8956cd9f24 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwFill.cpp
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwFill.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -167,7 +167,6 @@ bool _prepareLinear(SwFill* fill, const LinearGradient* linear, const Matrix* tr
fill->linear.dy = dx * invTransform.e12 + fill->linear.dy * invTransform.e22;
fill->linear.len = fill->linear.dx * fill->linear.dx + fill->linear.dy * fill->linear.dy;
- if (fill->linear.len < FLT_EPSILON) return true;
}
return true;
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwImage.cpp b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwImage.cpp
index b1624037bc..c162945501 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwImage.cpp
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwImage.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp
index d58dd9e3c5..42e405195e 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMath.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMemPool.cpp b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMemPool.cpp
index 54ae594bff..68eb7a5a6f 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMemPool.cpp
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwMemPool.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRaster.cpp b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRaster.cpp
index 96a0ed35ad..9a6dc45950 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRaster.cpp
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRaster.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -1714,7 +1714,7 @@ static bool _rasterSolidGradientRle(SwSurface* surface, const SwRleData* rle, co
static bool _rasterLinearGradientRle(SwSurface* surface, const SwRleData* rle, const SwFill* fill)
{
- if (!rle || fill->linear.len < FLT_EPSILON) return false;
+ if (!rle) return false;
if (_compositing(surface)) {
if (_matting(surface)) return _rasterGradientMattedRle<FillLinear>(surface, rle, fill);
@@ -1855,7 +1855,9 @@ void rasterUnpremultiply(Surface* surface)
void rasterPremultiply(Surface* surface)
{
- if (surface->channelSize != sizeof(uint32_t)) return;
+ unique_lock<mutex> lock{surface->mtx};
+ if (surface->premultiplied || (surface->channelSize != sizeof(uint32_t))) return;
+ surface->premultiplied = true;
TVGLOG("SW_ENGINE", "Premultiply [Size: %d x %d]", surface->w, surface->h);
@@ -1869,7 +1871,6 @@ void rasterPremultiply(Surface* surface)
*dst = (c & 0xff000000) + ((((c >> 8) & 0xff) * a) & 0xff00) + ((((c & 0x00ff00ff) * a) >> 8) & 0x00ff00ff);
}
}
- surface->premultiplied = true;
}
@@ -1935,6 +1936,9 @@ bool rasterImage(SwSurface* surface, SwImage* image, const RenderMesh* mesh, con
bool rasterConvertCS(Surface* surface, ColorSpace to)
{
+ unique_lock<mutex> lock{surface->mtx};
+ if (surface->cs == to) return true;
+
//TOOD: Support SIMD accelerations
auto from = surface->cs;
@@ -1946,6 +1950,5 @@ bool rasterConvertCS(Surface* surface, ColorSpace to)
surface->cs = to;
return cRasterARGBtoABGR(surface);
}
-
return false;
}
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterAvx.h b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterAvx.h
index 090fa29a7a..177c7b847f 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterAvx.h
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterAvx.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterC.h b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterC.h
index da3c7077e8..6d0bd9383d 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterC.h
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterC.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterNeon.h b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterNeon.h
index ba77ed53cf..cfbeb0caca 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterNeon.h
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterNeon.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterTexmap.h b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterTexmap.h
index 698ab37da2..04e382b842 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterTexmap.h
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRasterTexmap.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRenderer.cpp b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRenderer.cpp
index 18815e69a9..c9c543fbb5 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRenderer.cpp
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRenderer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -45,8 +45,11 @@ struct SwTask : Task
bool pushed = false; //Pushed into task list?
bool disposed = false; //Disposed task?
- RenderRegion bounds() const
+ RenderRegion bounds()
{
+ //Can we skip the synchronization?
+ done();
+
RenderRegion region;
//Range over?
@@ -278,10 +281,8 @@ struct SwImageTask : SwTask
auto clipRegion = bbox;
//Convert colorspace if it's not aligned.
- if (source->owner) {
- if (source->cs != surface->cs) rasterConvertCS(source, surface->cs);
- if (!source->premultiplied) rasterPremultiply(source);
- }
+ rasterConvertCS(source, surface->cs);
+ rasterPremultiply(source);
image.data = source->data;
image.w = source->w;
@@ -433,7 +434,6 @@ bool SwRenderer::target(pixel_t* data, uint32_t stride, uint32_t w, uint32_t h,
surface->cs = cs;
surface->channelSize = CHANNEL_SIZE(cs);
surface->premultiplied = true;
- surface->owner = true;
vport.x = vport.y = 0;
vport.w = surface->w;
@@ -635,11 +635,8 @@ Compositor* SwRenderer::target(const RenderRegion& region, ColorSpace cs)
//New Composition
if (!cmp) {
- cmp = new SwSurface;
-
//Inherits attributes from main surface
- *cmp = *surface;
-
+ cmp = new SwSurface(surface);
cmp->compositor = new SwCompositor;
//TODO: We can optimize compositor surface size from (surface->stride x surface->h) to Parameter(w x h)
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRenderer.h b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRenderer.h
index 4393740bd9..83d942388f 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRenderer.h
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRenderer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRle.cpp b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRle.cpp
index a4a7fabdee..33c94e1063 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRle.cpp
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwRle.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwShape.cpp b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwShape.cpp
index ae2ddd2af7..e001ced2a8 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwShape.cpp
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwShape.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwStroke.cpp b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwStroke.cpp
index 75c5fa5667..8f44cf3616 100644
--- a/thirdparty/thorvg/src/renderer/sw_engine/tvgSwStroke.cpp
+++ b/thirdparty/thorvg/src/renderer/sw_engine/tvgSwStroke.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/tvgAccessor.cpp b/thirdparty/thorvg/src/renderer/tvgAccessor.cpp
index 0c636979b5..903437f29d 100644
--- a/thirdparty/thorvg/src/renderer/tvgAccessor.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgAccessor.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/tvgAnimation.cpp b/thirdparty/thorvg/src/renderer/tvgAnimation.cpp
index b4ea534b91..995eca7f41 100644
--- a/thirdparty/thorvg/src/renderer/tvgAnimation.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgAnimation.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2023 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -64,7 +64,7 @@ Animation::Animation() : pImpl(new Impl)
Result Animation::frame(float no) noexcept
{
- auto loader = pImpl->picture->pImpl->loader.get();
+ auto loader = pImpl->picture->pImpl->loader;
if (!loader) return Result::InsufficientCondition;
if (!loader->animatable()) return Result::NonSupport;
@@ -82,7 +82,7 @@ Picture* Animation::picture() const noexcept
float Animation::curFrame() const noexcept
{
- auto loader = pImpl->picture->pImpl->loader.get();
+ auto loader = pImpl->picture->pImpl->loader;
if (!loader) return 0;
if (!loader->animatable()) return 0;
@@ -93,7 +93,7 @@ float Animation::curFrame() const noexcept
float Animation::totalFrame() const noexcept
{
- auto loader = pImpl->picture->pImpl->loader.get();
+ auto loader = pImpl->picture->pImpl->loader;
if (!loader) return 0;
if (!loader->animatable()) return 0;
@@ -104,7 +104,7 @@ float Animation::totalFrame() const noexcept
float Animation::duration() const noexcept
{
- auto loader = pImpl->picture->pImpl->loader.get();
+ auto loader = pImpl->picture->pImpl->loader;
if (!loader) return 0;
if (!loader->animatable()) return 0;
diff --git a/thirdparty/thorvg/src/renderer/tvgBinaryDesc.h b/thirdparty/thorvg/src/renderer/tvgBinaryDesc.h
index b1468148d6..29f84eb82a 100644
--- a/thirdparty/thorvg/src/renderer/tvgBinaryDesc.h
+++ b/thirdparty/thorvg/src/renderer/tvgBinaryDesc.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -36,7 +36,7 @@ using TvgBinFlag = TvgBinByte;
#define TVG_HEADER_SIZE 33 //TVG_HEADER_SIGNATURE_LENGTH + TVG_HEADER_VERSION_LENGTH + 2*SIZE(float) + TVG_HEADER_RESERVED_LENGTH + TVG_HEADER_COMPRESS_SIZE
#define TVG_HEADER_SIGNATURE "ThorVG"
#define TVG_HEADER_SIGNATURE_LENGTH 6
-#define TVG_HEADER_VERSION "001100" //Major 00, Minor 11, Micro 00
+#define TVG_HEADER_VERSION "001200" //Major 00, Minor 12, Micro 00
#define TVG_HEADER_VERSION_LENGTH 6
#define TVG_HEADER_RESERVED_LENGTH 1 //Storing flags for extensions
#define TVG_HEADER_COMPRESS_SIZE 12 //TVG_HEADER_UNCOMPRESSED_SIZE + TVG_HEADER_COMPRESSED_SIZE + TVG_HEADER_COMPRESSED_SIZE_BITS
diff --git a/thirdparty/thorvg/src/renderer/tvgCanvas.cpp b/thirdparty/thorvg/src/renderer/tvgCanvas.cpp
index 25741f611d..11d6b778f7 100644
--- a/thirdparty/thorvg/src/renderer/tvgCanvas.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgCanvas.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/tvgCanvas.h b/thirdparty/thorvg/src/renderer/tvgCanvas.h
index f893f9f7c0..25181de47e 100644
--- a/thirdparty/thorvg/src/renderer/tvgCanvas.h
+++ b/thirdparty/thorvg/src/renderer/tvgCanvas.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -20,14 +20,11 @@
* SOFTWARE.
*/
-#ifndef _TVG_CANVAS_IMPL_H_
-#define _TVG_CANVAS_IMPL_H_
+#ifndef _TVG_CANVAS_H_
+#define _TVG_CANVAS_H_
#include "tvgPaint.h"
-/************************************************************************/
-/* Internal Class Implementation */
-/************************************************************************/
struct Canvas::Impl
{
@@ -143,4 +140,4 @@ struct Canvas::Impl
}
};
-#endif /* _TVG_CANVAS_IMPL_H_ */
+#endif /* _TVG_CANVAS_H_ */
diff --git a/thirdparty/thorvg/src/renderer/tvgCommon.h b/thirdparty/thorvg/src/renderer/tvgCommon.h
index 2b67681a40..deb419bc65 100644
--- a/thirdparty/thorvg/src/renderer/tvgCommon.h
+++ b/thirdparty/thorvg/src/renderer/tvgCommon.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -61,8 +61,9 @@ using namespace tvg;
#define TVG_CLASS_ID_PICTURE 3
#define TVG_CLASS_ID_LINEAR 4
#define TVG_CLASS_ID_RADIAL 5
+#define TVG_CLASS_ID_TEXT 6
-enum class FileType { Tvg = 0, Svg, Lottie, Raw, Png, Jpg, Webp, Gif, Unknown };
+enum class FileType { Tvg = 0, Svg, Ttf, Lottie, Raw, Png, Jpg, Webp, Gif, Unknown };
using Size = Point;
diff --git a/thirdparty/thorvg/src/renderer/tvgFill.cpp b/thirdparty/thorvg/src/renderer/tvgFill.cpp
index 9215882c8d..ea1010051e 100644
--- a/thirdparty/thorvg/src/renderer/tvgFill.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgFill.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/tvgFill.h b/thirdparty/thorvg/src/renderer/tvgFill.h
index ff3dd48c49..47f0c051c0 100644
--- a/thirdparty/thorvg/src/renderer/tvgFill.h
+++ b/thirdparty/thorvg/src/renderer/tvgFill.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/tvgFrameModule.h b/thirdparty/thorvg/src/renderer/tvgFrameModule.h
index 332cca3090..df97ccb894 100644
--- a/thirdparty/thorvg/src/renderer/tvgFrameModule.h
+++ b/thirdparty/thorvg/src/renderer/tvgFrameModule.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2023 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -28,9 +28,10 @@
namespace tvg
{
-class FrameModule: public LoadModule
+class FrameModule: public ImageLoader
{
public:
+ FrameModule(FileType type) : ImageLoader(type) {}
virtual ~FrameModule() {}
virtual bool frame(float no) = 0; //set the current frame number
diff --git a/thirdparty/thorvg/src/renderer/tvgGlCanvas.cpp b/thirdparty/thorvg/src/renderer/tvgGlCanvas.cpp
index aa7f8dbe2a..f6f0d354d1 100644
--- a/thirdparty/thorvg/src/renderer/tvgGlCanvas.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgGlCanvas.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/tvgInitializer.cpp b/thirdparty/thorvg/src/renderer/tvgInitializer.cpp
index b7326a9fbc..76d89b40ed 100644
--- a/thirdparty/thorvg/src/renderer/tvgInitializer.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgInitializer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -36,6 +36,10 @@
#include "tvgGlRenderer.h"
#endif
+#ifdef THORVG_WG_RASTER_SUPPORT
+ #include "tvgWgRenderer.h"
+#endif
+
/************************************************************************/
/* Internal Class Implementation */
@@ -91,19 +95,27 @@ static bool _buildVersionInfo()
Result Initializer::init(CanvasEngine engine, uint32_t threads) noexcept
{
auto nonSupport = true;
+ if (static_cast<int>(engine) == 0) return Result::InvalidArguments;
if (engine & CanvasEngine::Sw) {
#ifdef THORVG_SW_RASTER_SUPPORT
if (!SwRenderer::init(threads)) return Result::FailedAllocation;
nonSupport = false;
#endif
- } else if (engine & CanvasEngine::Gl) {
+ }
+
+ if (engine & CanvasEngine::Gl) {
#ifdef THORVG_GL_RASTER_SUPPORT
if (!GlRenderer::init(threads)) return Result::FailedAllocation;
nonSupport = false;
#endif
- } else {
- return Result::InvalidArguments;
+ }
+
+ if (engine & CanvasEngine::Wg) {
+ #ifdef THORVG_WG_RASTER_SUPPORT
+ if (!WgRenderer::init(threads)) return Result::FailedAllocation;
+ nonSupport = false;
+ #endif
}
if (nonSupport) return Result::NonSupport;
@@ -125,19 +137,27 @@ Result Initializer::term(CanvasEngine engine) noexcept
if (_initCnt == 0) return Result::InsufficientCondition;
auto nonSupport = true;
+ if (static_cast<int>(engine) == 0) return Result::InvalidArguments;
if (engine & CanvasEngine::Sw) {
#ifdef THORVG_SW_RASTER_SUPPORT
if (!SwRenderer::term()) return Result::InsufficientCondition;
nonSupport = false;
#endif
- } else if (engine & CanvasEngine::Gl) {
+ }
+
+ if (engine & CanvasEngine::Gl) {
#ifdef THORVG_GL_RASTER_SUPPORT
if (!GlRenderer::term()) return Result::InsufficientCondition;
nonSupport = false;
#endif
- } else {
- return Result::InvalidArguments;
+ }
+
+ if (engine & CanvasEngine::Wg) {
+ #ifdef THORVG_WG_RASTER_SUPPORT
+ if (!WgRenderer::term()) return Result::InsufficientCondition;
+ nonSupport = false;
+ #endif
}
if (nonSupport) return Result::NonSupport;
@@ -156,3 +176,4 @@ uint16_t THORVG_VERSION_NUMBER()
{
return _version;
}
+
diff --git a/thirdparty/thorvg/src/renderer/tvgIteratorAccessor.h b/thirdparty/thorvg/src/renderer/tvgIteratorAccessor.h
index 2347613ed8..46e900a582 100644
--- a/thirdparty/thorvg/src/renderer/tvgIteratorAccessor.h
+++ b/thirdparty/thorvg/src/renderer/tvgIteratorAccessor.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/tvgLoadModule.h b/thirdparty/thorvg/src/renderer/tvgLoadModule.h
index 29ceba3fcc..0ea766395e 100644
--- a/thirdparty/thorvg/src/renderer/tvgLoadModule.h
+++ b/thirdparty/thorvg/src/renderer/tvgLoadModule.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -24,35 +24,73 @@
#define _TVG_LOAD_MODULE_H_
#include "tvgRender.h"
+#include "tvgInlist.h"
-namespace tvg
-{
-class LoadModule
+struct LoadModule
{
-public:
- float w = 0, h = 0; //default image size
- ColorSpace cs = ColorSpace::Unsupported; //must be clarified at open()
+ INLIST_ITEM(LoadModule);
+
+ //Use either hashkey(data) or hashpath(path)
+ uint64_t hashkey;
+ char* hashpath = nullptr;
- virtual ~LoadModule() {}
+ FileType type; //current loader file type
+ uint16_t sharing = 0; //reference count
+ bool readied = false; //read done already.
+
+ LoadModule(FileType type) : type(type) {}
+ virtual ~LoadModule()
+ {
+ free(hashpath);
+ }
virtual bool open(const string& path) { return false; }
virtual bool open(const char* data, uint32_t size, bool copy) { return false; }
- virtual bool open(const uint32_t* data, uint32_t w, uint32_t h, bool copy) { return false; }
-
- //Override this if the vector-format has own resizing policy.
virtual bool resize(Paint* paint, float w, float h) { return false; }
-
- virtual bool animatable() { return false; } //true if this loader supports animation.
virtual void sync() {}; //finish immediately if any async update jobs.
- virtual bool read() = 0;
- virtual bool close() = 0;
+ virtual bool read()
+ {
+ if (readied) return false;
+ readied = true;
+ return true;
+ }
- virtual unique_ptr<Surface> bitmap() { return nullptr; }
- virtual unique_ptr<Paint> paint() { return nullptr; }
+ virtual bool close()
+ {
+ if (sharing == 0) return true;
+ --sharing;
+ return false;
+ }
};
-}
+
+struct ImageLoader : LoadModule
+{
+ float w = 0, h = 0; //default image size
+ Surface surface;
+
+ ImageLoader(FileType type) : LoadModule(type) {}
+
+ virtual bool animatable() { return false; } //true if this loader supports animation.
+ virtual Paint* paint() { return nullptr; }
+
+ virtual Surface* bitmap()
+ {
+ if (surface.data) return &surface;
+ return nullptr;
+ }
+};
+
+
+struct FontLoader : LoadModule
+{
+ float scale = 1.0f;
+
+ FontLoader(FileType type) : LoadModule(type) {}
+
+ virtual bool request(Shape* shape, char* text, bool italic = false) = 0;
+};
#endif //_TVG_LOAD_MODULE_H_
diff --git a/thirdparty/thorvg/src/renderer/tvgLoader.cpp b/thirdparty/thorvg/src/renderer/tvgLoader.cpp
index 65330e9e77..628b0fa17f 100644
--- a/thirdparty/thorvg/src/renderer/tvgLoader.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgLoader.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -20,6 +20,9 @@
* SOFTWARE.
*/
+#include <string.h>
+
+#include "tvgInlist.h"
#include "tvgLoader.h"
#ifdef THORVG_SVG_LOADER_SUPPORT
@@ -42,16 +45,30 @@
#include "tvgWebpLoader.h"
#endif
+#ifdef THORVG_TTF_LOADER_SUPPORT
+ #include "tvgTtfLoader.h"
+#endif
+
#ifdef THORVG_LOTTIE_LOADER_SUPPORT
#include "tvgLottieLoader.h"
#endif
#include "tvgRawLoader.h"
+
+uint64_t HASH_KEY(const char* data, uint64_t size)
+{
+ return (((uint64_t) data) << 32) | size;
+}
+
/************************************************************************/
/* Internal Class Implementation */
/************************************************************************/
+static mutex mtx;
+static Inlist<LoadModule> _activeLoaders;
+
+
static LoadModule* _find(FileType type)
{
switch(type) {
@@ -67,6 +84,12 @@ static LoadModule* _find(FileType type)
#endif
break;
}
+ case FileType::Ttf: {
+#ifdef THORVG_TTF_LOADER_SUPPORT
+ return new TtfLoader;
+#endif
+ break;
+ }
case FileType::Lottie: {
#ifdef THORVG_LOTTIE_LOADER_SUPPORT
return new LottieLoader;
@@ -111,6 +134,10 @@ static LoadModule* _find(FileType type)
format = "SVG";
break;
}
+ case FileType::Ttf: {
+ format = "TTF";
+ break;
+ }
case FileType::Lottie: {
format = "lottie(json)";
break;
@@ -152,29 +179,71 @@ static LoadModule* _findByPath(const string& path)
if (!ext.compare("png")) return _find(FileType::Png);
if (!ext.compare("jpg")) return _find(FileType::Jpg);
if (!ext.compare("webp")) return _find(FileType::Webp);
+ if (!ext.compare("ttf") || !ext.compare("ttc")) return _find(FileType::Ttf);
+ if (!ext.compare("otf") || !ext.compare("otc")) return _find(FileType::Ttf);
return nullptr;
}
-static LoadModule* _findByType(const string& mimeType)
+static FileType _convert(const string& mimeType)
{
- if (mimeType.empty()) return nullptr;
-
auto type = FileType::Unknown;
if (mimeType == "tvg") type = FileType::Tvg;
else if (mimeType == "svg" || mimeType == "svg+xml") type = FileType::Svg;
+ else if (mimeType == "ttf" || mimeType == "otf") type = FileType::Ttf;
else if (mimeType == "lottie") type = FileType::Lottie;
else if (mimeType == "raw") type = FileType::Raw;
else if (mimeType == "png") type = FileType::Png;
else if (mimeType == "jpg" || mimeType == "jpeg") type = FileType::Jpg;
else if (mimeType == "webp") type = FileType::Webp;
- else {
- TVGLOG("RENDERER", "Given mimetype is unknown = \"%s\".", mimeType.c_str());
- return nullptr;
+ else TVGLOG("RENDERER", "Given mimetype is unknown = \"%s\".", mimeType.c_str());
+
+ return type;
+}
+
+
+static LoadModule* _findByType(const string& mimeType)
+{
+ return _find(_convert(mimeType));
+}
+
+
+static LoadModule* _findFromCache(const string& path)
+{
+ unique_lock<mutex> lock{mtx};
+
+ auto loader = _activeLoaders.head;
+
+ while (loader) {
+ if (loader->hashpath && !strcmp(loader->hashpath, path.c_str())) {
+ ++loader->sharing;
+ return loader;
+ }
+ loader = loader->next;
}
+ return nullptr;
+}
+
+
+static LoadModule* _findFromCache(const char* data, uint32_t size, const string& mimeType)
+{
+ auto type = _convert(mimeType);
+ if (type == FileType::Unknown) return nullptr;
- return _find(type);
+ unique_lock<mutex> lock{mtx};
+ auto loader = _activeLoaders.head;
+
+ auto key = HASH_KEY(data, size);
+
+ while (loader) {
+ if (loader->type == type && loader->hashkey == key) {
+ ++loader->sharing;
+ return loader;
+ }
+ loader = loader->next;
+ }
+ return nullptr;
}
@@ -185,40 +254,95 @@ static LoadModule* _findByType(const string& mimeType)
bool LoaderMgr::init()
{
- //TODO:
-
return true;
}
bool LoaderMgr::term()
{
- //TODO:
+ auto loader = _activeLoaders.head;
+
+ //clean up the remained font loaders which is globally used.
+ while (loader && loader->type == FileType::Ttf) {
+ auto ret = loader->close();
+ auto tmp = loader;
+ loader = loader->next;
+ _activeLoaders.remove(tmp);
+ if (ret) delete(loader);
+ }
+ return true;
+}
+
+bool LoaderMgr::retrieve(LoadModule* loader)
+{
+ if (!loader) return false;
+ if (loader->close()) {
+ {
+ unique_lock<mutex> lock{mtx};
+ _activeLoaders.remove(loader);
+ }
+ delete(loader);
+ }
return true;
}
-shared_ptr<LoadModule> LoaderMgr::loader(const string& path, bool* invalid)
+LoadModule* LoaderMgr::loader(const string& path, bool* invalid)
{
*invalid = false;
+ if (auto loader = _findFromCache(path)) return loader;
+
if (auto loader = _findByPath(path)) {
- if (loader->open(path)) return shared_ptr<LoadModule>(loader);
- else delete(loader);
+ if (loader->open(path)) {
+ loader->hashpath = strdup(path.c_str());
+ {
+ unique_lock<mutex> lock{mtx};
+ _activeLoaders.back(loader);
+ }
+ return loader;
+ }
+ delete(loader);
*invalid = true;
}
return nullptr;
}
-shared_ptr<LoadModule> LoaderMgr::loader(const char* data, uint32_t size, const string& mimeType, bool copy)
+bool LoaderMgr::retrieve(const string& path)
+{
+ return retrieve(_findFromCache(path));
+}
+
+
+LoadModule* LoaderMgr::loader(const char* key)
+{
+ auto loader = _activeLoaders.head;
+
+ while (loader) {
+ if (loader->hashpath && strstr(loader->hashpath, key)) {
+ ++loader->sharing;
+ return loader;
+ }
+ loader = loader->next;
+ }
+ return nullptr;
+}
+
+
+LoadModule* LoaderMgr::loader(const char* data, uint32_t size, const string& mimeType, bool copy)
{
+ if (auto loader = _findFromCache(data, size, mimeType)) return loader;
+
//Try with the given MimeType
if (!mimeType.empty()) {
if (auto loader = _findByType(mimeType)) {
if (loader->open(data, size, copy)) {
- return shared_ptr<LoadModule>(loader);
+ loader->hashkey = HASH_KEY(data, size);
+ unique_lock<mutex> lock{mtx};
+ _activeLoaders.back(loader);
+ return loader;
} else {
TVGLOG("LOADER", "Given mimetype \"%s\" seems incorrect or not supported.", mimeType.c_str());
delete(loader);
@@ -229,8 +353,15 @@ shared_ptr<LoadModule> LoaderMgr::loader(const char* data, uint32_t size, const
for (int i = 0; i < static_cast<int>(FileType::Unknown); i++) {
auto loader = _find(static_cast<FileType>(i));
if (loader) {
- if (loader->open(data, size, copy)) return shared_ptr<LoadModule>(loader);
- else delete(loader);
+ if (loader->open(data, size, copy)) {
+ loader->hashkey = HASH_KEY(data, size);
+ {
+ unique_lock<mutex> lock{mtx};
+ _activeLoaders.back(loader);
+ }
+ return loader;
+ }
+ delete(loader);
}
}
}
@@ -238,12 +369,21 @@ shared_ptr<LoadModule> LoaderMgr::loader(const char* data, uint32_t size, const
}
-shared_ptr<LoadModule> LoaderMgr::loader(const uint32_t *data, uint32_t w, uint32_t h, bool copy)
+LoadModule* LoaderMgr::loader(const uint32_t *data, uint32_t w, uint32_t h, bool copy)
{
+ //TODO: should we check premultiplied??
+ if (auto loader = _findFromCache((const char*)(data), w * h, "raw")) return loader;
+
//function is dedicated for raw images only
auto loader = new RawLoader;
- if (loader->open(data, w, h, copy)) return shared_ptr<LoadModule>(loader);
- else delete(loader);
-
+ if (loader->open(data, w, h, copy)) {
+ loader->hashkey = HASH_KEY((const char*)data, w * h);
+ {
+ unique_lock<mutex> lock{mtx};
+ _activeLoaders.back(loader);
+ }
+ return loader;
+ }
+ delete(loader);
return nullptr;
}
diff --git a/thirdparty/thorvg/src/renderer/tvgLoader.h b/thirdparty/thorvg/src/renderer/tvgLoader.h
index 17ff9e2637..b15032df27 100644
--- a/thirdparty/thorvg/src/renderer/tvgLoader.h
+++ b/thirdparty/thorvg/src/renderer/tvgLoader.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,9 +29,12 @@ struct LoaderMgr
{
static bool init();
static bool term();
- static shared_ptr<LoadModule> loader(const string& path, bool* invalid);
- static shared_ptr<LoadModule> loader(const char* data, uint32_t size, const string& mimeType, bool copy);
- static shared_ptr<LoadModule> loader(const uint32_t* data, uint32_t w, uint32_t h, bool copy);
+ static LoadModule* loader(const string& path, bool* invalid);
+ static LoadModule* loader(const char* data, uint32_t size, const string& mimeType, bool copy);
+ static LoadModule* loader(const uint32_t* data, uint32_t w, uint32_t h, bool copy);
+ static LoadModule* loader(const char* key);
+ static bool retrieve(const string& path);
+ static bool retrieve(LoadModule* loader);
};
#endif //_TVG_LOADER_H_
diff --git a/thirdparty/thorvg/src/renderer/tvgPaint.cpp b/thirdparty/thorvg/src/renderer/tvgPaint.cpp
index 008e6589b5..563db3b44a 100644
--- a/thirdparty/thorvg/src/renderer/tvgPaint.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgPaint.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
#include "tvgShape.h"
#include "tvgPicture.h"
#include "tvgScene.h"
+#include "tvgText.h"
/************************************************************************/
/* Internal Class Implementation */
@@ -35,6 +36,7 @@
case TVG_CLASS_ID_SHAPE: ret = P((Shape*)paint)->METHOD; break; \
case TVG_CLASS_ID_SCENE: ret = P((Scene*)paint)->METHOD; break; \
case TVG_CLASS_ID_PICTURE: ret = P((Picture*)paint)->METHOD; break; \
+ case TVG_CLASS_ID_TEXT: ret = P((Text*)paint)->METHOD; break; \
default: ret = {}; \
}
diff --git a/thirdparty/thorvg/src/renderer/tvgPaint.h b/thirdparty/thorvg/src/renderer/tvgPaint.h
index f4721f8e15..4ec9fa7f7e 100644
--- a/thirdparty/thorvg/src/renderer/tvgPaint.h
+++ b/thirdparty/thorvg/src/renderer/tvgPaint.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/tvgPicture.cpp b/thirdparty/thorvg/src/renderer/tvgPicture.cpp
index e382795698..7f120593f4 100644
--- a/thirdparty/thorvg/src/renderer/tvgPicture.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgPicture.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -30,9 +30,8 @@ RenderUpdateFlag Picture::Impl::load()
{
if (loader) {
if (!paint) {
- if (auto p = loader->paint()) {
- paint = p.release();
- loader->close();
+ paint = loader->paint();
+ if (paint) {
if (w != loader->w || h != loader->h) {
if (!resizing) {
w = loader->w;
@@ -41,13 +40,12 @@ RenderUpdateFlag Picture::Impl::load()
loader->resize(paint, w, h);
resizing = false;
}
- if (paint) return RenderUpdateFlag::None;
+ return RenderUpdateFlag::None;
}
} else loader->sync();
if (!surface) {
- if ((surface = loader->bitmap().release())) {
- loader->close();
+ if ((surface = loader->bitmap())) {
return RenderUpdateFlag::Image;
}
}
@@ -55,6 +53,93 @@ RenderUpdateFlag Picture::Impl::load()
return RenderUpdateFlag::None;
}
+
+bool Picture::Impl::needComposition(uint8_t opacity)
+{
+ //In this case, paint(scene) would try composition itself.
+ if (opacity < 255) return false;
+
+ //Composition test
+ const Paint* target;
+ auto method = picture->composite(&target);
+ if (!target || method == tvg::CompositeMethod::ClipPath) return false;
+ if (target->pImpl->opacity == 255 || target->pImpl->opacity == 0) return false;
+
+ return true;
+}
+
+
+bool Picture::Impl::render(RenderMethod &renderer)
+{
+ bool ret = false;
+ if (surface) return renderer.renderImage(rd);
+ else if (paint) {
+ Compositor* cmp = nullptr;
+ if (needComp) {
+ cmp = renderer.target(bounds(renderer), renderer.colorSpace());
+ renderer.beginComposite(cmp, CompositeMethod::None, 255);
+ }
+ ret = paint->pImpl->render(renderer);
+ if (cmp) renderer.endComposite(cmp);
+ }
+ return ret;
+}
+
+
+bool Picture::Impl::size(float w, float h)
+{
+ this->w = w;
+ this->h = h;
+ resizing = true;
+ return true;
+}
+
+
+RenderRegion Picture::Impl::bounds(RenderMethod& renderer)
+{
+ if (rd) return renderer.region(rd);
+ if (paint) return paint->pImpl->bounds(renderer);
+ return {0, 0, 0, 0};
+}
+
+
+RenderTransform Picture::Impl::resizeTransform(const RenderTransform* pTransform)
+{
+ //Overriding Transformation by the desired image size
+ auto sx = w / loader->w;
+ auto sy = h / loader->h;
+ auto scale = sx < sy ? sx : sy;
+
+ RenderTransform tmp;
+ tmp.m = {scale, 0, 0, 0, scale, 0, 0, 0, 1};
+
+ if (!pTransform) return tmp;
+ else return RenderTransform(pTransform, &tmp);
+}
+
+
+Result Picture::Impl::load(ImageLoader* loader)
+{
+ //Same resource has been loaded.
+ if (this->loader == loader) {
+ this->loader->sharing--; //make it sure the reference counting.
+ return Result::Success;
+ } else if (this->loader) {
+ LoaderMgr::retrieve(this->loader);
+ }
+
+ this->loader = loader;
+
+ if (!loader->read()) return Result::Unknown;
+
+ this->w = loader->w;
+ this->h = loader->h;
+
+ return Result::Success;
+}
+
+
+
/************************************************************************/
/* External Class Implementation */
/************************************************************************/
diff --git a/thirdparty/thorvg/src/renderer/tvgPicture.h b/thirdparty/thorvg/src/renderer/tvgPicture.h
index 447f56ecb7..26a171ba66 100644
--- a/thirdparty/thorvg/src/renderer/tvgPicture.h
+++ b/thirdparty/thorvg/src/renderer/tvgPicture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -20,16 +20,13 @@
* SOFTWARE.
*/
-#ifndef _TVG_PICTURE_IMPL_H_
-#define _TVG_PICTURE_IMPL_H_
+#ifndef _TVG_PICTURE_H_
+#define _TVG_PICTURE_H_
#include <string>
#include "tvgPaint.h"
#include "tvgLoader.h"
-/************************************************************************/
-/* Internal Class Implementation */
-/************************************************************************/
struct PictureIterator : Iterator
{
@@ -60,7 +57,7 @@ struct PictureIterator : Iterator
struct Picture::Impl
{
- shared_ptr<LoadModule> loader = nullptr;
+ ImageLoader* loader = nullptr;
Paint* paint = nullptr; //vector picture uses
Surface* surface = nullptr; //bitmap picture uses
@@ -71,14 +68,21 @@ struct Picture::Impl
bool resizing = false;
bool needComp = false; //need composition
+ RenderTransform resizeTransform(const RenderTransform* pTransform);
+ bool needComposition(uint8_t opacity);
+ bool render(RenderMethod &renderer);
+ bool size(float w, float h);
+ RenderRegion bounds(RenderMethod& renderer);
+ Result load(ImageLoader* ploader);
+
Impl(Picture* p) : picture(p)
{
}
~Impl()
{
+ LoaderMgr::retrieve(loader);
delete(paint);
- delete(surface);
}
bool dispose(RenderMethod& renderer)
@@ -89,34 +93,6 @@ struct Picture::Impl
return true;
}
- RenderTransform resizeTransform(const RenderTransform* pTransform)
- {
- //Overriding Transformation by the desired image size
- auto sx = w / loader->w;
- auto sy = h / loader->h;
- auto scale = sx < sy ? sx : sy;
-
- RenderTransform tmp;
- tmp.m = {scale, 0, 0, 0, scale, 0, 0, 0, 1};
-
- if (!pTransform) return tmp;
- else return RenderTransform(pTransform, &tmp);
- }
-
- bool needComposition(uint8_t opacity)
- {
- //In this case, paint(scene) would try composition itself.
- if (opacity < 255) return false;
-
- //Composition test
- const Paint* target;
- auto method = picture->composite(&target);
- if (!target || method == tvg::CompositeMethod::ClipPath) return false;
- if (target->pImpl->opacity == 255 || target->pImpl->opacity == 0) return false;
-
- return true;
- }
-
RenderData update(RenderMethod &renderer, const RenderTransform* pTransform, Array<RenderData>& clips, uint8_t opacity, RenderUpdateFlag pFlag, bool clipper)
{
auto flag = load();
@@ -135,30 +111,6 @@ struct Picture::Impl
return rd;
}
- bool render(RenderMethod &renderer)
- {
- bool ret = false;
- if (surface) return renderer.renderImage(rd);
- else if (paint) {
- Compositor* cmp = nullptr;
- if (needComp) {
- cmp = renderer.target(bounds(renderer), renderer.colorSpace());
- renderer.beginComposite(cmp, CompositeMethod::None, 255);
- }
- ret = paint->pImpl->render(renderer);
- if (cmp) renderer.endComposite(cmp);
- }
- return ret;
- }
-
- bool size(float w, float h)
- {
- this->w = w;
- this->h = h;
- resizing = true;
- return true;
- }
-
bool bounds(float* x, float* y, float* w, float* h, bool stroking)
{
if (rm.triangleCnt > 0) {
@@ -195,50 +147,35 @@ struct Picture::Impl
return true;
}
- RenderRegion bounds(RenderMethod& renderer)
- {
- if (rd) return renderer.region(rd);
- if (paint) return paint->pImpl->bounds(renderer);
- return {0, 0, 0, 0};
- }
-
Result load(const string& path)
{
if (paint || surface) return Result::InsufficientCondition;
- if (loader) loader->close();
+
bool invalid; //Invalid Path
- loader = LoaderMgr::loader(path, &invalid);
+ auto loader = static_cast<ImageLoader*>(LoaderMgr::loader(path, &invalid));
if (!loader) {
if (invalid) return Result::InvalidArguments;
return Result::NonSupport;
}
- if (!loader->read()) return Result::Unknown;
- w = loader->w;
- h = loader->h;
- return Result::Success;
+ return load(loader);
}
Result load(const char* data, uint32_t size, const string& mimeType, bool copy)
{
if (paint || surface) return Result::InsufficientCondition;
- if (loader) loader->close();
- loader = LoaderMgr::loader(data, size, mimeType, copy);
+ auto loader = static_cast<ImageLoader*>(LoaderMgr::loader(data, size, mimeType, copy));
if (!loader) return Result::NonSupport;
- if (!loader->read()) return Result::Unknown;
- w = loader->w;
- h = loader->h;
- return Result::Success;
+ return load(loader);
}
Result load(uint32_t* data, uint32_t w, uint32_t h, bool copy)
{
if (paint || surface) return Result::InsufficientCondition;
- if (loader) loader->close();
- loader = LoaderMgr::loader(data, w, h, copy);
+
+ auto loader = static_cast<ImageLoader*>(LoaderMgr::loader(data, w, h, copy));
if (!loader) return Result::FailedAllocation;
- this->w = loader->w;
- this->h = loader->h;
- return Result::Success;
+
+ return load(loader);
}
void mesh(const Polygon* triangles, const uint32_t triangleCnt)
@@ -258,18 +195,17 @@ struct Picture::Impl
{
load();
- auto ret = Picture::gen();
+ auto ret = Picture::gen().release();
+ auto dup = ret->pImpl;
- auto dup = ret.get()->pImpl;
if (paint) dup->paint = paint->duplicate();
- dup->loader = loader;
- if (surface) {
- dup->surface = new Surface;
- *dup->surface = *surface;
- //TODO: A dupilcation is not a proxy... it needs copy of the pixel data?
- dup->surface->owner = false;
+ if (loader) {
+ dup->loader = loader;
+ ++dup->loader->sharing;
}
+
+ dup->surface = surface;
dup->w = w;
dup->h = h;
dup->resizing = resizing;
@@ -280,7 +216,7 @@ struct Picture::Impl
memcpy(dup->rm.triangles, rm.triangles, sizeof(Polygon) * rm.triangleCnt);
}
- return ret.release();
+ return ret;
}
Iterator* iterator()
@@ -308,4 +244,4 @@ struct Picture::Impl
RenderUpdateFlag load();
};
-#endif //_TVG_PICTURE_IMPL_H_
+#endif //_TVG_PICTURE_H_
diff --git a/thirdparty/thorvg/src/renderer/tvgRender.cpp b/thirdparty/thorvg/src/renderer/tvgRender.cpp
index 64d76d3562..bdfb9f322e 100644
--- a/thirdparty/thorvg/src/renderer/tvgRender.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgRender.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/tvgRender.h b/thirdparty/thorvg/src/renderer/tvgRender.h
index 6c0a7d5f13..1e70b53494 100644
--- a/thirdparty/thorvg/src/renderer/tvgRender.h
+++ b/thirdparty/thorvg/src/renderer/tvgRender.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -23,6 +23,7 @@
#ifndef _TVG_RENDER_H_
#define _TVG_RENDER_H_
+#include <mutex>
#include "tvgCommon.h"
#include "tvgArray.h"
@@ -49,17 +50,33 @@ enum ColorSpace
struct Surface
{
union {
- pixel_t* data; //system based data pointer
- uint32_t* buf32; //for explicit 32bits channels
- uint8_t* buf8; //for explicit 8bits grayscale
+ pixel_t* data = nullptr; //system based data pointer
+ uint32_t* buf32; //for explicit 32bits channels
+ uint8_t* buf8; //for explicit 8bits grayscale
};
- uint32_t stride;
- uint32_t w, h;
- ColorSpace cs;
- uint8_t channelSize;
+ mutex mtx; //used for thread safety
+ uint32_t stride = 0;
+ uint32_t w = 0, h = 0;
+ ColorSpace cs = ColorSpace::Unsupported;
+ uint8_t channelSize = 0;
+ bool premultiplied = 0; //Alpha-premultiplied
+
+ Surface()
+ {
+ }
+
+ Surface(const Surface* rhs)
+ {
+ data = rhs->data;
+ stride = rhs->stride;
+ w = rhs->w;
+ h = rhs->h;
+ cs = rhs->cs;
+ channelSize = rhs->channelSize;
+ premultiplied = rhs->premultiplied;
+ }
+
- bool premultiplied; //Alpha-premultiplied
- bool owner; //Only owner could modify the buffer
};
struct Compositor
diff --git a/thirdparty/thorvg/src/renderer/tvgSaveModule.h b/thirdparty/thorvg/src/renderer/tvgSaveModule.h
index 09e7bde72b..fed05c52df 100644
--- a/thirdparty/thorvg/src/renderer/tvgSaveModule.h
+++ b/thirdparty/thorvg/src/renderer/tvgSaveModule.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -34,7 +34,7 @@ public:
virtual ~SaveModule() {}
virtual bool save(Paint* paint, const string& path, bool compress) = 0;
- virtual bool save(Animation* animation, const string& path, uint32_t quality, uint32_t fps) = 0;
+ virtual bool save(Animation* animation, Paint* bg, const string& path, uint32_t quality, uint32_t fps) = 0;
virtual bool close() = 0;
};
diff --git a/thirdparty/thorvg/src/renderer/tvgSaver.cpp b/thirdparty/thorvg/src/renderer/tvgSaver.cpp
index 038d1ad097..11eb24d437 100644
--- a/thirdparty/thorvg/src/renderer/tvgSaver.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgSaver.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2021 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -37,9 +37,12 @@
struct Saver::Impl
{
SaveModule* saveModule = nullptr;
+ Paint* bg = nullptr;
+
~Impl()
{
delete(saveModule);
+ delete(bg);
}
};
@@ -139,7 +142,16 @@ Result Saver::save(std::unique_ptr<Paint> paint, const string& path, bool compre
}
-Result Saver::save(std::unique_ptr<Animation> animation, const string& path, uint32_t quality, uint32_t fps) noexcept
+Result Saver::background(unique_ptr<Paint> paint) noexcept
+{
+ delete(pImpl->bg);
+ pImpl->bg = paint.release();
+
+ return Result::Success;
+}
+
+
+Result Saver::save(unique_ptr<Animation> animation, const string& path, uint32_t quality, uint32_t fps) noexcept
{
auto a = animation.release();
if (!a) return Result::MemoryCorruption;
@@ -156,7 +168,7 @@ Result Saver::save(std::unique_ptr<Animation> animation, const string& path, uin
}
if (auto saveModule = _find(path)) {
- if (saveModule->save(a, path, quality, fps)) {
+ if (saveModule->save(a, pImpl->bg, path, quality, fps)) {
pImpl->saveModule = saveModule;
return Result::Success;
} else {
diff --git a/thirdparty/thorvg/src/renderer/tvgScene.cpp b/thirdparty/thorvg/src/renderer/tvgScene.cpp
index cd73913b30..f5809cf93b 100644
--- a/thirdparty/thorvg/src/renderer/tvgScene.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgScene.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/tvgScene.h b/thirdparty/thorvg/src/renderer/tvgScene.h
index b558e95a2f..1a5600c231 100644
--- a/thirdparty/thorvg/src/renderer/tvgScene.h
+++ b/thirdparty/thorvg/src/renderer/tvgScene.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -20,15 +20,12 @@
* SOFTWARE.
*/
-#ifndef _TVG_SCENE_IMPL_H_
-#define _TVG_SCENE_IMPL_H_
+#ifndef _TVG_SCENE_H_
+#define _TVG_SCENE_H_
#include <float.h>
#include "tvgPaint.h"
-/************************************************************************/
-/* Internal Class Implementation */
-/************************************************************************/
struct SceneIterator : Iterator
{
@@ -126,8 +123,7 @@ struct Scene::Impl
this->renderer = &renderer;
if (clipper) {
- Array<RenderData> rds;
- rds.reserve(paints.size());
+ Array<RenderData> rds(paints.size());
for (auto paint : paints) {
rds.push(paint->pImpl->update(renderer, transform, clips, opacity, flag, true));
}
@@ -216,9 +212,8 @@ struct Scene::Impl
Paint* duplicate()
{
- auto ret = Scene::gen();
-
- auto dup = ret.get()->pImpl;
+ auto ret = Scene::gen().release();
+ auto dup = ret->pImpl;
for (auto paint : paints) {
auto cdup = paint->duplicate();
@@ -226,7 +221,7 @@ struct Scene::Impl
dup->paints.push_back(cdup);
}
- return ret.release();
+ return ret;
}
void clear(bool free)
@@ -247,4 +242,4 @@ struct Scene::Impl
}
};
-#endif //_TVG_SCENE_IMPL_H_
+#endif //_TVG_SCENE_H_
diff --git a/thirdparty/thorvg/src/renderer/tvgShape.cpp b/thirdparty/thorvg/src/renderer/tvgShape.cpp
index 9a64c7df9f..23b8006dd9 100644
--- a/thirdparty/thorvg/src/renderer/tvgShape.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgShape.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/tvgShape.h b/thirdparty/thorvg/src/renderer/tvgShape.h
index 46b2d7d0db..a7f1226690 100644
--- a/thirdparty/thorvg/src/renderer/tvgShape.h
+++ b/thirdparty/thorvg/src/renderer/tvgShape.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -20,16 +20,13 @@
* SOFTWARE.
*/
-#ifndef _TVG_SHAPE_IMPL_H_
-#define _TVG_SHAPE_IMPL_H_
+#ifndef _TVG_SHAPE_H_
+#define _TVG_SHAPE_H_
#include <memory.h>
#include "tvgMath.h"
#include "tvgPaint.h"
-/************************************************************************/
-/* Internal Class Implementation */
-/************************************************************************/
struct Shape::Impl
{
@@ -341,9 +338,9 @@ struct Shape::Impl
Paint* duplicate()
{
- auto ret = Shape::gen();
+ auto ret = Shape::gen().release();
+ auto dup = ret->pImpl;
- auto dup = ret.get()->pImpl;
dup->rs.rule = rs.rule;
//Color
@@ -379,7 +376,7 @@ struct Shape::Impl
dup->flag |= RenderUpdateFlag::Gradient;
}
- return ret.release();
+ return ret;
}
Iterator* iterator()
@@ -388,4 +385,4 @@ struct Shape::Impl
}
};
-#endif //_TVG_SHAPE_IMPL_H_
+#endif //_TVG_SHAPE_H_
diff --git a/thirdparty/thorvg/src/renderer/tvgSwCanvas.cpp b/thirdparty/thorvg/src/renderer/tvgSwCanvas.cpp
index 95df6b486d..4404057049 100644
--- a/thirdparty/thorvg/src/renderer/tvgSwCanvas.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgSwCanvas.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/thirdparty/thorvg/src/renderer/tvgTaskScheduler.cpp b/thirdparty/thorvg/src/renderer/tvgTaskScheduler.cpp
index e3887c60fc..36d1ce1f8b 100644
--- a/thirdparty/thorvg/src/renderer/tvgTaskScheduler.cpp
+++ b/thirdparty/thorvg/src/renderer/tvgTaskScheduler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -20,11 +20,11 @@
* SOFTWARE.
*/
-#include <deque>
#include <thread>
-#include <vector>
#include <atomic>
#include <condition_variable>
+#include "tvgArray.h"
+#include "tvgInlist.h"
#include "tvgTaskScheduler.h"
/************************************************************************/
@@ -34,7 +34,7 @@
namespace tvg {
struct TaskQueue {
- deque<Task*> taskDeque;
+ Inlist<Task> taskDeque;
mutex mtx;
condition_variable ready;
bool done = false;
@@ -44,8 +44,6 @@ struct TaskQueue {
unique_lock<mutex> lock{mtx, try_to_lock};
if (!lock || taskDeque.empty()) return false;
*task = taskDeque.front();
- taskDeque.pop_front();
-
return true;
}
@@ -54,11 +52,9 @@ struct TaskQueue {
{
unique_lock<mutex> lock{mtx, try_to_lock};
if (!lock) return false;
- taskDeque.push_back(task);
+ taskDeque.back(task);
}
-
ready.notify_one();
-
return true;
}
@@ -82,8 +78,6 @@ struct TaskQueue {
if (taskDeque.empty()) return false;
*task = taskDeque.front();
- taskDeque.pop_front();
-
return true;
}
@@ -91,12 +85,10 @@ struct TaskQueue {
{
{
unique_lock<mutex> lock{mtx};
- taskDeque.push_back(task);
+ taskDeque.back(task);
}
-
ready.notify_one();
}
-
};
@@ -105,24 +97,36 @@ static thread_local bool _async = true; //toggle async tasking for each thread
struct TaskSchedulerImpl
{
- uint32_t threadCnt;
- vector<thread> threads;
- vector<TaskQueue> taskQueues;
+ Array<thread*> threads;
+ Array<TaskQueue*> taskQueues;
atomic<uint32_t> idx{0};
- TaskSchedulerImpl(unsigned threadCnt) : threadCnt(threadCnt), taskQueues(threadCnt)
+ TaskSchedulerImpl(unsigned threadCnt)
{
threads.reserve(threadCnt);
+ taskQueues.reserve(threadCnt);
for (unsigned i = 0; i < threadCnt; ++i) {
- threads.emplace_back([&, i] { run(i); });
+ taskQueues.push(new TaskQueue);
+ threads.push(new thread);
+ }
+ for (unsigned i = 0; i < threadCnt; ++i) {
+ *threads.data[i] = thread([&, i] { run(i); });
}
}
~TaskSchedulerImpl()
{
- for (auto& queue : taskQueues) queue.complete();
- for (auto& thread : threads) thread.join();
+ for (auto tq = taskQueues.data; tq < taskQueues.end(); ++tq) {
+ (*tq)->complete();
+ }
+ for (auto thread = threads.data; thread < threads.end(); ++thread) {
+ (*thread)->join();
+ delete(*thread);
+ }
+ for (auto tq = taskQueues.data; tq < taskQueues.end(); ++tq) {
+ delete(*tq);
+ }
}
void run(unsigned i)
@@ -132,14 +136,14 @@ struct TaskSchedulerImpl
//Thread Loop
while (true) {
auto success = false;
- for (unsigned x = 0; x < threadCnt * 2; ++x) {
- if (taskQueues[(i + x) % threadCnt].tryPop(&task)) {
+ for (unsigned x = 0; x < threads.count * 2; ++x) {
+ if (taskQueues[(i + x) % threads.count]->tryPop(&task)) {
success = true;
break;
}
}
- if (!success && !taskQueues[i].pop(&task)) break;
+ if (!success && !taskQueues[i]->pop(&task)) break;
(*task)(i + 1);
}
}
@@ -147,13 +151,13 @@ struct TaskSchedulerImpl
void request(Task* task)
{
//Async
- if (threadCnt > 0 && _async) {
+ if (threads.count > 0 && _async) {
task->prepare();
auto i = idx++;
- for (unsigned n = 0; n < threadCnt; ++n) {
- if (taskQueues[(i + n) % threadCnt].tryPush(task)) return;
+ for (unsigned n = 0; n < threads.count; ++n) {
+ if (taskQueues[(i + n) % threads.count]->tryPush(task)) return;
}
- taskQueues[i % threadCnt].push(task);
+ taskQueues[i % threads.count]->push(task);
//Sync
} else {
task->run(0);
@@ -192,7 +196,7 @@ void TaskScheduler::request(Task* task)
unsigned TaskScheduler::threads()
{
- if (inst) return inst->threadCnt;
+ if (inst) return inst->threads.count;
return 0;
}
diff --git a/thirdparty/thorvg/src/renderer/tvgTaskScheduler.h b/thirdparty/thorvg/src/renderer/tvgTaskScheduler.h
index 2dad80f5d0..483e084880 100644
--- a/thirdparty/thorvg/src/renderer/tvgTaskScheduler.h
+++ b/thirdparty/thorvg/src/renderer/tvgTaskScheduler.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 - 2023 the ThorVG project. All rights reserved.
+ * Copyright (c) 2020 - 2024 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -26,6 +26,7 @@
#include <mutex>
#include <condition_variable>
#include "tvgCommon.h"
+#include "tvgInlist.h"
namespace tvg
{
@@ -50,6 +51,8 @@ private:
bool pending = false;
public:
+ INLIST_ITEM(Task);
+
virtual ~Task() = default;
void done()
diff --git a/thirdparty/thorvg/src/renderer/tvgText.cpp b/thirdparty/thorvg/src/renderer/tvgText.cpp
new file mode 100644
index 0000000000..1fe244c11d
--- /dev/null
+++ b/thirdparty/thorvg/src/renderer/tvgText.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2023 - 2024 the ThorVG project. All rights reserved.
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+
+#include "tvgText.h"
+
+
+/************************************************************************/
+/* Internal Class Implementation */
+/************************************************************************/
+
+
+
+/************************************************************************/
+/* External Class Implementation */
+/************************************************************************/
+
+
+Text::Text() : pImpl(new Impl)
+{
+ Paint::pImpl->id = TVG_CLASS_ID_TEXT;
+}
+
+
+Text::~Text()
+{
+ delete(pImpl);
+}
+
+
+Result Text::text(const char* text) noexcept
+{
+ return pImpl->text(text);
+}
+
+
+Result Text::font(const char* name, float size, const char* style) noexcept
+{
+ return pImpl->font(name, size, style);
+}
+
+
+Result Text::load(const std::string& path) noexcept
+{
+ bool invalid; //invalid path
+ if (!LoaderMgr::loader(path, &invalid)) {
+ if (invalid) return Result::InvalidArguments;
+ else return Result::NonSupport;
+ }
+
+ return Result::Success;
+}
+
+
+Result Text::unload(const std::string& path) noexcept
+{
+ if (LoaderMgr::retrieve(path)) return Result::Success;
+ return Result::InsufficientCondition;
+}
+
+
+Result Text::fill(uint8_t r, uint8_t g, uint8_t b) noexcept
+{
+ if (!pImpl->paint) return Result::InsufficientCondition;
+
+ return pImpl->fill(r, g, b);
+}
+
+
+Result Text::fill(unique_ptr<Fill> f) noexcept
+{
+ if (!pImpl->paint) return Result::InsufficientCondition;
+
+ auto p = f.release();
+ if (!p) return Result::MemoryCorruption;
+
+ return pImpl->fill(p);
+}
+
+
+unique_ptr<Text> Text::gen() noexcept
+{
+ return unique_ptr<Text>(new Text);
+}
+
+
+uint32_t Text::identifier() noexcept
+{
+ return TVG_CLASS_ID_TEXT;
+}
diff --git a/thirdparty/thorvg/src/renderer/tvgText.h b/thirdparty/thorvg/src/renderer/tvgText.h
new file mode 100644
index 0000000000..b9f7ef6079
--- /dev/null
+++ b/thirdparty/thorvg/src/renderer/tvgText.h
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2023 - 2024 the ThorVG project. All rights reserved.
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef _TVG_TEXT_H
+#define _TVG_TEXT_H
+
+#include <cstring>
+#include "tvgShape.h"
+#include "tvgFill.h"
+
+#ifdef THORVG_TTF_LOADER_SUPPORT
+ #include "tvgTtfLoader.h"
+#else
+ #include "tvgLoader.h"
+#endif
+
+struct Text::Impl
+{
+ RenderData rd = nullptr;
+ FontLoader* loader = nullptr;
+ Shape* paint = nullptr;
+ char* utf8 = nullptr;
+ float fontSize;
+ bool italic = false;
+ bool changed = false;
+
+ ~Impl()
+ {
+ free(utf8);
+ LoaderMgr::retrieve(loader);
+ delete(paint);
+ }
+
+ Result fill(uint8_t r, uint8_t g, uint8_t b)
+ {
+ return paint->fill(r, g, b);
+ }
+
+ Result fill(Fill* f)
+ {
+ return paint->fill(cast<Fill>(f));
+ }
+
+ Result text(const char* utf8)
+ {
+ free(this->utf8);
+ if (utf8) this->utf8 = strdup(utf8);
+ else this->utf8 = nullptr;
+ changed = true;
+
+ return Result::Success;
+ }
+
+ Result font(const char* name, float size, const char* style)
+ {
+ auto loader = LoaderMgr::loader(name);
+ if (!loader) return Result::InsufficientCondition;
+
+ //Same resource has been loaded.
+ if (this->loader == loader) {
+ this->loader->sharing--; //make it sure the reference counting.
+ return Result::Success;
+ } else if (this->loader) {
+ LoaderMgr::retrieve(this->loader);
+ }
+ this->loader = static_cast<FontLoader*>(loader);
+
+ if (!paint) paint = Shape::gen().release();
+
+ fontSize = size;
+ if (style && strstr(style, "italic")) italic = true;
+ changed = true;
+ return Result::Success;
+ }
+
+ RenderRegion bounds(RenderMethod& renderer)
+ {
+ return renderer.region(rd);
+ }
+
+ bool render(RenderMethod& renderer)
+ {
+ if (paint) return PP(paint)->render(renderer);
+ return false;
+ }
+
+ bool load()
+ {
+ if (!loader) return false;
+
+ //reload
+ if (changed) {
+ loader->request(paint, utf8, italic);
+ loader->read();
+ changed = false;
+ }
+ if (paint) {
+ loader->resize(paint, fontSize, fontSize);
+ return true;
+ }
+ return false;
+ }
+
+ RenderData update(RenderMethod& renderer, const RenderTransform* transform, Array<RenderData>& clips, uint8_t opacity, RenderUpdateFlag pFlag, bool clipper)
+ {
+ if (!load()) return nullptr;
+
+ //transform the gradient coordinates based on the final scaled font.
+ if (P(paint)->flag & RenderUpdateFlag::Gradient) {
+ auto fill = P(paint)->rs.fill;
+ auto scale = 1.0f / loader->scale;
+ if (fill->identifier() == TVG_CLASS_ID_LINEAR) {
+ P(static_cast<LinearGradient*>(fill))->x1 *= scale;
+ P(static_cast<LinearGradient*>(fill))->y1 *= scale;
+ P(static_cast<LinearGradient*>(fill))->x2 *= scale;
+ P(static_cast<LinearGradient*>(fill))->y2 *= scale;
+ } else {
+ P(static_cast<RadialGradient*>(fill))->cx *= scale;
+ P(static_cast<RadialGradient*>(fill))->cy *= scale;
+ P(static_cast<RadialGradient*>(fill))->r *= scale;
+ P(static_cast<RadialGradient*>(fill))->fx *= scale;
+ P(static_cast<RadialGradient*>(fill))->fy *= scale;
+ P(static_cast<RadialGradient*>(fill))->fr *= scale;
+ }
+ }
+ rd = PP(paint)->update(renderer, transform, clips, opacity, pFlag, clipper);
+ return rd;
+ }
+
+ bool bounds(float* x, float* y, float* w, float* h, TVG_UNUSED bool stroking)
+ {
+ if (!load() || !paint) return false;
+ paint->bounds(x, y, w, h, true);
+ return true;
+ }
+
+ bool dispose(RenderMethod& renderer)
+ {
+ renderer.dispose(rd);
+ this->rd = nullptr;
+ return true;
+ }
+
+ Paint* duplicate()
+ {
+ load();
+
+ auto ret = Text::gen().release();
+ auto dup = ret->pImpl;
+ if (paint) dup->paint = static_cast<Shape*>(paint->duplicate());
+
+ if (loader) {
+ dup->loader = loader;
+ ++dup->loader->sharing;
+ }
+
+ dup->utf8 = strdup(utf8);
+ dup->italic = italic;
+ dup->fontSize = fontSize;
+
+ return ret;
+ }
+
+ Iterator* iterator()
+ {
+ return nullptr;
+ }
+};
+
+
+
+#endif //_TVG_TEXT_H
diff --git a/thirdparty/thorvg/src/renderer/tvgWgCanvas.cpp b/thirdparty/thorvg/src/renderer/tvgWgCanvas.cpp
new file mode 100644
index 0000000000..5205df1737
--- /dev/null
+++ b/thirdparty/thorvg/src/renderer/tvgWgCanvas.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2023 - 2024 the ThorVG project. All rights reserved.
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "tvgCanvas.h"
+
+#ifdef THORVG_WG_RASTER_SUPPORT
+ #include "tvgWgRenderer.h"
+#endif
+
+/************************************************************************/
+/* Internal Class Implementation */
+/************************************************************************/
+
+struct WgCanvas::Impl
+{
+};
+
+
+/************************************************************************/
+/* External Class Implementation */
+/************************************************************************/
+
+#ifdef THORVG_WG_RASTER_SUPPORT
+WgCanvas::WgCanvas() : Canvas(WgRenderer::gen()), pImpl(new Impl)
+#else
+WgCanvas::WgCanvas() : Canvas(nullptr), pImpl(nullptr)
+#endif
+{
+}
+
+WgCanvas::~WgCanvas()
+{
+ delete pImpl;
+}
+
+Result WgCanvas::target(void* window, uint32_t w, uint32_t h) noexcept
+{
+#ifdef THORVG_WG_RASTER_SUPPORT
+ if (!window) return Result::InvalidArguments;
+ if ((w == 0) || (h == 0)) return Result::InvalidArguments;
+
+ //We know renderer type, avoid dynamic_cast for performance.
+ auto renderer = static_cast<WgRenderer*>(Canvas::pImpl->renderer);
+ if (!renderer) return Result::MemoryCorruption;
+
+ if (!renderer->target(window, w, h)) return Result::Unknown;
+
+ //Paints must be updated again with this new target.
+ Canvas::pImpl->needRefresh();
+
+ return Result::Success;
+#endif
+ return Result::NonSupport;
+}
+
+unique_ptr<WgCanvas> WgCanvas::gen() noexcept
+{
+#ifdef THORVG_WG_RASTER_SUPPORT
+ return unique_ptr<WgCanvas>(new WgCanvas);
+#endif
+ return nullptr;
+}
diff --git a/thirdparty/thorvg/update-thorvg.sh b/thirdparty/thorvg/update-thorvg.sh
index d4323848da..a1732d5157 100755
--- a/thirdparty/thorvg/update-thorvg.sh
+++ b/thirdparty/thorvg/update-thorvg.sh
@@ -1,6 +1,6 @@
#!/bin/bash -e
-VERSION=0.11.6
+VERSION=0.12.0
cd thirdparty/thorvg/ || true
rm -rf AUTHORS LICENSE inc/ src/ *.zip *.tar.gz tmp/
@@ -52,6 +52,7 @@ cp -rv src/renderer ../src/
# Only sw_engine is enabled.
rm -rfv ../src/renderer/gl_engine
+rm -rfv ../src/renderer/wg_engine
# Enabled embedded loaders: raw, JPEG, PNG.
mkdir ../src/loaders