diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4507ce9..67c233f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,8 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v4 + with: + submodules: true - uses: actions/setup-python@v5 with: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 40eee5c..1fea230 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,6 +10,8 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v4 + with: + submodules: true - uses: actions/setup-python@v5 with: diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 37f3583..55e7ccf 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -15,6 +15,8 @@ jobs: python: ["cp39", "cp310", "cp311", "cp312", "cp313"] steps: - uses: actions/checkout@v4 + with: + submodules: true - name: Setup MSVC uses: ilammy/msvc-dev-cmd@v1 @@ -64,6 +66,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + submodules: true - name: Build sdist run: pipx run build --sdist diff --git a/.gitignore b/.gitignore index ba37bed..d0ade9b 100644 --- a/.gitignore +++ b/.gitignore @@ -58,7 +58,3 @@ CMakeUserPresets.json */models logs/ *log.txt - -# Bypass general rules for vendored SDK -!external/TouchEngine-Windows/bin/*.dll -!external/TouchEngine-Windows/lib/*.lib diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..44ccb53 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "external/TouchEngine-Windows"] + path = external/TouchEngine-Windows + url = https://github.com/TouchDesigner/TouchEngine-Windows diff --git a/README.md b/README.md index 6326454..2f03222 100644 --- a/README.md +++ b/README.md @@ -55,10 +55,18 @@ Full API documentation is available at [intentdev.github.io/touchpy](https://int ### Setup ```bash +git clone --recurse-submodules https://github.com/IntentDev/touchpy.git +cd touchpy uv venv --python 3.12 uv sync --extra examples ``` +If you already cloned without `--recurse-submodules`: + +```bash +git submodule update --init +``` + This creates a `.venv` with Python 3.12, builds TouchPy from source (via scikit-build-core), and installs CUDA-enabled PyTorch + numpy for running examples. > **Note:** Python 3.12 is recommended. PyTorch wheels for 3.13+ may have packaging issues. diff --git a/external/TouchEngine-Windows b/external/TouchEngine-Windows new file mode 160000 index 0000000..e96c345 --- /dev/null +++ b/external/TouchEngine-Windows @@ -0,0 +1 @@ +Subproject commit e96c345310121bb0244ed456e1bc471f8f8b9762 diff --git a/external/TouchEngine-Windows/CHANGES.md b/external/TouchEngine-Windows/CHANGES.md deleted file mode 100644 index 2577e0f..0000000 --- a/external/TouchEngine-Windows/CHANGES.md +++ /dev/null @@ -1,178 +0,0 @@ -# Changes - - -## 3.0 - -* Add TELinkTypeSequence and TEInstanceLinkSetSequenceCount() - Sequences are repeating groups of parameters. The number of repetitions is user configurable. - -## 2.7 - -* Add TEInstanceLinkHasValue() and TELinkValueUIMinimum, TELinkValueUIMaximum -* Add support for some more sRGB compressed texture formats -* Fix issue which could prevent TEObjectEventEndUse being sent in some circumstances - -## 2.6 - -* Fix an issue which could cause unexpected behaviour for texture inputs or outputs following a crash in the TouchEngine process - -## 2.5 - -* Add TEOpenGLContextSupportsTexturesForInstance() -* Add TEInstanceSetAssetDirectory() and TEInstanceGetAssetDirectory() -* Fix crash which could occur handling component errors during loading -* Improve error reporting in cases where the TouchEngine process crashes - -## 2.3 - -* Add TEInstanceLinkHasUserTint() and TEInstanceLinkGetUserTint() -* Check for presence of TOUCHENGINE_APP_PATH environment variable to specificy a TouchDesigner installation to use -* Fix an issue which could cause lost CHOP or DAT values when running in independent mode -* Fix an issue which could leave a TEInstance in an inconsistent state if the TouchEngine process crashed -* Fix an issue which could cause a hang in some circumstances -* Fix an issue which could cause a crash releasing a TETable or TEFloatData - -## 2.2 - -* Fix an issue which caused GPU synchronization to fail for Direct3D 11 hosts on some hardware (there is a corresponding fix in TouchDesigner 2022.31800+) - -## 2.1 - -* Add detailed reporting for component errors via TEInstanceGetErrors() -* Fix an issue which could upset COM state in hosts in particular circumstances -* A subsequent call to TEInstanceConfigure() before a previous configuration has completed now completes the initial configuration with TEResultCancelled -* Other fixes for stability - -## 2.0 - - * Adds support for Vulkan textures and semaphores (see TEVulkan.h) - * Adds support for Direct3D 12 textures and fences (see TED3D12.h and TED3D.h) - * Adds support for Direct3D 11 fences (see TED3D.h) - * Adds support for macOS (SDK available at https://github.com/TouchDesigner/TouchEngine-macOS) - * Functionality for each graphics API is no longer included from the umbrella header and should be explicitly included from TED3D11.h, TED3D12.h, TEOpenGL.h, TEMetal.h or TEVulkan.h - * Replaces 'TETextureIsVerticallyFlipped()' with 'TETextureGetOrigin()' - * Adds 'TEInstanceSetOutputTextureOrigin()' and 'TEInstanceGetOutputTextureOrigin()' - * Adds 'TESemaphore' and associated functions (see TESemaphore.h) - * Removes TEDXGITexture and replaces it with TED3DSharedTexture (see TED3D.h) - * Exposes synchronization of texture usage with texture transfers (see TEInstance.h and Vulkan-specific transfers in TEVulkan.h) - * TEObjects which previously had a release callback now have an event callback for richer lifetime event notifications - see TEObjectEvent in TEObject.h - * Some TEObjects vended by TouchEngine now have configurable callbacks to allow hosts to track resource lifetime - * Adds TEInstanceLinkSetInterest() to allow hosts to express disinterest in input or output links - * Adds support for more texture formats, including some compressed formats, and functions to interrogate support (see TEVulkan.h and TED3D.h) - * Adds TEInstanceLinkHasChoices() to simplify discovery of link menus - * Numerous fixes for stability - -### 2.0 General Changes - - -#### Windows Libraries - -TouchEngine is now distributed as a single DLL. If you have an existing project with libIPM.dll and libTPC.dll alongside TouchEngine.dll, they should be deleted on updating TouchEngine.dll. - - -#### Resource Lifetime - -TouchEngine's performance can be considerably improved by reusing GPU resources. - -For textures and semaphore types you supply to TouchEngine, TouchEngine uses the lifetime of the TEObjects you create to manage internal resource lifetime. For example, to improve texture performance, recycle input textures from a pool, keeping the associated TETexture alive for as long as the texture is reused. Callbacks for textures now include a TEObjectEvent which will signal TEObjectEventEndUse when TouchEngine is no longer using the resource - at this point, it can be recycled to the pool. Reusing semaphores brings a similar gain. - -For textures and semaphores you receive from TouchEngine as outputs, which will be re-used when possible, you can now register a callback with the TETexture or TESemaphore which allows you to keep associated resources alive until your callback receives TEObjectEventRelease. Note that you must release the TETexture you receive from an output to allow it to be recycled - retain it for as long as you are using it for GPU work, then release it. The TouchEngine example project demonstrates doing this for Direct3D 12. - - -#### GPU Synchronization - -Previously GPU synchronization was managed for you. To accommodate more modern graphics APIs synchronization is now exposed through the concept of texture transfers. Check for support for texture transfers after instance configuration has completed (TEEventInstanceReady). - -For transferring textures **to** TouchEngine, the sequence would normally be: - - TEInstanceLinkSetTextureValue(instance, identifier, texture) - TEInstanceAddTextureTransfer(instance, texture, semaphore, value) - // GPU signals the semaphore you used in the texture transfer - -For transferring textures **from** TouchEngine: - - TEInstanceLinkGetTextureValue(instance, identifier, &texture) - if (TEInstanceHasTextureTransfer(instance, texture)) - { - TESemaphore *semaphore; - uint64_t value; - TEInstanceLinkGetTextureTransfer(instance, texture, &semaphore, &value) - // GPU waits for the returned semaphore before using the texture - } - - -A TED3D11Context will handle sync of TED3D11Texture inputs for you. You must use texture transfer operations to acquire and release the DXGI keyed mutexes associated with output textures. In this case, the `semaphore` parameter to `TEInstanceAddTextureTransfer()` and `TEInstanceAddTextureTransfer()` will be `NULL` and the wait-value the value to be used for mutex acquire or release. - -A TEOpenGLContext will handle sync of TEOpenGLTexture inputs for you. You must use `TEOpenGLTextureLock()` to sync output textures before using them, and `TEOpenGLTextureUnlock()` to release them when you are finished with them. - - -#### Vulkan - -To opt in to using Vulkan texture and semaphore types, associate a TEVulkanContext with an instance prior to configuring it, using `TEInstanceAssociateGraphicsContext()`. - -Vulkan is only supported when TouchDesigner 2022 or later is installed. Check for support using `TEInstanceGetSupportedTextureTypes()` and `TEInstanceGetSupportedSemaphoreTypes()` after instance configuration is complete. - -For Vulkan texture transfers, see TEVulkan.h which deals with the image layouts required for image memory barriers - when performing a texture transfer for a texture whose contents you wish to preserve, do the full Vulkan image transfer including performing the memory barrier operation. When texture content is disposable, use the regular texture transfer mechanism from TEInstance.h. - -TouchEngine provides you with the importable handles for Vulkan GPU resources and it is up to the host to instantiate these objects and manage their lifetime. Use the advice in "Resource Lifetime" above to allow resources to be recycled by the host and TouchEngine. - - -#### Direct3D 12 - -To opt in to using D3D12 textures and fences, associate a TED3D12Context with an instance prior to configuring it, using `TEInstanceAssociateGraphicsContext()`. - -D3D12 is only supported when TouchDesigner 2022.28580 or later is installed. Check for support using `TEInstanceGetSupportedD3DHandleTypes()` and `TEInstanceGetSupportedSemaphoreTypes()` after instance configuration is complete. - -TouchEngine provides you with the importable handles for D3D12 GPU resources (via TED3DSharedTexture and TED3DSharedFence) and it is up to the host to instantiate the D3D objects and manage their lifetime. Use the advice in "Resource Lifetime" above to allow resources to be recycled by the host and TouchEngine. - - -#### Direct3D 11 - -If you use TED3DSharedTexture for inputs or to instantiate outputs yourself, DXGI shared texture handles (eg from a D3D11 texture) may be backed by a DXGI Keyed Mutex. Due to limitations in some versions of TouchDesigner, textures transferred **to** TouchEngine must be released to the value 0 - use `TEInstanceRequiresDXGIReleaseToZero()` to check after instance configuration has completed. To perform a texture transfer for a DXGI Keyed Mutex, pass a `NULL` semaphore to `TEInstanceAddTextureTransfer()`, passing the value you have released the mutex to as the wait value. `TEInstanceLinkGetTextureTransfer()` will return a `NULL` semaphore and a wait value which you must use when acquiring the DXGI Keyed Mutex. - - -## 1.9 - - * Fix a crash which could occur on systems with TouchDesigner 2022 installed. - -## 1.8 - - * Fix issue which could cause `TEInstanceAssociateGraphicsContext()` or `TEInstanceAssociateGraphicsContext()` to ignore device selection on multi-GPU machines - * Where a link has TELinkIntentPulse, setting `false` will not cancel a previous `true` for the current frame - * When a link with TELinkIntentPulse is set to true, it will revert to `false` immediately afterwards - -## 1.7 - -* Fix a performance issue which affected texture inputs. - -## 1.6 - -* Fix an issue which could cause a long delay before reporting an error in some situations. - -## 1.5 - -* Add `TEInstanceConfigure()` and change arguments to `TEInstanceLoad()` -* Add `TEEventInstanceReady` and `TEEventInstanceDidUnload` -* `TEInstanceGetPath()` now returns a `TEString` which the caller should release - -## 1.4 - -* Add `TEInstanceSetStatisticsCallback()`. - -## 1.3 - - * Add `TETextureComponentMap` to support swizzled texture formats. - * Fixes for working directly with DXGI textures. - -## 1.2 - -### Fixes - - * Passing a null texture to `TEInstanceLinkSetTextureValue()` correctly clears any previous texture. - * `TEInstanceHasFile()` correctly returns false after an unload following an unrecoverable error. - -## 1.1 - -### Fixes - - * Fix a crash which could occur using `TEInstance...` functions from an unload callback after the final TERelease of an instance. diff --git a/external/TouchEngine-Windows/LICENSE.md b/external/TouchEngine-Windows/LICENSE.md deleted file mode 100644 index edc1a1c..0000000 --- a/external/TouchEngine-Windows/LICENSE.md +++ /dev/null @@ -1,6 +0,0 @@ -# Shared Use License - -This software in source and binary forms is owned by Derivative Inc. (Derivative) and can only be used, and/or modified for use, in conjunction with Derivative's TouchDesigner software, and only if you are a licensee who has accepted Derivative's TouchDesigner license or assignment agreement (which also govern the use of this software). You may share or redistribute a modified version of this software provided the following conditions are met: - -1. The shared files or redistribution must retain the information set out above and this list of conditions. -2. Derivative's name (Derivative Inc.) or its trademarks may not be used to endorse or promote products derived from this software without specific prior written permission from Derivative. diff --git a/external/TouchEngine-Windows/README.md b/external/TouchEngine-Windows/README.md deleted file mode 100644 index 4dd1504..0000000 --- a/external/TouchEngine-Windows/README.md +++ /dev/null @@ -1,304 +0,0 @@ -TouchEngine -=========== - -TouchEngine provides an API to load and render TouchDesigner components. - -SDK ---- - -This repository contains the libraries and headers you will use in your own applications, as well as an example project. The SDK for macOS is available at https://github.com/TouchDesigner/TouchEngine-macOS. - -Instances And TouchDesigner Installations ------------------------------------------ - -TouchEngine requires an installed version of TouchDesigner to load and work with components, along with any paid license (TouchPlayer/TouchDesigner Pro/Commercial/Educational). TouchEngine will locate an installed version suitable for use on the user's system. TouchEngine will return errors for missing or unlicensed installations, which you should communicate to the user. - -By default the most recently installed version of TouchDesigner will be used. The earliest TouchDesigner version which works with this version of TouchEngine is 2020.28110. Use of the DirectX 12 TouchEngine API requires users have a 2022 version of TouchDesigner or later. Generally, the most up-to-date release is recommended. - -Users can specify a particular version to use by including a folder named "TouchEngine" alongside the component .tox being loaded. This folder can be a renamed TouchDesigner installation directory, or a file-system link to an installation (either a symbolic link or a Windows Explorer shortcut). Alternatively an environment variable `TOUCHENGINE_APP_PATH` can be set to the path to a TouchDesigner installation directory. - -Example Project ---------------- - -The example project "TouchEngineExample" demonstrates some of the techniques discussed below, with examples for OpenGL and Direct3D 11 and 12. A Vulkan API is also available. - -API Documentation ------------------ - -The TouchEngine API is documented in the TouchEngine headers. This document gives a high-level overview and details some best practices for working with the API. - -Using TouchEngine ------------------ - -TouchEngine.dll, TouchEngine.lib and include/TouchEngine should be included/linked in your own applications. `#include ` in any source file you wish to use TouchEngine in. Note that graphics-specific functions are not included in the umbrella header. For example to use Direct3D 12, add `#include ` to your includes. - -TEObjects ---------- - -Objects created or returned from the TouchEngine API are reference-counted, and you take ownership of objects returned to you from the API. If you use an API function with "Create" or "Get" in its name which returns a TEObject (including via a function argument), you must use `TERelease()` when you are finished with the object. - - TELinkInfo *info; - TEResult result = TEInstanceLinkGetInfo(instance, identifier, &info); - if (result == TEResultSuccess) - { - // You become the owner of the TELinkInfo object - // use the object... - // ... - // ...and then release it - TERelease(&info); - // (info is set to NULL by TERelease()) - } - -You can use `TERetain()` to increase the reference-count of an object. - -Some functions accept or return several types of TEObject. Use `TEGetType()` to check the type of a TEObject returned from such functions, then cast the value to the actual type. - -For C++ code, you may wish to use the `TouchObject` class in the example project, which wraps TEObjects and takes care of retain and release. See TouchObject.h for documentation. - - -Links ------ - -Individual inputs and outputs of an instance are referred to as *links*. In TouchDesigner terms, links combine parameters and In and Out operators. - - -Creating and Configuring Instances ----------------------------------- - -An instance requires two callbacks: one for instance events, and one to receive link events: - - void eventCallback(TEInstance * instance, TEEvent event, TEResult result, int64_t start_time_value, int32_t start_time_scale, int64_t end_time_value, int32_t end_time_scale, void * info) - { - // handle the event - } - - void linkCallback(TEInstance * instance, TELinkEvent event, const char *identifier, void * info) - { - // handle the link event - } - -A single instance can be re-used to load several components. Only one component can be loaded in an instance at a time (but any number of instances can co-exist). Maximise performance by re-using an existing instance rather than creating a new one where possible. - -Create an instance: - - TEInstance *instance; - TEResult result = TEInstanceCreate(eventCallback, linkCallback, NULL, &instance); - if (result == TEResultSuccess) - { - // Continue to use the instance - } - -If working with textures, create and associate a TEGraphicsContext suitable for your needs. A graphics context provides functionality to work with textures using your chosen graphics API. Alternatively you can create and associate a TEAdapter to indicate a device without the full functionality of a graphics context. If neither are associated, the instance will select a device as it sees fit. - - if (result == TEResultSuccess) - { - result = TEInstanceAssociateGraphicsContext(instance, context); - } - -You may wish to set a frame-rate to match your intended render rate: - - if (result == TEResultSuccess) - { - // for example, this would set 30 FPS - result = TEInstanceSetFrameRate(instance, 30, 1); - } - -Configure and load a component: - - if (result == TEResultSuccess) - { - result = TEInstanceConfigure(instance, "sample.tox", TETimeExternal); - } - if (result == TEResultSuccess) - { - result = TEInstanceLoad(instance); - } - -Loading begins immediately. - -During loading you will receive link callbacks with the event TELinkEventAdded for any links on the instance. - -Once loading has completed you will receive an event callback with the event TEEventInstanceDidLoad, and a TEResult indicating success or any warning or error. - -An instance is loaded suspended. Once configured, resuming the instance will permit rendering (and start playback in TETimeInternal mode): - - if (result == TEResultSuccess) - { - result = TEInstanceResume(instance); - } - -Note that if you are able to call TEInstanceConfigure() with a NULL path sometime before loading a component, the instance will perform some pre-loading setup. You can then call TEInstanceConfigure() again with a valid path, and the subsequent TEInstanceLoad() will complete much faster. - - -Rendering An Instance ---------------------- - -Rendering is performed asynchronously according to the TETimeMode of the instance. - -For a TETimeExternal instance, rendering is driven by your API calls. Times passed to `TEInstanceStartFrameAtTime()` determine progress. - -For a TETimeInternal instance, rendering continues in the background at the instance's frame-rate. Output is driven by calls to `TEInstanceStartFrameAtTime()`. - -For both modes, after starting a frame the instance's link callback will be invoked for outputs whose value has changed. The completion of a frame you have requested is marked by the event callback receiving TEEventFrameDidFinish with a TEResult indicating success or any warning or error. - - -Working With TELinkTypeFloatBuffer ----------------------------------- - -Float buffer links take or emit a buffer of float values arranged in channels. They can contain time-based or static values. One example of time-based values is audio data. An example of static values might be coordinates, perhaps with a channel for each dimension. - -To allow the most efficient memory re-use inside TouchEngine, for each input link create a TEFloatBuffer once (using `TEFloatBufferCreate()` or `TEFloatBufferCreateTimeDependent()`) and then create subsequent buffers from the original buffer using `TEFloatBufferCreateCopy()`. - -Time-dependent buffers can be added to the instance with `TEInstanceLinkAddFloatBuffer()`, which adds the buffer to an internal queue. - -For static values, calling `TEInstanceLinkSetFloatBufferValue()` replaces any current value as well as clearing any time-dependent values previously queued. - -To receive time-dependent buffers from the instance, call `TEInstanceLinkGetFloatBufferValue()` from your `TEInstanceLinkCallback`. No further buffers will be received during the callback, allowing you to safely dequeue them without risk of loss. - - -Working with TELinkTypeStringData ---------------------------------- - -String data links can be tables or a single string value. - -When working with table inputs, to allow the most efficient memory re-use inside TouchEngine, for each link create a TETable once using `TETableCreate()` and then create subsequent tables from the original table using `TETableCreateCopy()`. - -Set a single string value on a string data input with `TEInstanceLinkSetStringValue()`, or set a table value with `TEInstanceLinkSetTableValue()`. To receive string data values from an output, use `TEInstanceLinkGetObjectValue()` and then use `TEGetType()` on the returned value to determine if it is a TEString or TETable. - - -Menus ------ - -TELinkTypeInt and TELinkTypeString can have a list of choices associated with them, suitable for presentation to the user as a menu. - - if (TEInstanceLinkHasChoices(instance, identifier)) - { - TEStringArray *labels = nullptr; - result = TEInstanceLinkGetChoiceLabels(instance, identifier, &labels); - if (result == TEResultSuccess && labels) - { - // ... - TERelease(&labels); - } - } - -For TELinkTypeInt, the associated value for a menu item is its index. For TELinkTypeString, `TEInstanceLinkGetChoiceValues()` returns a list of values, ordered to match the labels. Note that this list should not be considered exhaustive and users should be allowed to enter their own values as well as those in this list. - - -Working with TELinkTypeTexture ------------------------------- - -The TEGraphicsContext associated with an instance affects the behaviour of input and output links, so the first task is to associate a graphics context of a suitable type. - -One-time setup (Direct3D11): - - TED3D11Context *context; - TEResult result = TED3D11ContextCreate(device, &context); - -One-time association (all graphics APIs): - - if (result == TEResultSuccess) - { - result = TEInstanceAssociateGraphicsContext(instance, context); - } - if (result != TEResultSuccess) - { - // deal with the error - } - -An instance will accept inputs and emit outputs of a TETextureType which is shareable and appropriate for the associated graphics context. - -The TEGraphicsContexts for Direct3D 11 and OpenGL allow you to work with native textures and have the context do the work of copying and instantiating the native texture types from the shareable type used by the instance. Even when using these contexts, best performance is achieved by setting inputs as the shareable type directly, saving the copy stage performed by the TEGraphicsContext. In both the Direct3D11 and OpenGL case the shareable texture type is TED3DSharedTexture. OpenGL further requires that the handle associated with the TED3DSharedTexture is of TED3DHandleTypeD3D11Global. - -For Direct3D 12 and Vulkan contexts, you can only set a shareable type: TED3DSharedTexture or TEVulkanTexture respectively. - -If you are setting a shareable texture type on input links directly, TouchEngine will use the lifetime of the TETextures you create to manage the lifetime of internal resources. For this reason, performance is improved by recycling textures in a pool, and keeping the associated TETexture alive for the lifetime of the underlying resource. To know when a texture is in use by TouchEngine, use the TEObjectEvent parameter of the TETexture's callback and monitor TEObjectEventBeginUse and TEObjectEventEndUse. When TEObjectEventEndUse is received, the texture can be returned to your pool for reuse. - -If you are instantiating output textures directly from a shareable type (TED3DSharedTexture or TEVulkanTexture), then there will usually be benefit in keeping a cache of instantiated textures, as TouchEngine will recycle textures internally. The lifetime of TETextures got from outputs indicates to TouchEngine when the output is in use by you, and so you *must* TERelease them when you are finished with them to allow them to be recycled - ie do *not* TERetain the TETexture itself in your output texture cache, but use the associated HANDLE value to map TETextures to your instantiated textures. You can register a callback for the TETextures you receive from the instance, and monitor TEObjectEventRelease to know when an instantiated texture should be deleted from your cache. For Direct3D 11 and OpenGL, this is all handled for you if you use `TED3D11ContextCreateTexture()` or `TEOpenGLContextCreateTexture()` to instantiate the native texture from the shareable type. - -Setting an input (Direct3D 11): - - TED3D11Texture *texture = TED3D11TextureCreate(tex, false, NULL, NULL); - TEResult result = TEInstanceLinkSetTextureValue(instance, identifier, texture, context); - // Release the texture - the instance will have retained it if necessary - TERelease(&texture); - -Getting an output (Direct3D 11): - - TETexture *value; - TEResult result = TEInstanceLinkGetTextureValue(instance, identifier, TELinkValueCurrent, &value); - if (result == TEResultSuccess && - value != NULL) - { - if (TETextureGetType(value) == TETextureTypeD3DShared) - { - TED3D11Texture *texture; - result = TED3D11ContextCreateTexture(context, (TED3DSharedTexture *)value, &texture); - if (result == TEResultSuccess) - { - // Use the instantiated texture here - // ... - TERelease(&texture); - } - } - } - TERelease(&value); - - -GPU Synchronization -------------------- - -Usage of texture inputs and outputs must be synchronized between the host and TouchEngine. TouchEngine describes this operation as a texture transfer. The exact process depends on the graphics API in use - as determined by the TEGraphicsContext associated with the instance. - -#### OpenGL - -There are no texture transfer operations at the host level if you operate only with TEOpenGLTextures, but you must bracket GPU usage of output textures with calls to `TEOpenGLTextureLock()` and `TEOpenGLTextureUnlock()`. - -#### Direct3D 11 - -For inputs, if you are setting TED3D11Textures as link values, the transfer operation is managed for you by the TED3D11GraphicsContext. If you are setting TED3DSharedTextures as link values, you should perform a texture transfer either using a shareable D3D11 fence, or using the DXGI Keyed Mutex associated with the texture, as described below. - -For outputs, even if you use the TED3D11GraphicsContext to instantiate a TED3D11Texture, you must perform a texture transfer. - -A transfer for Direct3D 11 can be done either using a DXGI Keyed Mutex, or a Direct3D 11 fence (as a TED3DSharedFence). - -The transfer using a DXGI Keyed Mutex will have NULL for the `semaphore` parameter to `TEInstanceGetTextureTransfer()` and `TEInstanceAddTextureTransfer()`. When using a texture in the host, the `waitValue` parameter from `TEInstanceGetTextureTransfer()` is the value which should be passed to `IDXGIKeyedMutex::AcquireSync()`. After use the `waitValue` parameter you pass to `TEInstanceAddTextureTransfer()` is the value you passed to `IDXGIKeyedMutex::ReleaseSync()`. - -One further complication for the use of a DXGI Keyed Mutex is that some older versions of TouchDesigner required that textures always be released to a value of 0. This requirement can be tested using `TEInstanceRequiresKeyedMutexReleaseToZero()`. - -Transfers using a fence are simpler - see the directions for Direct3D 12 below. - -#### Direct3D 12 - -Texture transfers are required for inputs and outputs, which are always TED3DSharedTextures. The transfer is done with a Direct3D 12 fence (as a TED3DSharedFence). - -When transferring a texture *to* TouchEngine, schedule a signal for the fence with a known value, then pass the fence and value to `TEInstanceAddTextureTransfer()`. TouchEngine will schedule a wait for the provided value before utilising the texture. - -When transferring a texture *from* TouchEngine, `TEInstanceGetTextureTransfer()` will return a fence and wait-value. Schedule a wait for the returned value before utilising the texture. - -#### Vulkan - -Because a texture transfer can require a Vulkan memory barrier operation, extra steps are required. TEVulkan.h has functions which supplement the texture transfer functions in TEInstance.h when working with a Vulkan graphics context. - -Texture transfers are required for inputs and outputs, which are always TEVulkanTextures. The transfer is done with a Vulkan timeline or binary semaphore (as a TEVulkanSemaphore). - -When transferring textures the contents of which should be kept (ie transferring inputs to TouchEngine, and outputs from TouchEngine), a Vulkan memory barrier is required. For inputs, perform the barrier to the image layout returned from `TEInstanceGetVulkanReleaseImageLayout()` and then provide the old and new layouts to `TEInstanceAddVulkanTextureTransfer()`. You can change the image layout the instance transfers textures to by calling `TEInstanceSetVulkanAcquireImageLayout()` once. This will determine the new layout you receive from `TEInstanceGetVulkanTextureTransfer()`. - -When transferring textures the contents of which can be discarded, use a regular texture transfer with `TEInstanceAddTextureTransfer()` or `TEInstanceGetTextureTransfer()`. - -When transferring a texture *to* TouchEngine, schedule a signal for the semaphore (with a known value for a timeline semaphore), then pass the semaphore and value to `TEInstanceAddVulkanTextureTransfer()` or `TEInstanceAddTextureTransfer()`. TouchEngine will schedule a wait for the provided value before utilising the texture. For a binary semaphore TouchEngine will schedule a signal after the wait, to maintain consistent state. - -When transferring a texture *from* TouchEngine, `TEInstanceGetTextureTransfer()` or `TEInstanceGetVulkanTextureTransfer()` will return a semaphore and wait-value. Schedule a wait (for the returned value, if the semaphore is a timeline semaphore) before utilising the texture. If the semaphore is a binary semaphore, you must schedule a signal after the wait, to maintain consistent state. - - -Allowing users to reference known TouchDesigner objects -------------------------------------------------------- - -In some cases your users may want to refer to inputs and outputs by the name they have used for entities inside a loaded TouchDesigner component. Combined use of the `name` and `domain` members of the `TELinkInfo` struct allow for a one-to-one reference to entities within a component. For example, a user may wish to refer to a TouchDesigner operator with the name "out1" to locate an output. To match that, locate a link with the domain `TELinkDomainOperator` and name "out1". Note that `name` is only a reliable identifier within a single domain - the same name can occur in multiple domains. - -If you need to use domains in UI, the two domains which users might expect to be able to refer to, and textual names and abbreviations which will be familiar to them, are: - -|Domain |Name |Abbreviation | -|----------------------|----------|-------------| -|TELinkDomainParameter |Parameter |par | -|TELinkDomainOperator |Operator |op | diff --git a/external/TouchEngine-Windows/bin/TouchEngine.dll b/external/TouchEngine-Windows/bin/TouchEngine.dll deleted file mode 100644 index c3ae6fb..0000000 Binary files a/external/TouchEngine-Windows/bin/TouchEngine.dll and /dev/null differ diff --git a/external/TouchEngine-Windows/include/TouchEngine/TEAdapter.h b/external/TouchEngine-Windows/include/TouchEngine/TEAdapter.h deleted file mode 100644 index 0da04a4..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TEAdapter.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - -#ifndef TEAdapter_h -#define TEAdapter_h - -#include -#include - -#ifdef __APPLE__ -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -TE_ASSUME_NONNULL_BEGIN - -typedef struct TEAdapter_ TEAdapter; - -#ifdef _WIN32 -struct IDXGIDevice; -#endif - -#ifdef _WIN32 - -/* - Creates an adapter from a DXGI device. - - 'device' is a DXGI device. If NULL is passed, an adapter based on system defaults will be created. - 'adapter' will be set to a TEAdapter on return, or NULL if an adapter could not be created. - The caller is responsible for releasing the returned TEAdapter using TERelease() - Returns TEResultSucccess or an error - */ -TE_EXPORT TEResult TEAdapterCreateForDevice(IDXGIDevice * TE_NULLABLE device, - TEAdapter * TE_NULLABLE * TE_NONNULL adapter); - - -#endif // _WIN32 -#ifdef __APPLE__ - -/* - Creates an adapter for a connected display - - 'display' is the CGDirectDisplayID of the target display. - 'adapter' will be set to a TEAdapter on return, or NULL if an adapter could not be created. - The caller is responsible for releasing the returned TEAdapter using TERelease() - Returns TEResultSucccess or an error - */ -TE_EXPORT TEResult TEAdapterCreateForDisplayID(CGDirectDisplayID display, TEAdapter * TE_NULLABLE * TE_NONNULL adapter); - -#endif // __APPLE__ - -TE_ASSUME_NONNULL_END - -#ifdef __cplusplus -} -#endif - -#endif // TEAdapter_h diff --git a/external/TouchEngine-Windows/include/TouchEngine/TEBase.h b/external/TouchEngine-Windows/include/TouchEngine/TEBase.h deleted file mode 100644 index f149fcb..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TEBase.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - -#ifndef TEBase_h -#define TEBase_h - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(__APPLE__) - #define TE_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") - #define TE_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") - #define TE_NONNULL _Nonnull - #define TE_NULLABLE _Nullable - #if !defined(TE_EXPORT) - #define TE_EXPORT __attribute__((visibility("default"))) - #endif -#else - #define TE_ASSUME_NONNULL_BEGIN - #define TE_ASSUME_NONNULL_END - #define TE_NONNULL - #define TE_NULLABLE - #if !defined(TE_EXPORT) - #if defined (TE_BUILD_DLL) - #define TE_EXPORT __declspec(dllexport) - #else - #define TE_EXPORT __declspec(dllimport) - #endif - #endif -#endif - -// This form is supported for C by MSVC and LLVM, please contact us if your compiler doesn't support it -#define TE_ENUM(_name, _type) enum _name : _type _name; enum _name : _type - -#ifdef __cplusplus -} -#endif - -#endif /* TEBase_h */ diff --git a/external/TouchEngine-Windows/include/TouchEngine/TED3D.h b/external/TouchEngine-Windows/include/TouchEngine/TED3D.h deleted file mode 100644 index 63422d7..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TED3D.h +++ /dev/null @@ -1,181 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - - -#ifndef TED3D_h -#define TED3D_h - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -TE_ASSUME_NONNULL_BEGIN - -#ifdef _WIN32 - -#include - -typedef TE_ENUM(TED3DHandleType, int32_t) -{ - /* - A global handle from a call to IDXGIResource::GetSharedHandle() - */ - TED3DHandleTypeD3D11Global, - /* - A NT handle from a call to IDXGIResource1::CreateSharedHandle() - */ - TED3DHandleTypeD3D11NT, - - /* - A NT handle from a call to ID3D12Device::CreateSharedHandle() - */ - TED3DHandleTypeD3D12ResourceNT -}; - - -/* - Returns via 'types' the TED3DHandleType supported by the instance. - This may change during configuration of an instance, and must be queried after receiving TEEventInstanceReady - 'types' is an array of TED3DHandleType, or NULL, in which case the value at counts is set to the number of available types - 'count' is a pointer to an int32_t which should be set to the number of available elements in 'types'. - If this function returns TEResultSuccess, 'count' is set to the number of TED3DHandleTypes filled in 'types' - If this function returns TEResultInsufficientMemory, the value at 'count' was too small to return all the types, and - 'count' has been set to the number of available types. Resize 'types' appropriately and call the function again to - retrieve the full array of types. - Where multiple types are returned, they may be selected for output by association of a suitable TEGraphicsContext - */ -TE_EXPORT TEResult TEInstanceGetSupportedD3DHandleTypes(TEInstance *instance, TED3DHandleType types[TE_NULLABLE], int32_t *count); - -/* - Returns via 'formats' the DXGI_FORMATs supported by the instance. - This may change during configuration of an instance, and must be queried after receiving TEEventInstanceReady - 'formats' is an array of DXGI_FORMAT, or NULL, in which case the value at counts is set to the number of available formats - 'count' is a pointer to an int32_t which should be set to the number of available elements in 'formats'. - If this function returns TEResultSuccess, 'count' is set to the number of DXGI_FORMATs filled in 'formats' - If this function returns TEResultInsufficientMemory, the value at 'count' was too small to return all the formats, and - 'count' has been set to the number of available formats. Resize 'formats' appropriately and call the function again to - retrieve the full array of formats. - */ -TE_EXPORT TEResult TEInstanceGetSupportedD3DFormats(TEInstance *instance, DXGI_FORMAT formats[TE_NULLABLE], int32_t *count); - -typedef struct TED3DSharedTexture_ TED3DSharedTexture; - -/* - D3D Shared Textures - see TETexture.h for functions common to all textures - */ - -/* - Event callback for D3D Shared Textures - */ -typedef void (*TED3DSharedTextureCallback)(HANDLE handle, TEObjectEvent event, void * TE_NULLABLE info); - -/* -Create a texture from a shared handle -'handle' from a call to IDXGIResource::GetSharedHandle() or IDXGIResource1::CreateSharedHandle() (DX11) or ID3D12Device::CreateSharedHandle() (DX12) - if the handle is a NT handle, it will be duplicated and the TED3DSharedTexture will manage its lifetime - consequently the value returned from - TED3DSharedTextureGetHandle() will not match this value -'type' is the type of shared handle -'origin' is the position in 2D space of the 0th texel of the texture -'map' describes how components are to be mapped when the texture is read. If components are not swizzled, you - can pass kTETextureComponentMapIdentity -'callback' will be invoked for object use and lifetime events - see TEObjectEvent in TEObject.h -The caller is responsible for releasing the returned TED3DSharedTexture using TERelease() -*/ -TE_EXPORT TED3DSharedTexture *TED3DSharedTextureCreate(HANDLE handle, - TED3DHandleType type, - DXGI_FORMAT format, - uint64_t width, - uint32_t height, - TETextureOrigin origin, - TETextureComponentMap map, - TED3DSharedTextureCallback TE_NULLABLE callback, - void * TE_NULLABLE info); - -TE_EXPORT HANDLE TED3DSharedTextureGetHandle(const TED3DSharedTexture *texture); - -TE_EXPORT TED3DHandleType TED3DSharedTextureGetHandleType(const TED3DSharedTexture *texture); - -/* - Returns the width of the texture, if known - Some older TouchDesigner installations may output textures which report a width and height of 0 and a format - of DXGI_FORMAT_UNKNOWN - these properties can be discovered from the instantiated Direct3D texture - */ -TE_EXPORT uint64_t TED3DSharedTextureGetWidth(const TED3DSharedTexture *texture); - -/* - Returns the height of the texture, if known - Some older TouchDesigner installations may output textures which report a width and height of 0 and a format - of DXGI_FORMAT_UNKNOWN - these properties can be discovered from the instantiated Direct3D texture - */ -TE_EXPORT uint32_t TED3DSharedTextureGetHeight(const TED3DSharedTexture *texture); - -/* - Returns the format of the texture, if known - Some older TouchDesigner installations may output textures which report a width and height of 0 and a format - of DXGI_FORMAT_UNKNOWN - these properties can be discovered from the instantiated Direct3D texture - */ -TE_EXPORT DXGI_FORMAT TED3DSharedTextureGetFormat(const TED3DSharedTexture *texture); - -/* - Sets 'callback' to be invoked for object use and lifetime events - see TEObjectEvent in TEObject.h. - This replaces (or cancels) any callback previously set on the TED3DSharedTexture - */ -TE_EXPORT TEResult TED3DSharedTextureSetCallback(TED3DSharedTexture *texture, TED3DSharedTextureCallback TE_NULLABLE callback, void * TE_NULLABLE info); - - -/* - D3D Fences - see TESemaphore.h for functions common to all semaphore types - */ - -typedef struct TED3DSharedFence_ TED3DSharedFence; - -typedef void (*TED3DSharedFenceCallback)(HANDLE handle, TEObjectEvent event, void * TE_NULLABLE info); - -/* - Creates a fence from a handle exported from a Direct3D 11 or 12 fence - - 'handle' is a HANDLE exported from a Direct3D 11 or 12 fence object (using ID3D11Fence::CreateSharedHandle() or - ID3D12Device::CreateSharedHandle()) - The handle will be duplicated and TouchEngine will manage its lifetime - consequently the value returned from - TED3DSharedFenceGetHandle() will not match this value -'callback' will be invoked for object use and lifetime events - see TEObjectEvent in TEObject.h -The caller is responsible for releasing the returned TED3DSharedFence using TERelease() - */ -TE_EXPORT TED3DSharedFence *TED3DSharedFenceCreate(HANDLE handle, TED3DSharedFenceCallback callback, void * TE_NULLABLE info); - -/* - Returns the HANDLE associated with the fence. The lifetime of this handle is managed by TouchEngine and it should not be passed - to a call to CloseHandle(). - */ -TE_EXPORT HANDLE TED3DSharedFenceGetHandle(TED3DSharedFence *fence); - -/* - Sets 'callback' to be invoked for object use and lifetime events - see TEObjectEvent in TEObject.h. - This replaces (or cancels) any callback previously set on the TED3DSharedFence - */ -TE_EXPORT TEResult TED3DSharedFenceSetCallback(TED3DSharedFence *fence, TED3DSharedFenceCallback TE_NULLABLE callback, void * TE_NULLABLE info); - -#endif // _WIN32 - -TE_ASSUME_NONNULL_END - -#ifdef __cplusplus -} -#endif - -#endif // TED3D_h diff --git a/external/TouchEngine-Windows/include/TouchEngine/TED3D11.h b/external/TouchEngine-Windows/include/TouchEngine/TED3D11.h deleted file mode 100644 index a734654..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TED3D11.h +++ /dev/null @@ -1,137 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - - -#ifndef TED3D11_h -#define TED3D11_h - -#include -#include -#include -#ifdef _WIN32 -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -TE_ASSUME_NONNULL_BEGIN - -#ifdef _WIN32 - -/* - D3D11 Textures - see TETexture.h for functions common to all textures, and TEDXGI.h for DXGI textures - */ - -typedef struct TED3D11Texture_ TED3D11Texture; -typedef struct TEInstance_ TEInstance; - -/* - Event callback for D3D11 Textures - When this callback is invoked with TEObjectEventRelease the ID3D11Texture2D is no longer being used by TouchEngine - and it may be re-used. TouchEngine keeps a reference to the texture through this callback, and issues its - final ID3D11Texture2D::Release() after the callback completes. - */ -typedef void (*TED3D11TextureCallback)(ID3D11Texture2D *texture, TEObjectEvent event, void * TE_NULLABLE info); - - -/* - 'origin' is the position in 2D space of the 0th texel of the texture - 'map' describes how components are to be mapped when the texture is read. If components are not swizzled, you - can pass kTETextureComponentMapIdentity - 'callback' will be invoked for object use and lifetime events - see TEObjectEvent in TEObject.h - The caller is responsible for releasing the returned TED3D11Texture using TERelease() - */ -TE_EXPORT TED3D11Texture *TED3D11TextureCreate(ID3D11Texture2D *texture, - TETextureOrigin origin, TETextureComponentMap map, - TED3D11TextureCallback TE_NULLABLE callback, void * TE_NULLABLE info); - -/* - 'origin' is the position in 2D space of the 0th texel of the texture - 'map' describes how components are to be mapped when the texture is read. If components are not swizzled, you - can pass kTETextureComponentMapIdentity - 'typedFormat' is a typed texture format specifying how the typeless format of the texture is to be interpreted. - 'callback' will be called with the values passed to 'texture' and 'info' when the texture is released - The caller is responsible for releasing the returned TED3D11Texture using TERelease() - */ -TE_EXPORT TED3D11Texture *TED3D11TextureCreateTypeless(ID3D11Texture2D *texture, - TETextureOrigin origin, TETextureComponentMap map, DXGI_FORMAT typedFormat, - TED3D11TextureCallback TE_NULLABLE callback, void * TE_NULLABLE info); - -/* - Returns the underlying ID3D11Texture2D. - This texture should be considered to be owned by the TED3D11Texture and should not be retained beyond - the lifetime of its owner. - */ -TE_EXPORT ID3D11Texture2D *TED3D11TextureGetTexture(const TED3D11Texture *texture); - -/* - Sets 'callback' to be invoked for object use and lifetime events - see TEObjectEvent in TEObject.h. - This replaces (or cancels) any callback previously set on the TED3D11Texture - */ -TE_EXPORT TEResult TED3D11TextureSetCallback(TED3D11Texture *texture, TED3D11TextureCallback TE_NULLABLE callback, void * TE_NULLABLE info); - -/* - D3D11 Graphics Contexts - see TEGraphicsContext.h for functions common to all graphics contexts - */ - -typedef struct TED3D11Context_ TED3D11Context; - -/* - Creates a graphics context for use with Direct3D 11. - - 'device' is the Direct3D device to be used for texture creation. - If the ID3D11Device was created for a specific adaptor, that adapter must be from a DXGI 1.1 factory - (IDXGIFactory1, not IDXGIFactory) - 'context' will be set to a TED3D11Context on return, or NULL if a context could not be created. - The caller is responsible for releasing the returned TED3D11Context using TERelease() - Returns TEResultSucccess or an error - */ -TE_EXPORT TEResult TED3D11ContextCreate(ID3D11Device * TE_NULLABLE device, - TED3D11Context * TE_NULLABLE * TE_NONNULL context); - -/* -Returns the ID3D11Device associated with a Direct3D context, or NULL. -*/ -TE_EXPORT ID3D11Device *TED3D11ContextGetDevice(TED3D11Context *context); - -/* - Creates a TED3D11Texture from a TED3DSharedTexture - - Both the created TED3D11Texture and the TED3DSharedTexture refer to the same resource. - The context maintains an internal cache, so repeated calls to this function for the same texture are faster than - instantiating an ID3D11Texture2D from the TED3DSharedTexture manually. - The caller is responsible for releasing the returned TETexture using TERelease() - */ -TE_EXPORT TEResult TED3D11ContextGetTexture(TED3D11Context *context, TED3DSharedTexture *source, TED3D11Texture * TE_NULLABLE * TE_NONNULL texture); - -/* - Some older versions of TouchDesigner require textures backed by DXGI keyed mutexes are released to 0 before they are - used by the instance. If this function returns true, always release to 0 rather than any other value, and add a - corresponding texture transfer. - This may change during configuration of an instance, and must be queried after receiving TEEventInstanceReady - See also TEInstanceAddTextureTransfer() in TEInstance.h - */ -TE_EXPORT bool TEInstanceRequiresKeyedMutexReleaseToZero(TEInstance *instance); - -#endif // _WIN32 - -TE_ASSUME_NONNULL_END - -#ifdef __cplusplus -} -#endif - -#endif // TED3D11_h diff --git a/external/TouchEngine-Windows/include/TouchEngine/TED3D12.h b/external/TouchEngine-Windows/include/TouchEngine/TED3D12.h deleted file mode 100644 index 9ac2632..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TED3D12.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - - -#ifndef TED3D12_h -#define TED3D12_h - -#include -#include -#include -#ifdef _WIN32 -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -TE_ASSUME_NONNULL_BEGIN - -#ifdef _WIN32 - -/* - See TED3D.h for shared textures and fences - */ - -/* - D3D12 Graphics Contexts - see TEGraphicsContext.h for functions common to all graphics contexts - */ - -typedef struct TED3D12Context_ TED3D12Context; - -/* - Creates a graphics context for use with Direct3D 12. Passing a TED3D12Context to TEInstanceAssociateGraphicsContext() will - - associate the instance with the same physical device - - cause the instance to return D3D12 textures for output link values - - 'device' is the Direct3D device to be used for texture creation. - 'context' will be set to a TED3D12Context on return, or NULL if a context could not be created. - The caller is responsible for releasing the returned TED3D12Context using TERelease() - Returns TEResultSucccess or an error - */ -TE_EXPORT TEResult TED3D12ContextCreate(ID3D12Device * TE_NULLABLE device, - TED3D12Context * TE_NULLABLE * TE_NONNULL context); - -/* -Returns the ID3D12Device associated with a Direct3D context, or NULL. -*/ -TE_EXPORT ID3D12Device *TED3D12ContextGetDevice(TED3D12Context *context); - -#endif // _WIN32 - -TE_ASSUME_NONNULL_END - -#ifdef __cplusplus -} -#endif - -#endif // TED3D12_h \ No newline at end of file diff --git a/external/TouchEngine-Windows/include/TouchEngine/TEFloatBuffer.h b/external/TouchEngine-Windows/include/TouchEngine/TEFloatBuffer.h deleted file mode 100644 index eee5dfa..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TEFloatBuffer.h +++ /dev/null @@ -1,176 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - -#ifndef TEFloatBuffer_h -#define TEFloatBuffer_h - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -TE_ASSUME_NONNULL_BEGIN - -typedef TE_ENUM(TEFloatBufferExtend, int32_t) -{ - TEFloatBufferExtendHold, - TEFloatBufferExtendSlope, - TEFloatBufferExtendCycle, - TEFloatBufferExtendMirror, - TEFloatBufferExtendConstant -}; - -typedef struct TEFloatBuffer_ TEFloatBuffer; - -/* - Creates a TEFloatBuffer instance for values which are not time-dependent. - - 'rate' is the number of values (or samples) per second, if this applies to the data. - Pass -1.0 to indicate no rate applies to the data. - 'channels' is the number of channels - 'capacity' is the maximum number of float values per channel - 'names' is an array of UTF-8 encoded strings denoting names for the channels, or NULL if the channels aren't named. - The names are copied into the buffer, and needn't last beyond this function call - Returns a new TEFloatBuffer instance, or NULL if an error prevented one being created. - The caller is responsible for releasing the returned TEFloatBuffer using TERelease() - */ -TE_EXPORT TEFloatBuffer *TEFloatBufferCreate(double rate, int32_t channels, uint32_t capacity, const char * TE_NULLABLE const * TE_NULLABLE names); - -/* - Creates a TEFloatBuffer instance for values which are time-dependent. - - 'rate' is the number of values (or samples) per second - 'channels' is the number of channels - 'capacity' is the maximum number of float values per channel - 'names' is an array of UTF-8 encoded strings denoting names for the channels, or NULL if the channels aren't named - The names are copied into the buffer, and needn't last beyond this function call - Returns a new TEFloatBuffer instance, or NULL if an error prevented one being created. - The caller is responsible for releasing the returned TEFloatBuffer using TERelease() - */ -TE_EXPORT TEFloatBuffer *TEFloatBufferCreateTimeDependent(double rate, int32_t channels, uint32_t capacity, const char * TE_NULLABLE const * TE_NULLABLE names); - -/* - Creates a new TEFloatBuffer instance sharing the same properties as an existing one. - - 'data' is an existing TEFloatBuffer instance - Returns a new TEFloatBuffer instance, or NULL if an error prevented one being created. - The caller is responsible for releasing the returned TEFloatBuffer using TERelease() - */ -TE_EXPORT TEFloatBuffer *TEFloatBufferCreateCopy(const TEFloatBuffer *buffer); - -/* - Sets the float values of a buffer, copying the values into the instance. - - 'values' is an array of pointers to float values to be set, one pointer per channel - 'count' is the number of values present per channel, and must not exceed the buffer's capacity - */ -TE_EXPORT TEResult TEFloatBufferSetValues(TEFloatBuffer *buffer, const float * TE_NONNULL * TE_NONNULL values, uint32_t count); - -/* - Sets the time associated with the values of a TEFloatBuffer. - - For time-dependent TEFloatBuffer, this is the time of the first value (or sample) present, expressed - in the buffer's sample rate. - When adding time-dependent TEFloatBuffers to a TEInstance as input, the start time is used to match - samples to frame start times. - If this function is not called, the default value is 0 - */ -TE_EXPORT TEResult TEFloatBufferSetStartTime(TEFloatBuffer *buffer, int64_t start); - -/* - Access the values in a TEFloatBuffer instance. - - The size of the returned array can be determined with TEFloatBufferGetChannelCount(). - These buffers are read-only: do not use them to change the content of the TEFloatBuffer instance. - The returned array is invalidated by any subsequent modification of the TEFloatBuffer instance - - for example by calls to TEFloatBufferSetValues() - Returns an array of pointers to float values, one pointer per channel, or NULL on an error. - */ -TE_EXPORT const float * TE_NONNULL const * TE_NULLABLE TEFloatBufferGetValues(const TEFloatBuffer *buffer); - -/* - Returns true if the contained values are time-dependent. - */ -TE_EXPORT bool TEFloatBufferIsTimeDependent(const TEFloatBuffer *buffer); - -/* - Returns the time associated with the contained values. For time-dependent values, this - is the time of the first value (or sample) present. - */ -TE_EXPORT int64_t TEFloatBufferGetStartTime(const TEFloatBuffer *buffer); - -/* - Returns the time associated with the last contained value (or sample). This value only has - meaning for time-dependent values. - */ -TE_EXPORT int64_t TEFloatBufferGetEndTime(const TEFloatBuffer *buffer); - -/* - Returns the maximum number of values the TEFloatBuffer instance can contain per channel. - */ -TE_EXPORT uint32_t TEFloatBufferGetCapacity(const TEFloatBuffer *buffer); - -/* - Returns the sample rate of the TEFloatBuffer instance, where applicable. - */ -TE_EXPORT double TEFloatBufferGetRate(const TEFloatBuffer *buffer); - -/* - Returns the number of channels. - */ -TE_EXPORT int32_t TEFloatBufferGetChannelCount(const TEFloatBuffer *buffer); - -/* - Returns the number of values per channel currently in the TEFloatBuffer instance. - */ -TE_EXPORT uint32_t TEFloatBufferGetValueCount(const TEFloatBuffer *buffer); - -/* - Returns an array of UTF-8 encoded strings, one per channel, denoting the names of the channels, - or NULL if no names are set. - */ -TE_EXPORT const char * TE_NULLABLE const * TE_NULLABLE TEFloatBufferGetChannelNames(const TEFloatBuffer *buffer); - -/* - Returns the behaviour that should be applied to determine values coming before those in the TEFloatBuffer instance. - */ -TE_EXPORT TEFloatBufferExtend TEFloatBufferGetExtendBefore(const TEFloatBuffer *buffer); - -/* - Returns the behaviour that should be applied to determine values coming after those in the TEFloatBuffer instance. - */ -TE_EXPORT TEFloatBufferExtend TEFloatBufferGetExtendAfter(const TEFloatBuffer *buffer); - -/* - Where TEFloatBufferExtend indicates TEFloatBufferExtendConstant, this returns the constant value to be applied. - */ -TE_EXPORT float TEFloatBufferGetExtendConstantValue(const TEFloatBuffer *buffer); - -/* - Sets the behaviour to be applied to determine values coming before or after those in the TEFloatBuffer instance. - - If this function is never called for an instance, the default behaviour is TEFloatBufferExtendHold. - 'constant' is the value to be applied in the case of TEFloatBufferExtendConstant - */ -TE_EXPORT void TEFloatBufferSetExtend(TEFloatBuffer *buffer, TEFloatBufferExtend before, TEFloatBufferExtend after, float constant); - -TE_ASSUME_NONNULL_END - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/TouchEngine-Windows/include/TouchEngine/TEGraphicsContext.h b/external/TouchEngine-Windows/include/TouchEngine/TEGraphicsContext.h deleted file mode 100644 index 426d599..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TEGraphicsContext.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - - -#ifndef TEGraphicsContext_h -#define TEGraphicsContext_h - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -TE_ASSUME_NONNULL_BEGIN - -typedef TEObject TEGraphicsContext; -typedef struct TEAdapter_ TEAdapter; - -/* - Returns the TEAdapter associated with a context. - The caller is responsible for releasing the returned TEAdapter using TERelease() - */ -TE_EXPORT TEAdapter *TEGraphicsContextGetAdapter(TEGraphicsContext *context); - -/* - See TEOpenGL.h, TED3D11.h, etc, to create and use TEGraphicsContexts - */ - -TE_ASSUME_NONNULL_END - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/TouchEngine-Windows/include/TouchEngine/TEInstance.h b/external/TouchEngine-Windows/include/TouchEngine/TEInstance.h deleted file mode 100644 index 181e716..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TEInstance.h +++ /dev/null @@ -1,1064 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - - -#ifndef TEInstance_h -#define TEInstance_h - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -TE_ASSUME_NONNULL_BEGIN - -typedef TE_ENUM(TEEvent, int32_t) -{ - /* - An error not associated with any other action has occurred. - */ - TEEventGeneral, - - /* - An instance is ready and waiting to be loaded. - */ - TEEventInstanceReady, - - /* - Loading an instance has completed. When this is received, all links - will have been added to the instance. You can begin requesting frames from the - instance. - */ - TEEventInstanceDidLoad, - - /* - Unloading an instance has completed. - */ - TEEventInstanceDidUnload, - - /* - A frequested frame has finished or been cancelled. - */ - TEEventFrameDidFinish -}; - -typedef TE_ENUM(TELinkEvent, int32_t) -{ - /* - A link was added to the instance. - */ - TELinkEventAdded, - - /* - A link was removed from the instance. - */ - TELinkEventRemoved, - - /* - An existing link was modified. The modification could affect: - - entries in the associated TELinkInfo - - minimum, maximum or default values - - choice names or labels - */ - TELinkEventModified, - - /* - An existing link was moved. The move could be: - - a change of parent container - - a change of order in the parent container - */ - TELinkEventMoved, - - /* - An existing link changed state. - See TEInstanceLinkGetState(). - */ - TELinkEventStateChange, - - /* - The number or order of a link's children changed. - */ - TELinkEventChildChange, - - /* - The link's current value changed. - */ - TELinkEventValueChange, -}; - -typedef TE_ENUM(TETimeMode, int32_t) -{ - /* - Rendering time is determined by times provided by you. - */ - TETimeExternal, - - /* - An internal clock is used to drive real-time rendering. - */ - TETimeInternal -}; - -typedef TE_ENUM(TEUIMode, int32_t) -{ - /* - No UI is permitted - */ - TEUINone, - - /* - TouchEngine may open windows - */ - TEUIWindows, -}; - -typedef TE_ENUM(TEScope, int32_t) -{ - TEScopeInput, - TEScopeOutput -}; - -typedef TE_ENUM(TELinkType, int32_t) -{ - /* - Multiple links collected according to user preference - */ - TELinkTypeGroup, - - /* - Multiple links which collectively form a single complex link - */ - TELinkTypeComplex, - - /* - Multiple repetitions of a group of links - */ - TELinkTypeSequence, - - /* - bool - */ - TELinkTypeBoolean, - - /* - double - */ - TELinkTypeDouble, - - /* - int32_t - */ - TELinkTypeInt, - - /* - UTF-8 char * (input) - TEString * (output) - */ - TELinkTypeString, - - - /* - TETexture * - */ - TELinkTypeTexture, - - /* - planar float sample buffers - */ - TELinkTypeFloatBuffer, - - /* - TETable * - or - UTF-8 char * (input) - TEString * (output) - */ - TELinkTypeStringData, - - /* - A division between grouped links - */ - TELinkTypeSeparator -}; - -typedef TE_ENUM(TELinkIntent, int32_t) -{ - TELinkIntentNotSpecified, - TELinkIntentColorRGBA, - TELinkIntentPositionXYZW, - TELinkIntentSizeWH, - TELinkIntentUVW, - - /* - Applies to TELinkTypeString - */ - TELinkIntentFilePath, - - /* - Applies to TELinkTypeString - */ - TELinkIntentDirectoryPath, - - /* - Applies to TELinkTypeBoolean - A true value is considered transient but may have duration, as from a button held down - */ - TELinkIntentMomentary, - - /* - Applies to TELinkTypeBoolean - A true value is considered transient, as from a single button press - */ - TELinkIntentPulse -}; - -typedef TE_ENUM(TELinkValue, int32_t) -{ - /* - A strict lower limit for the value of the link - Use TEInstanceLinkHasValue() to determine if this is set - */ - TELinkValueMinimum, - - /* - A strict upper limit for the value of the link - Use TEInstanceLinkHasValue() to determine if this is set - */ - TELinkValueMaximum, - - /* - A lower limit for UI elements representing the value of the link - Use TEInstanceLinkHasValue() to determine if this is set - */ - TELinkValueUIMinimum, - - /* - An upper limit for UI elements representing the value of the link - Use TEInstanceLinkHasValue() to determine if this is set - */ - TELinkValueUIMaximum, - - /* - The default value of the link, which should be used if you allow users - to restore defaults - */ - TELinkValueDefault, - - /* - The current value of the link - */ - TELinkValueCurrent -}; - -typedef TE_ENUM(TELinkDomain, int32_t) -{ - /* - The TouchEngine link has no one-to-one relationship with a TouchDesigner entity. - */ - TELinkDomainNone, - - /* - The TouchEngine link represents a TouchDesigner parameter. - */ - TELinkDomainParameter, - - /* - The TouchEngine link represents a TouchDesigner parameter page. - */ - TELinkDomainParameterPage, - - /* - The TouchEngine link represents a TouchDesigner operator. - */ - TELinkDomainOperator, -}; - -typedef TE_ENUM(TELinkInterest, int32_t) -{ - /* - No TELinkEvents will be received - You must not get the value of the link - */ - TELinkInterestNone, - - /* - TELinkEventValueChange will not be received - You must not get the value of the link - */ - TELinkInterestNoValues, - - /* - You must not get the value of the link until after TELinkEventValueChange has next been received - After TELinkEventValueChange is received, the interest will change to TELinkInterestAll - */ - TELinkInterestSubsequentValues, - - /* - All TELinksEvents will be received - The caller may get the value of the link - */ - TELinkInterestAll, -}; - -typedef struct TEInstance_ TEInstance; -typedef struct TEAdapter_ TEAdapter; -typedef TEObject TEGraphicsContext; -typedef struct TETable_ TETable; -typedef struct TEFloatBuffer_ TEFloatBuffer; - -struct TEColor -{ - double red; - double green; - double blue; - double alpha; -}; - -struct TELinkInfo -{ - /* - The scope (input or output) of the link. - */ - TEScope scope; - - /* - How the link is intended to be used. - */ - TELinkIntent intent; - - /* - The type of link - */ - TELinkType type; - - /* - The domain of the link. The domain describes the link's relationship - to a type of entity within TouchDesigner. - */ - TELinkDomain domain; - - /* - For value links, the number of values associated with the link - eg a colour may have four values for red, green, blue and alpha. - - For group, sequence or complex links, the number of children. - */ - int32_t count; - - /* - The human readable label for the link. - This may not be unique. - */ - const char * label; - - /* - The human readable name for the link. When present, the name is a way - for the user to uniquely reference a link within its domain: no two links - in the same domain will have the same name. - */ - const char * name; - - /* - A unique identifier for the link. If the underlying file is unchanged this - will persist through instantiations and will be the same for any given link - in multiple instances of the same file. - */ - const char * identifier; -}; - -struct TELinkState -{ - bool enabled; - bool editable; -}; - -struct TEString -{ - /* - A null-terminated UTF-8 encoded string - */ - const char *string; -}; - -struct TEStringArray -{ - /* - The number of strings in the array - */ - int32_t count; - - /* - The array of strings, each entry being a null-terminated UTF-8 encoded string - */ - const char * TE_NONNULL const * TE_NULLABLE strings; -}; - - -struct TEInstanceStatistics -{ - /* - In bytes - */ - int64_t memUsedGPU; - - /* - In bytes - */ - int64_t memUsedCPU; - - /* - The CPU time for the frames, in nanoseconds - */ - int64_t frameTimeCPU; - - /* - The GPU time for the frames, in nanoseconds - This value is delayed by one frame - A value of -1 indicates this value is not available due to the version - of TouchDesigner being used - */ - int64_t frameTimeGPU; - - /* - The number of frames processed since statistics were last delivered - */ - int64_t frames; - - /* - The number of frames dropped since statistics were last delivered - A value of -1 indicates this value is not available due to the version - of TouchDesigner being used - */ - int64_t framesDropped; -}; - -struct TEError -{ - /* - The domain for the error - */ - const char * domain; - - /* - A code for the error, which is meaningful for the domain - */ - int32_t code; - - /* - The severity of the error - */ - TESeverity severity; - - /* - The human readable description for the error as a null-terminated UTF-8 encoded string - */ - const char * description; - - /* - The location for the error, meaningful for the domain, as a null-terminated UTF-8 encoded string - */ - const char * location; -}; - -struct TEErrorArray -{ - /* - The number of errors in the array - */ - int32_t count; - - /* - The array of errors - */ - const struct TEError * errors; -}; - -/* - This callback is used to signal events related to an instance. - Note callbacks may be invoked from any thread. -*/ -typedef void (*TEInstanceEventCallback)(TEInstance *instance, - TEEvent event, - TEResult result, - int64_t start_time_value, - int32_t start_time_scale, - int64_t end_time_value, - int32_t end_time_scale, - void * TE_NULLABLE info); - -/* - This callback is used to signal changes to links. - Note callbacks may be invoked from any thread. -*/ -typedef void (*TEInstanceLinkCallback)(TEInstance *instance, TELinkEvent event, const char *identifier, void *info); - -/* - This callback is used to deliver statistics about the instance. - Note callbacks may be invoked from any thread. - */ -typedef void (*TEInstanceStatisticsCallback)(TEInstance *instance, - const struct TEInstanceStatistics *statistics, - void * TE_NULLABLE info); -/* - On return, extensions is a list of file extensions supported by TEInstanceCreate - The caller is responsible for releasing the returned TEStringArray using TERelease() - */ -TE_EXPORT TEResult TEInstanceGetSupportedFileExtensions(struct TEStringArray * TE_NULLABLE * TE_NONNULL extensions); - -/* - Creates an instance. - - 'event_callback' will be called to deliver TEEvents related to loading and rendering the instance. - 'link_callback' will be called to deliver TELinkEvents related to the instance's links. - 'callback_info' will be passed into the callbacks as the 'info' argument. - 'instance' will be set to a TEInstance on return, or NULL if an instance could not be created. - The caller is responsible for releasing the returned TEInstance using TERelease() - Returns TEResultSucccess or an error. - */ -TE_EXPORT TEResult TEInstanceCreate(TEInstanceEventCallback event_callback, - TEInstanceLinkCallback link_callback, - void * TE_NULLABLE callback_info, - TEInstance * TE_NULLABLE * TE_NONNULL instance); - - -/* - Optionally sets a path to a TouchDesigner installation which should be used in the absence of any overriding user direction - (eg an environment variable or file-system link) - In the absence of any setting, TouchEngine will select an installed version to use. - 'path' should be a path to an installation, or NULL to remove any earlier setting - On Windows, this should be the path to the installation directory (e.g. C:\Program Files\Derivative\TouchDesigner) - On macOS, this should be the path to the application (e.g. /Applications/TouchDesigner.app) -*/ -TE_EXPORT TEResult TEInstanceSetPreferredEnginePath(TEInstance *instance, const char * TE_NULLABLE path); - -/* - On return 'string' is the preferred installation path previously set on the instance, or an empty string if no preferred - installation path has been set. - The caller is responsible for releasing the returned TEString using TERelease(). - */ -TE_EXPORT TEResult TEInstanceGetPreferredEnginePath(TEInstance *instance, struct TEString * TE_NULLABLE * TE_NONNULL string); - -/* - On return 'string' is the path to the installed version of TouchDesigner used by the configured instance, or an empty - string if the instance has not been configured or configuration failed. - The caller is responsible for releasing the returned TEString using TERelease(). - */ -TE_EXPORT TEResult TEInstanceGetConfiguredEnginePath(TEInstance *instance, struct TEString * TE_NULLABLE * TE_NONNULL string); - -/* - Configures an instance for a .tox file which you subsequently intend to load. - If TEResultSuccess is returned: - Any in-progress configuration is cancelled. - Any currently loaded instance will be unloaded. - The instance is readied but the .tox file is not loaded. Once the instance is ready, your - TEInstanceEventCallback will receive TEEventInstanceReady and a TEResult indicating success or failure. - If you wish, you may immediately call TEInstanceLoad() after calling this function, without waiting - for the TEEventInstanceReady event. - You may pass a NULL argument for 'path' in which case the instance is readied but cannot be loaded. - - 'path' is a UTF-8 encoded string, or NULL. - 'time_mode' see TETimeMode above - ignored if 'path' is NULL - 'ui_mode' see TEUIMode above - time_mode must be TETimeInternal when TEUIWindows is used - */ -TE_EXPORT TEResult TEInstanceConfigure(TEInstance *instance, const char * TE_NULLABLE path, TETimeMode time_mode, TEUIMode ui_mode); - -/* - Loads a .tox file which you have previously set using TEInstanceConfigure(). - Any currently loaded instance will be unloaded. - The file is loaded asynchronously after this function returns. - The instance is loaded and put into a suspended state. During loading, your TEInstanceLinkCallback - may receive events as links are added to the instance. Once loading is complete, your - TEInstanceEventCallback will receive TEEventInstanceDidLoad and a TEResult indicating success or - failure. - Once loading is complete, call TEInstanceResume() when you are ready to allow rendering. - - */ -TE_EXPORT TEResult TEInstanceLoad(TEInstance *instance); - -/* - Any in-progress frame is cancelled. - Any currently loaded instance is unloaded. - During unload your TEInstanceLinkCallback will receive events for any links as they are - removed from the instance. Once the instance has unloaded your TEInstanceEventCallback will - receive TEEventInstanceReady. - */ -TE_EXPORT TEResult TEInstanceUnload(TEInstance *instance); - -/* - Returns true if a file is waiting to be loaded, being loaded, or has been loaded and not unloaded. - */ -TE_EXPORT bool TEInstanceHasFile(TEInstance *instance); - -/* - On return 'string' is the .tox file path set on the instance, or an empty string if no .tox - file has been set. - The caller is responsible for releasing the returned TEString using TERelease(). - */ -TE_EXPORT void TEInstanceGetPath(TEInstance *instance, struct TEString * TE_NULLABLE * TE_NONNULL string); - -TE_EXPORT TETimeMode TEInstanceGetTimeMode(TEInstance *instance); - -TE_EXPORT TEUIMode TEInstanceGetUIMode(TEInstance *instance); - -/* - Associates an instance with a graphics context. This optional association permits optimizations when - working with texture inputs and outputs and, for some instances, enables additional texture types. - To most clearly communicate your intentions to the instance, call this prior to the initial call to - TEInstanceResume(), and subsequently if you require support for a different context. - One context may be shared between several instances. - This function will call TEInstanceAssociateAdapter() on your behalf. - This function will call TEInstanceSetOutputTextureOrigin() on your behalf to match the native origin - for the context. If native orientation is not desired, call TEInstanceSetOutputTextureOrigin() afterwards. - */ -TE_EXPORT TEResult TEInstanceAssociateGraphicsContext(TEInstance *instance, TEGraphicsContext *context); - -/* - Associates an instance with an adapter. This optional association may guide the choice of adapter - used by the instance. - To most clearly communicate your intentions to the instance, call this prior to the initial call to - TEInstanceResume(), and subsequently if you require support for a different adapter. - */ -TE_EXPORT TEResult TEInstanceAssociateAdapter(TEInstance *instance, TEAdapter * TE_NULLABLE adapter); - -/* - Configures the origin for texture outputs. - */ -TE_EXPORT TEResult TEInstanceSetOutputTextureOrigin(TEInstance *instance, TETextureOrigin origin); - -/* - Returns the configured orientation for texture outputs. - */ -TE_EXPORT TETextureOrigin TEInstanceGetOutputTextureOrigin(TEInstance *instance); - -/* - Resumes an instance - */ -TE_EXPORT TEResult TEInstanceResume(TEInstance *instance); - -/* - Suspends an instance - Callbacks for any activities started prior to suspension may be received while suspended. - */ -TE_EXPORT TEResult TEInstanceSuspend(TEInstance *instance); - -/* - Sets a frame-rate for an instance. - - This is an indication of the rate the instance can expect to be rendered at, in frames per second, - expressed as a rational number. - Some possible values for numerator/denominator for 60 FPS are 60/1 or 60000/1000. - See also TEInstanceSetFloatFrameRate(). - 'numerator' is the numerator of the rate expressed as a rational number. - 'denominator' is the denominator of the rate expressed as a rational number. - */ -TE_EXPORT TEResult TEInstanceSetFrameRate(TEInstance *instance, int64_t numerator, int32_t denominator); - -/* - Sets a frame-rate for an instance, expressed as a floating-point number. - This is an indication of the rate the instance can expect to be rendered at, in frames per second. - */ -TE_EXPORT TEResult TEInstanceSetFloatFrameRate(TEInstance *instance, float rate); - -/* - Gets the frame-rate for an instance - 'numerator' and 'denominator' are filled out when the function completes. - */ -TE_EXPORT TEResult TEInstanceGetFrameRate(TEInstance *instance, int64_t *numerator, int32_t *denominator); - -/* - Gets the frame-rate for an instance, expressed as a floating-point number. - 'rate' is filled out when the function completes. - */ -TE_EXPORT TEResult TEInstanceGetFloatFrameRate(TEInstance* instance, float* rate); - -/* -'callback' will be called to deliver statistics related to the instance. - This argument may be NULL, in which case no statistics will be delivered. - */ -TE_EXPORT TEResult TEInstanceSetStatisticsCallback(TEInstance *instance, TEInstanceStatisticsCallback TE_NULLABLE callback); - -/* - On return 'string' is the directory path the instance will search to locate file assets referenced by the loaded component, - or an empty string if no component is loaded and no custom path has been set. - The caller is responsible for releasing the returned TEString using TERelease(). - */ -TE_EXPORT void TEInstanceGetAssetDirectory(TEInstance *instance, struct TEString * TE_NULLABLE * TE_NONNULL string); - -/* - Sets the path to a directory the instance will search to locate file assets referenced by the loaded component. - The default is to use the directory for the currently configured .tox file, which can be restored by passing NULL - or an empty string as 'path'. - */ -TE_EXPORT TEResult TEInstanceSetAssetDirectory(TEInstance *instance, const char * TE_NULLABLE path); - -/* - Rendering - */ - -/* - Returns via 'types' the TETextureTypes supported by the instance. - This may change during configuration of an instance, and must be queried after receiving TEEventInstanceReady - 'types' is an array of TETextureType, or NULL, in which case the value at counts is set to the number of available types - 'count' is a pointer to an int32_t which should be set to the number of available elements in 'types'. - If this function returns TEResultSuccess, 'count' is set to the number of TETextureType filled in 'types' - If this function returns TEResultInsufficientMemory, the value at 'count' was too small to return all the types, and - 'count' has been set to the number of available types. Resize 'types' appropriately and call the function again to - retrieve the full array of types. - Where multiple types are returned, they may be selected for output by association of a suitable TEGraphicsContext - */ -TE_EXPORT TEResult TEInstanceGetSupportedTextureTypes(TEInstance *instance, TETextureType types[TE_NULLABLE], int32_t *count); - -/* - Returns via 'formats' the TETextureFormats supported by the instance. - This may change during configuration of an instance, and must be queried after receiving TEEventInstanceReady - Versions of this function exist for each graphics API and those versions should be preferred over this one, as they - can express types supported by future versions of TouchDesigner - 'formats' is an array of TETextureFormat, or NULL, in which case the value at counts is set to the number of available formats - 'count' is a pointer to an int32_t which should be set to the number of available elements in 'formats'. - If this function returns TEResultSuccess, 'count' is set to the number of TETextureFormat filled in 'formats' - If this function returns TEResultInsufficientMemory, the value at 'count' was too small to return all the formats, and - 'count' has been set to the number of available formats. Resize 'formats' appropriately and call the function again to - retrieve the full array of formats. - */ -TE_EXPORT TEResult TEInstanceGetSupportedTextureFormats(TEInstance *instance, TETextureFormat formats[TE_NULLABLE], int32_t *count); - -/* - Returns via 'types' the TESemaphoreTypes supported by the instance. - This may change during configuration of an instance, and must be queried after receiving TEEventInstanceReady - 'types' is an array of TESemaphoreType, or NULL, in which case the value at counts is set to the number of available types - 'count' is a pointer to an int32_t which should be set to the number of available elements in 'types'. - If this function returns TEResultSuccess, 'count' is set to the number of TESemaphoreType filled in 'types' - If this function returns TEResultInsufficientMemory, the value at 'count' was too small to return all the types, and - 'count' has been set to the number of available types. Resize 'types' appropriately and call the function again to - retrieve the full array of types. - */ -TE_EXPORT TEResult TEInstanceGetSupportedSemaphoreTypes(TEInstance *instance, TESemaphoreType types[TE_NULLABLE], int32_t *count); - -/* - Returns true if the instance requires ownership transfer via TEInstanceAddTextureTransfer() (or equivalent) - This may change during configuration of an instance, and must be queried after receiving TEEventInstanceReady - 'instance' is an instance which has previously been configured. - */ -TE_EXPORT bool TEInstanceDoesTextureOwnershipTransfer(TEInstance *instance); - -/* - Provide the instance with a semaphore to synchronize texture usage by the instance. Note that the texture may not be - used, in which case the semaphore will not be used. - Texture transfers you have added which are not used for any reason may be discarded when a texture ceases to be used - by the instance (eg because the link's texture value has changed, or because the link itself has been removed). If - you subsequently set the same texture as a link value again, you must provide a texture transfer at that time. - 'texture' is the texture to synchronize usage of - 'semaphore' is a TESemaphore to synchronize usage - The instance will wait for this semaphore prior to using the texture - If this semaphore is a Vulkan binary semaphore, the instance will also signal this semaphore after waiting - To synchronize a D3D11 texture with a DXGI Keyed Mutex, pass NULL for this value - 'waitValue' is, if appropriate for the semaphore type, a value for the semaphore wait operation - */ -TE_EXPORT TEResult TEInstanceAddTextureTransfer(TEInstance *instance, TETexture *texture, TESemaphore * TE_NULLABLE semaphore, uint64_t value); - -/* - Returns true if 'instance' has a pending texture transfer for 'texture' - */ -TE_EXPORT bool TEInstanceHasTextureTransfer(TEInstance *instance, const TETexture *texture); - -/* - Get the semaphore needed to transfer ownership from the instance prior to using a texture, if - such an operation is pending. - 'texture' is a texture associated with one of the instance's links - 'semaphore' is, on successful return, a TESemaphore to synchronize the transfer on the GPU - The caller must wait for this semaphore prior to using the texture - If this semaphore is a Vulkan binary semaphore, the caller must also signal this semaphore after waiting - If the TETexture is a D3D11 texture and this value is NULL, use a DXGI Keyed Mutex acquire operation on the - instantiated texture - The caller is responsible for releasing the returned TESemaphore using TERelease() - 'waitValue' is, on successful return and if appropriate for the semaphore type, a value for the semaphore wait operation - */ -TE_EXPORT TEResult TEInstanceGetTextureTransfer(TEInstance *instance, - const TETexture *texture, - TESemaphore * TE_NULLABLE * TE_NONNULL semaphore, - uint64_t *waitValue); - -/* - Initiates rendering of a frame. - 'time_value' is the time for the frame expressed as a number of ticks in the unit of time given by 'time_scale' - 'time_scale' is the unit of time in which the frame times is represented, and is the number of ticks in one second - When frame-rate is fixed, this should generally be some multiple of the frame-rate so that whole frame times can - be precisely expressed. - 'time_value' and 'time_scale' are ignored for TETimeInternal unless 'discontinuity' is true - Excessive use of this method to set times on an instance in TETimeInternal mode will degrade performance. - 'discontinuity' if true indicates the frame does not follow naturally from the previously requested frame - The frame is rendered asynchronously after this function returns. - TEInstanceLinkCallback is called for any outputs affected by the rendered frame. - TEInstanceEventCallback is called with TEEventFrameDidFinish when the frame completes. - Returns TEResultSuccess or an error. - If an error is returned, the frame will not be rendered and the TEInstanceEventCallback will not be invoked. - */ -TE_EXPORT TEResult TEInstanceStartFrameAtTime(TEInstance *instance, int64_t time_value, int32_t time_scale, bool discontinuity); - -/* - Requests the cancellation of an in-progress frame. - If the frame was successfully cancelled, TEInstanceEventCallback is called with TEEventFrameDidFinish and TEResultCancelled, - alternatively the frame may complete as usual before the cancellation request is delivered. -*/ -TE_EXPORT TEResult TEInstanceCancelFrame(TEInstance *instance); - -/* - On return 'errors' is a list of TEErrors for the currently loaded file at the current frame. - The caller is responsible for releasing the returned TEErrorArray using TERelease(). - */ -TE_EXPORT TEResult TEInstanceGetErrors(TEInstance *instance, struct TEErrorArray * TE_NULLABLE * TE_NONNULL errors); - -/* - Link Layout - */ - -/* - On return 'children' is a list of link identifiers for the children of the parent link denoted by 'identifier'. - If 'identifier' is NULL or an empty string, the top level links are returned. - 'identifier' should denote a link of type TELinkTypeGroup, TELinkTypeSequence or TELinkTypeComplex. - The caller is responsible for releasing the returned TEStringArray using TERelease(). - */ -TE_EXPORT TEResult TEInstanceLinkGetChildren(TEInstance *instance, const char * TE_NULLABLE identifier, struct TEStringArray * TE_NULLABLE * TE_NONNULL children); - -/* - On return 'string' is the link identifier for the TELinkTypeGroup, TELinkTypeSequence or TELinkTypeComplex which - contains the link denoted by 'identifier', or an empty string if 'identifier' denotes a top level link. - The caller is responsible for releasing the returned TEString using TERelease(). - */ -TE_EXPORT TEResult TEInstanceLinkGetParent(TEInstance *instance, const char * TE_NULLABLE identifier, struct TEString * TE_NULLABLE * TE_NONNULL string); - -/* - On return 'groups' is a list of link identifiers for the top level links in the given scope. - The caller is responsible for releasing the returned TEStringArray using TERelease(). - */ -TE_EXPORT TEResult TEInstanceGetLinkGroups(TEInstance *instance, TEScope scope, struct TEStringArray * TE_NULLABLE * TE_NONNULL groups); - -/* - Link Basics - */ - -/* - On return 'info' describes the link denoted by 'identifier'. - The caller is responsible for releasing the returned TELinkInfo using TERelease(). - */ -TE_EXPORT TEResult TEInstanceLinkGetInfo(TEInstance *instance, const char *identifier, struct TELinkInfo * TE_NULLABLE * TE_NONNULL info); - -/* - On return 'state' describes the state of the link denoted by 'identifier'. - The caller is responsible for releasing the returned TELinkState using TERelease(). - */ -TE_EXPORT TEResult TEInstanceLinkGetState(TEInstance *instance, const char *identifier, struct TELinkState * TE_NULLABLE * TE_NONNULL state); - -/* - Returns true if the link has a list of choices associated with it, suitable for presentation to the user as a menu. - Only TELinkTypeInt and TELinkTypeString may have a list of choices. - */ -TE_EXPORT bool TEInstanceLinkHasChoices(TEInstance *instance, const char *identifier); - -/* - On return 'labels' is a list of labels suitable for presentation to the user as options for choosing a value for the link denoted by 'identifier'. - If 'identifier' does not offer a list of options then 'labels' will be set to NULL. - Only TELinkTypeInt and TELinkTypeString may have a list of choices. For TELinkTypeInt, the corresponding value is the index of the label - in the list. For TELinkTypeString, the corresponding value is the entry at the same index in the list returned by TEInstanceLinkGetChoiceValues(). - The caller is responsible for releasing the returned TEStringArray using TERelease(). -*/ -TE_EXPORT TEResult TEInstanceLinkGetChoiceLabels(TEInstance *instance, const char *identifier, struct TEStringArray * TE_NULLABLE * TE_NONNULL labels); - -/* - On return 'values' is a list of values which may be set on the link denoted by 'identifier'. Each value will have a corresponding label for - presentation in UI (see TEInstanceLinkGetChoiceLabels()). - If 'identifier' does not offer a list of value options then 'values' will be set to NULL. - Only TELinkTypeString may have a list of value options. This list should not be considered exhaustive and users should be allowed to enter their own - values as well as those in this list. - The caller is responsible for releasing the returned TEStringArray using TERelease(). -*/ -TE_EXPORT TEResult TEInstanceLinkGetChoiceValues(TEInstance *instance, const char *identifier, struct TEStringArray * TE_NULLABLE * TE_NONNULL values); - -/* - Returns true if a user-selected color tint is associated with a link. If no tint has been set by the user, or if no matching link exists, returns false. -*/ -TE_EXPORT bool TEInstanceLinkHasUserTint(TEInstance *instance, const char *identifier); - -/* - If a user-selected color tint is associated with the link 'tint' is set. - 'tint' is a pointer to a TEColor which will be set to the color tint on return - If no color tint is set, returns TEResultNoMatchingEntity -*/ -TE_EXPORT TEResult TEInstanceLinkGetUserTint(TEInstance *instance, const char *identifier, struct TEColor * TE_NONNULL tint); - -/* - Notifies the instance of the caller's interest in a link - The default for all links is TELinkInterestAll - Setting TELinkInterestNone or TELinkInterestNoValues permits the instance to reduce the work done for those links - After getting a value, setting TELinkInterestSubsequentValues can allow the instance to release or re-use resources sooner - */ -TE_EXPORT TEResult TEInstanceLinkSetInterest(TEInstance *instance, const char *identifier, TELinkInterest interest); - -TE_EXPORT TELinkInterest TEInstanceLinkGetInterest(TEInstance *instance, const char *identifier); - -/* - Getting Link Values - */ - -/* - Returns true if a link matching `identifier` exists and if it has a value for `which` at the specified `index`. - Links with multiple values (TELinkTypeInt and TELinkTypeDouble) can have minimum or maximum values for some entries but not others. - Use this function when calling TEInstanceLinkGetDoubleValue() or TEInstanceLinkGetIntValue() for TELinkValueMinimum, TELinkValueMaximum, - TELinkValueUIMinimum or TELinkValueUIMaximum. - */ -TE_EXPORT bool TEInstanceLinkHasValue(TEInstance *instance, const char *identifier, TELinkValue which, int32_t index); - -TE_EXPORT TEResult TEInstanceLinkGetBooleanValue(TEInstance *instance, const char *identifier, TELinkValue which, bool *value); - -/* - Use TEInstanceLinkHasValue() to determine the validity of TELinkValueMinimum, TELinkValueMaximum, TELinkValueUIMinimum and TELinkValueUIMaximum - for links of TELinkTypeDouble - */ -TE_EXPORT TEResult TEInstanceLinkGetDoubleValue(TEInstance *instance, const char *identifier, TELinkValue which, double *value, int32_t count); - -/* - Use TEInstanceLinkHasValue() to determine the validity of TELinkValueMinimum, TELinkValueMaximum, TELinkValueUIMinimum and TELinkValueUIMaximum - for links of TELinkTypeInt - */ -TE_EXPORT TEResult TEInstanceLinkGetIntValue(TEInstance *instance, const char *identifier, TELinkValue which, int32_t *value, int32_t count); - -/* - The caller is responsible for releasing the returned TEString using TERelease(). - */ -TE_EXPORT TEResult TEInstanceLinkGetStringValue(TEInstance *instance, const char *identifier, TELinkValue which, struct TEString * TE_NULLABLE * TE_NONNULL string); - -/* - On successful completion 'value' is set to a TETexture or NULL if no value is set. - The type of TETexture returned can be configured by associating an appropriate TEGraphicsContext, and some - TEGraphicsContexts will convert between texture types. - There may be an associated texture transfer to synchronize usage of the texture (see TEInstanceGetTextureTransfer()) - - this transfer will only be available for as long as the texture is set on the link. - The caller is responsible for releasing the returned TETexture using TERelease() - */ -TE_EXPORT TEResult TEInstanceLinkGetTextureValue(TEInstance *instance, const char *identifier, TELinkValue which, TETexture * TE_NULLABLE * TE_NONNULL value); - -/* - On successful completion 'value' is set to a TETable or NULL if no value is set. - The caller is responsible for releasing the returned TETable using TERelease() -*/ -TE_EXPORT TEResult TEInstanceLinkGetTableValue(TEInstance *instance, const char *identifier, TELinkValue which, TETable * TE_NULLABLE * TE_NONNULL value); - -/* - On successful completion 'value' is set to a TEFloatBuffer or NULL if no value is set. - The caller is responsible for releasing the returned TEFloatBuffer using TERelease() -*/ -TE_EXPORT TEResult TEInstanceLinkGetFloatBufferValue(TEInstance *instance, const char *identifier, TELinkValue which, TEFloatBuffer * TE_NULLABLE * TE_NONNULL value); - -/* - On successful completion 'value' is set to a TEObject or NULL if no value is set. - An error will be returned if the link cannot be represented as a TEObject. - The type of the returned object can be determined using TEGetType(). - The caller is responsible for releasing the returned TEObject using TERelease() -*/ -TE_EXPORT TEResult TEInstanceLinkGetObjectValue(TEInstance *instance, const char *identifier, TELinkValue which, TEObject * TE_NULLABLE * TE_NONNULL value); - - -/* - Setting Input Link Values - */ - -TE_EXPORT TEResult TEInstanceLinkSetBooleanValue(TEInstance *instance, const char *identifier, bool value); - -TE_EXPORT TEResult TEInstanceLinkSetDoubleValue(TEInstance *instance, const char *identifier, const double *value, int32_t count); - -TE_EXPORT TEResult TEInstanceLinkSetIntValue(TEInstance *instance, const char *identifier, const int32_t *value, int32_t count); - -/* - Sets the value of a string input link. - 'value' is a UTF-8 encoded string - */ -TE_EXPORT TEResult TEInstanceLinkSetStringValue(TEInstance *instance, const char *identifier, const char * TE_NULLABLE value); - -/* - Sets the value of a texture input link - 'texture' may be retained by the instance - 'context' is a valid TEGraphicsContext of a type suitable for working with the provided texture. - NULL may be passed ONLY if 'texture' is of type TETextureTypeD3DShared or TETextureTypeIOSurface or TETextureTypeVulkan - Work may be done in the provided graphics context by this call. - An OpenGL context may change the current framebuffer and GL_TEXTURE_2D bindings during this call. - This may be a different context than any previously passed to TEInstanceAssociateGraphicsContext(). - */ -TE_EXPORT TEResult TEInstanceLinkSetTextureValue(TEInstance *instance, const char *identifier, TETexture *TE_NULLABLE texture, TEGraphicsContext * TE_NULLABLE context); - -/* - Sets the value of a float buffer input link, replacing any previously set value. - See also TEInstanceLinkAddFloatBuffer(). - This call is required even if a single buffer is used but modified between frames. - 'buffer' may be retained by the instance. - */ -TE_EXPORT TEResult TEInstanceLinkSetFloatBufferValue(TEInstance *instance, const char *identifier, const TEFloatBuffer * TE_NULLABLE buffer); - -/* - Appends a float buffer for an input link receiving time-dependent values. - The start time of the TEFloatBuffer is used to match samples to frames using the time passed to - TEInstanceStartFrameAtTime(). - 'buffer' must be a time-dependent TEFloatBuffer, and may be retained by the instance. - */ -TE_EXPORT TEResult TEInstanceLinkAddFloatBuffer(TEInstance *instance, const char *identifier, const TEFloatBuffer * TE_NULLABLE buffer); - -/* - Sets the value of a table input link. - - This call is required even if a single table is used but modified between frames. - 'table' may be retained by the instance. - */ -TE_EXPORT TEResult TEInstanceLinkSetTableValue(TEInstance *instance, const char *identifier, const TETable * TE_NULLABLE table); - -/* - Sets the value of an input link. - - An error will be returned if the link cannot be set using the provided TEObject. - 'value' may be retained by the instance - */ -TE_EXPORT TEResult TEInstanceLinkSetObjectValue(TEInstance *instance, const char *identifier, TEObject * TE_NULLABLE object); - -/* - Sets the number of repetitions of a link of type TELinkTypeSequence. - - The change may happen asynchronously, after this function returns. Updates will be posted as events to the - TEInstanceLinkCallback. - The current number of instances is queried from the 'count' member of TELinkInfo or the 'count' member of the - TEStringArray returned from TEInstanceLinkGetChildren() for the identifier for the sequence. - */ -TE_EXPORT TEResult TEInstanceLinkSetSequenceCount(TEInstance *instance, const char *identifier, int32_t count); - -#define kStructAlignmentError "struct misaligned for library" - -static_assert(offsetof(struct TELinkInfo, intent) == 4, kStructAlignmentError); -static_assert(offsetof(struct TELinkInfo, type) == 8, kStructAlignmentError); -static_assert(offsetof(struct TELinkInfo, count) == 16, kStructAlignmentError); -static_assert(offsetof(struct TELinkInfo, label) == 24, kStructAlignmentError); -static_assert(offsetof(struct TELinkInfo, identifier) == 40, kStructAlignmentError); -static_assert(offsetof(struct TEStringArray, strings) == 8, kStructAlignmentError); - -TE_ASSUME_NONNULL_END - -#ifdef __cplusplus -} -#endif - -#endif /* TEInstance_h */ diff --git a/external/TouchEngine-Windows/include/TouchEngine/TEObject.h b/external/TouchEngine-Windows/include/TouchEngine/TEObject.h deleted file mode 100644 index 3ff50a8..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TEObject.h +++ /dev/null @@ -1,94 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - - -#ifndef TEObject_h -#define TEObject_h - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -TE_ASSUME_NONNULL_BEGIN - -typedef TE_ENUM(TEObjectType, int32_t) -{ - TEObjectTypeUnknown, - TEObjectTypeInstance, - TEObjectTypeTexture, - TEObjectTypeAdapter, - TEObjectTypeGraphicsContext, - TEObjectTypeLinkInfo, - TEObjectTypeLinkState, - TEObjectTypeString, - TEObjectTypeStringArray, - TEObjectTypeTable, - TEObjectTypeFloatBuffer, - TEObjectTypeSemaphore, - TEObjectTypeErrorArray, -}; - -/* - Events for TEObject callbacks - */ -typedef TE_ENUM(TEObjectEvent, int32_t) -{ - /* - Sent when an object starts to be used by the library - */ - TEObjectEventBeginUse, - - /* - Sent when an object ceases to be used by the library. You may re-use the object at this point. - */ - TEObjectEventEndUse, - - /* - Sent when the object has received its final TERelease and will be destroyed - */ - TEObjectEventRelease -}; - -typedef void TEObject; - -/* - Retains a TEObject, incrementing its reference count. If you retain an object, - you are responsible for releasing it (using TERelease()). - Returns the input value. - */ -TE_EXPORT TEObject *TERetain(TEObject *object); - -/* - Releases a TEObject, decrementing its reference count. When the last reference - to an object is released, it is deallocated and destroyed. - Sets the passed pointer to NULL. - */ -#define TERelease(x) TERelease_((TEObject **)(x)) -TE_EXPORT void TERelease_(TEObject * TE_NULLABLE * TE_NULLABLE object); - -/* - Returns the type of a TEObject. - */ -TE_EXPORT TEObjectType TEGetType(const TEObject *object); - -TE_ASSUME_NONNULL_END - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/TouchEngine-Windows/include/TouchEngine/TEOpenGL.h b/external/TouchEngine-Windows/include/TouchEngine/TEOpenGL.h deleted file mode 100644 index 9a20da6..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TEOpenGL.h +++ /dev/null @@ -1,223 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - - -#ifndef TEOpenGL_h -#define TEOpenGL_h - -#include -#include -#include -#ifdef __APPLE__ - #include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -TE_ASSUME_NONNULL_BEGIN - -#ifdef _WIN32 - -typedef unsigned int GLenum; -typedef int GLint; -typedef unsigned int GLuint; - -typedef struct HGLRC__ *HGLRC; -typedef struct HDC__ *HDC; - -typedef unsigned int UINT; - -#endif - -typedef struct TEOpenGLTexture_ TEOpenGLTexture; - -/* - OpenGL Textures - see TETexture.h for functions common to all textures - */ - -typedef void (*TEOpenGLTextureCallback)(GLuint texture, TEObjectEvent event, void * TE_NULLABLE info); - -/* -Create a texture from an OpenGL texture -'internaFormat' must be a sized format (eg GL_RGBA8, not GL_RGBA) -'callback' will be invoked for object use and lifetime events - see TEObjectEvent in TEObject.h - the - OpenGL texture should remain valid until receiving TEObjectEventRelease. -'origin' is the position in 2D space of the 0th texel of the texture -'map' describes how components are to be mapped when the texture is read. If components are not swizzled, you - can pass kTETextureComponentMapIdentity -The caller is responsible for releasing the returned TEOpenGLTexture using TERelease() -*/ -TE_EXPORT TEOpenGLTexture *TEOpenGLTextureCreate(GLuint texture, - GLenum target, - GLint internalFormat, - int32_t width, - int32_t height, - TETextureOrigin origin, - TETextureComponentMap map, - TEOpenGLTextureCallback TE_NULLABLE callback, void * TE_NULLABLE info); - -/* - Returns the underlying OpenGL texture. - This texture is owned by the TEOpenGLTexture and should not be used beyond the lifetime of its owner. - */ -TE_EXPORT GLuint TEOpenGLTextureGetName(const TEOpenGLTexture *texture); - -TE_EXPORT GLenum TEOpenGLTextureGetTarget(const TEOpenGLTexture *texture); - -TE_EXPORT GLint TEOpenGLTextureGetInternalFormat(const TEOpenGLTexture *texture); - -TE_EXPORT int32_t TEOpenGLTextureGetWidth(const TEOpenGLTexture *texture); - -TE_EXPORT int32_t TEOpenGLTextureGetHeight(const TEOpenGLTexture *texture); - -#ifdef _WIN32 -/* - Acquires an exclusive lock for access to the texture - */ -TE_EXPORT TEResult TEOpenGLTextureLock(TEOpenGLTexture *texture); - -/* - Releases a previously acquired exclusive lock for access to the texture - */ -TE_EXPORT TEResult TEOpenGLTextureUnlock(TEOpenGLTexture *texture); -#endif - -/* - Sets 'callback' to be invoked for object use and lifetime events - see TEObjectEvent in TEObject.h. - This replaces (or cancels) any callback previously set on the TEOpenGLTexture - */ -TE_EXPORT TEResult TEDOpenGLTextureSetCallback(TEOpenGLTexture *texture, TEOpenGLTextureCallback TE_NULLABLE callback, void * TE_NULLABLE info); - -/* - OpenGL Adapter - */ - -#ifdef _WIN32 -/* - Creates an adapter for an AMD GPU using the WGL_AMD_gpu_association OpenGL extension. - - 'gpuID' is the ID of a GPU obtained using the extension. - 'adapter' will be set to a TEAdapter on return, or NULL if an adapter could not be created. - The caller is responsible for releasing the returned TEAdapter using TERelease() - Returns TEResultSucccess or an error - */ -TE_EXPORT TEResult TEAdapterCreateForAMDGPUAssociation(UINT gpuID, TEAdapter * TE_NULLABLE * TE_NONNULL adapter); -#endif - -/* - OpenGL Graphics Contexts - see TEGraphicsContext.h for functions common to all graphics contexts - */ - -typedef struct TEOpenGLContext_ TEOpenGLContext; - -#ifdef _WIN32 - -typedef struct TED3DSharedTexture_ TED3DSharedTexture; - -/* - Creates a graphics context for use with OpenGL. - - 'dc' is a valid device context to be used for OpenGL commands - This value can be changed later using TEOpenGLContextSetDC() - 'rc' is a valid OpenGL render context to be used for OpenGL commands - 'context' will be set to a TEOpenGLContext on return, or NULL if a context could not be created. - The caller is responsible for releasing the returned TEOpenGLContext using TERelease() - Returns TEResultSucccess or an error - */ -TE_EXPORT TEResult TEOpenGLContextCreate(HDC dc, - HGLRC rc, - TEOpenGLContext * TE_NULLABLE * TE_NONNULL context); - -/* - Creates a graphics context for use with OpenGL where the context is bound - to particular device(s) with the WGL_NV_gpu_affinity extension. - - 'dc' is a valid device context to be used for OpenGL commands - This value can be changed later using TEOpenGLContextSetDC() - 'rc' is a valid OpenGL render context to be used for OpenGL commands - 'context' will be set to a TEOpenGLContext on return, or NULL if a context could not be created. - The caller is responsible for releasing the returned TEOpenGLContext using TERelease() - Returns TEResultSucccess or an error - */ -TE_EXPORT TEResult TEOpenGLNVAffinityContextCreate(HDC dc, - HGLRC rc, - TEOpenGLContext * TE_NULLABLE * TE_NONNULL context); - -/* - Creates a graphics context for use with OpenGL where the context is bound - to a particular device with the WGL_AMD_gpu_association extension. - - The supplied HGLRC must have been created with a GPU association and must be active at the time - of this call. - - 'rc' is a valid OpenGL render context to be used for OpenGL commands - 'context' will be set to a TEOpenGLContext on return, or NULL if a context could not be created. - The caller is responsible for releasing the returned TEOpenGLContext using TERelease() - Returns TEResultSucccess or an error - */ -TE_EXPORT TEResult TEOpenGLAMDAssociatedContextCreate(HGLRC rc, - TEOpenGLContext * TE_NULLABLE * TE_NONNULL context); - -/* - Returns the device context associated with an OpenGL context, or NULL. - */ -TE_EXPORT HDC TEOpenGLContextGetDC(TEOpenGLContext *context); - -/* - Returns the OpenGL render context associated with an OpenGL context, or NULL. - */ -TE_EXPORT HGLRC TEOpenGLContextGetRC(TEOpenGLContext *context); - -/* - Change the device context used by an OpenGL context. - Returns TEResultSuccess on success, or an error. - */ -TE_EXPORT TEResult TEOpenGLContextSetDC(TEOpenGLContext *context, HDC dc); - -/* - Work may be done in the graphics context by this call. - The current OpenGL framebuffer and texture bindings may be changed during this call. - The caller is responsible for releasing the returned TETexture using TERelease() - - work may be done in the graphics context associated with the instance by the final - call to TERelease() for the returned texture. - */ -TE_EXPORT TEResult TEOpenGLContextGetTexture(TEOpenGLContext *context, TED3DSharedTexture *source, TEOpenGLTexture * TE_NULLABLE * TE_NONNULL texture); - -#endif - -#ifdef __APPLE__ - -TE_EXPORT TEResult TEOpenGLContextCreate(CGLContextObj cgl, TEOpenGLContext * TE_NULLABLE * TE_NONNULL context); - -TE_EXPORT CGLContextObj TEOpenGLContextGetCGLContext(TEOpenGLContext *context); - -TE_EXPORT TEResult TEOpenGLContextGetTexture(TEOpenGLContext *context, TEIOSurfaceTexture *source, TEOpenGLTexture * TE_NULLABLE * TE_NONNULL texture); - -#endif - -/* - Returns true if OpenGL textures are supported by the instance with the use of the context. - This may change during configuration of an instance, and must be queried after receiving TEEventInstanceReady - */ -TE_EXPORT bool TEOpenGLContextSupportsTexturesForInstance(TEOpenGLContext *context, TEInstance *instance); - -TE_ASSUME_NONNULL_END - -#ifdef __cplusplus -} -#endif - -#endif // TEOpenGL_h diff --git a/external/TouchEngine-Windows/include/TouchEngine/TEResult.h b/external/TouchEngine-Windows/include/TouchEngine/TEResult.h deleted file mode 100644 index ae5162a..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TEResult.h +++ /dev/null @@ -1,202 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - - -#ifndef TEResult_h -#define TEResult_h - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -TE_ASSUME_NONNULL_BEGIN - -typedef TE_ENUM(TEResult, int32_t) -{ - - TEResultSuccess, - - TEResultInsufficientMemory, - - TEResultGPUAllocationFailed, - - TEResultTextureFormatNotSupported, - - /* - An input texture was used, but its component map was not honored. - */ - TEResultTextureComponentMapNotSupported, - - /* - The TouchEngine process crashed or stopped responding. - An instance will not be usable until TEInstanceConfigure() is called again. - */ - TEResultExecutableError, - - TEResultInternalError, - - TEResultMissingResource, - - /* - Samples were dropped during rendering due to full output stream buffers. - */ - TEResultDroppedSamples, - - /* - Insufficient samples were provided during rendering. - */ - TEResultMissedSamples, - - /* - Invalid arguments were given to a function, or a function was called at an improper time. - */ - TEResultBadUsage, - - /* - A requested entity does not exist. - */ - TEResultNoMatchingEntity, - - /* - The operation was previously cancelled. - */ - TEResultCancelled, - - /* - A TouchDesigner/Player key was found, but its update date is older than the build of TouchEngine being used. - */ - TEResultExpiredKey, - - /* - No TouchDesigner or TouchPlayer key was found, or the installed key does not permit TouchEngine use. - */ - TEResultNoKey, - - /* - General error trying to determine installed license. Open TouchDesigner to diagnose further. - */ - TEResultKeyError, - - /* - Error reading or accessing a file. - */ - TEResultFileError, - - /* - The version/build of TouchEngine being used is older than the one used to create the file being opened. - */ - TEResultNewerFileVersion, - - /* - Unable to find TouchEngine executable to launch. - */ - TEResultTouchEngineNotFound, - - /* - An instance of TouchEngine was specified but could not be used. - */ - TEResultTouchEngineBadPath, - - /* - Launching the TouchEngine executable failed. - */ - TEResultFailedToLaunchTouchEngine, - - /* - A required feature is not available on the selected system - (eg the selected graphics adapater does not offer a required command) - */ - TEResultFeatureNotSupportedBySystem, - - /* - The version of TouchEngine being used is older than the TouchEngine library. - - This result should be considered a warning and operation will continue, potentially with limited functionality. - */ - TEResultOlderEngineVersion, - - /* - The version of TouchEngine being used is not compatible with the TouchEngine library. - */ - TEResultIncompatibleEngineVersion, - - /* - The OS denied permission - */ - TEResultPermissionDenied, - - /* - Errors were reported by the component. - - This result may accompany TEEventInstanceDidLoad or TEEventFrameDidFinish. - You may use TEInstanceGetErrors() to receive detailed errors. - - Errors in the component do not prevent further use of TouchEngine, however output or other component behaviour - may be affected. - */ - TEResultComponentErrors, - - /* - Warnings were reported by the component. - - This result may accompany TEEventInstanceDidLoad or TEEventFrameDidFinish. - You may use TEInstanceGetErrors() to receive detailed errors. - */ - TEResultComponentWarnings, - - TEResultNoMatchingLink = TEResultNoMatchingEntity, - - TEResultBadFileBindings = TEResultComponentErrors, - - TEResultFileLoadWarnings = TEResultComponentWarnings, - -}; - -typedef TE_ENUM(TESeverity, int32_t) -{ - /* - Success - */ - TESeverityNone, - /* - The requested action may have been performed partially - */ - TESeverityWarning, - /* - The requested action could not be performed - */ - TESeverityError -}; - -/* - Returns a description of the TEResult as a UTF-8 encoded string in English, - or NULL if the TEResult was invalid. - */ -TE_EXPORT const char * TE_NULLABLE TEResultGetDescription(TEResult result); - -/* - Returns a TESeverity for a TEResult - */ -TE_EXPORT TESeverity TEResultGetSeverity(TEResult result); - -TE_ASSUME_NONNULL_END - -#ifdef __cplusplus -} -#endif - -#endif /* TEResult_h */ diff --git a/external/TouchEngine-Windows/include/TouchEngine/TESemaphore.h b/external/TouchEngine-Windows/include/TouchEngine/TESemaphore.h deleted file mode 100644 index a6cbdc9..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TESemaphore.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - - -#ifndef TESemaphore_h -#define TESemaphore_h - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -TE_ASSUME_NONNULL_BEGIN - -typedef TEObject TESemaphore; - -typedef TE_ENUM(TESemaphoreType, int32_t) -{ - TESemaphoreTypeVulkan, - TESemaphoreTypeMetal, - TESemaphoreTypeD3DFence, -}; - -/* - Returns the type (Vulkan, etc) of semaphore - */ -TE_EXPORT TESemaphoreType TESemaphoreGetType(const TESemaphore *semaphore); - -TE_ASSUME_NONNULL_END - -#ifdef __cplusplus -} -#endif - -#endif /* TESemaphore_h */ diff --git a/external/TouchEngine-Windows/include/TouchEngine/TETable.h b/external/TouchEngine-Windows/include/TouchEngine/TETable.h deleted file mode 100644 index e60797d..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TETable.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - - -#ifndef TETable_h -#define TETable_h - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -TE_ASSUME_NONNULL_BEGIN - -typedef struct TETable_ TETable; - -/* - Creates a new TETable. - The caller is responsible for releasing the returned TETable using TERelease() - */ -TE_EXPORT TETable *TETableCreate(void); - -/* - Creates a new table, duplicating an existing one. - The caller is responsible for releasing the returned TETable using TERelease() - */ -TE_EXPORT TETable *TETableCreateCopy(const TETable *table); - -/* - Returns the number of rows in the table. - */ -TE_EXPORT int32_t TETableGetRowCount(const TETable *table); - -/* - Returns the number of columns in the table. - */ -TE_EXPORT int32_t TETableGetColumnCount(const TETable *table); - -/* - Returns the UTF-8 encoded string at the cell at the given row and column indices, or NULL - if an error occurs. - The returned string is invalidated by any subsequent modification of the table. - */ -TE_EXPORT const char *TETableGetStringValue(const TETable *table, int32_t row, int32_t column); - -/* - Resizes the table, adding or deleting rows and columns as necessary. - */ -TE_EXPORT void TETableResize(TETable *table, int32_t rows, int32_t columns); - -/* - Sets the string value of the cell at the given row and column indices. - 'value' is a UTF-8 encoded string, or NULL to remove any existing value. - */ -TE_EXPORT TEResult TETableSetStringValue(TETable *table, int32_t row, int32_t column, const char *value); - -TE_ASSUME_NONNULL_END - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/external/TouchEngine-Windows/include/TouchEngine/TETexture.h b/external/TouchEngine-Windows/include/TouchEngine/TETexture.h deleted file mode 100644 index 090519c..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TETexture.h +++ /dev/null @@ -1,185 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - - -#ifndef TETexture_h -#define TETexture_h - -#include -#include -#include -#include -#ifdef __APPLE__ - #include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -TE_ASSUME_NONNULL_BEGIN - -typedef TE_ENUM(TETextureType, int32_t) -{ - TETextureTypeOpenGL, - TETextureTypeD3D11, - TETextureTypeD3DShared, - TETextureTypeIOSurface, - TETextureTypeVulkan, - TETextureTypeMetal, -}; - -/* - Support for other formats may be possible, please ask if you need them. -*/ -typedef TE_ENUM(TETextureFormat, int32_t) -{ - TETextureFormatInvalid, - TETextureFormatR8Unorm, - TETextureFormatR16Unorm, - TETextureFormatR16F, - TETextureFormatR32F, - TETextureFormatRG8Unorm, - TETextureFormatRG16Unorm, - TETextureFormatRG16F, - TETextureFormatRG32F, - TETextureFormatRG11B10F, - TETextureFormatRGB10_A2Unorm, - TETextureFormatBGR10_A2Unorm, - TETextureFormatRGBA8Unorm, - TETextureFormatBGRA8Unorm, - TETextureFormatSRGBA8Unorm, - TETextureFormatSBGRA8Unorm, - TETextureFormatRGBA16Unorm, - TETextureFormatRGBA16F, - TETextureFormatRGBA32F, - TETextureFormatBC1RGBUnorm, - TETextureFormatBC1SRGBUnorm, - TETextureFormatBC1RGBAUnorm, - TETextureFormatBC1SRGBAUnorm, - TETextureFormatBC2Unorm, - TETextureFormatBC3Unorm, - TETextureFormatBC3SRGBUnorm, - TETextureFormatBC4Unorm, - TETextureFormatBC5Unorm, - TETextureFormatBC6SF, - TETextureFormatBC6UF, - TETextureFormatBC7Unorm, - TETextureFormatBC7SRGBUnorm, -}; - -typedef TE_ENUM(TETextureComponentSource, int32_t) -{ - TETextureComponentSourceZero, - TETextureComponentSourceOne, - TETextureComponentSourceRed, - TETextureComponentSourceGreen, - TETextureComponentSourceBlue, - TETextureComponentSourceAlpha -}; - -typedef struct TETextureComponentMap -{ - TETextureComponentSource r; - TETextureComponentSource g; - TETextureComponentSource b; - TETextureComponentSource a; -} TETextureComponentMap; - -typedef TE_ENUM(TETextureOrigin, int32_t) -{ - TETextureOriginTopLeft, - TETextureOriginBottomLeft -}; - -static const TETextureComponentMap kTETextureComponentMapIdentity = { - TETextureComponentSourceRed, - TETextureComponentSourceGreen, - TETextureComponentSourceBlue, - TETextureComponentSourceAlpha -}; - -typedef TEObject TETexture; - -#ifdef __APPLE__ -typedef struct TEIOSurfaceTexture_ TEIOSurfaceTexture; -#endif - -/* - Returns the type (OpenGL, D3D, DXGI, IOSurface, Vulkan) of texture - */ -TE_EXPORT TETextureType TETextureGetType(const TETexture *texture); - -/* - Returns the position in 2D space of the 0th texel of the texture -*/ -TE_EXPORT TETextureOrigin TETextureGetOrigin(const TETexture *texture); - -TE_EXPORT TETextureComponentMap TETextureGetComponentMap(TETexture* texture); - -/* - See TEOpenGL.h, TED3D11.h, etc, to create and use other TETexture types - */ - -#ifdef __APPLE__ - -/* - IOSurface Textures - */ -/* - Release callback for IOSurface Textures - When this callback is invoked the IOSurface is no longer being used by TouchEngine and - it may be re-used. TouchEngine retains the texture through this callback, and issues its - final CFRelease() after the callback completes. - */ -typedef void (*TEIOSurfaceTextureCallback)(IOSurfaceRef surface, TEObjectEvent event, void * TE_NULLABLE info); - -/* - 'origin' is the position in 2D space of the 0th texel of the texture - 'plane' is the plane of the IOSurface to use or 0 if the IOSurface is not planar. - The caller is responsible for releasing the returned TEIOSurfaceTexture using TERelease() - */ -TE_EXPORT TEIOSurfaceTexture *TEIOSurfaceTextureCreate(IOSurfaceRef surface, - TETextureFormat format, - int plane, - TETextureOrigin origin, - TETextureComponentMap map, - TEIOSurfaceTextureCallback TE_NULLABLE callback, - void * TE_NULLABLE info); - -/* - Returns the underlying IOSurface. - This surface should be considered to be owned by the TEIOSurfaceTexture and should not be retained beyond - the lifetime of its owner. - */ -TE_EXPORT IOSurfaceRef TEIOSurfaceTextureGetSurface(const TEIOSurfaceTexture *texture); - -/* - Returns the format of the texture. - */ -TE_EXPORT TETextureFormat TEIOSurfaceTextureGetFormat(const TEIOSurfaceTexture *texture); - -TE_EXPORT TEResult TEIOSurfaceTextureSetCallback(TEIOSurfaceTexture *texture, - TEIOSurfaceTextureCallback TE_NULLABLE callback, - void * TE_NULLABLE info); - -#endif - -TE_ASSUME_NONNULL_END - -#ifdef __cplusplus -} -#endif - -#endif /* TETexture_h */ diff --git a/external/TouchEngine-Windows/include/TouchEngine/TEVulkan.h b/external/TouchEngine-Windows/include/TouchEngine/TEVulkan.h deleted file mode 100644 index ed1ffaf..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TEVulkan.h +++ /dev/null @@ -1,273 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - -#ifndef TEVulkan_h -#define TEVulkan_h - -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -TE_ASSUME_NONNULL_BEGIN - -#ifdef _WIN32 - -typedef struct TEVulkanSemaphore_ TEVulkanSemaphore; - -typedef void (*TEVulkanSemaphoreCallback)(HANDLE semaphore, TEObjectEvent event, void * TE_NULLABLE info); - -/* - Create a semaphore from a handle exported from a Vulkan semaphore - 'type' is the Vulkan semphore type - 'handle' is a HANDLE exported from a Vulkan semaphore. - If the handle is a NT handle, it will be duplicated and TouchEngine will manage its lifetime - consequently the value returned from - TEVulkanSemaphoreGetHandle() will not match this value - 'handleType' is the type of handle - 'callback' will be invoked for object use and lifetime events - see TEObjectEvent in TEObject.h - 'info' will be passed as an argument when 'callback' is invoked - The caller is responsible for releasing the returned TEVulkanSemaphore using TERelease() - */ -TE_EXPORT TEVulkanSemaphore *TEVulkanSemaphoreCreate(VkSemaphoreType type, HANDLE handle, VkExternalSemaphoreHandleTypeFlagBits handleType, TEVulkanSemaphoreCallback callback, void * TE_NULLABLE info); - -/* - Returns the HANDLE to be imported to instantiate a Vulkan semaphore. The lifetime of this handle is managed by TouchEngine and it - should not be passed to a call to CloseHandle() - */ -TE_EXPORT HANDLE TEVulkanSemaphoreGetHandle(TEVulkanSemaphore *semaphore); - -/* - Returns the Vulkan semaphore type - */ -TE_EXPORT VkSemaphoreType TEVulkanSemaphoreGetType(TEVulkanSemaphore *semaphore); - -/* - Returns the handle type - */ -TE_EXPORT VkExternalSemaphoreHandleTypeFlagBits TEVulkanSemaphoreGetHandleType(TEVulkanSemaphore *semaphore); - -/* - Sets 'callback' to be invoked for object use and lifetime events - see TEObjectEvent in TEObject.h. - This replaces (or cancels) any callback previously set on the TEVulkanSemaphore - */ -TE_EXPORT TEResult TEVulkanSemaphoreSetCallback(TEVulkanSemaphore *semaphore, TEVulkanSemaphoreCallback TE_NULLABLE callback, void * TE_NULLABLE info); - -/* - Vulkan Textures - see TETexture.h for functions common to all textures - macOS: see TETexture.h for TEIOSurfaceTexture and MoltenVK for vkUseIOSurfaceMVK()/vkGetIOSurfaceMVK() - or TEMetal.h for TEMetalTexture and MoltevnVK for vkSetMTLTextureMVK()/vkGetMTLTextureMVK - (or VK_EXT_metal_objects) - */ - -static const struct VkComponentMapping kTEVkComponentMappingIdentity = { - VK_COMPONENT_SWIZZLE_IDENTITY, - VK_COMPONENT_SWIZZLE_IDENTITY, - VK_COMPONENT_SWIZZLE_IDENTITY, - VK_COMPONENT_SWIZZLE_IDENTITY -}; - -typedef struct TEVulkanTexture_ TEVulkanTexture; - -typedef void (*TEVulkanTextureCallback)(HANDLE texture, TEObjectEvent event, void * TE_NULLABLE info); - -/* -Create a texture from a handle exported from a Vulkan texture -'texture' is the HANDLE for the exportable texture - If the handle is a NT handle, it will be duplicated and TouchEngine will manage its lifetime - consequently the value returned from - TEVulkanTextureGetHandle() will not match this value -'type' must be a valid TEVulkanHandleType -'callback' will be invoked for object use and lifetime events - see TEObjectEvent in TEObject.h - if the handle is not an NT handle, the - underlying texture should remain valid until receiving TEObjectEventRelease -'origin' is the position in 2D space of the 0th texel of the texture -'map' describes how components are to be mapped when the texture is read. If components are not swizzled, you - can pass kTEVkComponentMappingIdentity -The caller is responsible for releasing the returned TEVulkanTexture using TERelease() -*/ -TE_EXPORT TEVulkanTexture *TEVulkanTextureCreate(HANDLE texture, - VkExternalMemoryHandleTypeFlagBits handleType, - VkFormat format, - int32_t width, - int32_t height, - TETextureOrigin origin, - VkComponentMapping map, - TEVulkanTextureCallback TE_NULLABLE callback, void * TE_NULLABLE info); - -/* - Returns the HANDLE to be imported to instantiate a Vulkan texture. The lifetime of this handle is managed by TouchEngine and it - should not be passed to a call to CloseHandle() - */ -TE_EXPORT HANDLE TEVulkanTextureGetHandle(const TEVulkanTexture *texture); - -/* - Returns the handle type - */ -TE_EXPORT VkExternalMemoryHandleTypeFlagBits TEVulkanTextureGetHandleType(const TEVulkanTexture *texture); - -/* - Returns the format of the texture - */ -TE_EXPORT VkFormat TEVulkanTextureGetFormat(const TEVulkanTexture *texture); - -/* - Returns the VkComponentMapping for the texture - */ -TE_EXPORT VkComponentMapping TEVulkanTextureGetVkComponentMapping(const TEVulkanTexture *texture); - -/* - Returns the width of the texture - */ -TE_EXPORT int TEVulkanTextureGetWidth(const TEVulkanTexture *texture); - -/* - Returns the height of the texture - */ -TE_EXPORT int TEVulkanTextureGetHeight(const TEVulkanTexture *texture); - -/* - Sets 'callback' to be invoked for object use and lifetime events - see TEObjectEvent in TEObject.h. - This replaces (or cancels) any callback previously set on the TEVulkanTexture. - */ -TE_EXPORT TEResult TEVulkanTextureSetCallback(TEVulkanTexture *texture, TEVulkanTextureCallback TE_NULLABLE callback, void * TE_NULLABLE info); - - -/* - Supported Vulkan Texture Formats - */ - -/* - Returns via 'formats' the VkFormat supported by the instance. - This may change during configuration of an instance, and must be queried after receiving TEEventInstanceReady - 'formats' is an array of VkFormat, or NULL, in which case the value at counts is set to the number of available formats. - 'count' is a pointer to an int32_t which should be set to the number of available elements in 'formats'. - If this function returns TEResultSuccess, 'count' is set to the number of VkFormats filled in 'formats' - If this function returns TEResultInsufficientMemory, the value at 'count' was too small to return all the formats, and - 'count' has been set to the number of available formats. Resize 'formats' appropriately and call the function again to - retrieve the full array of formats. - */ -TE_EXPORT TEResult TEInstanceGetSupportedVkFormats(TEInstance *instance, VkFormat formats[TE_NULLABLE], int32_t *count); - -#endif // _WIN32 - -/* - Vulkan Image Ownership Transfer Operations - */ - -/* - Returns true if the instance requires Vulkan ownership transfer via image memory barriers. - This may change during configuration of an instance, and must be queried after receiving TEEventInstanceReady - 'instance' is an instance which has previously had a TEVulkanContext associated with it. - */ -TE_EXPORT bool TEInstanceDoesVulkanTextureOwnershipTransfer(TEInstance *instance); - -/* - Returns the VkImageLayout to be used by the caller as the 'newLayout' member of a VkImageMemoryBarrier(2) - when transferring ownership of a texture to the instance. - This may change during configuration of an instance, and must be queried after receiving TEEventInstanceReady - 'instance' is an instance which has previously had a TEVulkanContext associated with it. - */ -TE_EXPORT VkImageLayout TEInstanceGetVulkanInputReleaseImageLayout(TEInstance *instance); - -/* - Set the VkImageLayout to be used by the instance as the 'newLayout' member of a VkImageMemoryBarrier(2) - as part of the release operation after using a texture - 'instance' is an instance which has previously had a TEVulkanContext associated with it. - */ -TE_EXPORT TEResult TEInstanceSetVulkanOutputAcquireImageLayout(TEInstance *instance, VkImageLayout newLayout); - -/* - Provide the instance with values it will need for an acquire operation to transfer ownership to the instance - prior to using a texture. Note that the texture may not be used, in which case the acquire operation will - not take place. - Texture transfers you have added which are not used for any reason may be discarded when a texture ceases to be used - by the instance (eg because the link's texture value has changed, or because the link itself has been removed). If - you subsequently set the same texture as a link value again, you must provide a texture transfer at that time. - 'instance' is an instance which has previously had a TEVulkanContext associated with it - 'texture' is a texture of an appropriate type (TEVulkanTexture or TEIOSurfaceTexture) - 'acquireOldLayout' is the VkImageLayout to be set as the 'oldLayout' member of a VkImageMemoryBarrier(2) - when completing the ownership transfer - 'acquireNewLayout' is the VkImageLayout to be set as the 'newLayout' member of a VkImageMemoryBarrier(2) - when completing the ownership transfer - 'semaphore' is a TESemaphore to synchronize the acquire operation - The instance will wait for this semaphore prior to using the texture - If this semaphore is a Vulkan binary semaphore, the instance will also signal this semaphore after waiting - 'waitValue' is, if appropriate for the semaphore type, a value for the semaphore wait operation - */ -TE_EXPORT TEResult TEInstanceAddVulkanTextureTransfer(TEInstance *instance, - const TETexture *texture, - VkImageLayout acquireOldLayout, - VkImageLayout acquireNewLayout, - TESemaphore *semaphore, - uint64_t waitValue); - -/* - Returns true if 'instance' has a pending texture transfer for 'texture' - */ -TE_EXPORT bool TEInstanceHasVulkanTextureTransfer(TEInstance *instance, const TETexture *texture); - -/* - Get the values needed for an acquire operation to transfer ownership from the instance prior to using a texture, if - such an operation is pending. - 'instance' is an instance which has previously had a TEVulkanContext associated with it - 'texture' is a texture of an appropriate type (TEVulkanTexture or TEIOSurfaceTexture) - 'acquireOldLayout' is, on successful return, the VkImageLayout to be set as the 'oldLayout' member of a - VkImageMemoryBarrier(2) when completing the ownership transfer - 'acquireNewLayout' is, on successful return, the VkImageLayout to be set as the 'newLayout' member of a - VkImageMemoryBarrier(2) when completing the ownership transfer - 'semaphore' is, on successful return, a TESemaphore to synchronize the acquire operation on the GPU - The caller must wait for this semaphore prior to using the texture - If this semaphore is a Vulkan binary semaphore, the caller must also signal this semaphore after waiting - The caller is responsible for releasing the returned TESemaphore using TERelease() - 'waitValue' is, on successful return and if appropriate for the semaphore type, a value for the semaphore wait operation - */ -TE_EXPORT TEResult TEInstanceGetVulkanTextureTransfer(TEInstance *instance, - const TETexture *texture, - VkImageLayout *acquireOldLayout, - VkImageLayout *acquireNewLayout, - TESemaphore * TE_NULLABLE * TE_NONNULL semaphore, - uint64_t *waitValue); - - -/* - Vulkan Graphics Contexts - see TEGraphicsContext.h for functions common to all graphics contexts - */ - -typedef struct TEVulkanContext_ TEVulkanContext; - -/* - Creates a TEVulkanContext. Passing a TEVulkanContext to TEInstanceAssociateGraphicsContext() will - - associate the instance with the same physical device - - cause the instance to use Vulkan texture transfers when supported by the user's installed version - of TouchDesigner - - on Windows, cause the instance to return TEVulkanTextures for output link values - */ -TE_EXPORT TEResult TEVulkanContextCreate(const uint8_t deviceUUID[TE_NONNULL VK_UUID_SIZE], - const uint8_t driverUUID[TE_NONNULL VK_UUID_SIZE], - const uint8_t luid[TE_NONNULL VK_LUID_SIZE], - bool luidValid, - TETextureOrigin origin, - TEVulkanContext * TE_NULLABLE * TE_NONNULL context); - -TE_ASSUME_NONNULL_END - -#ifdef __cplusplus -} -#endif - -#endif // TEVulkan_h diff --git a/external/TouchEngine-Windows/include/TouchEngine/TouchEngine.h b/external/TouchEngine-Windows/include/TouchEngine/TouchEngine.h deleted file mode 100644 index 64d768d..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TouchEngine.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include diff --git a/external/TouchEngine-Windows/include/TouchEngine/TouchObject.h b/external/TouchEngine-Windows/include/TouchEngine/TouchObject.h deleted file mode 100644 index 6685b21..0000000 --- a/external/TouchEngine-Windows/include/TouchEngine/TouchObject.h +++ /dev/null @@ -1,248 +0,0 @@ -/* Shared Use License: This file is owned by Derivative Inc. (Derivative) -* and can only be used, and/or modified for use, in conjunction with -* Derivative's TouchDesigner software, and only if you are a licensee who has -* accepted Derivative's TouchDesigner license or assignment agreement -* (which also govern the use of this file). You may share or redistribute -* a modified version of this file provided the following conditions are met: -* -* 1. The shared file or redistribution must retain the information set out -* above and this list of conditions. -* 2. Derivative's name (Derivative Inc.) or its trademarks may not be used -* to endorse or promote products derived from this file without specific -* prior written permission from Derivative. -*/ - - -#ifndef TouchObject_h -#define TouchObject_h - -#ifdef __cplusplus - -#include -#include - -/* -* TouchObject wraps TEObject types, managing reference counting through TERetain and TERelease -* -* It has two methods for transferring an existing TEObject in: -* "take" - takes over ownership of a TEObject (no call to TERetain on take, TERelease when the TouchObject is destroyed) -* "set" - adds a reference, becoming an additional owner of the TEObject (calls TERetain on set, TERelease when the TouchObject is destroyed) -* -* Construct a TouchObject from a TouchEngine function returning a TEObject, taking ownership of the object: -* -* TouchObject table = TouchObject::make_take(TETableCreate()); -* -* Construct a TouchObject from a TouchEngine function returning a value through a parameter, taking ownership of the object: -* -* TouchObject texture; // empty -* TEResult result = TEInstanceLinkGetTextureValue(myInstance, identifier.c_str(), TELinkValueCurrent, texture.take()); -* if (result == TEResultSuccess) -* { -* // texture now contains a TETexture -* } -* // the TouchObject will release the TETexture when it goes out of scope -* -* You can pass a TouchObject directly to TouchEngine functions: -* -* TouchObject table = TouchObject::make_take(TETableCreate()); -* TETableResize(table, 3, 2); -* -* TouchObjects are copyable and assignable and you can use them in other objects, etc: -* -* std::vector> textures; -* -*/ - -/* -* Utility for TouchObject -*/ - -#ifdef _WIN32 -typedef struct TED3DSharedTexture_ TED3DSharedTexture; -typedef struct TED3DSharedFence_ TED3DSharedFence; -typedef struct TED3D11Texture_ TED3D11Texture; -typedef struct TED3D11Context_ TED3D11Context; -typedef struct TED3D12Context_ TED3D12Context; -typedef struct TEVulkanTexture_ TEVulkanTexture; -typedef struct TEVulkanSemaphore_ TEVulkanSemaphore; -#else -typedef struct TEMetalSemaphore_ TEMetalSemaphore; -#endif -typedef struct TEOpenGLTexture_ TEOpenGLTexture; -typedef struct TEOpenGLContext_ TEOpenGLContext; -typedef struct TEVulkanContext_ TEVulkanContext; - -template -struct TouchIsMemberOf : std::false_type -{}; - -template -struct TouchIsMemberOf::value || - (std::is_same::value && ( - std::is_same::value || -#ifdef _WIN32 - std::is_same::value || - std::is_same::value || - std::is_same::value -#else - std::is_same::value -#endif - ) - ) || - - (std::is_same::value && ( - std::is_same::value || - std::is_same::value -#ifdef _WIN32 - || std::is_same::value || - std::is_same::value -#endif - ) - ) -#ifdef _WIN32 - || (std::is_same::value && ( - std::is_same::value || - std::is_same::value - ) - ) -#else - || (std::is_same::value && ( - std::is_same::value - ) - ) -#endif - >> : std::true_type -{}; - -/* -* Wrapper for TEObjects -*/ -template -class TouchObject -{ -public: - /* - * Empty TouchObject - */ - TouchObject() - { } - /* - * Empty TouchObject - */ - TouchObject(nullptr_t) - { } - - ~TouchObject() - { - TERelease(&myObject); - } - - TouchObject(const TouchObject& o) - : myObject(static_cast(TERetain(o.myObject))) - { } - - TouchObject(TouchObject&& o) noexcept - : myObject(o.myObject) - { - o.myObject = nullptr; - } - - template ::value, int > = 0 > - TouchObject(const TouchObject& o) - : myObject(static_cast(TERetain(o.get()))) - { }; - - TouchObject& operator=(const TouchObject& o) - { - if (&o != this) - { - TERetain(o.myObject); - TERelease(&myObject); - myObject = o.myObject; - } - return *this; - } - - TouchObject& operator=(TouchObject&& o) noexcept(false) - { - TERelease(&myObject); - myObject = o.myObject; - o.myObject = nullptr; - return *this; - } - - template ::value, int > = 0 > - TouchObject& operator=(const TouchObject& o) - { - set(o.get()); - return *this; - } - - void reset() - { - TERelease(&myObject); - } - - operator T*() const - { - return myObject; - } - - T* operator ->() const - { - return myObject; - } - - T* get() const - { - return myObject; - } - - /* - * Use set(T*) to become an additional owner of a TEObject. - */ - void set(T* o) - { - TERetain(o); - TERelease(&myObject); - myObject = o; - } - - /* - * Use take() to take ownership from functions which return a TEObject through a parameter. - * This TouchObject takes ownership of the TEObject when it is returned. - */ - T** take() - { - TERelease(&myObject); - return &myObject; - } - /* - * Use take(T*) to transfer ownership of a TEObject to this TouchObject. - */ - void take(T* o) - { - TERelease(&myObject); - myObject = o; - } - static TouchObject make_take(T* o) - { - TouchObject obj; - obj.take(o); - return obj; - } - static TouchObject make_set(T* o) - { - TouchObject obj; - obj.set(o); - return obj; - } -private: - T* myObject{ nullptr }; - -}; - -#endif - -#endif diff --git a/external/TouchEngine-Windows/lib/TouchEngine.lib b/external/TouchEngine-Windows/lib/TouchEngine.lib deleted file mode 100644 index 2d9575e..0000000 Binary files a/external/TouchEngine-Windows/lib/TouchEngine.lib and /dev/null differ diff --git a/pyproject.toml b/pyproject.toml index b30475e..2bdef09 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build" [project] name = "touchpy" -version = "0.12.0.dev0" +version = "0.12.0" authors = [ { name = "Keith Lostracco", email = "keith@intentdev.io" } ] diff --git a/source/comp.cpp b/source/comp.cpp index 526cc26..8d0a234 100644 --- a/source/comp.cpp +++ b/source/comp.cpp @@ -224,14 +224,12 @@ bool Comp::load() spdlog::info("Loading tox: {}", filePath_); auto timeMode = TETimeInternal; - auto uiMode = TEUIWindows; if (compFlags_ & CompFlagBits::ExternalTime) { timeMode = TETimeExternal; - uiMode = TEUINone; } - result = TEInstanceConfigure(instance_, filePath_.c_str(), timeMode, uiMode); + result = TEInstanceConfigure(instance_, filePath_.c_str(), timeMode); if (result != TEResultSuccess) { spdlog::error("Failed to configure TEInstance: {}", TEResultGetDescription(result));