diff --git a/Plugin/External/Unity/include/PluginAPI/IUnityEventQueue.h b/Plugin/External/Unity/include/PluginAPI/IUnityEventQueue.h deleted file mode 100644 index d02e26c..0000000 --- a/Plugin/External/Unity/include/PluginAPI/IUnityEventQueue.h +++ /dev/null @@ -1,431 +0,0 @@ -#pragma once - -#include "IUnityInterface.h" - -// 5.2 patch 1 + of Unity will support this. -// The lack or presence of this feature can cause the EventQueue -// to crash if used against the wrong version of Unity. -// -// Before we had the IUnityInterfaces system this interface changed -// to support a cleanup handler on events. This broke our plugins -// in older versions of Unity. The registry should help us with -// this sort of thing in the future. -#ifndef EVENTQUEUE_SUPPORTS_EVENT_CLEANUP - #define EVENTQUEUE_SUPPORTS_EVENT_CLEANUP 1 -#endif - -//////////////////////////////////////////////////////////////////////////////////////// -// NOTE: Do not include any additional headers here. This is an external facing header -// so avoid any internal dependencies. -//////////////////////////////////////////////////////////////////////////////////////// -// The Unity EventQueue is a standard way of passing information between plugins or parts -// of the engine without any reliance on managed systems, game objects or -// other pieces of Unity. -// -// Events are simply a structure and GUID pair. GUIDs were chosen rather -// than hashes as it allows plugins to define their own event -// payloads and use the EventQueue. -// -// While the EventQueue itself is self contained and can be used for -// many different applications within Unity the global event -// queue that is passed to plugins is always serviced on the main -// simulation thread and thus serves as a convenient means of -// pushing asynchronous operations back to the main game thread -// -// Payloads should strive to be small. The EventQueue is a 0 allocation -// system which ensures that the use of events does not fragment -// or add undue pressure on resource limited systems. -// -// This header defines ALL that is required to listen, define -// and send events from both within Unity and from plugins. -//////////////////////////////////////////////////////////////////////////////////////// -// USAGE: -// -// SENDING -// ======== -// -// To Define new Event: -// -------------------- -// // Structure and GUID -// struct MyEvent {}; -// REGISTER_EVENT_ID(0x19D736400584B24BULL,0x98B9EFBE26D3F3C9ULL,MyEvent) -// // hash above is a GUID split into 2 64 bit integers for convenience. -// // DO NOT DUPLICATE GUIDS! -// -// To Send an Event: -// ----------------- -// // Create Payload and send -// MyEvent evt; -// GlobalEventQueue::GetInstance ().SendEvent (evt); -// -// LISTENING -// ========== -// -// STATIC FUNCTION: To Listen For An Event: -// ---------------------------------------- -// -// void MyListenFunction (const MyEvent & payload) -// { /* do something useful */ } -// -// // No register that function, create delegate, register delegate with EventQueue -// // Lifetime of delegate is important. -// StaticFunctionEventHandler myEventDelegate (&MyListenFunction); -// GlobalEventQueue::GetInstance ()->AddHandler (&myEventDelegate); -// -// -// CLASS LISTENER: To Listen on an instance of a class: -// ---------------------------------------------------- -// class MyClass -// { -// // This method will get called, always called HandleEvent -// void HandleEvent(const MyEvent & payload); -// -// MyClass() -// { -// // Hookup to listen can be anywhere but here it's in the ctor. -// GlobalEventQueue::GetInstance ()->AddHandler (m_myDelegate.SetObject (this)); -// } -// -// ~MyClass() -// { -// // Stop listening. -// GlobalEventQueue::GetInstance ()->RemoveHandler (m_myDelegate); -// } -// -// // Delegate is a member of the class. -// ClassBasedEventHandler m_myDelegate; -// }; - -// GUID definition for a new event. -// -// There is a tool to compute these, run the tool on the name of your -// message and insert the hash/type combination in your header file. -// This defines the EventId for your event payload (struct) -// Use this for events that do not require a destructor. -#define REGISTER_EVENT_ID(HASHH, HASHL ,TYPE) \ -namespace UnityEventQueue \ -{ \ - template<> \ - inline const EventId GetEventId< TYPE > () \ - { \ - return EventId(HASHH,HASHL) ; \ - } \ -} - -#if EVENTQUEUE_SUPPORTS_EVENT_CLEANUP -// GUID definition for a new event with a destructor. -// -// If your event payload requires a destructor. Define: -// -// void Destroy() -// -// Which should be a method on your payload and then use this macro. -// If your event -// can guarantee that someone is listening before you fire -// your first event this is all you have to do. -// -// However if you do not know if someone is listening when you -// fire your first event you will need to call RegisterCleanup -// somewhere to ensure your events get cleaned up properly. -// -// There is a tool to compute these, run the tool on the name of your -// payload and insert the hash/type combination in your header file. -#define REGISTER_EVENT_ID_WITH_CLEANUP(HASHH,HASHL,TYPE) \ -namespace UnityEventQueue \ -{ \ - typedef StaticFunctionEventHandler< TYPE > DestructorMethod_##HASHH##HASHL; \ - \ - template<> \ - inline void GenericDestructorMethodForType< TYPE > ( const TYPE & eventPayload ) \ - { const_cast(eventPayload).Destroy(); } \ - \ - template<> \ - inline EventHandler * GetEventDestructor< TYPE >() \ - { \ - static DestructorMethod_##HASHH##HASHL g_Destructor(&GenericDestructorMethodForType< TYPE >); \ - return &g_Destructor; \ - } \ -} \ -REGISTER_EVENT_ID(HASHH,HASHL,TYPE) - -#endif - -namespace UnityEventQueue -{ - - // EventId - GUID - // - // To facilitate custom events the EventId object must be a full fledged GUID - // to ensure cross plugin uniqueness constraints. - // - // Template specialization is used to produce a means of looking up an - // EventId from it's payload type at compile time. The net result should compile - // down to passing around the GUID. - // - // REGISTER_EVENT_ID should be placed in - // the header file of any payload definition OUTSIDE of all namespaces (all EventIds live - // in the UnityEventQueue namespace by default) The payload structure and the registration ID are all that - // is required to expose the event to other systems. - // - // There is a tool to generate registration macros for EventIds. - struct EventId - { - public: - EventId(unsigned long long high, unsigned long long low) - : mGUIDHigh(high) - , mGUIDLow(low) - {} - - EventId( const EventId & other ) - { - mGUIDHigh = other.mGUIDHigh; - mGUIDLow = other.mGUIDLow; - } - - EventId & operator=(const EventId & other ) - { - mGUIDHigh = other.mGUIDHigh; - mGUIDLow = other.mGUIDLow; - return *this; - } - - bool Equals(const EventId & other) const { return mGUIDHigh == other.mGUIDHigh && mGUIDLow == other.mGUIDLow; } - bool LessThan(const EventId & other) const { return mGUIDHigh < other.mGUIDHigh || (mGUIDHigh == other.mGUIDHigh && mGUIDLow < other.mGUIDLow); } - - unsigned long long mGUIDHigh; - unsigned long long mGUIDLow; - }; - inline bool operator==(const EventId & left, const EventId & right ) { return left.Equals(right); } - inline bool operator!=(const EventId & left, const EventId & right ) { return !left.Equals(right); } - inline bool operator< (const EventId & left, const EventId & right ) { return left.LessThan(right); } - inline bool operator> (const EventId & left, const EventId & right ) { return right.LessThan(left); } - inline bool operator>=(const EventId & left, const EventId & right ) { return !operator< (left,right); } - inline bool operator<=(const EventId & left, const EventId & right ) { return !operator> (left,right); } - // Generic Version of GetEventId to allow for specialization - // - // If you get errors about return values related to this method - // then you have forgotten to include REGISTER_EVENT_ID() for your - // payload / event. This method should never be compiled, ever. - template< typename T > const EventId GetEventId() {} - class EventQueue; - class EventHandler; - -#if EVENTQUEUE_SUPPORTS_EVENT_CLEANUP - // Generic version retrieving a classes destructor. - // Any class that does not specialize this will not define a destructor. - template< typename T > EventHandler * GetEventDestructor() { return (EventHandler*)NULL; } - - // This is a static method that helps us call a meaningful method on the event - // itself improving the cleanliness of the EQ design. - template< typename T > void GenericDestructorMethodForType(const T & /*eventPayload*/ ) {} -#endif - - // ==================================================================== - // ADAPTER / DELEGATE - This is the base interface that the EventQueue - // uses to know about listeners for events. - // - // DO NOT USE DIRECTLY! - // - // Use the StaticFunction of ClassBased EventHandlers to build - // adapters to your systems and empower them to receive events. - class EventHandler - { - public: - EventHandler() : m_Next(0) {} - virtual ~EventHandler() {} - // This actually kicks the event to the handler function or object. - virtual void HandleEvent ( EventId & id, void * data ) = 0; - // This is required when registering this handler - virtual EventId HandlerEventId() = 0; -#if EVENTQUEUE_SUPPORTS_EVENT_CLEANUP - // This is required when registering this handler - virtual EventHandler * GetMyEventDestructor() = 0; -#endif - // Internal, do not use, required for walking and calling handlers - EventHandler * GetNext() { return m_Next; } - private: - // Intrusive list holding a linked list of handlers for this EventId - // Exists to avoid allocations - Do Not Touch. - friend class EventHandlerList; - EventHandler * m_Next; - }; - - // ==================================================================== - // CLASS DELEGATE - Classes can be the target of events. - // - // Event handlers are the endpoints of the system. To Unity all - // event endpoints look like a single virtual function call. - // - // This adapter will call the HandleEvent( EVENTTYPE & ) method - // on the object specified when an event is triggered. - template< typename EVENTTYPE, typename OBJECTTYPE > - class ClassBasedEventHandler : public EventHandler - { - public: - ClassBasedEventHandler( OBJECTTYPE * handler = NULL ) : m_Handler(handler) {} - - // The actual adapter method, calls into the registered object. - virtual void HandleEvent( EventId & id, void * data ) - { (void)id; m_Handler->HandleEvent( *static_cast(data) ); } - - // Boilerplate required when registering this handler. - virtual EventId HandlerEventId() - { return GetEventId(); } - -#if EVENTQUEUE_SUPPORTS_EVENT_CLEANUP - // Required boilerplate. Used during registration of this object. - virtual EventHandler * GetMyEventDestructor() - { return GetEventDestructor(); } -#endif - - ClassBasedEventHandler * - SetObject( OBJECTTYPE * handler ) - { m_Handler = handler; return this; } - -#if EVENTQUEUE_SUPPORTS_EVENT_CLEANUP - OBJECTTYPE * GetHandler() - { return m_Handler; } -#endif - protected: - OBJECTTYPE * m_Handler; - }; - - // ==================================================================== - // FUNCTION DELEGATE - Static functions can be event handlers. - // - // Event handlers are the endpoints of the system. To Unity all - // event endpoints look like a single virtual function call. - // - // This object wraps a static function turning it into an event endpoint - // much like a C# delegate does. - // The wrapped function will be called when the event is triggered - template< typename EVENTTYPE > - class StaticFunctionEventHandler : public EventHandler - { - public: - typedef void (*HandlerFunction)(const EVENTTYPE & payload); - - StaticFunctionEventHandler( HandlerFunction handlerCallback ) : m_Handler(handlerCallback) {} - - virtual void HandleEvent( EventId & id, void * data ) - { (void)id; m_Handler(*static_cast(data)); } - - // Required boilerplate. Used during registration of this object. - virtual EventId HandlerEventId() - { return GetEventId(); } - -#if EVENTQUEUE_SUPPORTS_EVENT_CLEANUP - // Required boilerplate. Used during registration of this object. - virtual EventHandler * GetMyEventDestructor() - { return GetEventDestructor(); } -#endif - - protected: - HandlerFunction m_Handler; - }; - - // ============================================================ - // Some built in event types for adding removing event handlers - // from secondary threads. Use these instead of calling AddHandler - // from a secondary thread. - struct AddEventHandler - { - AddEventHandler( EventHandler * handler ) : m_Handler(handler) {} - EventHandler * m_Handler; - }; - - struct RemoveEventHandler - { - RemoveEventHandler( EventHandler * handler ) : m_Handler(handler) {} - EventHandler * m_Handler; - }; - - // ============================================================ - // The Event Queue is a lock free multiple write single read - // deferred event system. It uses GUIDs to map payloads to - // event handler delegates. The system has some - // templates to make registering for events fairly painless - // but takes care to try to keep template cost very low. - // - // NOTE: payloads should be very very small and never allocate - // or free memory since they can and will be passed across - // dll boundaries. - // - // There is a hard limit of kMaxEventQueueEventSize bytes for any - // payload being passed through this system but payloads that are - // this big are probably being handled improperly. - UNITY_DECLARE_INTERFACE(IUnityEventQueue) - { - public: - // size of 8196 required for PS4 system events - #define kMaxEventQueueEventSize 8196+sizeof(EventId) - - virtual ~IUnityEventQueue() {} - - // The primary entry point for firing any - // event through the system. The templated - // version is simply syntatic sugar for extracting - // the EventId from the event object. - // - // This can be called from any thread. - template - void SendEvent(T & payload) - { - // Ensure we never fire an event that we can't handle size wise. - Assert( sizeof(T) <= (kMaxEventQueueEventSize-sizeof(EventId)) ); - - // NOTE: Keep this small to avoid code bloat. - // every line of code in here should be scrutinized - // as this and GetEventId could easily be sources - // of bloat if allowed to grow. - SendEventImpl(UnityEventQueue::GetEventId(), (unsigned char *)(&payload), sizeof(T)); - } - -#if EVENTQUEUE_SUPPORTS_EVENT_CLEANUP - // Some events want to have a destructor. - // - // You do this by creating a public Destroy() - // method on your Event payload. You then - // register the event with REGISTER_EVENT_ID_WITH_CLEANUP - // - // If your event will have someone listening to it right away - // then you do not need to do anything else. - // - // However, if there is a danger that your event will be fired - // before someone starts listening for it then you must - // call this method somewhere. This will manually register your - // class for cleanup. There is no harm in calling this even - // if it is not required. If in doubt and your event payload - // requires some form of destruction, call this method! - template - void RegisterCleanup(T & payload) - { - EventHandler * eh = UnityEventQueue::GetEventDestructor (); - if (eh != NULL) - SetCleanupImpl(eh); - } -#endif - - // These are not thread safe and must be done on the same thread - // as the dispatch thread. Doing otherwise risks race conditions. - // Fire the add handler / remove handler event if you need to - // schedule this from a different thread. - virtual void AddHandler(EventHandler * handler) = 0; - virtual void RemoveHandler(EventHandler * handler) = 0; - protected: - virtual void SendEventImpl(EventId id, unsigned char * data, int size) = 0; - -#if EVENTQUEUE_SUPPORTS_EVENT_CLEANUP - // This is an event destructor. You can register one of these - // per event type. This allows events to manage resource if - // they absolutely must. In general you should avoid handling - // resources in events as events usually imply cross thread activity. - virtual void SetCleanupImpl(EventHandler * handler) = 0; -#endif - }; -} - -REGISTER_EVENT_ID(0x19D736400584B24BULL,0x98B9EFBE26D3F3C9ULL,AddEventHandler) -REGISTER_EVENT_ID(0x8D4A317C4F577F4AULL,0x851D6E457566A905ULL,RemoveEventHandler) - -UNITY_REGISTER_INTERFACE_GUID_IN_NAMESPACE(0x9959C347F5AE374DULL,0x9BADE6FC8EF49E7FULL,IUnityEventQueue,UnityEventQueue) \ No newline at end of file diff --git a/Plugin/External/Unity/include/PluginAPI/IUnityGraphics.h b/Plugin/External/Unity/include/PluginAPI/IUnityGraphics.h deleted file mode 100644 index 161f88f..0000000 --- a/Plugin/External/Unity/include/PluginAPI/IUnityGraphics.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once -#include "IUnityInterface.h" - -typedef enum UnityGfxRenderer -{ - //kUnityGfxRendererOpenGL = 0, // Legacy OpenGL, removed - kUnityGfxRendererD3D9 = 1, // Direct3D 9 - kUnityGfxRendererD3D11 = 2, // Direct3D 11 - kUnityGfxRendererGCM = 3, // PlayStation 3 - kUnityGfxRendererNull = 4, // "null" device (used in batch mode) - kUnityGfxRendererOpenGLES20 = 8, // OpenGL ES 2.0 - kUnityGfxRendererOpenGLES30 = 11, // OpenGL ES 3.0 - kUnityGfxRendererGXM = 12, // PlayStation Vita - kUnityGfxRendererPS4 = 13, // PlayStation 4 - kUnityGfxRendererXboxOne = 14, // Xbox One - kUnityGfxRendererMetal = 16, // iOS Metal - kUnityGfxRendererOpenGLCore = 17, // OpenGL core - kUnityGfxRendererD3D12 = 18, // Direct3D 12 - kUnityGfxRendererVulkan = 21, // Vulkan -} UnityGfxRenderer; - -typedef enum UnityGfxDeviceEventType -{ - kUnityGfxDeviceEventInitialize = 0, - kUnityGfxDeviceEventShutdown = 1, - kUnityGfxDeviceEventBeforeReset = 2, - kUnityGfxDeviceEventAfterReset = 3, -} UnityGfxDeviceEventType; - -typedef void (UNITY_INTERFACE_API * IUnityGraphicsDeviceEventCallback)(UnityGfxDeviceEventType eventType); - -// Should only be used on the rendering thread unless noted otherwise. -UNITY_DECLARE_INTERFACE(IUnityGraphics) -{ - UnityGfxRenderer (UNITY_INTERFACE_API * GetRenderer)(); // Thread safe - - // This callback will be called when graphics device is created, destroyed, reset, etc. - // It is possible to miss the kUnityGfxDeviceEventInitialize event in case plugin is loaded at a later time, - // when the graphics device is already created. - void (UNITY_INTERFACE_API * RegisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); - void (UNITY_INTERFACE_API * UnregisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); -}; -UNITY_REGISTER_INTERFACE_GUID(0x7CBA0A9CA4DDB544ULL,0x8C5AD4926EB17B11ULL,IUnityGraphics) - - - -// Certain Unity APIs (GL.IssuePluginEvent, CommandBuffer.IssuePluginEvent) can callback into native plugins. -// Provide them with an address to a function of this signature. -typedef void (UNITY_INTERFACE_API * UnityRenderingEvent)(int eventId); diff --git a/Plugin/External/Unity/include/PluginAPI/IUnityGraphicsD3D11.h b/Plugin/External/Unity/include/PluginAPI/IUnityGraphicsD3D11.h deleted file mode 100644 index b6658f0..0000000 --- a/Plugin/External/Unity/include/PluginAPI/IUnityGraphicsD3D11.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once -#include "IUnityInterface.h" - -struct RenderSurfaceBase; -typedef struct RenderSurfaceBase* UnityRenderBuffer; - -// Should only be used on the rendering thread unless noted otherwise. -UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D11) -{ - ID3D11Device* (UNITY_INTERFACE_API * GetDevice)(); - - ID3D11Resource* (UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer buffer); -}; -UNITY_REGISTER_INTERFACE_GUID(0xAAB37EF87A87D748ULL,0xBF76967F07EFB177ULL,IUnityGraphicsD3D11) diff --git a/Plugin/External/Unity/include/PluginAPI/IUnityGraphicsD3D12.h b/Plugin/External/Unity/include/PluginAPI/IUnityGraphicsD3D12.h deleted file mode 100644 index 5721270..0000000 --- a/Plugin/External/Unity/include/PluginAPI/IUnityGraphicsD3D12.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once -#include "IUnityInterface.h" -#ifndef __cplusplus - #include -#endif - -typedef struct UnityGraphicsD3D12ResourceState UnityGraphicsD3D12ResourceState; -struct UnityGraphicsD3D12ResourceState -{ - ID3D12Resource* resource; // Resource to barrier. - D3D12_RESOURCE_STATES expected; // Expected resource state before this command list is executed. - D3D12_RESOURCE_STATES current; // State this resource will be in after this command list is executed. -}; - -typedef struct UnityGraphicsD3D12PhysicalVideoMemoryControlValues UnityGraphicsD3D12PhysicalVideoMemoryControlValues; -struct UnityGraphicsD3D12PhysicalVideoMemoryControlValues // all values in bytes -{ - UINT64 reservation; // Minimum required physical memory for an application [default = 64MB]. - UINT64 systemMemoryThreshold; // If free physical video memory drops below this threshold, resources will be allocated in system memory. [default = 64MB] - UINT64 residencyThreshold; // Minimum free physical video memory needed to start bringing evicted resources back after shrunken video memory budget expands again. [default = 128MB] -}; - -// Should only be used on the main thread. -UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v3) -{ - ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); - - ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); - // Returns the value set on the frame fence once the current frame completes or the GPU is flushed - UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); - - // Executes a given command list on a worker thread. - // [Optional] Declares expected and post-execution resource states. - // Returns the fence value. - UINT64(UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList* commandList, int stateCount, UnityGraphicsD3D12ResourceState* states); - - void (UNITY_INTERFACE_API* SetPhysicalVideoMemoryControlValues)(const UnityGraphicsD3D12PhysicalVideoMemoryControlValues* memInfo); -}; -UNITY_REGISTER_INTERFACE_GUID(0x57C3FAFE59E5E843ULL, 0xBF4F5998474BB600ULL, IUnityGraphicsD3D12v3) - -// Should only be used on the main thread. -UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v2) -{ - ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); - - ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); - // Returns the value set on the frame fence once the current frame completes or the GPU is flushed - UINT64 (UNITY_INTERFACE_API * GetNextFrameFenceValue)(); - - // Executes a given command list on a worker thread. - // [Optional] Declares expected and post-execution resource states. - // Returns the fence value. - UINT64 (UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList* commandList, int stateCount, UnityGraphicsD3D12ResourceState* states); -}; -UNITY_REGISTER_INTERFACE_GUID(0xEC39D2F18446C745ULL,0xB1A2626641D6B11FULL,IUnityGraphicsD3D12v2) - - - -// Obsolete -UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12) -{ - ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); - ID3D12CommandQueue* (UNITY_INTERFACE_API * GetCommandQueue)(); - - ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); - // Returns the value set on the frame fence once the current frame completes or the GPU is flushed - UINT64 (UNITY_INTERFACE_API * GetNextFrameFenceValue)(); - - // Returns the state a resource will be in after the last command list is executed - bool (UNITY_INTERFACE_API * GetResourceState)(ID3D12Resource* resource, D3D12_RESOURCE_STATES* outState); - // Specifies the state a resource will be in after a plugin command list with resource barriers is executed - void (UNITY_INTERFACE_API * SetResourceState)(ID3D12Resource* resource, D3D12_RESOURCE_STATES state); -}; -UNITY_REGISTER_INTERFACE_GUID(0xEF4CEC88A45F4C4CULL,0xBD295B6F2A38D9DEULL,IUnityGraphicsD3D12) diff --git a/Plugin/External/Unity/include/PluginAPI/IUnityGraphicsD3D9.h b/Plugin/External/Unity/include/PluginAPI/IUnityGraphicsD3D9.h deleted file mode 100644 index 202b8b2..0000000 --- a/Plugin/External/Unity/include/PluginAPI/IUnityGraphicsD3D9.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once -#include "IUnityInterface.h" - -// Should only be used on the rendering thread unless noted otherwise. -UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D9) -{ - IDirect3D9* (UNITY_INTERFACE_API * GetD3D)(); - IDirect3DDevice9* (UNITY_INTERFACE_API * GetDevice)(); -}; -UNITY_REGISTER_INTERFACE_GUID(0xE90746A523D53C4CULL,0xAC825B19B6F82AC3ULL,IUnityGraphicsD3D9) diff --git a/Plugin/External/Unity/include/PluginAPI/IUnityGraphicsMetal.h b/Plugin/External/Unity/include/PluginAPI/IUnityGraphicsMetal.h deleted file mode 100644 index 2207045..0000000 --- a/Plugin/External/Unity/include/PluginAPI/IUnityGraphicsMetal.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once -#include "IUnityInterface.h" - -#ifndef __OBJC__ - #error metal plugin is objc code. -#endif -#ifndef __clang__ - #error only clang compiler is supported. -#endif - -@class NSBundle; -@protocol MTLDevice; -@protocol MTLCommandBuffer; -@protocol MTLCommandEncoder; -@protocol MTLTexture; - -struct RenderSurfaceBase; -typedef struct RenderSurfaceBase* UnityRenderBuffer; - -// Should only be used on the rendering thread unless noted otherwise. -UNITY_DECLARE_INTERFACE(IUnityGraphicsMetal) -{ - NSBundle* (UNITY_INTERFACE_API * MetalBundle)(); - id (UNITY_INTERFACE_API * MetalDevice)(); - - id (UNITY_INTERFACE_API * CurrentCommandBuffer)(); - - // for custom rendering support there are two scenarios: - // you want to use current in-flight MTLCommandEncoder (NB: it might be nil) - id (UNITY_INTERFACE_API * CurrentCommandEncoder)(); - // or you might want to create your own encoder. - // In that case you should end unity's encoder before creating your own and end yours before returning control to unity - void (UNITY_INTERFACE_API * EndCurrentCommandEncoder)(); - - // converting trampoline UnityRenderBufferHandle into native RenderBuffer - UnityRenderBuffer (UNITY_INTERFACE_API * RenderBufferFromHandle)(void* bufferHandle); - - // access to RenderBuffer's texure - // NB: you pass here *native* RenderBuffer, acquired by calling (C#) RenderBuffer.GetNativeRenderBufferPtr - // AAResolvedTextureFromRenderBuffer will return nil in case of non-AA RenderBuffer or if called for depth RenderBuffer - // StencilTextureFromRenderBuffer will return nil in case of no-stencil RenderBuffer or if called for color RenderBuffer - id (UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer buffer); - id (UNITY_INTERFACE_API * AAResolvedTextureFromRenderBuffer)(UnityRenderBuffer buffer); - id (UNITY_INTERFACE_API * StencilTextureFromRenderBuffer)(UnityRenderBuffer buffer); - -}; -UNITY_REGISTER_INTERFACE_GUID(0x992C8EAEA95811E5ULL,0x9A62C4B5B9876117ULL,IUnityGraphicsMetal) diff --git a/Plugin/External/Unity/include/PluginAPI/IUnityInterface.h b/Plugin/External/Unity/include/PluginAPI/IUnityInterface.h deleted file mode 100644 index fa52ba3..0000000 --- a/Plugin/External/Unity/include/PluginAPI/IUnityInterface.h +++ /dev/null @@ -1,195 +0,0 @@ -#pragma once - -// Unity native plugin API -// Compatible with C99 - -#if defined(__CYGWIN32__) - #define UNITY_INTERFACE_API __stdcall - #define UNITY_INTERFACE_EXPORT __declspec(dllexport) -#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WINAPI_FAMILY) - #define UNITY_INTERFACE_API __stdcall - #define UNITY_INTERFACE_EXPORT __declspec(dllexport) -#elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) || defined(__QNX__) - #define UNITY_INTERFACE_API - #define UNITY_INTERFACE_EXPORT -#else - #define UNITY_INTERFACE_API - #define UNITY_INTERFACE_EXPORT -#endif - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// IUnityInterface is a registry of interfaces we choose to expose to plugins. -// -// USAGE: -// --------- -// To retrieve an interface a user can do the following from a plugin, assuming they have the header file for the interface: -// -// IMyInterface * ptr = registry->Get(); -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -// Unity Interface GUID -// Ensures global uniqueness. -// -// Template specialization is used to produce a means of looking up a GUID from its interface type at compile time. -// The net result should compile down to passing around the GUID. -// -// UNITY_REGISTER_INTERFACE_GUID should be placed in the header file of any interface definition outside of all namespaces. -// The interface structure and the registration GUID are all that is required to expose the interface to other systems. -struct UnityInterfaceGUID -{ -#ifdef __cplusplus - UnityInterfaceGUID(unsigned long long high, unsigned long long low) - : m_GUIDHigh(high) - , m_GUIDLow(low) - { - } - - UnityInterfaceGUID(const UnityInterfaceGUID& other) - { - m_GUIDHigh = other.m_GUIDHigh; - m_GUIDLow = other.m_GUIDLow; - } - - UnityInterfaceGUID& operator=(const UnityInterfaceGUID& other) - { - m_GUIDHigh = other.m_GUIDHigh; - m_GUIDLow = other.m_GUIDLow; - return *this; - } - - bool Equals(const UnityInterfaceGUID& other) const { return m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow == other.m_GUIDLow; } - bool LessThan(const UnityInterfaceGUID& other) const { return m_GUIDHigh < other.m_GUIDHigh || (m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow < other.m_GUIDLow); } -#endif - unsigned long long m_GUIDHigh; - unsigned long long m_GUIDLow; -}; -#ifdef __cplusplus -inline bool operator==(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.Equals(right); } -inline bool operator!=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !left.Equals(right); } -inline bool operator< (const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.LessThan(right); } -inline bool operator> (const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return right.LessThan(left); } -inline bool operator>=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator< (left,right); } -inline bool operator<=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator> (left,right); } -#else -typedef struct UnityInterfaceGUID UnityInterfaceGUID; -#endif - - - - -#ifdef __cplusplus - #define UNITY_DECLARE_INTERFACE(NAME) \ - struct NAME : IUnityInterface - - // Generic version of GetUnityInterfaceGUID to allow us to specialize it - // per interface below. The generic version has no actual implementation - // on purpose. - // - // If you get errors about return values related to this method then - // you have forgotten to include UNITY_REGISTER_INTERFACE_GUID with - // your interface, or it is not visible at some point when you are - // trying to retrieve or add an interface. - template - inline const UnityInterfaceGUID GetUnityInterfaceGUID(); - - // This is the macro you provide in your public interface header - // outside of a namespace to allow us to map between type and GUID - // without the user having to worry about it when attempting to - // add or retrieve and interface from the registry. - #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ - template<> \ - inline const UnityInterfaceGUID GetUnityInterfaceGUID() \ - { \ - return UnityInterfaceGUID(HASHH,HASHL); \ - } - - // Same as UNITY_REGISTER_INTERFACE_GUID but allows the interface to live in - // a particular namespace. As long as the namespace is visible at the time you call - // GetUnityInterfaceGUID< INTERFACETYPE >() or you explicitly qualify it in the template - // calls this will work fine, only the macro here needs to have the additional parameter - #define UNITY_REGISTER_INTERFACE_GUID_IN_NAMESPACE(HASHH, HASHL, TYPE, NAMESPACE) \ - const UnityInterfaceGUID TYPE##_GUID(HASHH, HASHL); \ - template<> \ - inline const UnityInterfaceGUID GetUnityInterfaceGUID< NAMESPACE :: TYPE >() \ - { \ - return UnityInterfaceGUID(HASHH,HASHL); \ - } - - // These macros allow for C compatibility in user code. - #define UNITY_GET_INTERFACE_GUID(TYPE) GetUnityInterfaceGUID< TYPE >() - - -#else - #define UNITY_DECLARE_INTERFACE(NAME) \ - typedef struct NAME NAME; \ - struct NAME - - // NOTE: This has the downside that one some compilers it will not get stripped from all compilation units that - // can see a header containing this constant. However, it's only for C compatibility and thus should have - // minimal impact. - #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ - const UnityInterfaceGUID TYPE##_GUID = {HASHH, HASHL}; - - // In general namespaces are going to be a problem for C code any interfaces we expose in a namespace are - // not going to be usable from C. - #define UNITY_REGISTER_INTERFACE_GUID_IN_NAMESPACE(HASHH, HASHL, TYPE, NAMESPACE) - - // These macros allow for C compatibility in user code. - #define UNITY_GET_INTERFACE_GUID(TYPE) TYPE##_GUID -#endif - -// Using this in user code rather than INTERFACES->Get() will be C compatible for those places in plugins where -// this may be needed. Unity code itself does not need this. -#define UNITY_GET_INTERFACE(INTERFACES, TYPE) (TYPE*)INTERFACES->GetInterface (UNITY_GET_INTERFACE_GUID(TYPE)); - - -#ifdef __cplusplus -struct IUnityInterface -{ -}; -#else -typedef void IUnityInterface; -#endif - - - -typedef struct IUnityInterfaces -{ - // Returns an interface matching the guid. - // Returns nullptr if the given interface is unavailable in the active Unity runtime. - IUnityInterface* (UNITY_INTERFACE_API * GetInterface)(UnityInterfaceGUID guid); - - // Registers a new interface. - void (UNITY_INTERFACE_API * RegisterInterface)(UnityInterfaceGUID guid, IUnityInterface* ptr); - -#ifdef __cplusplus - // Helper for GetInterface. - template - INTERFACE* Get() - { - return static_cast(GetInterface(GetUnityInterfaceGUID())); - } - - // Helper for RegisterInterface. - template - void Register(IUnityInterface* ptr) - { - RegisterInterface(GetUnityInterfaceGUID(), ptr); - } -#endif -} IUnityInterfaces; - - - -#ifdef __cplusplus -extern "C" { -#endif - -// If exported by a plugin, this function will be called when the plugin is loaded. -void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces); -// If exported by a plugin, this function will be called when the plugin is about to be unloaded. -void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload(); - -#ifdef __cplusplus -} -#endif diff --git a/Plugin/MeshUtils.vcxproj b/Plugin/MeshUtils.vcxproj index 93166b4..bb81bf5 100644 --- a/Plugin/MeshUtils.vcxproj +++ b/Plugin/MeshUtils.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -79,18 +79,18 @@ {FD3FE1FF-ABE5-40DB-B867-144E9DD9B23C} Win32Proj - 10.0.14393.0 + 10.0.16299.0 StaticLibrary - v140 + v141 Unicode true StaticLibrary - v140 + v141 Unicode diff --git a/Plugin/Test/Test.vcxproj b/Plugin/Test/Test.vcxproj index 63ef72a..46849da 100644 --- a/Plugin/Test/Test.vcxproj +++ b/Plugin/Test/Test.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -38,15 +38,15 @@ {89E3D0A3-3CCB-43E3-9B92-F70EB5731429} Win32Proj - 10.0.14393.0 + 10.0.16299.0 - v140 + v141 DynamicLibrary - v140 + v141 DynamicLibrary true diff --git a/Plugin/Test/TestMain.vcxproj b/Plugin/Test/TestMain.vcxproj index 7bbc91d..76c3793 100644 --- a/Plugin/Test/TestMain.vcxproj +++ b/Plugin/Test/TestMain.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -24,15 +24,15 @@ {11990C37-1C63-418F-9AB1-74076C470584} Win32Proj - 10.0.14393.0 + 10.0.16299.0 - v140 + v141 Application - v140 + v141 Application true diff --git a/Plugin/setup.vcxproj b/Plugin/setup.vcxproj index f923cae..d1e114d 100644 --- a/Plugin/setup.vcxproj +++ b/Plugin/setup.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -42,13 +42,13 @@ {1C5DE91B-7AE9-4304-9FA1-0DE1ABA8C02D} MakeFileProj - 10.0.14393.0 + 10.0.16299.0 Utility true - v140 + v141 diff --git a/Plugin/usdi.vcxproj b/Plugin/usdi.vcxproj index ef13c4f..ab44dc3 100644 --- a/Plugin/usdi.vcxproj +++ b/Plugin/usdi.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -80,15 +80,15 @@ {08361722-5520-47AC-A0C2-31E8A062B73F} Win32Proj - 10.0.14393.0 + 10.0.16299.0 - v140 + v141 DynamicLibrary - v140 + v141 DynamicLibrary true diff --git a/Plugin/usdi/usdiContext.cpp b/Plugin/usdi/usdiContext.cpp index aaea805..0f45bbf 100644 --- a/Plugin/usdi/usdiContext.cpp +++ b/Plugin/usdi/usdiContext.cpp @@ -49,7 +49,7 @@ bool Context::valid() const void Context::initialize() { if (m_stage) { - m_stage->Close(); + m_stage->Unload(); } m_stage = UsdStageRefPtr(); diff --git a/Plugin/usdi/usdiSchema.cpp b/Plugin/usdi/usdiSchema.cpp index f633db2..80d80a1 100644 --- a/Plugin/usdi/usdiSchema.cpp +++ b/Plugin/usdi/usdiSchema.cpp @@ -217,7 +217,7 @@ void Schema::setInstanceable(bool v) { m_prim.SetInstanceable(v); } bool Schema::addReference(const char *asset_path, const char *prim_path) { if (!asset_path) { asset_path = ""; } - return m_prim.GetReferences().AppendReference(SdfReference(asset_path, SdfPath(prim_path))); + return m_prim.GetReferences().AddReference(SdfReference(asset_path, SdfPath(prim_path))); } @@ -368,7 +368,7 @@ bool Schema::beginEditVariant(const char *set, const char *variant) return false; } else { - vset.AppendVariant(variant); + vset.AddVariant(variant); vset.SetVariantSelection(variant); syncVariantSets(); m_ctx->beginEdit(vset.GetVariantEditTarget()); diff --git a/Plugin/usdiRT.vcxproj b/Plugin/usdiRT.vcxproj index 1a553e8..b8aa9e9 100644 --- a/Plugin/usdiRT.vcxproj +++ b/Plugin/usdiRT.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -29,15 +29,15 @@ {66397903-6FF2-46C6-B51E-B323FD248FAD} Win32Proj - 10.0.14393.0 + 10.0.16299.0 - v140 + v141 DynamicLibrary - v140 + v141 DynamicLibrary true