├── .gitignore ├── LICENSE ├── PluginSource ├── projects │ ├── Android │ │ └── jni │ │ │ ├── Android.mk │ │ │ └── Application.mk │ ├── EmbeddedLinux │ │ ├── make_arm32.bat │ │ ├── make_arm64.bat │ │ ├── make_x64.bat │ │ └── make_x86.bat │ ├── GNUMake │ │ └── Makefile │ ├── QNX │ │ └── Makefile │ ├── UWPVisualStudio2022 │ │ ├── RenderingPlugin.sln │ │ ├── RenderingPlugin.vcxproj │ │ └── RenderingPlugin.vcxproj.filters │ ├── VisualStudio2022 │ │ ├── RenderingPlugin.sln │ │ ├── RenderingPlugin.vcxproj │ │ └── RenderingPlugin.vcxproj.filters │ └── Xcode │ │ ├── Info.plist │ │ └── RenderingPlugin.xcodeproj │ │ └── project.pbxproj └── source │ ├── PlatformBase.h │ ├── RenderAPI.cpp │ ├── RenderAPI.h │ ├── RenderAPI_D3D11.cpp │ ├── RenderAPI_D3D12.cpp │ ├── RenderAPI_Metal.mm │ ├── RenderAPI_OpenGLCoreES.cpp │ ├── RenderAPI_Vulkan.cpp │ ├── RenderingPlugin.cpp │ ├── RenderingPlugin.def │ ├── Unity │ ├── IUnityGraphics.h │ ├── IUnityGraphicsD3D11.h │ ├── IUnityGraphicsD3D12.h │ ├── IUnityGraphicsD3D9.h │ ├── IUnityGraphicsMetal.h │ ├── IUnityGraphicsVulkan.h │ └── IUnityInterface.h │ └── gl3w │ ├── gl3w.c │ ├── gl3w.h │ ├── glcorearb.h │ └── readme.txt ├── README.md └── UnityProject ├── Assets ├── Editor.meta ├── Editor │ ├── MyBuildPostprocessor.cs │ └── MyBuildPostprocessor.cs.meta ├── Plugins.meta ├── Plugins │ ├── Metro.meta │ ├── Metro │ │ ├── SDK81.meta │ │ ├── SDK81 │ │ │ ├── ARM.meta │ │ │ ├── ARM │ │ │ │ ├── RenderingPlugin.dll │ │ │ │ └── RenderingPlugin.dll.meta │ │ │ ├── x64.meta │ │ │ ├── x64 │ │ │ │ ├── RenderingPlugin.dll │ │ │ │ └── RenderingPlugin.dll.meta │ │ │ ├── x86.meta │ │ │ └── x86 │ │ │ │ ├── RenderingPlugin.dll │ │ │ │ └── RenderingPlugin.dll.meta │ │ ├── UWP.meta │ │ └── UWP │ │ │ ├── ARM.meta │ │ │ ├── ARM │ │ │ ├── RenderingPlugin.dll │ │ │ └── RenderingPlugin.dll.meta │ │ │ ├── x64.meta │ │ │ ├── x64 │ │ │ ├── RenderingPlugin.dll │ │ │ └── RenderingPlugin.dll.meta │ │ │ ├── x86.meta │ │ │ └── x86 │ │ │ ├── RenderingPlugin.dll │ │ │ └── RenderingPlugin.dll.meta │ ├── RenderingPlugin.bundle.meta │ ├── RenderingPlugin.bundle │ │ ├── Contents.meta │ │ └── Contents │ │ │ ├── Info.plist │ │ │ ├── Info.plist.meta │ │ │ ├── MacOS.meta │ │ │ └── MacOS │ │ │ ├── RenderingPlugin │ │ │ └── RenderingPlugin.meta │ ├── WebGL.meta │ ├── WebGL │ │ ├── RenderingPlugin.cpp │ │ └── RenderingPlugin.cpp.meta │ ├── iOS.meta │ ├── iOS │ │ ├── RegisterPlugin.mm │ │ └── RegisterPlugin.mm.meta │ ├── x86.meta │ ├── x86 │ │ ├── RenderingPlugin.dll │ │ ├── RenderingPlugin.dll.meta │ │ ├── libRenderingPlugin.so │ │ └── libRenderingPlugin.so.meta │ ├── x86_64.meta │ └── x86_64 │ │ ├── RenderingPlugin.dll │ │ ├── RenderingPlugin.dll.meta │ │ ├── libRenderingPlugin.so │ │ └── libRenderingPlugin.so.meta ├── UseRenderingPlugin.cs ├── UseRenderingPlugin.cs.meta ├── scene.unity └── scene.unity.meta ├── Packages └── manifest.json └── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NavMeshLayers.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset └── VFXManager.asset /.gitignore: -------------------------------------------------------------------------------- 1 | *.sdf 2 | *.vcxproj.user 3 | *.VC.opendb 4 | .vs 5 | 6 | xcuserdata 7 | *.xcworkspace 8 | xcshareddata 9 | 10 | WSATestCertificate.pfx* 11 | 12 | UnityProject/*.csproj 13 | UnityProject/*.sln 14 | UnityProject/Library 15 | UnityProject/Temp 16 | UnityProject/UWP 17 | UnityProject/Logs 18 | 19 | PluginSource/build 20 | PluginSource/projects/Android/libs/* 21 | PluginSource/projects/Android/obj/* 22 | PluginSource/source/*.o 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016, Unity Technologies 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /PluginSource/projects/Android/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | SRC_DIR := ../../../source 3 | 4 | include $(CLEAR_VARS) 5 | LOCAL_MODULE := RenderingPlugin 6 | LOCAL_C_INCLUDES += $(SRC_DIR) 7 | LOCAL_LDLIBS := -llog 8 | LOCAL_ARM_MODE := arm 9 | 10 | LOCAL_SRC_FILES += $(SRC_DIR)/RenderAPI.cpp 11 | LOCAL_SRC_FILES += $(SRC_DIR)/RenderingPlugin.cpp 12 | 13 | # OpenGL ES 14 | LOCAL_SRC_FILES += $(SRC_DIR)/RenderAPI_OpenGLCoreES.cpp 15 | LOCAL_LDLIBS += -lGLESv2 16 | LOCAL_CPPFLAGS += -DSUPPORT_OPENGL_ES=1 17 | 18 | # Vulkan (optional) 19 | LOCAL_SRC_FILES += $(SRC_DIR)/RenderAPI_Vulkan.cpp 20 | LOCAL_C_INCLUDES += $(NDK_ROOT)/sources/third_party/vulkan/src/include 21 | LOCAL_CPPFLAGS += -DSUPPORT_VULKAN=1 22 | 23 | # build 24 | include $(BUILD_SHARED_LIBRARY) 25 | -------------------------------------------------------------------------------- /PluginSource/projects/Android/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := armeabi-v7a arm64-v8a x86 x86_64 2 | APP_PLATFORM := android-9 3 | APP_STL := gnustl_static 4 | APP_CPPFLAGS += -std=c++11 5 | NDK_TOOLCHAIN_VERSION := clang 6 | -------------------------------------------------------------------------------- /PluginSource/projects/EmbeddedLinux/make_arm32.bat: -------------------------------------------------------------------------------- 1 | REM UNITY_ROOT should be set to folder with Unity repository 2 | "%UNITY_ROOT%/build/EmbeddedLinux/llvm/bin/clang++" --sysroot="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-arm32/arm-embedded-linux-gnueabihf/sysroot" -DUNITY_EMBEDDED_LINUX=1 -O2 -fPIC -shared -rdynamic -o libRenderingPlugin.so -fuse-ld=lld.exe -Wl,-soname,RenderingPlugin -Wl,-lGLESv2 --gcc-toolchain="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-arm32" -target arm-embedded-linux-gnueabihf ../../source/RenderingPlugin.cpp ../../source/RenderAPI_OpenGLCoreES.cpp ../../source/RenderAPI.cpp 3 | -------------------------------------------------------------------------------- /PluginSource/projects/EmbeddedLinux/make_arm64.bat: -------------------------------------------------------------------------------- 1 | REM UNITY_ROOT should be set to folder with Unity repository 2 | "%UNITY_ROOT%/build/EmbeddedLinux/llvm/bin/clang++" --sysroot="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-arm64/aarch64-embedded-linux-gnu/sysroot" -DUNITY_EMBEDDED_LINUX=1 -DSUPPORT_VULKAN=1 -I"%UNITY_ROOT%/External/Vulkan/include" -O2 -fPIC -shared -rdynamic -o libRenderingPlugin.so -fuse-ld=lld.exe -Wl,-soname,RenderingPlugin -Wl,-lGLESv2 --gcc-toolchain="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-arm64" -target aarch64-embedded-linux-gnu ../../source/RenderingPlugin.cpp ../../source/RenderAPI_OpenGLCoreES.cpp ../../source/RenderAPI_Vulkan.cpp ../../source/RenderAPI.cpp 3 | -------------------------------------------------------------------------------- /PluginSource/projects/EmbeddedLinux/make_x64.bat: -------------------------------------------------------------------------------- 1 | REM UNITY_ROOT should be set to folder with Unity repository 2 | "%UNITY_ROOT%/build/EmbeddedLinux/llvm/bin/clang++" --sysroot="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-x64/x86_64-embedded-linux-gnu/sysroot" -DUNITY_EMBEDDED_LINUX=1 -DSUPPORT_OPENGL_CORE=1 -DSUPPORT_VULKAN=1 -I"%UNITY_ROOT%/External/Vulkan/include" -O2 -fPIC -shared -rdynamic -o libRenderingPlugin.so -fuse-ld=lld.exe -Wl,-soname,RenderingPlugin -Wl,-lGL --gcc-toolchain="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-x64" -target x86_64-embedded-linux-gnu ../../source/RenderingPlugin.cpp ../../source/RenderAPI_OpenGLCoreES.cpp ../../source/RenderAPI_Vulkan.cpp ../../source/RenderAPI.cpp 3 | -------------------------------------------------------------------------------- /PluginSource/projects/EmbeddedLinux/make_x86.bat: -------------------------------------------------------------------------------- 1 | REM UNITY_ROOT should be set to folder with Unity repository 2 | "%UNITY_ROOT%/build/EmbeddedLinux/llvm/bin/clang++" --sysroot="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-x86/i686-embedded-linux-gnu/sysroot" -DUNITY_EMBEDDED_LINUX=1 -DSUPPORT_OPENGL_CORE=1 -O2 -fPIC -shared -rdynamic -o libRenderingPlugin.so -fuse-ld=lld.exe -Wl,-soname,RenderingPlugin -Wl,-lGL --gcc-toolchain="%UNITY_ROOT%/build/EmbeddedLinux/sdk-linux-x86" -target i686-embedded-linux-gnu ../../source/RenderingPlugin.cpp ../../source/RenderAPI_OpenGLCoreES.cpp ../../source/RenderAPI.cpp 3 | -------------------------------------------------------------------------------- /PluginSource/projects/GNUMake/Makefile: -------------------------------------------------------------------------------- 1 | SRCDIR = ../../source 2 | SRCS = $(SRCDIR)/RenderingPlugin.cpp \ 3 | $(SRCDIR)/RenderAPI.cpp \ 4 | $(SRCDIR)/RenderAPI_OpenGLCoreES.cpp \ 5 | $(SRCDIR)/RenderAPI_Vulkan.cpp 6 | OBJS = ${SRCS:.cpp=.o} 7 | UNITY_DEFINES = -DSUPPORT_OPENGL_UNIFIED=1 -DSUPPORT_VULKAN=1 -DUNITY_LINUX=1 8 | CXXFLAGS = $(UNITY_DEFINES) -O2 -fPIC 9 | LDFLAGS = -shared -rdynamic 10 | LIBS = -lGL 11 | PLUGIN_SHARED = libRenderingPlugin.so 12 | CXX ?= g++ 13 | 14 | .cpp.o: 15 | $(CXX) $(CXXFLAGS) -c -o $@ $< 16 | 17 | all: shared 18 | 19 | clean: 20 | rm -f $(OBJS) $(PLUGIN_SHARED) 21 | 22 | shared: $(OBJS) 23 | $(CXX) $(LDFLAGS) -o $(PLUGIN_SHARED) $(OBJS) $(LIBS) 24 | -------------------------------------------------------------------------------- /PluginSource/projects/QNX/Makefile: -------------------------------------------------------------------------------- 1 | # UNITY_QNX_TARGET_LIB allows to specify the path to the QNX target libraries 2 | # e.g. for imx8qm, use "~/qnx710/target/qnx7/aarch64le/usr/lib/graphics/iMX8QM/" 3 | UNITY_QNX_TARGET_LIB ?= $(QNX_TARGET)/aarch64le/usr/lib 4 | 5 | # UNITY_QNX_GLES2_LIB allows to link against a device/driver-specific library 6 | # e.g. for imx8qm, use "GLESv2_viv" 7 | UNITY_QNX_GLES2_LIB ?= GLESv2 8 | 9 | SRCDIR = ../../source 10 | SRCS = $(SRCDIR)/RenderingPlugin.cpp \ 11 | $(SRCDIR)/RenderAPI.cpp \ 12 | $(SRCDIR)/RenderAPI_OpenGLCoreES.cpp 13 | OBJS = ${SRCS:.cpp=.o} 14 | UNITY_DEFINES = -DUNITY_QNX=1 15 | CXXFLAGS = $(UNITY_DEFINES) -O2 -fPIC 16 | LDFLAGS = -shared -rdynamic -static-libstdc++ -Wl,-soname,RenderingPlugin -Wl,-L$(UNITY_QNX_TARGET_LIB) -Wl,-l$(UNITY_QNX_GLES2_LIB) 17 | LIBS = 18 | PLUGIN_SHARED = libRenderingPlugin.so 19 | CXX = ntoaarch64-g++ 20 | 21 | ifeq (, $(shell echo $(QNX_TARGET))) 22 | $(error "QNX_TARGET is not set.") 23 | endif 24 | 25 | ifeq (, $(shell echo $(QNX_HOST))) 26 | $(error "QNX_HOST is not set.") 27 | endif 28 | 29 | # Check if the CXX variable is set to a valid compiler 30 | ifeq (, $(shell which $(CXX))) 31 | $(error "No $(CXX) in PATH. Did you set '$$QNX_HOST/usr/bin' in your PATH?") 32 | endif 33 | 34 | .cpp.o: 35 | $(CXX) $(CXXFLAGS) -c -o $@ $< 36 | 37 | all: clean shared 38 | 39 | cleanobjs: 40 | rm -f $(OBJS) 41 | 42 | cleanlib: 43 | rm -f $(PLUGIN_SHARED) 44 | 45 | clean: cleanobjs cleanlib 46 | 47 | shared: $(OBJS) 48 | $(CXX) $(LDFLAGS) -o $(PLUGIN_SHARED) $(OBJS) $(LIBS) 49 | -------------------------------------------------------------------------------- /PluginSource/projects/UWPVisualStudio2022/RenderingPlugin.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40418.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenderingPlugin", "RenderingPlugin.vcxproj", "{F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Debug|Win32.Build.0 = Debug|Win32 18 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Debug|x64.ActiveCfg = Debug|x64 19 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Debug|x64.Build.0 = Debug|x64 20 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Release|Win32.ActiveCfg = Release|Win32 21 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Release|Win32.Build.0 = Release|Win32 22 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Release|x64.ActiveCfg = Release|x64 23 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /PluginSource/projects/UWPVisualStudio2022/RenderingPlugin.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | $(VULKAN_SDK)\Include 41 | $(VULKAN_SDK)\Include 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | true 52 | true 53 | true 54 | true 55 | 56 | 57 | 58 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C} 59 | RenderingPlugin 60 | Win32Proj 61 | 10.0 62 | 63 | 64 | 65 | DynamicLibrary 66 | v143 67 | Unicode 68 | 69 | 70 | DynamicLibrary 71 | v143 72 | Unicode 73 | 74 | 75 | DynamicLibrary 76 | v143 77 | Unicode 78 | 79 | 80 | DynamicLibrary 81 | Unicode 82 | v143 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | <_ProjectFileVersion>12.0.30501.0 102 | 103 | 104 | $(SolutionDir)..\..\build\uwp\$(Platform)\$(Configuration)\ 105 | $(SolutionDir)..\..\build\uwp\$(Platform)\$(Configuration)\ 106 | $(IncludePath) 107 | 108 | 109 | $(SolutionDir)..\..\build\uwp\$(Platform)\$(Configuration)\ 110 | $(SolutionDir)..\..\build\uwp\$(Platform)\$(Configuration)\ 111 | $(IncludePath) 112 | 113 | 114 | $(SolutionDir)..\..\build\uwp\$(Platform)\$(Configuration)\ 115 | $(SolutionDir)..\..\build\uwp\$(Platform)\$(Configuration)\ 116 | $(IncludePath) 117 | 118 | 119 | $(SolutionDir)..\..\build\uwp\$(Platform)\$(Configuration)\ 120 | $(SolutionDir)..\..\build\uwp\$(Platform)\$(Configuration)\ 121 | $(IncludePath) 122 | 123 | 124 | 125 | GLEW_STATIC;WIN32 126 | 127 | Level3 128 | stdcpp17 129 | MultiThreadedDLL 130 | true 131 | 132 | 133 | opengl32.lib;d3d12.lib 134 | true 135 | Windows 136 | ../../source/RenderingPlugin.def 137 | 138 | 139 | SETLOCAL 140 | 141 | if "$(PlatformShortName)" == "x86" ( 142 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\Metro\UWP\x86 143 | ) else ( 144 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\Metro\UWP\x64 145 | ) 146 | echo Target Plugin Path is %TARGET_PLUGIN_PATH% 147 | copy /Y "$(TargetPath)" "%TARGET_PLUGIN_PATH%\$(TargetFileName)" 148 | 149 | ENDLOCAL 150 | 151 | 152 | 153 | 154 | 155 | GLEW_STATIC;WIN32 156 | 157 | 158 | Level3 159 | stdcpp17 160 | MultiThreadedDLL 161 | true 162 | 163 | 164 | opengl32.lib;d3d12.lib 165 | true 166 | Windows 167 | ../../source/RenderingPlugin.def 168 | 169 | 170 | SETLOCAL 171 | 172 | if "$(PlatformShortName)" == "x86" ( 173 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\Metro\UWP\x86 174 | ) else ( 175 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\Metro\UWP\x64 176 | ) 177 | echo Target Plugin Path is %TARGET_PLUGIN_PATH% 178 | copy /Y "$(TargetPath)" "%TARGET_PLUGIN_PATH%\$(TargetFileName)" 179 | 180 | ENDLOCAL 181 | 182 | 183 | 184 | 185 | 186 | GLEW_STATIC;WIN32 187 | 188 | Level3 189 | stdcpp17 190 | MultiThreadedDLL 191 | true 192 | 193 | 194 | opengl32.lib;d3d12.lib 195 | true 196 | Windows 197 | ../../source/RenderingPlugin.def 198 | 199 | 200 | SETLOCAL 201 | 202 | if "$(PlatformShortName)" == "x86" ( 203 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\Metro\UWP\x86 204 | ) else ( 205 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\Metro\UWP\x64 206 | ) 207 | echo Target Plugin Path is %TARGET_PLUGIN_PATH% 208 | copy /Y "$(TargetPath)" "%TARGET_PLUGIN_PATH%\$(TargetFileName)" 209 | 210 | ENDLOCAL 211 | 212 | 213 | 214 | 215 | 216 | GLEW_STATIC;WIN32 217 | 218 | 219 | Level3 220 | stdcpp17 221 | MultiThreadedDLL 222 | true 223 | 224 | 225 | opengl32.lib;d3d12.lib 226 | true 227 | Windows 228 | ../../source/RenderingPlugin.def 229 | 230 | 231 | SETLOCAL 232 | 233 | if "$(PlatformShortName)" == "x86" ( 234 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\Metro\UWP\x86 235 | ) else ( 236 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\Metro\UWP\x64 237 | ) 238 | echo Target Plugin Path is %TARGET_PLUGIN_PATH% 239 | copy /Y "$(TargetPath)" "%TARGET_PLUGIN_PATH%\$(TargetFileName)" 240 | 241 | ENDLOCAL 242 | 243 | 244 | 245 | 246 | 247 | 248 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 249 | 250 | 251 | -------------------------------------------------------------------------------- /PluginSource/projects/UWPVisualStudio2022/RenderingPlugin.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Unity 8 | 9 | 10 | Unity 11 | 12 | 13 | Unity 14 | 15 | 16 | Unity 17 | 18 | 19 | Unity 20 | 21 | 22 | Unity 23 | 24 | 25 | gl3w 26 | 27 | 28 | gl3w 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | gl3w 40 | 41 | 42 | 43 | 44 | {c01468d4-90d4-4d19-9a9b-ee2f1b5e9083} 45 | 46 | 47 | {f00ad923-e825-43a2-b22c-b3380a3a8813} 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /PluginSource/projects/VisualStudio2022/RenderingPlugin.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40418.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenderingPlugin", "RenderingPlugin.vcxproj", "{F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Debug|Win32.Build.0 = Debug|Win32 18 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Debug|x64.ActiveCfg = Debug|x64 19 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Debug|x64.Build.0 = Debug|x64 20 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Release|Win32.ActiveCfg = Release|Win32 21 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Release|Win32.Build.0 = Release|Win32 22 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Release|x64.ActiveCfg = Release|x64 23 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /PluginSource/projects/VisualStudio2022/RenderingPlugin.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | $(VULKAN_SDK)\Include 41 | $(VULKAN_SDK)\Include 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | true 52 | true 53 | true 54 | true 55 | 56 | 57 | 58 | {F7CFEF5A-54BD-42E8-A59E-54ABAEB4EA9C} 59 | RenderingPlugin 60 | Win32Proj 61 | 10.0 62 | 63 | 64 | 65 | DynamicLibrary 66 | v143 67 | Unicode 68 | 69 | 70 | DynamicLibrary 71 | v143 72 | Unicode 73 | 74 | 75 | DynamicLibrary 76 | v143 77 | Unicode 78 | 79 | 80 | DynamicLibrary 81 | Unicode 82 | v143 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | <_ProjectFileVersion>12.0.30501.0 102 | 103 | 104 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 105 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 106 | $(IncludePath) 107 | 108 | 109 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 110 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 111 | $(IncludePath) 112 | 113 | 114 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 115 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 116 | $(IncludePath) 117 | 118 | 119 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 120 | $(SolutionDir)..\..\build\$(Platform)\$(Configuration)\ 121 | $(IncludePath) 122 | 123 | 124 | 125 | GLEW_STATIC;WIN32 126 | 127 | Level3 128 | stdcpp17 129 | MultiThreadedDLL 130 | true 131 | 132 | 133 | opengl32.lib;d3d12.lib 134 | true 135 | Windows 136 | ../../source/RenderingPlugin.def 137 | 138 | 139 | SETLOCAL 140 | 141 | if "$(PlatformShortName)" == "x86" ( 142 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86 143 | ) else ( 144 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86_64 145 | ) 146 | echo Target Plugin Path is %TARGET_PLUGIN_PATH% 147 | copy /Y "$(TargetPath)" "%TARGET_PLUGIN_PATH%\$(TargetFileName)" 148 | 149 | ENDLOCAL 150 | 151 | 152 | 153 | 154 | 155 | GLEW_STATIC;WIN32 156 | 157 | 158 | Level3 159 | stdcpp17 160 | MultiThreadedDLL 161 | true 162 | 163 | 164 | opengl32.lib;d3d12.lib 165 | true 166 | Windows 167 | ../../source/RenderingPlugin.def 168 | 169 | 170 | SETLOCAL 171 | 172 | if "$(PlatformShortName)" == "x86" ( 173 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86 174 | ) else ( 175 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86_64 176 | ) 177 | echo Target Plugin Path is %TARGET_PLUGIN_PATH% 178 | copy /Y "$(TargetPath)" "%TARGET_PLUGIN_PATH%\$(TargetFileName)" 179 | 180 | ENDLOCAL 181 | 182 | 183 | 184 | 185 | 186 | GLEW_STATIC;WIN32 187 | 188 | Level3 189 | stdcpp17 190 | MultiThreadedDLL 191 | true 192 | 193 | 194 | opengl32.lib;d3d12.lib 195 | true 196 | Windows 197 | ../../source/RenderingPlugin.def 198 | 199 | 200 | SETLOCAL 201 | 202 | if "$(PlatformShortName)" == "x86" ( 203 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86 204 | ) else ( 205 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86_64 206 | ) 207 | echo Target Plugin Path is %TARGET_PLUGIN_PATH% 208 | copy /Y "$(TargetPath)" "%TARGET_PLUGIN_PATH%\$(TargetFileName)" 209 | 210 | ENDLOCAL 211 | 212 | 213 | 214 | 215 | 216 | GLEW_STATIC;WIN32 217 | 218 | 219 | Level3 220 | stdcpp17 221 | MultiThreadedDLL 222 | true 223 | 224 | 225 | opengl32.lib;d3d12.lib 226 | true 227 | Windows 228 | ../../source/RenderingPlugin.def 229 | 230 | 231 | SETLOCAL 232 | 233 | if "$(PlatformShortName)" == "x86" ( 234 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86 235 | ) else ( 236 | set TARGET_PLUGIN_PATH=$(SolutionDir)..\..\..\UnityProject\Assets\Plugins\x86_64 237 | ) 238 | echo Target Plugin Path is %TARGET_PLUGIN_PATH% 239 | copy /Y "$(TargetPath)" "%TARGET_PLUGIN_PATH%\$(TargetFileName)" 240 | 241 | ENDLOCAL 242 | 243 | 244 | 245 | 246 | 247 | 248 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 249 | 250 | 251 | -------------------------------------------------------------------------------- /PluginSource/projects/VisualStudio2022/RenderingPlugin.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | Unity 8 | 9 | 10 | Unity 11 | 12 | 13 | Unity 14 | 15 | 16 | Unity 17 | 18 | 19 | Unity 20 | 21 | 22 | Unity 23 | 24 | 25 | gl3w 26 | 27 | 28 | gl3w 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | gl3w 40 | 41 | 42 | 43 | 44 | {c01468d4-90d4-4d19-9a9b-ee2f1b5e9083} 45 | 46 | 47 | {f00ad923-e825-43a2-b22c-b3380a3a8813} 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /PluginSource/projects/Xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | CFPlugInDynamicRegisterFunction 26 | 27 | CFPlugInDynamicRegistration 28 | NO 29 | CFPlugInFactories 30 | 31 | 00000000-0000-0000-0000-000000000000 32 | MyFactoryFunction 33 | 34 | CFPlugInTypes 35 | 36 | 00000000-0000-0000-0000-000000000000 37 | 38 | 00000000-0000-0000-0000-000000000000 39 | 40 | 41 | CFPlugInUnloadFunction 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /PluginSource/projects/Xcode/RenderingPlugin.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2B6899B81CF8396700C4BA4F /* RenderAPI_OpenGLCoreES.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B6899B01CF8396700C4BA4F /* RenderAPI_OpenGLCoreES.cpp */; }; 11 | 2B6899B91CF8396700C4BA4F /* RenderAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B6899B11CF8396700C4BA4F /* RenderAPI.cpp */; }; 12 | 2B6899BA1CF8396700C4BA4F /* RenderingPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B6899B31CF8396700C4BA4F /* RenderingPlugin.cpp */; }; 13 | 2B6899C91CF83DB000C4BA4F /* RenderingPlugin.bundle in Copy Bundle into Unity project */ = {isa = PBXBuildFile; fileRef = 8D576316048677EA00EA77CD /* RenderingPlugin.bundle */; }; 14 | 2B6899CB1CF8409A00C4BA4F /* RenderAPI_Metal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2B6899CA1CF8409A00C4BA4F /* RenderAPI_Metal.mm */; }; 15 | 2BC2A8D5144C433D00D5EF79 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BC2A8D4144C433D00D5EF79 /* OpenGL.framework */; }; 16 | 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXCopyFilesBuildPhase section */ 20 | 2B6899C81CF83D6200C4BA4F /* Copy Bundle into Unity project */ = { 21 | isa = PBXCopyFilesBuildPhase; 22 | buildActionMask = 2147483647; 23 | dstPath = ../../../UnityProject/Assets/Plugins; 24 | dstSubfolderSpec = 16; 25 | files = ( 26 | 2B6899C91CF83DB000C4BA4F /* RenderingPlugin.bundle in Copy Bundle into Unity project */, 27 | ); 28 | name = "Copy Bundle into Unity project"; 29 | runOnlyForDeploymentPostprocessing = 0; 30 | }; 31 | /* End PBXCopyFilesBuildPhase section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; 35 | 2B6899AB1CF8396700C4BA4F /* PlatformBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatformBase.h; path = ../../source/PlatformBase.h; sourceTree = ""; }; 36 | 2B6899AD1CF8396700C4BA4F /* RenderAPI_D3D11.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderAPI_D3D11.cpp; path = ../../source/RenderAPI_D3D11.cpp; sourceTree = ""; }; 37 | 2B6899AE1CF8396700C4BA4F /* RenderAPI_D3D12.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderAPI_D3D12.cpp; path = ../../source/RenderAPI_D3D12.cpp; sourceTree = ""; }; 38 | 2B6899B01CF8396700C4BA4F /* RenderAPI_OpenGLCoreES.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderAPI_OpenGLCoreES.cpp; path = ../../source/RenderAPI_OpenGLCoreES.cpp; sourceTree = ""; }; 39 | 2B6899B11CF8396700C4BA4F /* RenderAPI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderAPI.cpp; path = ../../source/RenderAPI.cpp; sourceTree = ""; }; 40 | 2B6899B21CF8396700C4BA4F /* RenderAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderAPI.h; path = ../../source/RenderAPI.h; sourceTree = ""; }; 41 | 2B6899B31CF8396700C4BA4F /* RenderingPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderingPlugin.cpp; path = ../../source/RenderingPlugin.cpp; sourceTree = ""; }; 42 | 2B6899C21CF839A600C4BA4F /* IUnityGraphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IUnityGraphics.h; path = ../../source/Unity/IUnityGraphics.h; sourceTree = ""; }; 43 | 2B6899C31CF839A600C4BA4F /* IUnityGraphicsD3D9.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IUnityGraphicsD3D9.h; path = ../../source/Unity/IUnityGraphicsD3D9.h; sourceTree = ""; }; 44 | 2B6899C41CF839A600C4BA4F /* IUnityGraphicsD3D11.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IUnityGraphicsD3D11.h; path = ../../source/Unity/IUnityGraphicsD3D11.h; sourceTree = ""; }; 45 | 2B6899C51CF839A600C4BA4F /* IUnityGraphicsD3D12.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IUnityGraphicsD3D12.h; path = ../../source/Unity/IUnityGraphicsD3D12.h; sourceTree = ""; }; 46 | 2B6899C61CF839A600C4BA4F /* IUnityGraphicsMetal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IUnityGraphicsMetal.h; path = ../../source/Unity/IUnityGraphicsMetal.h; sourceTree = ""; }; 47 | 2B6899C71CF839A600C4BA4F /* IUnityInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IUnityInterface.h; path = ../../source/Unity/IUnityInterface.h; sourceTree = ""; }; 48 | 2B6899CA1CF8409A00C4BA4F /* RenderAPI_Metal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RenderAPI_Metal.mm; path = ../../source/RenderAPI_Metal.mm; sourceTree = ""; }; 49 | 2BC2A8D4144C433D00D5EF79 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; }; 50 | 8D576316048677EA00EA77CD /* RenderingPlugin.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RenderingPlugin.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 8D576313048677EA00EA77CD /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */, 60 | 2BC2A8D5144C433D00D5EF79 /* OpenGL.framework in Frameworks */, 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | /* End PBXFrameworksBuildPhase section */ 65 | 66 | /* Begin PBXGroup section */ 67 | 089C166AFE841209C02AAC07 /* RenderingPlugin */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 08FB77AFFE84173DC02AAC07 /* Source */, 71 | 089C167CFE841241C02AAC07 /* Resources */, 72 | 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */, 73 | 19C28FB6FE9D52B211CA2CBB /* Products */, 74 | ); 75 | name = RenderingPlugin; 76 | sourceTree = ""; 77 | }; 78 | 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */, 82 | 2BC2A8D4144C433D00D5EF79 /* OpenGL.framework */, 83 | ); 84 | name = "External Frameworks and Libraries"; 85 | sourceTree = ""; 86 | }; 87 | 089C167CFE841241C02AAC07 /* Resources */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 8D576317048677EA00EA77CD /* Info.plist */, 91 | ); 92 | name = Resources; 93 | sourceTree = ""; 94 | }; 95 | 08FB77AFFE84173DC02AAC07 /* Source */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 2B6899BC1CF8398200C4BA4F /* Unity */, 99 | 2B6899AB1CF8396700C4BA4F /* PlatformBase.h */, 100 | 2B6899AD1CF8396700C4BA4F /* RenderAPI_D3D11.cpp */, 101 | 2B6899AE1CF8396700C4BA4F /* RenderAPI_D3D12.cpp */, 102 | 2B6899CA1CF8409A00C4BA4F /* RenderAPI_Metal.mm */, 103 | 2B6899B01CF8396700C4BA4F /* RenderAPI_OpenGLCoreES.cpp */, 104 | 2B6899B11CF8396700C4BA4F /* RenderAPI.cpp */, 105 | 2B6899B21CF8396700C4BA4F /* RenderAPI.h */, 106 | 2B6899B31CF8396700C4BA4F /* RenderingPlugin.cpp */, 107 | ); 108 | name = Source; 109 | sourceTree = ""; 110 | }; 111 | 19C28FB6FE9D52B211CA2CBB /* Products */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | 8D576316048677EA00EA77CD /* RenderingPlugin.bundle */, 115 | ); 116 | name = Products; 117 | sourceTree = ""; 118 | }; 119 | 2B6899BC1CF8398200C4BA4F /* Unity */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 2B6899C21CF839A600C4BA4F /* IUnityGraphics.h */, 123 | 2B6899C31CF839A600C4BA4F /* IUnityGraphicsD3D9.h */, 124 | 2B6899C41CF839A600C4BA4F /* IUnityGraphicsD3D11.h */, 125 | 2B6899C51CF839A600C4BA4F /* IUnityGraphicsD3D12.h */, 126 | 2B6899C61CF839A600C4BA4F /* IUnityGraphicsMetal.h */, 127 | 2B6899C71CF839A600C4BA4F /* IUnityInterface.h */, 128 | ); 129 | name = Unity; 130 | sourceTree = ""; 131 | }; 132 | /* End PBXGroup section */ 133 | 134 | /* Begin PBXNativeTarget section */ 135 | 8D57630D048677EA00EA77CD /* RenderingPlugin */ = { 136 | isa = PBXNativeTarget; 137 | buildConfigurationList = 1DEB911A08733D790010E9CD /* Build configuration list for PBXNativeTarget "RenderingPlugin" */; 138 | buildPhases = ( 139 | 8D57630F048677EA00EA77CD /* Resources */, 140 | 8D576311048677EA00EA77CD /* Sources */, 141 | 8D576313048677EA00EA77CD /* Frameworks */, 142 | 2B6899C81CF83D6200C4BA4F /* Copy Bundle into Unity project */, 143 | ); 144 | buildRules = ( 145 | ); 146 | dependencies = ( 147 | ); 148 | name = RenderingPlugin; 149 | productInstallPath = "$(HOME)/Library/Bundles"; 150 | productName = RenderingPlugin; 151 | productReference = 8D576316048677EA00EA77CD /* RenderingPlugin.bundle */; 152 | productType = "com.apple.product-type.bundle"; 153 | }; 154 | /* End PBXNativeTarget section */ 155 | 156 | /* Begin PBXProject section */ 157 | 089C1669FE841209C02AAC07 /* Project object */ = { 158 | isa = PBXProject; 159 | attributes = { 160 | LastUpgradeCheck = 0730; 161 | }; 162 | buildConfigurationList = 1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "RenderingPlugin" */; 163 | compatibilityVersion = "Xcode 3.2"; 164 | developmentRegion = English; 165 | hasScannedForEncodings = 1; 166 | knownRegions = ( 167 | English, 168 | Japanese, 169 | French, 170 | German, 171 | ); 172 | mainGroup = 089C166AFE841209C02AAC07 /* RenderingPlugin */; 173 | projectDirPath = ""; 174 | projectRoot = ""; 175 | targets = ( 176 | 8D57630D048677EA00EA77CD /* RenderingPlugin */, 177 | ); 178 | }; 179 | /* End PBXProject section */ 180 | 181 | /* Begin PBXResourcesBuildPhase section */ 182 | 8D57630F048677EA00EA77CD /* Resources */ = { 183 | isa = PBXResourcesBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | ); 187 | runOnlyForDeploymentPostprocessing = 0; 188 | }; 189 | /* End PBXResourcesBuildPhase section */ 190 | 191 | /* Begin PBXSourcesBuildPhase section */ 192 | 8D576311048677EA00EA77CD /* Sources */ = { 193 | isa = PBXSourcesBuildPhase; 194 | buildActionMask = 2147483647; 195 | files = ( 196 | 2B6899BA1CF8396700C4BA4F /* RenderingPlugin.cpp in Sources */, 197 | 2B6899B81CF8396700C4BA4F /* RenderAPI_OpenGLCoreES.cpp in Sources */, 198 | 2B6899B91CF8396700C4BA4F /* RenderAPI.cpp in Sources */, 199 | 2B6899CB1CF8409A00C4BA4F /* RenderAPI_Metal.mm in Sources */, 200 | ); 201 | runOnlyForDeploymentPostprocessing = 0; 202 | }; 203 | /* End PBXSourcesBuildPhase section */ 204 | 205 | /* Begin XCBuildConfiguration section */ 206 | 1DEB911B08733D790010E9CD /* Debug */ = { 207 | isa = XCBuildConfiguration; 208 | buildSettings = { 209 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 210 | CLANG_ENABLE_OBJC_ARC = YES; 211 | COMBINE_HIDPI_IMAGES = YES; 212 | DEBUG_INFORMATION_FORMAT = dwarf; 213 | GCC_ENABLE_FIX_AND_CONTINUE = YES; 214 | HEADER_SEARCH_PATHS = ../; 215 | INFOPLIST_FILE = Info.plist; 216 | INSTALL_PATH = "$(HOME)/Library/Bundles"; 217 | PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.${PRODUCT_NAME:rfc1034Identifier}"; 218 | PRODUCT_NAME = RenderingPlugin; 219 | VALID_ARCHS = x86_64; 220 | WRAPPER_EXTENSION = bundle; 221 | }; 222 | name = Debug; 223 | }; 224 | 1DEB911C08733D790010E9CD /* Release */ = { 225 | isa = XCBuildConfiguration; 226 | buildSettings = { 227 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 228 | CLANG_ENABLE_OBJC_ARC = YES; 229 | COMBINE_HIDPI_IMAGES = YES; 230 | DEBUG_INFORMATION_FORMAT = dwarf; 231 | HEADER_SEARCH_PATHS = ../; 232 | INFOPLIST_FILE = Info.plist; 233 | INSTALL_PATH = "$(HOME)/Library/Bundles"; 234 | PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.${PRODUCT_NAME:rfc1034Identifier}"; 235 | PRODUCT_NAME = RenderingPlugin; 236 | VALID_ARCHS = x86_64; 237 | WRAPPER_EXTENSION = bundle; 238 | }; 239 | name = Release; 240 | }; 241 | 1DEB911F08733D790010E9CD /* Debug */ = { 242 | isa = XCBuildConfiguration; 243 | buildSettings = { 244 | ARCHS = "$(ARCHS_STANDARD)"; 245 | ENABLE_TESTABILITY = YES; 246 | GCC_OPTIMIZATION_LEVEL = 0; 247 | MACOSX_DEPLOYMENT_TARGET = 10.11; 248 | ONLY_ACTIVE_ARCH = YES; 249 | SDKROOT = macosx; 250 | SYMROOT = ../../build; 251 | }; 252 | name = Debug; 253 | }; 254 | 1DEB912008733D790010E9CD /* Release */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | ARCHS = "$(ARCHS_STANDARD)"; 258 | MACOSX_DEPLOYMENT_TARGET = 10.11; 259 | SDKROOT = macosx; 260 | SYMROOT = ../../build; 261 | }; 262 | name = Release; 263 | }; 264 | /* End XCBuildConfiguration section */ 265 | 266 | /* Begin XCConfigurationList section */ 267 | 1DEB911A08733D790010E9CD /* Build configuration list for PBXNativeTarget "RenderingPlugin" */ = { 268 | isa = XCConfigurationList; 269 | buildConfigurations = ( 270 | 1DEB911B08733D790010E9CD /* Debug */, 271 | 1DEB911C08733D790010E9CD /* Release */, 272 | ); 273 | defaultConfigurationIsVisible = 0; 274 | defaultConfigurationName = Release; 275 | }; 276 | 1DEB911E08733D790010E9CD /* Build configuration list for PBXProject "RenderingPlugin" */ = { 277 | isa = XCConfigurationList; 278 | buildConfigurations = ( 279 | 1DEB911F08733D790010E9CD /* Debug */, 280 | 1DEB912008733D790010E9CD /* Release */, 281 | ); 282 | defaultConfigurationIsVisible = 0; 283 | defaultConfigurationName = Release; 284 | }; 285 | /* End XCConfigurationList section */ 286 | }; 287 | rootObject = 089C1669FE841209C02AAC07 /* Project object */; 288 | } 289 | -------------------------------------------------------------------------------- /PluginSource/source/PlatformBase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Standard base includes, defines that indicate our current platform, etc. 4 | 5 | #include 6 | 7 | 8 | // Which platform we are on? 9 | // UNITY_WIN - Windows (regular win32) 10 | // UNITY_OSX - Mac OS X 11 | // UNITY_LINUX - Linux 12 | // UNITY_IOS - iOS 13 | // UNITY_TVOS - tvOS 14 | // UNITY_ANDROID - Android 15 | // UNITY_METRO - WSA or UWP 16 | // UNITY_WEBGL - WebGL 17 | // UNITY_EMBEDDED_LINUX - EmbeddedLinux OpenGLES 18 | // UNITY_EMBEDDED_LINUX_GL - EmbeddedLinux OpenGLCore 19 | #if _MSC_VER 20 | #define UNITY_WIN 1 21 | #elif defined(__APPLE__) 22 | #if TARGET_OS_TV 23 | #define UNITY_TVOS 1 24 | #elif TARGET_OS_IOS 25 | #define UNITY_IOS 1 26 | #else 27 | #define UNITY_OSX 1 28 | #endif 29 | #elif defined(__ANDROID__) 30 | #define UNITY_ANDROID 1 31 | #elif defined(UNITY_METRO) || defined(UNITY_LINUX) || defined(UNITY_WEBGL) || defined (UNITY_EMBEDDED_LINUX) || defined (UNITY_EMBEDDED_LINUX_GL) || defined (UNITY_QNX) 32 | // these are defined externally 33 | #elif defined(__EMSCRIPTEN__) 34 | // this is already defined in Unity 5.6 35 | #define UNITY_WEBGL 1 36 | #else 37 | #error "Unknown platform!" 38 | #endif 39 | 40 | 41 | 42 | // Which graphics device APIs we possibly support? 43 | #if UNITY_METRO 44 | #define SUPPORT_D3D11 1 45 | #if WINDOWS_UWP 46 | #define SUPPORT_D3D12 1 47 | #endif 48 | #elif UNITY_WIN 49 | #define SUPPORT_D3D11 1 // comment this out if you don't have D3D11 header/library files 50 | #define SUPPORT_D3D12 0 // comment this out if you don't have D3D12 header/library files 51 | #define SUPPORT_OPENGL_UNIFIED 1 52 | #define SUPPORT_OPENGL_CORE 1 53 | #define SUPPORT_VULKAN 0 // Requires Vulkan SDK to be installed 54 | #elif UNITY_IOS || UNITY_TVOS || UNITY_ANDROID || UNITY_WEBGL 55 | #ifndef SUPPORT_OPENGL_ES 56 | #define SUPPORT_OPENGL_ES 1 57 | #endif 58 | #define SUPPORT_OPENGL_UNIFIED SUPPORT_OPENGL_ES 59 | #ifndef SUPPORT_VULKAN 60 | #define SUPPORT_VULKAN 0 61 | #endif 62 | #elif UNITY_OSX || UNITY_LINUX 63 | #define SUPPORT_OPENGL_UNIFIED 1 64 | #define SUPPORT_OPENGL_CORE 1 65 | #elif UNITY_EMBEDDED_LINUX 66 | #define SUPPORT_OPENGL_UNIFIED 1 67 | #define SUPPORT_OPENGL_ES 1 68 | #ifndef SUPPORT_VULKAN 69 | #define SUPPORT_VULKAN 0 70 | #endif 71 | #elif UNITY_QNX 72 | #define SUPPORT_OPENGL_UNIFIED 1 73 | #define SUPPORT_OPENGL_ES 1 74 | #endif 75 | 76 | #if UNITY_IOS || UNITY_TVOS || UNITY_OSX 77 | #define SUPPORT_METAL 1 78 | #endif 79 | 80 | 81 | 82 | // COM-like Release macro 83 | #ifndef SAFE_RELEASE 84 | #define SAFE_RELEASE(a) if (a) { a->Release(); a = NULL; } 85 | #endif 86 | 87 | -------------------------------------------------------------------------------- /PluginSource/source/RenderAPI.cpp: -------------------------------------------------------------------------------- 1 | #include "RenderAPI.h" 2 | #include "PlatformBase.h" 3 | #include "Unity/IUnityGraphics.h" 4 | 5 | RenderAPI* CreateRenderAPI(UnityGfxRenderer apiType) 6 | { 7 | # if SUPPORT_D3D11 8 | if (apiType == kUnityGfxRendererD3D11) 9 | { 10 | extern RenderAPI* CreateRenderAPI_D3D11(); 11 | return CreateRenderAPI_D3D11(); 12 | } 13 | # endif // if SUPPORT_D3D11 14 | 15 | # if SUPPORT_D3D12 16 | if (apiType == kUnityGfxRendererD3D12) 17 | { 18 | extern RenderAPI* CreateRenderAPI_D3D12(); 19 | return CreateRenderAPI_D3D12(); 20 | } 21 | # endif // if SUPPORT_D3D12 22 | 23 | 24 | # if SUPPORT_OPENGL_UNIFIED 25 | if (apiType == kUnityGfxRendererOpenGLCore || apiType == kUnityGfxRendererOpenGLES30) 26 | { 27 | extern RenderAPI* CreateRenderAPI_OpenGLCoreES(UnityGfxRenderer apiType); 28 | return CreateRenderAPI_OpenGLCoreES(apiType); 29 | } 30 | # endif // if SUPPORT_OPENGL_UNIFIED 31 | 32 | # if SUPPORT_METAL 33 | if (apiType == kUnityGfxRendererMetal) 34 | { 35 | extern RenderAPI* CreateRenderAPI_Metal(); 36 | return CreateRenderAPI_Metal(); 37 | } 38 | # endif // if SUPPORT_METAL 39 | 40 | # if SUPPORT_VULKAN 41 | if (apiType == kUnityGfxRendererVulkan) 42 | { 43 | extern RenderAPI* CreateRenderAPI_Vulkan(); 44 | return CreateRenderAPI_Vulkan(); 45 | } 46 | # endif // if SUPPORT_VULKAN 47 | 48 | // Unknown or unsupported graphics API 49 | return NULL; 50 | } 51 | -------------------------------------------------------------------------------- /PluginSource/source/RenderAPI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Unity/IUnityGraphics.h" 4 | 5 | #include 6 | 7 | struct IUnityInterfaces; 8 | 9 | // Super-simple "graphics abstraction". This is nothing like how a proper platform abstraction layer would look like; 10 | // all this does is a base interface for whatever our plugin sample needs. Which is only "draw some triangles" 11 | // and "modify a texture" at this point. 12 | // 13 | // There are implementations of this base class for D3D9, D3D11, OpenGL etc.; see individual RenderAPI_* files. 14 | class RenderAPI 15 | { 16 | public: 17 | virtual ~RenderAPI() { } 18 | 19 | 20 | // Process general event like initialization, shutdown, device loss/reset etc. 21 | virtual void ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces) = 0; 22 | 23 | // Is the API using "reversed" (1.0 at near plane, 0.0 at far plane) depth buffer? 24 | // Reversed Z is used on modern platforms, and improves depth buffer precision. 25 | virtual bool GetUsesReverseZ() = 0; 26 | 27 | // Draw some triangle geometry, using some simple rendering state. 28 | // Upon call into our plug-in the render state can be almost completely arbitrary depending 29 | // on what was rendered in Unity before. Here, we turn off culling, blending, depth writes etc. 30 | // and draw the triangles with a given world matrix. The triangle data is 31 | // float3 (position) and byte4 (color) per vertex. 32 | virtual void DrawSimpleTriangles(const float worldMatrix[16], int triangleCount, const void* verticesFloat3Byte4) = 0; 33 | 34 | 35 | // Begin modifying texture data. You need to pass texture width/height too, since some graphics APIs 36 | // (e.g. OpenGL ES) do not have a good way to query that from the texture itself... 37 | // 38 | // Returns pointer into the data buffer to write into (or NULL on failure), and pitch in bytes of a single texture row. 39 | virtual void* BeginModifyTexture(void* textureHandle, int textureWidth, int textureHeight, int* outRowPitch) = 0; 40 | // End modifying texture data. 41 | virtual void EndModifyTexture(void* textureHandle, int textureWidth, int textureHeight, int rowPitch, void* dataPtr) = 0; 42 | 43 | 44 | // Begin modifying vertex buffer data. 45 | // Returns pointer into the data buffer to write into (or NULL on failure), and buffer size. 46 | virtual void* BeginModifyVertexBuffer(void* bufferHandle, size_t* outBufferSize) = 0; 47 | // End modifying vertex buffer data. 48 | virtual void EndModifyVertexBuffer(void* bufferHandle) = 0; 49 | 50 | // -------------------------------------------------------------------------- 51 | // DX12 plugin specific functions 52 | // -------------------------------------------------------------------------- 53 | 54 | // Draws to a texture that is created by the plugin 55 | virtual void drawToPluginTexture() {} 56 | 57 | // Draws to a a unity RenderBuffer which can be set with 58 | // setRenderTextureResource(). When the texture resource is not 59 | // set with setRenderTextureResource() one is created by the plugin 60 | virtual void drawToRenderTexture() {} 61 | 62 | // Returns the native resource pointer to either unity render buffer or 63 | // to the resource created by the plugin (i.e ID3D12Resource* in case of DX12) 64 | virtual void* getRenderTexture() { return nullptr; } 65 | 66 | // Sets the underlying resource to unity RenderBuffer 67 | // see https://docs.unity3d.com/ScriptReference/RenderBuffer.html 68 | // setting rb to nullptr is used to signal the plugin that the 69 | // previously set RenderBuffer is no longer valid 70 | virtual void setRenderTextureResource(UnityRenderBuffer rb) {} 71 | 72 | // This should return true when the plugin is used with the unity player 73 | // and false when the editor is used. The editor uses multiple swap 74 | // chains (for each window) so instead of choosing one of them nullptr is returned. 75 | virtual bool isSwapChainAvailable() { return false; }; 76 | 77 | // These require the swap chain to be available to be functional. 78 | // When the swap chain is not available these simply return 0 79 | 80 | virtual unsigned int getPresentFlags() { return 0; } 81 | virtual unsigned int getSyncInterval() { return 0; } 82 | virtual unsigned int getBackbufferWidth() { return 0; } 83 | virtual unsigned int getBackbufferHeight() { return 0; } 84 | }; 85 | 86 | 87 | // Create a graphics API implementation instance for the given API type. 88 | RenderAPI* CreateRenderAPI(UnityGfxRenderer apiType); 89 | 90 | -------------------------------------------------------------------------------- /PluginSource/source/RenderAPI_D3D11.cpp: -------------------------------------------------------------------------------- 1 | #include "RenderAPI.h" 2 | #include "PlatformBase.h" 3 | 4 | // Direct3D 11 implementation of RenderAPI. 5 | 6 | #if SUPPORT_D3D11 7 | 8 | #include 9 | #include 10 | #include "Unity/IUnityGraphicsD3D11.h" 11 | 12 | 13 | class RenderAPI_D3D11 : public RenderAPI 14 | { 15 | public: 16 | RenderAPI_D3D11(); 17 | virtual ~RenderAPI_D3D11() { } 18 | 19 | virtual void ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces); 20 | 21 | virtual bool GetUsesReverseZ() { return (int)m_Device->GetFeatureLevel() >= (int)D3D_FEATURE_LEVEL_10_0; } 22 | 23 | virtual void DrawSimpleTriangles(const float worldMatrix[16], int triangleCount, const void* verticesFloat3Byte4); 24 | 25 | virtual void* BeginModifyTexture(void* textureHandle, int textureWidth, int textureHeight, int* outRowPitch); 26 | virtual void EndModifyTexture(void* textureHandle, int textureWidth, int textureHeight, int rowPitch, void* dataPtr); 27 | 28 | virtual void* BeginModifyVertexBuffer(void* bufferHandle, size_t* outBufferSize); 29 | virtual void EndModifyVertexBuffer(void* bufferHandle); 30 | 31 | private: 32 | void CreateResources(); 33 | void ReleaseResources(); 34 | 35 | private: 36 | ID3D11Device* m_Device; 37 | ID3D11Buffer* m_VB; // vertex buffer 38 | ID3D11Buffer* m_CB; // constant buffer 39 | ID3D11VertexShader* m_VertexShader; 40 | ID3D11PixelShader* m_PixelShader; 41 | ID3D11InputLayout* m_InputLayout; 42 | ID3D11RasterizerState* m_RasterState; 43 | ID3D11BlendState* m_BlendState; 44 | ID3D11DepthStencilState* m_DepthState; 45 | }; 46 | 47 | 48 | RenderAPI* CreateRenderAPI_D3D11() 49 | { 50 | return new RenderAPI_D3D11(); 51 | } 52 | 53 | 54 | // Simple compiled shader bytecode. 55 | // 56 | // Shader source that was used: 57 | #if 0 58 | cbuffer MyCB : register(b0) 59 | { 60 | float4x4 worldMatrix; 61 | } 62 | void VS(float3 pos : POSITION, float4 color : COLOR, out float4 ocolor : COLOR, out float4 opos : SV_Position) 63 | { 64 | opos = mul(worldMatrix, float4(pos, 1)); 65 | ocolor = color; 66 | } 67 | float4 PS(float4 color : COLOR) : SV_TARGET 68 | { 69 | return color; 70 | } 71 | #endif // #if 0 72 | // 73 | // Which then was compiled with: 74 | // fxc /Tvs_4_0_level_9_3 /EVS source.hlsl /Fh outVS.h /Qstrip_reflect /Qstrip_debug /Qstrip_priv 75 | // fxc /Tps_4_0_level_9_3 /EPS source.hlsl /Fh outPS.h /Qstrip_reflect /Qstrip_debug /Qstrip_priv 76 | // and results pasted & formatted to take less lines here 77 | const BYTE kVertexShaderCode[] = 78 | { 79 | 68,88,66,67,86,189,21,50,166,106,171,1,10,62,115,48,224,137,163,129,1,0,0,0,168,2,0,0,4,0,0,0,48,0,0,0,0,1,0,0,4,2,0,0,84,2,0,0, 80 | 65,111,110,57,200,0,0,0,200,0,0,0,0,2,254,255,148,0,0,0,52,0,0,0,1,0,36,0,0,0,48,0,0,0,48,0,0,0,36,0,1,0,48,0,0,0,0,0, 81 | 4,0,1,0,0,0,0,0,0,0,0,0,1,2,254,255,31,0,0,2,5,0,0,128,0,0,15,144,31,0,0,2,5,0,1,128,1,0,15,144,5,0,0,3,0,0,15,128, 82 | 0,0,85,144,2,0,228,160,4,0,0,4,0,0,15,128,1,0,228,160,0,0,0,144,0,0,228,128,4,0,0,4,0,0,15,128,3,0,228,160,0,0,170,144,0,0,228,128, 83 | 2,0,0,3,0,0,15,128,0,0,228,128,4,0,228,160,4,0,0,4,0,0,3,192,0,0,255,128,0,0,228,160,0,0,228,128,1,0,0,2,0,0,12,192,0,0,228,128, 84 | 1,0,0,2,0,0,15,224,1,0,228,144,255,255,0,0,83,72,68,82,252,0,0,0,64,0,1,0,63,0,0,0,89,0,0,4,70,142,32,0,0,0,0,0,4,0,0,0, 85 | 95,0,0,3,114,16,16,0,0,0,0,0,95,0,0,3,242,16,16,0,1,0,0,0,101,0,0,3,242,32,16,0,0,0,0,0,103,0,0,4,242,32,16,0,1,0,0,0, 86 | 1,0,0,0,104,0,0,2,1,0,0,0,54,0,0,5,242,32,16,0,0,0,0,0,70,30,16,0,1,0,0,0,56,0,0,8,242,0,16,0,0,0,0,0,86,21,16,0, 87 | 0,0,0,0,70,142,32,0,0,0,0,0,1,0,0,0,50,0,0,10,242,0,16,0,0,0,0,0,70,142,32,0,0,0,0,0,0,0,0,0,6,16,16,0,0,0,0,0, 88 | 70,14,16,0,0,0,0,0,50,0,0,10,242,0,16,0,0,0,0,0,70,142,32,0,0,0,0,0,2,0,0,0,166,26,16,0,0,0,0,0,70,14,16,0,0,0,0,0, 89 | 0,0,0,8,242,32,16,0,1,0,0,0,70,14,16,0,0,0,0,0,70,142,32,0,0,0,0,0,3,0,0,0,62,0,0,1,73,83,71,78,72,0,0,0,2,0,0,0, 90 | 8,0,0,0,56,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,7,7,0,0,65,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,1,0,0,0, 91 | 15,15,0,0,80,79,83,73,84,73,79,78,0,67,79,76,79,82,0,171,79,83,71,78,76,0,0,0,2,0,0,0,8,0,0,0,56,0,0,0,0,0,0,0,0,0,0,0, 92 | 3,0,0,0,0,0,0,0,15,0,0,0,62,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,1,0,0,0,15,0,0,0,67,79,76,79,82,0,83,86,95,80,111,115, 93 | 105,116,105,111,110,0,171,171 94 | }; 95 | const BYTE kPixelShaderCode[]= 96 | { 97 | 68,88,66,67,196,65,213,199,14,78,29,150,87,236,231,156,203,125,244,112,1,0,0,0,32,1,0,0,4,0,0,0,48,0,0,0,124,0,0,0,188,0,0,0,236,0,0,0, 98 | 65,111,110,57,68,0,0,0,68,0,0,0,0,2,255,255,32,0,0,0,36,0,0,0,0,0,36,0,0,0,36,0,0,0,36,0,0,0,36,0,0,0,36,0,1,2,255,255, 99 | 31,0,0,2,0,0,0,128,0,0,15,176,1,0,0,2,0,8,15,128,0,0,228,176,255,255,0,0,83,72,68,82,56,0,0,0,64,0,0,0,14,0,0,0,98,16,0,3, 100 | 242,16,16,0,0,0,0,0,101,0,0,3,242,32,16,0,0,0,0,0,54,0,0,5,242,32,16,0,0,0,0,0,70,30,16,0,0,0,0,0,62,0,0,1,73,83,71,78, 101 | 40,0,0,0,1,0,0,0,8,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,15,15,0,0,67,79,76,79,82,0,171,171,79,83,71,78, 102 | 44,0,0,0,1,0,0,0,8,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,15,0,0,0,83,86,95,84,65,82,71,69,84,0,171,171 103 | }; 104 | 105 | 106 | RenderAPI_D3D11::RenderAPI_D3D11() 107 | : m_Device(NULL) 108 | , m_VB(NULL) 109 | , m_CB(NULL) 110 | , m_VertexShader(NULL) 111 | , m_PixelShader(NULL) 112 | , m_InputLayout(NULL) 113 | , m_RasterState(NULL) 114 | , m_BlendState(NULL) 115 | , m_DepthState(NULL) 116 | { 117 | } 118 | 119 | 120 | void RenderAPI_D3D11::ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces) 121 | { 122 | switch (type) 123 | { 124 | case kUnityGfxDeviceEventInitialize: 125 | { 126 | IUnityGraphicsD3D11* d3d = interfaces->Get(); 127 | m_Device = d3d->GetDevice(); 128 | CreateResources(); 129 | break; 130 | } 131 | case kUnityGfxDeviceEventShutdown: 132 | ReleaseResources(); 133 | break; 134 | } 135 | } 136 | 137 | 138 | void RenderAPI_D3D11::CreateResources() 139 | { 140 | D3D11_BUFFER_DESC desc; 141 | memset(&desc, 0, sizeof(desc)); 142 | 143 | // vertex buffer 144 | desc.Usage = D3D11_USAGE_DEFAULT; 145 | desc.ByteWidth = 1024; 146 | desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; 147 | m_Device->CreateBuffer(&desc, NULL, &m_VB); 148 | 149 | // constant buffer 150 | desc.Usage = D3D11_USAGE_DEFAULT; 151 | desc.ByteWidth = 64; // hold 1 matrix 152 | desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; 153 | desc.CPUAccessFlags = 0; 154 | m_Device->CreateBuffer(&desc, NULL, &m_CB); 155 | 156 | // shaders 157 | HRESULT hr; 158 | hr = m_Device->CreateVertexShader(kVertexShaderCode, sizeof(kVertexShaderCode), nullptr, &m_VertexShader); 159 | if (FAILED(hr)) 160 | OutputDebugStringA("Failed to create vertex shader.\n"); 161 | hr = m_Device->CreatePixelShader(kPixelShaderCode, sizeof(kPixelShaderCode), nullptr, &m_PixelShader); 162 | if (FAILED(hr)) 163 | OutputDebugStringA("Failed to create pixel shader.\n"); 164 | 165 | // input layout 166 | if (m_VertexShader) 167 | { 168 | D3D11_INPUT_ELEMENT_DESC s_DX11InputElementDesc[] = 169 | { 170 | { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, 171 | { "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, 172 | }; 173 | m_Device->CreateInputLayout(s_DX11InputElementDesc, 2, kVertexShaderCode, sizeof(kVertexShaderCode), &m_InputLayout); 174 | } 175 | 176 | // render states 177 | D3D11_RASTERIZER_DESC rsdesc; 178 | memset(&rsdesc, 0, sizeof(rsdesc)); 179 | rsdesc.FillMode = D3D11_FILL_SOLID; 180 | rsdesc.CullMode = D3D11_CULL_NONE; 181 | rsdesc.DepthClipEnable = TRUE; 182 | m_Device->CreateRasterizerState(&rsdesc, &m_RasterState); 183 | 184 | D3D11_DEPTH_STENCIL_DESC dsdesc; 185 | memset(&dsdesc, 0, sizeof(dsdesc)); 186 | dsdesc.DepthEnable = TRUE; 187 | dsdesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; 188 | dsdesc.DepthFunc = GetUsesReverseZ() ? D3D11_COMPARISON_GREATER_EQUAL : D3D11_COMPARISON_LESS_EQUAL; 189 | m_Device->CreateDepthStencilState(&dsdesc, &m_DepthState); 190 | 191 | D3D11_BLEND_DESC bdesc; 192 | memset(&bdesc, 0, sizeof(bdesc)); 193 | bdesc.RenderTarget[0].BlendEnable = FALSE; 194 | bdesc.RenderTarget[0].RenderTargetWriteMask = 0xF; 195 | m_Device->CreateBlendState(&bdesc, &m_BlendState); 196 | } 197 | 198 | 199 | void RenderAPI_D3D11::ReleaseResources() 200 | { 201 | SAFE_RELEASE(m_VB); 202 | SAFE_RELEASE(m_CB); 203 | SAFE_RELEASE(m_VertexShader); 204 | SAFE_RELEASE(m_PixelShader); 205 | SAFE_RELEASE(m_InputLayout); 206 | SAFE_RELEASE(m_RasterState); 207 | SAFE_RELEASE(m_BlendState); 208 | SAFE_RELEASE(m_DepthState); 209 | } 210 | 211 | 212 | void RenderAPI_D3D11::DrawSimpleTriangles(const float worldMatrix[16], int triangleCount, const void* verticesFloat3Byte4) 213 | { 214 | ID3D11DeviceContext* ctx = NULL; 215 | m_Device->GetImmediateContext(&ctx); 216 | 217 | // Set basic render state 218 | ctx->OMSetDepthStencilState(m_DepthState, 0); 219 | ctx->RSSetState(m_RasterState); 220 | ctx->OMSetBlendState(m_BlendState, NULL, 0xFFFFFFFF); 221 | 222 | // Update constant buffer - just the world matrix in our case 223 | ctx->UpdateSubresource(m_CB, 0, NULL, worldMatrix, 64, 0); 224 | 225 | // Set shaders 226 | ctx->VSSetConstantBuffers(0, 1, &m_CB); 227 | ctx->VSSetShader(m_VertexShader, NULL, 0); 228 | ctx->PSSetShader(m_PixelShader, NULL, 0); 229 | 230 | // Update vertex buffer 231 | const int kVertexSize = 12 + 4; 232 | ctx->UpdateSubresource(m_VB, 0, NULL, verticesFloat3Byte4, triangleCount * 3 * kVertexSize, 0); 233 | 234 | // set input assembler data and draw 235 | ctx->IASetInputLayout(m_InputLayout); 236 | ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); 237 | UINT stride = kVertexSize; 238 | UINT offset = 0; 239 | ctx->IASetVertexBuffers(0, 1, &m_VB, &stride, &offset); 240 | ctx->Draw(triangleCount * 3, 0); 241 | 242 | ctx->Release(); 243 | } 244 | 245 | 246 | void* RenderAPI_D3D11::BeginModifyTexture(void* textureHandle, int textureWidth, int textureHeight, int* outRowPitch) 247 | { 248 | const int rowPitch = textureWidth * 4; 249 | // Just allocate a system memory buffer here for simplicity 250 | unsigned char* data = new unsigned char[rowPitch * textureHeight]; 251 | *outRowPitch = rowPitch; 252 | return data; 253 | } 254 | 255 | 256 | void RenderAPI_D3D11::EndModifyTexture(void* textureHandle, int textureWidth, int textureHeight, int rowPitch, void* dataPtr) 257 | { 258 | ID3D11Texture2D* d3dtex = (ID3D11Texture2D*)textureHandle; 259 | assert(d3dtex); 260 | 261 | ID3D11DeviceContext* ctx = NULL; 262 | m_Device->GetImmediateContext(&ctx); 263 | // Update texture data, and free the memory buffer 264 | ctx->UpdateSubresource(d3dtex, 0, NULL, dataPtr, rowPitch, 0); 265 | delete[] (unsigned char*)dataPtr; 266 | ctx->Release(); 267 | } 268 | 269 | 270 | void* RenderAPI_D3D11::BeginModifyVertexBuffer(void* bufferHandle, size_t* outBufferSize) 271 | { 272 | ID3D11Buffer* d3dbuf = (ID3D11Buffer*)bufferHandle; 273 | assert(d3dbuf); 274 | D3D11_BUFFER_DESC desc; 275 | d3dbuf->GetDesc(&desc); 276 | *outBufferSize = desc.ByteWidth; 277 | 278 | ID3D11DeviceContext* ctx = NULL; 279 | m_Device->GetImmediateContext(&ctx); 280 | D3D11_MAPPED_SUBRESOURCE mapped; 281 | ctx->Map(d3dbuf, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped); 282 | ctx->Release(); 283 | 284 | return mapped.pData; 285 | } 286 | 287 | 288 | void RenderAPI_D3D11::EndModifyVertexBuffer(void* bufferHandle) 289 | { 290 | ID3D11Buffer* d3dbuf = (ID3D11Buffer*)bufferHandle; 291 | assert(d3dbuf); 292 | 293 | ID3D11DeviceContext* ctx = NULL; 294 | m_Device->GetImmediateContext(&ctx); 295 | ctx->Unmap(d3dbuf, 0); 296 | ctx->Release(); 297 | } 298 | 299 | #endif // #if SUPPORT_D3D11 300 | -------------------------------------------------------------------------------- /PluginSource/source/RenderAPI_Metal.mm: -------------------------------------------------------------------------------- 1 | 2 | #include "RenderAPI.h" 3 | #include "PlatformBase.h" 4 | 5 | 6 | // Metal implementation of RenderAPI. 7 | 8 | 9 | #if SUPPORT_METAL 10 | 11 | #include "Unity/IUnityGraphicsMetal.h" 12 | #import 13 | 14 | 15 | class RenderAPI_Metal : public RenderAPI 16 | { 17 | public: 18 | RenderAPI_Metal(); 19 | virtual ~RenderAPI_Metal() { } 20 | 21 | virtual void ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces); 22 | 23 | virtual bool GetUsesReverseZ() { return true; } 24 | 25 | virtual void DrawSimpleTriangles(const float worldMatrix[16], int triangleCount, const void* verticesFloat3Byte4); 26 | 27 | virtual void* BeginModifyTexture(void* textureHandle, int textureWidth, int textureHeight, int* outRowPitch); 28 | virtual void EndModifyTexture(void* textureHandle, int textureWidth, int textureHeight, int rowPitch, void* dataPtr); 29 | 30 | virtual void* BeginModifyVertexBuffer(void* bufferHandle, size_t* outBufferSize); 31 | virtual void EndModifyVertexBuffer(void* bufferHandle); 32 | 33 | private: 34 | void CreateResources(); 35 | 36 | private: 37 | IUnityGraphicsMetal* m_MetalGraphics; 38 | id m_VertexBuffer; 39 | id m_ConstantBuffer; 40 | 41 | id m_DepthStencil; 42 | id m_Pipeline; 43 | }; 44 | 45 | 46 | RenderAPI* CreateRenderAPI_Metal() 47 | { 48 | return new RenderAPI_Metal(); 49 | } 50 | 51 | 52 | static Class MTLVertexDescriptorClass; 53 | static Class MTLRenderPipelineDescriptorClass; 54 | static Class MTLDepthStencilDescriptorClass; 55 | const int kVertexSize = 12 + 4; 56 | 57 | // Simple vertex & fragment shader source 58 | static const char kShaderSource[] = 59 | "#include \n" 60 | "using namespace metal;\n" 61 | "struct AppData\n" 62 | "{\n" 63 | " float4x4 worldMatrix;\n" 64 | "};\n" 65 | "struct Vertex\n" 66 | "{\n" 67 | " float3 pos [[attribute(0)]];\n" 68 | " float4 color [[attribute(1)]];\n" 69 | "};\n" 70 | "struct VSOutput\n" 71 | "{\n" 72 | " float4 pos [[position]];\n" 73 | " half4 color;\n" 74 | "};\n" 75 | "struct FSOutput\n" 76 | "{\n" 77 | " half4 frag_data [[color(0)]];\n" 78 | "};\n" 79 | "vertex VSOutput vertexMain(Vertex input [[stage_in]], constant AppData& my_cb [[buffer(0)]])\n" 80 | "{\n" 81 | " VSOutput out = { my_cb.worldMatrix * float4(input.pos.xyz, 1), (half4)input.color };\n" 82 | " return out;\n" 83 | "}\n" 84 | "fragment FSOutput fragmentMain(VSOutput input [[stage_in]])\n" 85 | "{\n" 86 | " FSOutput out = { input.color };\n" 87 | " return out;\n" 88 | "}\n"; 89 | 90 | 91 | 92 | void RenderAPI_Metal::CreateResources() 93 | { 94 | id metalDevice = m_MetalGraphics->MetalDevice(); 95 | NSError* error = nil; 96 | 97 | // Create shaders 98 | NSString* srcStr = [[NSString alloc] initWithBytes:kShaderSource length:sizeof(kShaderSource) encoding:NSASCIIStringEncoding]; 99 | id shaderLibrary = [metalDevice newLibraryWithSource:srcStr options:nil error:&error]; 100 | if(error != nil) 101 | { 102 | NSString* desc = [error localizedDescription]; 103 | NSString* reason = [error localizedFailureReason]; 104 | ::fprintf(stderr, "%s\n%s\n\n", desc ? [desc UTF8String] : "", reason ? [reason UTF8String] : ""); 105 | } 106 | 107 | id vertexFunction = [shaderLibrary newFunctionWithName:@"vertexMain"]; 108 | id fragmentFunction = [shaderLibrary newFunctionWithName:@"fragmentMain"]; 109 | 110 | 111 | // Vertex / Constant buffers 112 | 113 | # if UNITY_OSX 114 | MTLResourceOptions bufferOptions = MTLResourceCPUCacheModeDefaultCache | MTLResourceStorageModeManaged; 115 | # else 116 | MTLResourceOptions bufferOptions = MTLResourceOptionCPUCacheModeDefault; 117 | # endif 118 | 119 | m_VertexBuffer = [metalDevice newBufferWithLength:1024 options:bufferOptions]; 120 | m_VertexBuffer.label = @"PluginVB"; 121 | m_ConstantBuffer = [metalDevice newBufferWithLength:16*sizeof(float) options:bufferOptions]; 122 | m_ConstantBuffer.label = @"PluginCB"; 123 | 124 | // Vertex layout 125 | MTLVertexDescriptor* vertexDesc = [MTLVertexDescriptorClass vertexDescriptor]; 126 | vertexDesc.attributes[0].format = MTLVertexFormatFloat3; 127 | vertexDesc.attributes[0].offset = 0; 128 | vertexDesc.attributes[0].bufferIndex = 1; 129 | vertexDesc.attributes[1].format = MTLVertexFormatUChar4Normalized; 130 | vertexDesc.attributes[1].offset = 3*sizeof(float); 131 | vertexDesc.attributes[1].bufferIndex = 1; 132 | vertexDesc.layouts[1].stride = kVertexSize; 133 | vertexDesc.layouts[1].stepFunction = MTLVertexStepFunctionPerVertex; 134 | vertexDesc.layouts[1].stepRate = 1; 135 | 136 | // Pipeline 137 | 138 | MTLRenderPipelineDescriptor* pipeDesc = [[MTLRenderPipelineDescriptorClass alloc] init]; 139 | // Let's assume we're rendering into BGRA8Unorm... 140 | pipeDesc.colorAttachments[0].pixelFormat= MTLPixelFormatBGRA8Unorm; 141 | 142 | pipeDesc.depthAttachmentPixelFormat = MTLPixelFormatDepth32Float_Stencil8; 143 | pipeDesc.stencilAttachmentPixelFormat = MTLPixelFormatDepth32Float_Stencil8; 144 | 145 | pipeDesc.sampleCount = 1; 146 | pipeDesc.colorAttachments[0].blendingEnabled = NO; 147 | 148 | pipeDesc.vertexFunction = vertexFunction; 149 | pipeDesc.fragmentFunction = fragmentFunction; 150 | pipeDesc.vertexDescriptor = vertexDesc; 151 | 152 | m_Pipeline = [metalDevice newRenderPipelineStateWithDescriptor:pipeDesc error:&error]; 153 | if (error != nil) 154 | { 155 | ::fprintf(stderr, "Metal: Error creating pipeline state: %s\n%s\n", [[error localizedDescription] UTF8String], [[error localizedFailureReason] UTF8String]); 156 | error = nil; 157 | } 158 | 159 | // Depth/Stencil state 160 | MTLDepthStencilDescriptor* depthDesc = [[MTLDepthStencilDescriptorClass alloc] init]; 161 | depthDesc.depthCompareFunction = GetUsesReverseZ() ? MTLCompareFunctionGreaterEqual : MTLCompareFunctionLessEqual; 162 | depthDesc.depthWriteEnabled = false; 163 | m_DepthStencil = [metalDevice newDepthStencilStateWithDescriptor:depthDesc]; 164 | } 165 | 166 | 167 | RenderAPI_Metal::RenderAPI_Metal() 168 | { 169 | } 170 | 171 | 172 | void RenderAPI_Metal::ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces) 173 | { 174 | if (type == kUnityGfxDeviceEventInitialize) 175 | { 176 | m_MetalGraphics = interfaces->Get(); 177 | MTLVertexDescriptorClass = NSClassFromString(@"MTLVertexDescriptor"); 178 | MTLRenderPipelineDescriptorClass = NSClassFromString(@"MTLRenderPipelineDescriptor"); 179 | MTLDepthStencilDescriptorClass = NSClassFromString(@"MTLDepthStencilDescriptor"); 180 | 181 | CreateResources(); 182 | } 183 | else if (type == kUnityGfxDeviceEventShutdown) 184 | { 185 | //@TODO: release resources 186 | } 187 | } 188 | 189 | 190 | void RenderAPI_Metal::DrawSimpleTriangles(const float worldMatrix[16], int triangleCount, const void* verticesFloat3Byte4) 191 | { 192 | // Update vertex and constant buffers 193 | //@TODO: we don't do any synchronization here :) 194 | 195 | const int vbSize = triangleCount * 3 * kVertexSize; 196 | const int cbSize = 16 * sizeof(float); 197 | 198 | ::memcpy(m_VertexBuffer.contents, verticesFloat3Byte4, vbSize); 199 | ::memcpy(m_ConstantBuffer.contents, worldMatrix, cbSize); 200 | 201 | #if UNITY_OSX 202 | [m_VertexBuffer didModifyRange:NSMakeRange(0, vbSize)]; 203 | [m_ConstantBuffer didModifyRange:NSMakeRange(0, cbSize)]; 204 | #endif 205 | 206 | id cmd = (id)m_MetalGraphics->CurrentCommandEncoder(); 207 | 208 | // Setup rendering state 209 | [cmd setRenderPipelineState:m_Pipeline]; 210 | [cmd setDepthStencilState:m_DepthStencil]; 211 | [cmd setCullMode:MTLCullModeNone]; 212 | 213 | // Bind buffers 214 | [cmd setVertexBuffer:m_VertexBuffer offset:0 atIndex:1]; 215 | [cmd setVertexBuffer:m_ConstantBuffer offset:0 atIndex:0]; 216 | 217 | // Draw 218 | [cmd drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:triangleCount*3]; 219 | } 220 | 221 | 222 | void* RenderAPI_Metal::BeginModifyTexture(void* textureHandle, int textureWidth, int textureHeight, int* outRowPitch) 223 | { 224 | const int rowPitch = textureWidth * 4; 225 | // Just allocate a system memory buffer here for simplicity 226 | unsigned char* data = new unsigned char[rowPitch * textureHeight]; 227 | *outRowPitch = rowPitch; 228 | return data; 229 | } 230 | 231 | 232 | void RenderAPI_Metal::EndModifyTexture(void* textureHandle, int textureWidth, int textureHeight, int rowPitch, void* dataPtr) 233 | { 234 | id tex = (__bridge id)textureHandle; 235 | // Update texture data, and free the memory buffer 236 | [tex replaceRegion:MTLRegionMake3D(0,0,0, textureWidth,textureHeight,1) mipmapLevel:0 withBytes:dataPtr bytesPerRow:rowPitch]; 237 | delete[](unsigned char*)dataPtr; 238 | } 239 | 240 | 241 | void* RenderAPI_Metal::BeginModifyVertexBuffer(void* bufferHandle, size_t* outBufferSize) 242 | { 243 | id buf = (__bridge id)bufferHandle; 244 | *outBufferSize = [buf length]; 245 | return [buf contents]; 246 | } 247 | 248 | 249 | void RenderAPI_Metal::EndModifyVertexBuffer(void* bufferHandle) 250 | { 251 | # if UNITY_OSX 252 | id buf = (__bridge id)bufferHandle; 253 | [buf didModifyRange:NSMakeRange(0, buf.length)]; 254 | # endif // if UNITY_OSX 255 | } 256 | 257 | 258 | #endif // #if SUPPORT_METAL 259 | -------------------------------------------------------------------------------- /PluginSource/source/RenderAPI_OpenGLCoreES.cpp: -------------------------------------------------------------------------------- 1 | #include "RenderAPI.h" 2 | #include "PlatformBase.h" 3 | 4 | // OpenGL Core profile (desktop) or OpenGL ES (mobile) implementation of RenderAPI. 5 | // Supports several flavors: Core, ES2, ES3 6 | 7 | 8 | #if SUPPORT_OPENGL_UNIFIED 9 | 10 | 11 | #include 12 | #if UNITY_IOS || UNITY_TVOS 13 | # include 14 | #elif UNITY_ANDROID || UNITY_WEBGL 15 | # include 16 | #elif UNITY_OSX 17 | # include 18 | #elif UNITY_WIN 19 | // On Windows, use gl3w to initialize and load OpenGL Core functions. In principle any other 20 | // library (like GLEW, GLFW etc.) can be used; here we use gl3w since it's simple and 21 | // straightforward. 22 | # include "gl3w/gl3w.h" 23 | #elif UNITY_LINUX 24 | # define GL_GLEXT_PROTOTYPES 25 | # include 26 | #elif UNITY_EMBEDDED_LINUX 27 | # include 28 | #if SUPPORT_OPENGL_CORE 29 | # define GL_GLEXT_PROTOTYPES 30 | # include 31 | #endif 32 | #elif UNITY_QNX 33 | # include 34 | #else 35 | # error Unknown platform 36 | #endif 37 | 38 | 39 | class RenderAPI_OpenGLCoreES : public RenderAPI 40 | { 41 | public: 42 | RenderAPI_OpenGLCoreES(UnityGfxRenderer apiType); 43 | virtual ~RenderAPI_OpenGLCoreES() { } 44 | 45 | virtual void ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces); 46 | 47 | virtual bool GetUsesReverseZ() { return false; } 48 | 49 | virtual void DrawSimpleTriangles(const float worldMatrix[16], int triangleCount, const void* verticesFloat3Byte4); 50 | 51 | virtual void* BeginModifyTexture(void* textureHandle, int textureWidth, int textureHeight, int* outRowPitch); 52 | virtual void EndModifyTexture(void* textureHandle, int textureWidth, int textureHeight, int rowPitch, void* dataPtr); 53 | 54 | virtual void* BeginModifyVertexBuffer(void* bufferHandle, size_t* outBufferSize); 55 | virtual void EndModifyVertexBuffer(void* bufferHandle); 56 | 57 | private: 58 | void CreateResources(); 59 | 60 | private: 61 | UnityGfxRenderer m_APIType; 62 | GLuint m_VertexShader; 63 | GLuint m_FragmentShader; 64 | GLuint m_Program; 65 | GLuint m_VertexArray; 66 | GLuint m_VertexBuffer; 67 | int m_UniformWorldMatrix; 68 | int m_UniformProjMatrix; 69 | }; 70 | 71 | 72 | RenderAPI* CreateRenderAPI_OpenGLCoreES(UnityGfxRenderer apiType) 73 | { 74 | return new RenderAPI_OpenGLCoreES(apiType); 75 | } 76 | 77 | 78 | enum VertexInputs 79 | { 80 | kVertexInputPosition = 0, 81 | kVertexInputColor = 1 82 | }; 83 | 84 | 85 | // Simple vertex shader source 86 | #define VERTEX_SHADER_SRC(ver, attr, varying) \ 87 | ver \ 88 | attr " highp vec3 pos;\n" \ 89 | attr " lowp vec4 color;\n" \ 90 | "\n" \ 91 | varying " lowp vec4 ocolor;\n" \ 92 | "\n" \ 93 | "uniform highp mat4 worldMatrix;\n" \ 94 | "uniform highp mat4 projMatrix;\n" \ 95 | "\n" \ 96 | "void main()\n" \ 97 | "{\n" \ 98 | " gl_Position = (projMatrix * worldMatrix) * vec4(pos,1);\n" \ 99 | " ocolor = color;\n" \ 100 | "}\n" \ 101 | 102 | static const char* kGlesVProgTextGLES2 = VERTEX_SHADER_SRC("\n", "attribute", "varying"); 103 | static const char* kGlesVProgTextGLES3 = VERTEX_SHADER_SRC("#version 300 es\n", "in", "out"); 104 | #if SUPPORT_OPENGL_CORE 105 | static const char* kGlesVProgTextGLCore = VERTEX_SHADER_SRC("#version 150\n", "in", "out"); 106 | #endif 107 | 108 | #undef VERTEX_SHADER_SRC 109 | 110 | 111 | // Simple fragment shader source 112 | #define FRAGMENT_SHADER_SRC(ver, varying, outDecl, outVar) \ 113 | ver \ 114 | outDecl \ 115 | varying " lowp vec4 ocolor;\n" \ 116 | "\n" \ 117 | "void main()\n" \ 118 | "{\n" \ 119 | " " outVar " = ocolor;\n" \ 120 | "}\n" \ 121 | 122 | static const char* kGlesFShaderTextGLES2 = FRAGMENT_SHADER_SRC("\n", "varying", "\n", "gl_FragColor"); 123 | static const char* kGlesFShaderTextGLES3 = FRAGMENT_SHADER_SRC("#version 300 es\n", "in", "out lowp vec4 fragColor;\n", "fragColor"); 124 | #if SUPPORT_OPENGL_CORE 125 | static const char* kGlesFShaderTextGLCore = FRAGMENT_SHADER_SRC("#version 150\n", "in", "out lowp vec4 fragColor;\n", "fragColor"); 126 | #endif 127 | 128 | #undef FRAGMENT_SHADER_SRC 129 | 130 | 131 | static GLuint CreateShader(GLenum type, const char* sourceText) 132 | { 133 | GLuint ret = glCreateShader(type); 134 | glShaderSource(ret, 1, &sourceText, NULL); 135 | glCompileShader(ret); 136 | return ret; 137 | } 138 | 139 | 140 | void RenderAPI_OpenGLCoreES::CreateResources() 141 | { 142 | # if UNITY_WIN && SUPPORT_OPENGL_CORE 143 | if (m_APIType == kUnityGfxRendererOpenGLCore) 144 | gl3wInit(); 145 | # endif 146 | // Make sure that there are no GL error flags set before creating resources 147 | while (glGetError() != GL_NO_ERROR) {} 148 | 149 | // Create shaders 150 | if (m_APIType == kUnityGfxRendererOpenGLES30) 151 | { 152 | m_VertexShader = CreateShader(GL_VERTEX_SHADER, kGlesVProgTextGLES2); 153 | m_FragmentShader = CreateShader(GL_FRAGMENT_SHADER, kGlesFShaderTextGLES2); 154 | } 155 | else if (m_APIType == kUnityGfxRendererOpenGLES30) 156 | { 157 | m_VertexShader = CreateShader(GL_VERTEX_SHADER, kGlesVProgTextGLES3); 158 | m_FragmentShader = CreateShader(GL_FRAGMENT_SHADER, kGlesFShaderTextGLES3); 159 | } 160 | # if SUPPORT_OPENGL_CORE 161 | else if (m_APIType == kUnityGfxRendererOpenGLCore) 162 | { 163 | m_VertexShader = CreateShader(GL_VERTEX_SHADER, kGlesVProgTextGLCore); 164 | m_FragmentShader = CreateShader(GL_FRAGMENT_SHADER, kGlesFShaderTextGLCore); 165 | } 166 | # endif // if SUPPORT_OPENGL_CORE 167 | 168 | 169 | // Link shaders into a program and find uniform locations 170 | m_Program = glCreateProgram(); 171 | glBindAttribLocation(m_Program, kVertexInputPosition, "pos"); 172 | glBindAttribLocation(m_Program, kVertexInputColor, "color"); 173 | glAttachShader(m_Program, m_VertexShader); 174 | glAttachShader(m_Program, m_FragmentShader); 175 | # if SUPPORT_OPENGL_CORE 176 | if (m_APIType == kUnityGfxRendererOpenGLCore) 177 | glBindFragDataLocation(m_Program, 0, "fragColor"); 178 | # endif // if SUPPORT_OPENGL_CORE 179 | glLinkProgram(m_Program); 180 | 181 | GLint status = 0; 182 | glGetProgramiv(m_Program, GL_LINK_STATUS, &status); 183 | assert(status == GL_TRUE); 184 | 185 | m_UniformWorldMatrix = glGetUniformLocation(m_Program, "worldMatrix"); 186 | m_UniformProjMatrix = glGetUniformLocation(m_Program, "projMatrix"); 187 | 188 | // Create vertex buffer 189 | glGenBuffers(1, &m_VertexBuffer); 190 | glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer); 191 | glBufferData(GL_ARRAY_BUFFER, 1024, NULL, GL_STREAM_DRAW); 192 | 193 | assert(glGetError() == GL_NO_ERROR); 194 | } 195 | 196 | 197 | RenderAPI_OpenGLCoreES::RenderAPI_OpenGLCoreES(UnityGfxRenderer apiType) 198 | : m_APIType(apiType) 199 | { 200 | } 201 | 202 | 203 | void RenderAPI_OpenGLCoreES::ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces) 204 | { 205 | if (type == kUnityGfxDeviceEventInitialize) 206 | { 207 | CreateResources(); 208 | } 209 | else if (type == kUnityGfxDeviceEventShutdown) 210 | { 211 | //@TODO: release resources 212 | } 213 | } 214 | 215 | 216 | void RenderAPI_OpenGLCoreES::DrawSimpleTriangles(const float worldMatrix[16], int triangleCount, const void* verticesFloat3Byte4) 217 | { 218 | // Set basic render state 219 | glDisable(GL_CULL_FACE); 220 | glDisable(GL_BLEND); 221 | glDepthFunc(GL_LEQUAL); 222 | glEnable(GL_DEPTH_TEST); 223 | glDepthMask(GL_FALSE); 224 | 225 | // Tweak the projection matrix a bit to make it match what identity projection would do in D3D case. 226 | float projectionMatrix[16] = { 227 | 1,0,0,0, 228 | 0,1,0,0, 229 | 0,0,2,0, 230 | 0,0,-1,1, 231 | }; 232 | 233 | // Setup shader program to use, and the matrices 234 | glUseProgram(m_Program); 235 | glUniformMatrix4fv(m_UniformWorldMatrix, 1, GL_FALSE, worldMatrix); 236 | glUniformMatrix4fv(m_UniformProjMatrix, 1, GL_FALSE, projectionMatrix); 237 | 238 | // Core profile needs VAOs, setup one 239 | # if SUPPORT_OPENGL_CORE 240 | if (m_APIType == kUnityGfxRendererOpenGLCore) 241 | { 242 | glGenVertexArrays(1, &m_VertexArray); 243 | glBindVertexArray(m_VertexArray); 244 | } 245 | # endif // if SUPPORT_OPENGL_CORE 246 | 247 | // Bind a vertex buffer, and update data in it 248 | const int kVertexSize = 12 + 4; 249 | glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); 250 | glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer); 251 | glBufferSubData(GL_ARRAY_BUFFER, 0, kVertexSize * triangleCount * 3, verticesFloat3Byte4); 252 | 253 | // Setup vertex layout 254 | glEnableVertexAttribArray(kVertexInputPosition); 255 | glVertexAttribPointer(kVertexInputPosition, 3, GL_FLOAT, GL_FALSE, kVertexSize, (char*)NULL + 0); 256 | glEnableVertexAttribArray(kVertexInputColor); 257 | glVertexAttribPointer(kVertexInputColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, kVertexSize, (char*)NULL + 12); 258 | 259 | // Draw 260 | glDrawArrays(GL_TRIANGLES, 0, triangleCount * 3); 261 | 262 | // Cleanup VAO 263 | # if SUPPORT_OPENGL_CORE 264 | if (m_APIType == kUnityGfxRendererOpenGLCore) 265 | { 266 | glDeleteVertexArrays(1, &m_VertexArray); 267 | } 268 | # endif 269 | } 270 | 271 | 272 | void* RenderAPI_OpenGLCoreES::BeginModifyTexture(void* textureHandle, int textureWidth, int textureHeight, int* outRowPitch) 273 | { 274 | const int rowPitch = textureWidth * 4; 275 | // Just allocate a system memory buffer here for simplicity 276 | unsigned char* data = new unsigned char[rowPitch * textureHeight]; 277 | *outRowPitch = rowPitch; 278 | return data; 279 | } 280 | 281 | 282 | void RenderAPI_OpenGLCoreES::EndModifyTexture(void* textureHandle, int textureWidth, int textureHeight, int rowPitch, void* dataPtr) 283 | { 284 | GLuint gltex = (GLuint)(size_t)(textureHandle); 285 | // Update texture data, and free the memory buffer 286 | glBindTexture(GL_TEXTURE_2D, gltex); 287 | glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, GL_RGBA, GL_UNSIGNED_BYTE, dataPtr); 288 | delete[](unsigned char*)dataPtr; 289 | } 290 | 291 | void* RenderAPI_OpenGLCoreES::BeginModifyVertexBuffer(void* bufferHandle, size_t* outBufferSize) 292 | { 293 | # if SUPPORT_OPENGL_ES 294 | return 0; 295 | # else 296 | glBindBuffer(GL_ARRAY_BUFFER, (GLuint)(size_t)bufferHandle); 297 | GLint size = 0; 298 | glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size); 299 | *outBufferSize = size; 300 | void* mapped = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); 301 | return mapped; 302 | # endif 303 | } 304 | 305 | 306 | void RenderAPI_OpenGLCoreES::EndModifyVertexBuffer(void* bufferHandle) 307 | { 308 | # if !SUPPORT_OPENGL_ES 309 | glBindBuffer(GL_ARRAY_BUFFER, (GLuint)(size_t)bufferHandle); 310 | glUnmapBuffer(GL_ARRAY_BUFFER); 311 | # endif 312 | } 313 | 314 | #endif // #if SUPPORT_OPENGL_UNIFIED 315 | -------------------------------------------------------------------------------- /PluginSource/source/RenderingPlugin.cpp: -------------------------------------------------------------------------------- 1 | // Example low level rendering Unity plugin 2 | 3 | #include "PlatformBase.h" 4 | #include "RenderAPI.h" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | // -------------------------------------------------------------------------- 12 | // SetTimeFromUnity, an example function we export which is called by one of the scripts. 13 | 14 | static float g_Time; 15 | 16 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API SetTimeFromUnity (float t) { g_Time = t; } 17 | 18 | 19 | 20 | // -------------------------------------------------------------------------- 21 | // SetTextureFromUnity, an example function we export which is called by one of the scripts. 22 | 23 | static void* g_TextureHandle = NULL; 24 | static int g_TextureWidth = 0; 25 | static int g_TextureHeight = 0; 26 | 27 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API SetTextureFromUnity(void* textureHandle, int w, int h) 28 | { 29 | // A script calls this at initialization time; just remember the texture pointer here. 30 | // Will update texture pixels each frame from the plugin rendering event (texture update 31 | // needs to happen on the rendering thread). 32 | g_TextureHandle = textureHandle; 33 | g_TextureWidth = w; 34 | g_TextureHeight = h; 35 | } 36 | 37 | 38 | // -------------------------------------------------------------------------- 39 | // SetMeshBuffersFromUnity, an example function we export which is called by one of the scripts. 40 | 41 | static void* g_VertexBufferHandle = NULL; 42 | static int g_VertexBufferVertexCount; 43 | 44 | struct MeshVertex 45 | { 46 | float pos[3]; 47 | float normal[3]; 48 | float color[4]; 49 | float uv[2]; 50 | }; 51 | static std::vector g_VertexSource; 52 | 53 | 54 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API SetMeshBuffersFromUnity(void* vertexBufferHandle, int vertexCount, float* sourceVertices, float* sourceNormals, float* sourceUV) 55 | { 56 | // A script calls this at initialization time; just remember the pointer here. 57 | // Will update buffer data each frame from the plugin rendering event (buffer update 58 | // needs to happen on the rendering thread). 59 | g_VertexBufferHandle = vertexBufferHandle; 60 | g_VertexBufferVertexCount = vertexCount; 61 | 62 | // The script also passes original source mesh data. The reason is that the vertex buffer we'll be modifying 63 | // will be marked as "dynamic", and on many platforms this means we can only write into it, but not read its previous 64 | // contents. In this example we're not creating meshes from scratch, but are just altering original mesh data -- 65 | // so remember it. The script just passes pointers to regular C# array contents. 66 | g_VertexSource.resize(vertexCount); 67 | for (int i = 0; i < vertexCount; ++i) 68 | { 69 | MeshVertex& v = g_VertexSource[i]; 70 | v.pos[0] = sourceVertices[0]; 71 | v.pos[1] = sourceVertices[1]; 72 | v.pos[2] = sourceVertices[2]; 73 | v.normal[0] = sourceNormals[0]; 74 | v.normal[1] = sourceNormals[1]; 75 | v.normal[2] = sourceNormals[2]; 76 | v.uv[0] = sourceUV[0]; 77 | v.uv[1] = sourceUV[1]; 78 | sourceVertices += 3; 79 | sourceNormals += 3; 80 | sourceUV += 2; 81 | } 82 | } 83 | 84 | 85 | // -------------------------------------------------------------------------- 86 | // UnitySetInterfaces 87 | 88 | static void UNITY_INTERFACE_API OnGraphicsDeviceEvent(UnityGfxDeviceEventType eventType); 89 | 90 | static IUnityInterfaces* s_UnityInterfaces = NULL; 91 | static IUnityGraphics* s_Graphics = NULL; 92 | 93 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces) 94 | { 95 | s_UnityInterfaces = unityInterfaces; 96 | s_Graphics = s_UnityInterfaces->Get(); 97 | s_Graphics->RegisterDeviceEventCallback(OnGraphicsDeviceEvent); 98 | 99 | #if SUPPORT_VULKAN 100 | if (s_Graphics->GetRenderer() == kUnityGfxRendererNull) 101 | { 102 | extern void RenderAPI_Vulkan_OnPluginLoad(IUnityInterfaces*); 103 | RenderAPI_Vulkan_OnPluginLoad(unityInterfaces); 104 | } 105 | #endif // SUPPORT_VULKAN 106 | 107 | // Run OnGraphicsDeviceEvent(initialize) manually on plugin load 108 | OnGraphicsDeviceEvent(kUnityGfxDeviceEventInitialize); 109 | } 110 | 111 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload() 112 | { 113 | s_Graphics->UnregisterDeviceEventCallback(OnGraphicsDeviceEvent); 114 | } 115 | 116 | #if UNITY_WEBGL 117 | typedef void (UNITY_INTERFACE_API * PluginLoadFunc)(IUnityInterfaces* unityInterfaces); 118 | typedef void (UNITY_INTERFACE_API * PluginUnloadFunc)(); 119 | 120 | extern "C" void UnityRegisterRenderingPlugin(PluginLoadFunc loadPlugin, PluginUnloadFunc unloadPlugin); 121 | 122 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API RegisterPlugin() 123 | { 124 | UnityRegisterRenderingPlugin(UnityPluginLoad, UnityPluginUnload); 125 | } 126 | #endif 127 | 128 | // -------------------------------------------------------------------------- 129 | // GraphicsDeviceEvent 130 | 131 | 132 | static RenderAPI* s_CurrentAPI = NULL; 133 | static UnityGfxRenderer s_DeviceType = kUnityGfxRendererNull; 134 | 135 | 136 | static void UNITY_INTERFACE_API OnGraphicsDeviceEvent(UnityGfxDeviceEventType eventType) 137 | { 138 | // Create graphics API implementation upon initialization 139 | if (eventType == kUnityGfxDeviceEventInitialize) 140 | { 141 | assert(s_CurrentAPI == NULL); 142 | s_DeviceType = s_Graphics->GetRenderer(); 143 | s_CurrentAPI = CreateRenderAPI(s_DeviceType); 144 | } 145 | 146 | // Let the implementation process the device related events 147 | if (s_CurrentAPI) 148 | { 149 | s_CurrentAPI->ProcessDeviceEvent(eventType, s_UnityInterfaces); 150 | } 151 | 152 | // Cleanup graphics API implementation upon shutdown 153 | if (eventType == kUnityGfxDeviceEventShutdown) 154 | { 155 | delete s_CurrentAPI; 156 | s_CurrentAPI = NULL; 157 | s_DeviceType = kUnityGfxRendererNull; 158 | } 159 | } 160 | 161 | 162 | 163 | // -------------------------------------------------------------------------- 164 | // OnRenderEvent 165 | // This will be called for GL.IssuePluginEvent script calls; eventID will 166 | // be the integer passed to IssuePluginEvent. In this example, we just ignore 167 | // that value. 168 | 169 | 170 | static void DrawColoredTriangle() 171 | { 172 | // Draw a colored triangle. Note that colors will come out differently 173 | // in D3D and OpenGL, for example, since they expect color bytes 174 | // in different ordering. 175 | struct MyVertex 176 | { 177 | float x, y, z; 178 | unsigned int color; 179 | }; 180 | MyVertex verts[3] = 181 | { 182 | { -0.5f, -0.25f, 0, 0xFFff0000 }, 183 | { 0.5f, -0.25f, 0, 0xFF00ff00 }, 184 | { 0, 0.5f , 0, 0xFF0000ff }, 185 | }; 186 | 187 | // Transformation matrix: rotate around Z axis based on time. 188 | float phi = g_Time; // time set externally from Unity script 189 | float cosPhi = cosf(phi); 190 | float sinPhi = sinf(phi); 191 | float depth = 0.7f; 192 | float finalDepth = s_CurrentAPI->GetUsesReverseZ() ? 1.0f - depth : depth; 193 | float worldMatrix[16] = { 194 | cosPhi,-sinPhi,0,0, 195 | sinPhi,cosPhi,0,0, 196 | 0,0,1,0, 197 | 0,0,finalDepth,1, 198 | }; 199 | 200 | s_CurrentAPI->DrawSimpleTriangles(worldMatrix, 1, verts); 201 | } 202 | 203 | 204 | static void ModifyTexturePixels() 205 | { 206 | void* textureHandle = g_TextureHandle; 207 | int width = g_TextureWidth; 208 | int height = g_TextureHeight; 209 | if (!textureHandle) 210 | return; 211 | 212 | int textureRowPitch; 213 | void* textureDataPtr = s_CurrentAPI->BeginModifyTexture(textureHandle, width, height, &textureRowPitch); 214 | if (!textureDataPtr) 215 | return; 216 | 217 | const float t = g_Time * 4.0f; 218 | 219 | unsigned char* dst = (unsigned char*)textureDataPtr; 220 | for (int y = 0; y < height; ++y) 221 | { 222 | unsigned char* ptr = dst; 223 | for (int x = 0; x < width; ++x) 224 | { 225 | // Simple "plasma effect": several combined sine waves 226 | int vv = int( 227 | (127.0f + (127.0f * sinf(x / 7.0f + t))) + 228 | (127.0f + (127.0f * sinf(y / 5.0f - t))) + 229 | (127.0f + (127.0f * sinf((x + y) / 6.0f - t))) + 230 | (127.0f + (127.0f * sinf(sqrtf(float(x*x + y*y)) / 4.0f - t))) 231 | ) / 4; 232 | 233 | // Write the texture pixel 234 | ptr[0] = vv; 235 | ptr[1] = vv; 236 | ptr[2] = vv; 237 | ptr[3] = vv; 238 | 239 | // To next pixel (our pixels are 4 bpp) 240 | ptr += 4; 241 | } 242 | 243 | // To next image row 244 | dst += textureRowPitch; 245 | } 246 | 247 | s_CurrentAPI->EndModifyTexture(textureHandle, width, height, textureRowPitch, textureDataPtr); 248 | } 249 | 250 | 251 | static void ModifyVertexBuffer() 252 | { 253 | void* bufferHandle = g_VertexBufferHandle; 254 | int vertexCount = g_VertexBufferVertexCount; 255 | if (!bufferHandle) 256 | return; 257 | 258 | size_t bufferSize; 259 | void* bufferDataPtr = s_CurrentAPI->BeginModifyVertexBuffer(bufferHandle, &bufferSize); 260 | if (!bufferDataPtr) 261 | return; 262 | int vertexStride = int(bufferSize / vertexCount); 263 | 264 | // Unity should return us a buffer that is the size of `vertexCount * sizeof(MeshVertex)` 265 | // If that's not the case then we should quit to avoid unexpected results. 266 | // This can happen if https://docs.unity3d.com/ScriptReference/Mesh.GetNativeVertexBufferPtr.html returns 267 | // a pointer to a buffer with an unexpected layout. 268 | if (static_cast(vertexStride) != sizeof(MeshVertex)) 269 | return; 270 | 271 | const float t = g_Time * 3.0f; 272 | 273 | char* bufferPtr = (char*)bufferDataPtr; 274 | // modify vertex Y position with several scrolling sine waves, 275 | // copy the rest of the source data unmodified 276 | for (int i = 0; i < vertexCount; ++i) 277 | { 278 | const MeshVertex& src = g_VertexSource[i]; 279 | MeshVertex& dst = *(MeshVertex*)bufferPtr; 280 | dst.pos[0] = src.pos[0]; 281 | dst.pos[1] = src.pos[1] + sinf(src.pos[0] * 1.1f + t) * 0.4f + sinf(src.pos[2] * 0.9f - t) * 0.3f; 282 | dst.pos[2] = src.pos[2]; 283 | dst.normal[0] = src.normal[0]; 284 | dst.normal[1] = src.normal[1]; 285 | dst.normal[2] = src.normal[2]; 286 | dst.uv[0] = src.uv[0]; 287 | dst.uv[1] = src.uv[1]; 288 | bufferPtr += vertexStride; 289 | } 290 | 291 | s_CurrentAPI->EndModifyVertexBuffer(bufferHandle); 292 | } 293 | 294 | static void drawToPluginTexture() 295 | { 296 | s_CurrentAPI->drawToPluginTexture(); 297 | } 298 | 299 | static void drawToRenderTexture() 300 | { 301 | s_CurrentAPI->drawToRenderTexture(); 302 | } 303 | 304 | static void UNITY_INTERFACE_API OnRenderEvent(int eventID) 305 | { 306 | // Unknown / unsupported graphics device type? Do nothing 307 | if (s_CurrentAPI == NULL) 308 | return; 309 | 310 | if (eventID == 1) 311 | { 312 | drawToRenderTexture(); 313 | DrawColoredTriangle(); 314 | ModifyTexturePixels(); 315 | ModifyVertexBuffer(); 316 | } 317 | 318 | if (eventID == 2) 319 | { 320 | drawToPluginTexture(); 321 | } 322 | 323 | } 324 | 325 | // -------------------------------------------------------------------------- 326 | // GetRenderEventFunc, an example function we export which is used to get a rendering event callback function. 327 | 328 | extern "C" UnityRenderingEvent UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API GetRenderEventFunc() 329 | { 330 | return OnRenderEvent; 331 | } 332 | 333 | // -------------------------------------------------------------------------- 334 | // DX12 plugin specific 335 | // -------------------------------------------------------------------------- 336 | 337 | extern "C" UNITY_INTERFACE_EXPORT void* UNITY_INTERFACE_API GetRenderTexture() 338 | { 339 | return s_CurrentAPI->getRenderTexture(); 340 | } 341 | 342 | extern "C" UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API SetRenderTexture(UnityRenderBuffer rb) 343 | { 344 | s_CurrentAPI->setRenderTextureResource(rb); 345 | } 346 | 347 | extern "C" UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API IsSwapChainAvailable() 348 | { 349 | return s_CurrentAPI->isSwapChainAvailable(); 350 | } 351 | 352 | extern "C" UNITY_INTERFACE_EXPORT unsigned int UNITY_INTERFACE_API GetPresentFlags() 353 | { 354 | return s_CurrentAPI->getPresentFlags(); 355 | } 356 | 357 | extern "C" UNITY_INTERFACE_EXPORT unsigned int UNITY_INTERFACE_API GetSyncInterval() 358 | { 359 | return s_CurrentAPI->getSyncInterval(); 360 | } 361 | 362 | extern "C" UNITY_INTERFACE_EXPORT unsigned int UNITY_INTERFACE_API GetBackBufferWidth() 363 | { 364 | return s_CurrentAPI->getBackbufferHeight(); 365 | } 366 | 367 | extern "C" UNITY_INTERFACE_EXPORT unsigned int UNITY_INTERFACE_API GetBackBufferHeight() 368 | { 369 | return s_CurrentAPI->getBackbufferWidth(); 370 | } 371 | -------------------------------------------------------------------------------- /PluginSource/source/RenderingPlugin.def: -------------------------------------------------------------------------------- 1 | ; file used by Visual Studio plugin builds, mostly for 32-bit 2 | ; to stop mangling our exported function names 3 | 4 | LIBRARY 5 | 6 | EXPORTS 7 | UnityPluginLoad 8 | UnityPluginUnload 9 | SetTimeFromUnity 10 | SetTextureFromUnity 11 | SetMeshBuffersFromUnity 12 | GetRenderEventFunc 13 | -------------------------------------------------------------------------------- /PluginSource/source/Unity/IUnityGraphics.h: -------------------------------------------------------------------------------- 1 | // Unity Native Plugin API copyright © 2015 Unity Technologies ApS 2 | // 3 | // Licensed under the Unity Companion License for Unity - dependent projects--see[Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License). 4 | // 5 | // Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.Please review the license for details on these and other terms and conditions. 6 | 7 | #pragma once 8 | #include "IUnityInterface.h" 9 | 10 | // Has to match the GfxDeviceRenderer enum 11 | typedef enum UnityGfxRenderer 12 | { 13 | //kUnityGfxRendererOpenGL = 0, // Legacy OpenGL, removed 14 | //kUnityGfxRendererD3D9 = 1, // Direct3D 9, removed 15 | kUnityGfxRendererD3D11 = 2, // Direct3D 11 16 | kUnityGfxRendererNull = 4, // "null" device (used in batch mode) 17 | //kUnityGfxRendererOpenGLES20 = 8, // OpenGL ES 2.0, removed 18 | kUnityGfxRendererOpenGLES30 = 11, // OpenGL ES 3.0 19 | //kUnityGfxRendererGXM = 12, // PlayStation Vita, removed 20 | kUnityGfxRendererPS4 = 13, // PlayStation 4 21 | kUnityGfxRendererXboxOne = 14, // Xbox One 22 | kUnityGfxRendererMetal = 16, // iOS Metal 23 | kUnityGfxRendererOpenGLCore = 17, // OpenGL core 24 | kUnityGfxRendererD3D12 = 18, // Direct3D 12 25 | kUnityGfxRendererVulkan = 21, // Vulkan 26 | kUnityGfxRendererNvn = 22, // Nintendo Switch NVN API 27 | kUnityGfxRendererXboxOneD3D12 = 23, // MS XboxOne Direct3D 12 28 | kUnityGfxRendererGameCoreXboxOne = 24, // GameCore Xbox One 29 | kUnityGfxRendererGameCoreXboxSeries = 25, // GameCore XboxSeries 30 | kUnityGfxRendererPS5 = 26, // PS5 31 | kUnityGfxRendererPS5NGGC = 27 // PS5 NGGC 32 | } UnityGfxRenderer; 33 | 34 | typedef enum UnityGfxDeviceEventType 35 | { 36 | kUnityGfxDeviceEventInitialize = 0, 37 | kUnityGfxDeviceEventShutdown = 1, 38 | kUnityGfxDeviceEventBeforeReset = 2, 39 | kUnityGfxDeviceEventAfterReset = 3, 40 | } UnityGfxDeviceEventType; 41 | 42 | typedef void (UNITY_INTERFACE_API * IUnityGraphicsDeviceEventCallback)(UnityGfxDeviceEventType eventType); 43 | 44 | // Should only be used on the rendering thread unless noted otherwise. 45 | UNITY_DECLARE_INTERFACE(IUnityGraphics) 46 | { 47 | UnityGfxRenderer(UNITY_INTERFACE_API * GetRenderer)(); // Thread safe 48 | 49 | // This callback will be called when graphics device is created, destroyed, reset, etc. 50 | // It is possible to miss the kUnityGfxDeviceEventInitialize event in case plugin is loaded at a later time, 51 | // when the graphics device is already created. 52 | void(UNITY_INTERFACE_API * RegisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 53 | void(UNITY_INTERFACE_API * UnregisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); 54 | int(UNITY_INTERFACE_API * ReserveEventIDRange)(int count); // reserves 'count' event IDs. Plugins should use the result as a base index when issuing events back and forth to avoid event id clashes. 55 | }; 56 | UNITY_REGISTER_INTERFACE_GUID(0x7CBA0A9CA4DDB544ULL, 0x8C5AD4926EB17B11ULL, IUnityGraphics) 57 | 58 | 59 | // Certain Unity APIs (GL.IssuePluginEvent, CommandBuffer.IssuePluginEvent) can callback into native plugins. 60 | // Provide them with an address to a function of this signature. 61 | typedef void (UNITY_INTERFACE_API * UnityRenderingEvent)(int eventId); 62 | typedef void (UNITY_INTERFACE_API * UnityRenderingEventAndData)(int eventId, void* data); 63 | -------------------------------------------------------------------------------- /PluginSource/source/Unity/IUnityGraphicsD3D11.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | 5 | // Should only be used on the rendering thread unless noted otherwise. 6 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D11) 7 | { 8 | ID3D11Device* (UNITY_INTERFACE_API * GetDevice)(); 9 | 10 | ID3D11Resource* (UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer buffer); 11 | ID3D11Resource* (UNITY_INTERFACE_API * TextureFromNativeTexture)(UnityTextureID texture); 12 | 13 | ID3D11RenderTargetView* (UNITY_INTERFACE_API * RTVFromRenderBuffer)(UnityRenderBuffer surface); 14 | ID3D11ShaderResourceView* (UNITY_INTERFACE_API * SRVFromNativeTexture)(UnityTextureID texture); 15 | }; 16 | 17 | UNITY_REGISTER_INTERFACE_GUID(0xAAB37EF87A87D748ULL, 0xBF76967F07EFB177ULL, IUnityGraphicsD3D11) 18 | -------------------------------------------------------------------------------- /PluginSource/source/Unity/IUnityGraphicsD3D12.h: -------------------------------------------------------------------------------- 1 | // Unity Native Plugin API copyright © 2015 Unity Technologies ApS 2 | // 3 | // Licensed under the Unity Companion License for Unity - dependent projects--see[Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License). 4 | // 5 | // Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.Please review the license for details on these and other terms and conditions. 6 | 7 | #pragma once 8 | #include "IUnityInterface.h" 9 | #ifndef __cplusplus 10 | #include 11 | #endif 12 | 13 | struct RenderSurfaceBase; 14 | typedef struct RenderSurfaceBase* UnityRenderBuffer; 15 | 16 | typedef struct UnityGraphicsD3D12ResourceState UnityGraphicsD3D12ResourceState; 17 | struct UnityGraphicsD3D12ResourceState 18 | { 19 | ID3D12Resource* resource; // Resource to barrier. 20 | D3D12_RESOURCE_STATES expected; // Expected resource state before this command list is executed. 21 | D3D12_RESOURCE_STATES current; // State this resource will be in after this command list is executed. 22 | }; 23 | 24 | struct UnityGraphicsD3D12RecordingState 25 | { 26 | ID3D12GraphicsCommandList* commandList; // D3D12 command list that is currently recorded by Unity 27 | }; 28 | 29 | enum UnityD3D12GraphicsQueueAccess 30 | { 31 | // No queue acccess, no work must be submitted to UnityD3D12Instance::graphicsQueue from the plugin event callback 32 | kUnityD3D12GraphicsQueueAccess_DontCare, 33 | 34 | // Make sure that Unity worker threads don't access the D3D12 graphics queue 35 | // This disables access to the current Unity command buffer 36 | kUnityD3D12GraphicsQueueAccess_Allow, 37 | }; 38 | 39 | enum UnityD3D12EventConfigFlagBits 40 | { 41 | kUnityD3D12EventConfigFlag_EnsurePreviousFrameSubmission = (1 << 0), // default: (NOT SUPPORTED) 42 | kUnityD3D12EventConfigFlag_FlushCommandBuffers = (1 << 1), // submit existing command buffers, default: not set 43 | kUnityD3D12EventConfigFlag_SyncWorkerThreads = (1 << 2), // wait for worker threads to finish, default: not set 44 | kUnityD3D12EventConfigFlag_ModifiesCommandBuffersState = (1 << 3), // should be set when descriptor set bindings, vertex buffer bindings, etc are changed (default: set) 45 | }; 46 | 47 | struct UnityD3D12PluginEventConfig 48 | { 49 | UnityD3D12GraphicsQueueAccess graphicsQueueAccess; 50 | UINT32 flags; // UnityD3D12EventConfigFlagBits to be used when invoking a native plugin 51 | bool ensureActiveRenderTextureIsBound; // If true, the actively bound render texture will be bound prior the execution of the native plugin method. 52 | }; 53 | 54 | typedef struct UnityGraphicsD3D12PhysicalVideoMemoryControlValues UnityGraphicsD3D12PhysicalVideoMemoryControlValues; 55 | struct UnityGraphicsD3D12PhysicalVideoMemoryControlValues // all absolute values in bytes 56 | { 57 | UINT64 reservation; // Minimum required physical memory for an application [default = 64MB]. 58 | UINT64 systemMemoryThreshold; // If free physical video memory drops below this threshold, resources will be allocated in system memory. [default = 64MB] 59 | UINT64 residencyHysteresisThreshold; // Minimum free physical video memory needed to start bringing evicted resources back after shrunken video memory budget expands again. [default = 128MB] 60 | float nonEvictableRelativeThreshold; // The relative proportion of the video memory budget that must be kept available for non-evictable resources. [default = 0.25] 61 | }; 62 | 63 | // Should only be used on the rendering/submission thread. 64 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v7) 65 | { 66 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 67 | 68 | IDXGISwapChain* (UNITY_INTERFACE_API * GetSwapChain)(); 69 | UINT32(UNITY_INTERFACE_API * GetSyncInterval)(); 70 | UINT(UNITY_INTERFACE_API * GetPresentFlags)(); 71 | 72 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 73 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 74 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 75 | 76 | // Executes a given command list on a worker thread. The command list type must be D3D12_COMMAND_LIST_TYPE_DIRECT. 77 | // [Optional] Declares expected and post-execution resource states. 78 | // Returns the fence value. The value will be set once the current frame completes or the GPU is flushed. 79 | UINT64(UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList * commandList, int stateCount, UnityGraphicsD3D12ResourceState * states); 80 | 81 | void(UNITY_INTERFACE_API * SetPhysicalVideoMemoryControlValues)(const UnityGraphicsD3D12PhysicalVideoMemoryControlValues * memInfo); 82 | 83 | ID3D12CommandQueue* (UNITY_INTERFACE_API * GetCommandQueue)(); 84 | 85 | ID3D12Resource* (UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer rb); 86 | ID3D12Resource* (UNITY_INTERFACE_API * TextureFromNativeTexture)(UnityTextureID texture); 87 | 88 | // Change the precondition for a specific user-defined event 89 | // Should be called during initialization 90 | void(UNITY_INTERFACE_API * ConfigureEvent)(int eventID, const UnityD3D12PluginEventConfig * pluginEventConfig); 91 | 92 | bool(UNITY_INTERFACE_API * CommandRecordingState)(UnityGraphicsD3D12RecordingState * outCommandRecordingState); 93 | }; 94 | UNITY_REGISTER_INTERFACE_GUID(0x4624B0DA41B64AACULL, 0x915AABCB9BC3F0D3ULL, IUnityGraphicsD3D12v7) 95 | 96 | // Should only be used on the rendering/submission thread. 97 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v6) 98 | { 99 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 100 | 101 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 102 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 103 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 104 | 105 | // Executes a given command list on a worker thread. The command list type must be D3D12_COMMAND_LIST_TYPE_DIRECT. 106 | // [Optional] Declares expected and post-execution resource states. 107 | // Returns the fence value. The value will be set once the current frame completes or the GPU is flushed. 108 | UINT64(UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList * commandList, int stateCount, UnityGraphicsD3D12ResourceState * states); 109 | 110 | void(UNITY_INTERFACE_API * SetPhysicalVideoMemoryControlValues)(const UnityGraphicsD3D12PhysicalVideoMemoryControlValues * memInfo); 111 | 112 | ID3D12CommandQueue* (UNITY_INTERFACE_API * GetCommandQueue)(); 113 | 114 | ID3D12Resource* (UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer rb); 115 | ID3D12Resource* (UNITY_INTERFACE_API * TextureFromNativeTexture)(UnityTextureID texture); 116 | 117 | // Change the precondition for a specific user-defined event 118 | // Should be called during initialization 119 | void(UNITY_INTERFACE_API * ConfigureEvent)(int eventID, const UnityD3D12PluginEventConfig * pluginEventConfig); 120 | 121 | bool(UNITY_INTERFACE_API * CommandRecordingState)(UnityGraphicsD3D12RecordingState* outCommandRecordingState); 122 | }; 123 | UNITY_REGISTER_INTERFACE_GUID(0xA396DCE58CAC4D78ULL, 0xAFDD9B281F20B840ULL, IUnityGraphicsD3D12v6) 124 | 125 | // Should only be used on the rendering/submission thread. 126 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v5) 127 | { 128 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 129 | 130 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 131 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 132 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 133 | 134 | // Executes a given command list on a worker thread. The command list type must be D3D12_COMMAND_LIST_TYPE_DIRECT. 135 | // [Optional] Declares expected and post-execution resource states. 136 | // Returns the fence value. The value will be set once the current frame completes or the GPU is flushed. 137 | UINT64(UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList * commandList, int stateCount, UnityGraphicsD3D12ResourceState * states); 138 | 139 | void(UNITY_INTERFACE_API * SetPhysicalVideoMemoryControlValues)(const UnityGraphicsD3D12PhysicalVideoMemoryControlValues * memInfo); 140 | 141 | ID3D12CommandQueue* (UNITY_INTERFACE_API * GetCommandQueue)(); 142 | 143 | ID3D12Resource* (UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer rb); 144 | }; 145 | UNITY_REGISTER_INTERFACE_GUID(0xF5C8D8A37D37BC42ULL, 0xB02DFE93B5064A27ULL, IUnityGraphicsD3D12v5) 146 | 147 | // Should only be used on the rendering/submission thread. 148 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v4) 149 | { 150 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 151 | 152 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 153 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 154 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 155 | 156 | // Executes a given command list on a worker thread. The command list type must be D3D12_COMMAND_LIST_TYPE_DIRECT. 157 | // [Optional] Declares expected and post-execution resource states. 158 | // Returns the fence value. The value will be set once the current frame completes or the GPU is flushed. 159 | UINT64(UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList * commandList, int stateCount, UnityGraphicsD3D12ResourceState * states); 160 | 161 | void(UNITY_INTERFACE_API * SetPhysicalVideoMemoryControlValues)(const UnityGraphicsD3D12PhysicalVideoMemoryControlValues * memInfo); 162 | 163 | ID3D12CommandQueue* (UNITY_INTERFACE_API * GetCommandQueue)(); 164 | }; 165 | UNITY_REGISTER_INTERFACE_GUID(0X498FFCC13EC94006ULL, 0XB18F8B0FF67778C8ULL, IUnityGraphicsD3D12v4) 166 | 167 | // Should only be used on the rendering/submission thread. 168 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v3) 169 | { 170 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 171 | 172 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 173 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 174 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 175 | 176 | // Executes a given command list on a worker thread. The command list type must be D3D12_COMMAND_LIST_TYPE_DIRECT. 177 | // [Optional] Declares expected and post-execution resource states. 178 | // Returns the fence value. The value will be set once the current frame completes or the GPU is flushed. 179 | UINT64(UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList * commandList, int stateCount, UnityGraphicsD3D12ResourceState * states); 180 | 181 | void(UNITY_INTERFACE_API * SetPhysicalVideoMemoryControlValues)(const UnityGraphicsD3D12PhysicalVideoMemoryControlValues * memInfo); 182 | }; 183 | UNITY_REGISTER_INTERFACE_GUID(0x57C3FAFE59E5E843ULL, 0xBF4F5998474BB600ULL, IUnityGraphicsD3D12v3) 184 | 185 | // Should only be used on the rendering/submission thread. 186 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v2) 187 | { 188 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 189 | 190 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 191 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 192 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 193 | 194 | // Executes a given command list on a worker thread. The command list type must be D3D12_COMMAND_LIST_TYPE_DIRECT. 195 | // [Optional] Declares expected and post-execution resource states. 196 | // Returns the fence value. The value will be set once the current frame completes or the GPU is flushed. 197 | UINT64(UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList * commandList, int stateCount, UnityGraphicsD3D12ResourceState * states); 198 | }; 199 | UNITY_REGISTER_INTERFACE_GUID(0xEC39D2F18446C745ULL, 0xB1A2626641D6B11FULL, IUnityGraphicsD3D12v2) 200 | 201 | 202 | // Obsolete 203 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12) 204 | { 205 | ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); 206 | ID3D12CommandQueue* (UNITY_INTERFACE_API * GetCommandQueue)(); 207 | 208 | ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); 209 | // Returns the value set on the frame fence once the current frame completes or the GPU is flushed 210 | UINT64(UNITY_INTERFACE_API * GetNextFrameFenceValue)(); 211 | 212 | // Returns the state a resource will be in after the last command list is executed 213 | bool(UNITY_INTERFACE_API * GetResourceState)(ID3D12Resource * resource, D3D12_RESOURCE_STATES * outState); 214 | // Specifies the state a resource will be in after a plugin command list with resource barriers is executed 215 | void(UNITY_INTERFACE_API * SetResourceState)(ID3D12Resource * resource, D3D12_RESOURCE_STATES state); 216 | }; 217 | UNITY_REGISTER_INTERFACE_GUID(0xEF4CEC88A45F4C4CULL, 0xBD295B6F2A38D9DEULL, IUnityGraphicsD3D12) 218 | -------------------------------------------------------------------------------- /PluginSource/source/Unity/IUnityGraphicsD3D9.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | // Should only be used on the rendering thread unless noted otherwise. 5 | UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D9) 6 | { 7 | IDirect3D9* (UNITY_INTERFACE_API * GetD3D)(); 8 | IDirect3DDevice9* (UNITY_INTERFACE_API * GetDevice)(); 9 | }; 10 | UNITY_REGISTER_INTERFACE_GUID(0xE90746A523D53C4CULL, 0xAC825B19B6F82AC3ULL, IUnityGraphicsD3D9) 11 | -------------------------------------------------------------------------------- /PluginSource/source/Unity/IUnityGraphicsMetal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IUnityInterface.h" 3 | 4 | #ifndef __OBJC__ 5 | #error metal plugin is objc code. 6 | #endif 7 | #ifndef __clang__ 8 | #error only clang compiler is supported. 9 | #endif 10 | 11 | @class NSBundle; 12 | @protocol MTLDevice; 13 | @protocol MTLCommandBuffer; 14 | @protocol MTLCommandEncoder; 15 | @protocol MTLTexture; 16 | @class MTLRenderPassDescriptor; 17 | 18 | // Should only be used on the rendering thread unless noted otherwise. 19 | UNITY_DECLARE_INTERFACE(IUnityGraphicsMetal) 20 | { 21 | NSBundle* (UNITY_INTERFACE_API * MetalBundle)(); 22 | id(UNITY_INTERFACE_API * MetalDevice)(); 23 | 24 | id(UNITY_INTERFACE_API * CurrentCommandBuffer)(); 25 | 26 | // for custom rendering support there are two scenarios: 27 | // you want to use current in-flight MTLCommandEncoder (NB: it might be nil) 28 | id(UNITY_INTERFACE_API * CurrentCommandEncoder)(); 29 | // or you might want to create your own encoder. 30 | // In that case you should end unity's encoder before creating your own and end yours before returning control to unity 31 | void(UNITY_INTERFACE_API * EndCurrentCommandEncoder)(); 32 | 33 | // returns MTLRenderPassDescriptor used to create current MTLCommandEncoder 34 | MTLRenderPassDescriptor* (UNITY_INTERFACE_API * CurrentRenderPassDescriptor)(); 35 | 36 | // converting trampoline UnityRenderBufferHandle into native RenderBuffer 37 | UnityRenderBuffer(UNITY_INTERFACE_API * RenderBufferFromHandle)(void* bufferHandle); 38 | 39 | // access to RenderBuffer's texure 40 | // NB: you pass here *native* RenderBuffer, acquired by calling (C#) RenderBuffer.GetNativeRenderBufferPtr 41 | // AAResolvedTextureFromRenderBuffer will return nil in case of non-AA RenderBuffer or if called for depth RenderBuffer 42 | // StencilTextureFromRenderBuffer will return nil in case of no-stencil RenderBuffer or if called for color RenderBuffer 43 | id(UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer buffer); 44 | id(UNITY_INTERFACE_API * AAResolvedTextureFromRenderBuffer)(UnityRenderBuffer buffer); 45 | id(UNITY_INTERFACE_API * StencilTextureFromRenderBuffer)(UnityRenderBuffer buffer); 46 | }; 47 | UNITY_REGISTER_INTERFACE_GUID(0x992C8EAEA95811E5ULL, 0x9A62C4B5B9876117ULL, IUnityGraphicsMetal) 48 | -------------------------------------------------------------------------------- /PluginSource/source/Unity/IUnityInterface.h: -------------------------------------------------------------------------------- 1 | // Unity Native Plugin API copyright © 2015 Unity Technologies ApS 2 | // 3 | // Licensed under the Unity Companion License for Unity - dependent projects--see[Unity Companion License](http://www.unity3d.com/legal/licenses/Unity_Companion_License). 4 | // 5 | // Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.Please review the license for details on these and other terms and conditions. 6 | 7 | #pragma once 8 | 9 | // Unity native plugin API 10 | // Compatible with C99 11 | 12 | #if defined(__CYGWIN32__) 13 | #define UNITY_INTERFACE_API __stdcall 14 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 15 | #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WINAPI_FAMILY) 16 | #define UNITY_INTERFACE_API __stdcall 17 | #define UNITY_INTERFACE_EXPORT __declspec(dllexport) 18 | #elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) || defined(LUMIN) 19 | #define UNITY_INTERFACE_API 20 | #define UNITY_INTERFACE_EXPORT __attribute__ ((visibility ("default"))) 21 | #else 22 | #define UNITY_INTERFACE_API 23 | #define UNITY_INTERFACE_EXPORT 24 | #endif 25 | 26 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 27 | // IUnityInterface is a registry of interfaces we choose to expose to plugins. 28 | // 29 | // USAGE: 30 | // --------- 31 | // To retrieve an interface a user can do the following from a plugin, assuming they have the header file for the interface: 32 | // 33 | // IMyInterface * ptr = registry->Get(); 34 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 35 | 36 | // Unity Interface GUID 37 | // Ensures global uniqueness. 38 | // 39 | // Template specialization is used to produce a means of looking up a GUID from its interface type at compile time. 40 | // The net result should compile down to passing around the GUID. 41 | // 42 | // UNITY_REGISTER_INTERFACE_GUID should be placed in the header file of any interface definition outside of all namespaces. 43 | // The interface structure and the registration GUID are all that is required to expose the interface to other systems. 44 | struct UnityInterfaceGUID 45 | { 46 | #ifdef __cplusplus 47 | UnityInterfaceGUID(unsigned long long high, unsigned long long low) 48 | : m_GUIDHigh(high) 49 | , m_GUIDLow(low) 50 | { 51 | } 52 | 53 | UnityInterfaceGUID(const UnityInterfaceGUID& other) 54 | { 55 | m_GUIDHigh = other.m_GUIDHigh; 56 | m_GUIDLow = other.m_GUIDLow; 57 | } 58 | 59 | UnityInterfaceGUID& operator=(const UnityInterfaceGUID& other) 60 | { 61 | m_GUIDHigh = other.m_GUIDHigh; 62 | m_GUIDLow = other.m_GUIDLow; 63 | return *this; 64 | } 65 | 66 | bool Equals(const UnityInterfaceGUID& other) const { return m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow == other.m_GUIDLow; } 67 | bool LessThan(const UnityInterfaceGUID& other) const { return m_GUIDHigh < other.m_GUIDHigh || (m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow < other.m_GUIDLow); } 68 | #endif 69 | unsigned long long m_GUIDHigh; 70 | unsigned long long m_GUIDLow; 71 | }; 72 | #ifdef __cplusplus 73 | inline bool operator==(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.Equals(right); } 74 | inline bool operator!=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !left.Equals(right); } 75 | inline bool operator<(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.LessThan(right); } 76 | inline bool operator>(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return right.LessThan(left); } 77 | inline bool operator>=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator<(left, right); } 78 | inline bool operator<=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator>(left, right); } 79 | #else 80 | typedef struct UnityInterfaceGUID UnityInterfaceGUID; 81 | #endif 82 | 83 | 84 | #ifdef __cplusplus 85 | #define UNITY_DECLARE_INTERFACE(NAME) \ 86 | struct NAME : IUnityInterface 87 | 88 | // Generic version of GetUnityInterfaceGUID to allow us to specialize it 89 | // per interface below. The generic version has no actual implementation 90 | // on purpose. 91 | // 92 | // If you get errors about return values related to this method then 93 | // you have forgotten to include UNITY_REGISTER_INTERFACE_GUID with 94 | // your interface, or it is not visible at some point when you are 95 | // trying to retrieve or add an interface. 96 | template 97 | inline const UnityInterfaceGUID GetUnityInterfaceGUID(); 98 | 99 | // This is the macro you provide in your public interface header 100 | // outside of a namespace to allow us to map between type and GUID 101 | // without the user having to worry about it when attempting to 102 | // add or retrieve and interface from the registry. 103 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 104 | template<> \ 105 | inline const UnityInterfaceGUID GetUnityInterfaceGUID() \ 106 | { \ 107 | return UnityInterfaceGUID(HASHH,HASHL); \ 108 | } 109 | 110 | // Same as UNITY_REGISTER_INTERFACE_GUID but allows the interface to live in 111 | // a particular namespace. As long as the namespace is visible at the time you call 112 | // GetUnityInterfaceGUID< INTERFACETYPE >() or you explicitly qualify it in the template 113 | // calls this will work fine, only the macro here needs to have the additional parameter 114 | #define UNITY_REGISTER_INTERFACE_GUID_IN_NAMESPACE(HASHH, HASHL, TYPE, NAMESPACE) \ 115 | const UnityInterfaceGUID TYPE##_GUID(HASHH, HASHL); \ 116 | template<> \ 117 | inline const UnityInterfaceGUID GetUnityInterfaceGUID< NAMESPACE :: TYPE >() \ 118 | { \ 119 | return UnityInterfaceGUID(HASHH,HASHL); \ 120 | } 121 | 122 | // These macros allow for C compatibility in user code. 123 | #define UNITY_GET_INTERFACE_GUID(TYPE) GetUnityInterfaceGUID< TYPE >() 124 | 125 | 126 | #else 127 | #define UNITY_DECLARE_INTERFACE(NAME) \ 128 | typedef struct NAME NAME; \ 129 | struct NAME 130 | 131 | // NOTE: This has the downside that one some compilers it will not get stripped from all compilation units that 132 | // can see a header containing this constant. However, it's only for C compatibility and thus should have 133 | // minimal impact. 134 | #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ 135 | const UnityInterfaceGUID TYPE##_GUID = {HASHH, HASHL}; 136 | 137 | // In general namespaces are going to be a problem for C code any interfaces we expose in a namespace are 138 | // not going to be usable from C. 139 | #define UNITY_REGISTER_INTERFACE_GUID_IN_NAMESPACE(HASHH, HASHL, TYPE, NAMESPACE) 140 | 141 | // These macros allow for C compatibility in user code. 142 | #define UNITY_GET_INTERFACE_GUID(TYPE) TYPE##_GUID 143 | #endif 144 | 145 | // Using this in user code rather than INTERFACES->Get() will be C compatible for those places in plugins where 146 | // this may be needed. Unity code itself does not need this. 147 | #define UNITY_GET_INTERFACE(INTERFACES, TYPE) (TYPE*)INTERFACES->GetInterfaceSplit (UNITY_GET_INTERFACE_GUID(TYPE).m_GUIDHigh, UNITY_GET_INTERFACE_GUID(TYPE).m_GUIDLow); 148 | 149 | 150 | #ifdef __cplusplus 151 | struct IUnityInterface 152 | { 153 | }; 154 | #else 155 | typedef void IUnityInterface; 156 | #endif 157 | 158 | 159 | typedef struct IUnityInterfaces 160 | { 161 | // Returns an interface matching the guid. 162 | // Returns nullptr if the given interface is unavailable in the active Unity runtime. 163 | IUnityInterface* (UNITY_INTERFACE_API * GetInterface)(UnityInterfaceGUID guid); 164 | 165 | // Registers a new interface. 166 | void(UNITY_INTERFACE_API * RegisterInterface)(UnityInterfaceGUID guid, IUnityInterface * ptr); 167 | 168 | // Split APIs for C 169 | IUnityInterface* (UNITY_INTERFACE_API * GetInterfaceSplit)(unsigned long long guidHigh, unsigned long long guidLow); 170 | void(UNITY_INTERFACE_API * RegisterInterfaceSplit)(unsigned long long guidHigh, unsigned long long guidLow, IUnityInterface * ptr); 171 | 172 | #ifdef __cplusplus 173 | // Helper for GetInterface. 174 | template 175 | INTERFACE* Get() 176 | { 177 | return static_cast(GetInterface(GetUnityInterfaceGUID())); 178 | } 179 | 180 | // Helper for RegisterInterface. 181 | template 182 | void Register(IUnityInterface* ptr) 183 | { 184 | RegisterInterface(GetUnityInterfaceGUID(), ptr); 185 | } 186 | 187 | #endif 188 | } IUnityInterfaces; 189 | 190 | 191 | #ifdef __cplusplus 192 | extern "C" { 193 | #endif 194 | 195 | // If exported by a plugin, this function will be called when the plugin is loaded. 196 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces); 197 | // If exported by a plugin, this function will be called when the plugin is about to be unloaded. 198 | void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload(); 199 | 200 | #ifdef __cplusplus 201 | } 202 | #endif 203 | 204 | struct RenderSurfaceBase; 205 | typedef struct RenderSurfaceBase* UnityRenderBuffer; 206 | typedef unsigned int UnityTextureID; 207 | -------------------------------------------------------------------------------- /PluginSource/source/gl3w/readme.txt: -------------------------------------------------------------------------------- 1 | gl3w is a small/simple OpenGL functions loader for Windows, 2 | from https://github.com/skaslev/gl3w 3 | 4 | license: public domain 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Native code (C++) rendering plugin example for Unity 2 | 3 | This sample demonstrates how to render and do other graphics related things from a C++ plugin, via a 4 | [native plugin interface](http://docs.unity3d.com/Manual/NativePluginInterface.html). 5 | 6 | Unity versions: 7 | 8 | * **2023.1+** use tip of default branch. 9 | 10 | The plugin itself does very few things: 11 | 12 | * **Demonstrates basic plumbing**. How to initialize the graphics API, and how calls from Unity into plugin are made. 13 | * **Draws a triangle**. A single colored rotating triangle in the middle of the screen. For each backend API, this shows bare basics of how to setup vertex data, setup 14 | some shaders or render states, and do a draw call. 15 | * **Changes Unity texture data**. Unity side passes a texture into the plugin, and the code changes the pixels of it each frame, with an animated "plasma" pattern. This 16 | demonstrates how to work with [Texture.GetNativeTexturePtr](https://docs.unity3d.com/ScriptReference/Texture.GetNativeTexturePtr.html). 17 | * **Changes Unity mesh vertex data**. Unity side passes a vertex buffer into the plugin, and the code changes the vertices each frame, with an animated "heightfield" pattern. This 18 | demonstrates how to work with [Mesh.GetNativeVertexBufferPtr](https://docs.unity3d.com/ScriptReference/Mesh.GetNativeVertexBufferPtr.html). 19 | 20 | 21 | Native code rendering is implemented for several platforms and graphics APIs: 22 | 23 | * Windows (D3D11, D3D12, OpenGL, Vulkan) 24 | * Note that Vulkan and DX12 are not compiled in by default 25 | * Vulkan requires Vulkan SDK; enable it by editing `#define SUPPORT_VULKAN 0` 26 | to `1` under `UNITY_WIN` clause in `PlatformBase.h` 27 | * DX12 requires additional header files (see on [github](https://github.com/microsoft/DirectX-Headers) or [nuget package](https://www.nuget.org/packages/Microsoft.Direct3D.D3D12/1.4.10)); enable it by editing `#define SUPPORT_D3D12 0` to `1` under `UNITY_WIN` clause in `PlatformBase.h` 28 | * macOS (Metal, OpenGL) 29 | * Linux (OpenGL, Vulkan) 30 | * Windows Store aka UWP (D3D11, D3D12) 31 | * WebGL (OpenGL ES) 32 | * Android (OpenGL ES, Vulkan) 33 | * iOS/tvOS (Metal; Simulator is supported if you use unity 2020+ and XCode 11+) 34 | * EmbeddedLinux (OpenGL, OpenGL ES , Vulkan) 35 | * QNX (OpenGL ES) 36 | * ...more platforms might be coming soon, we just did not get around to adding project files yet. 37 | 38 | Code is organized as follows: 39 | 40 | * `PluginSource` is source code & IDE project files for the C++ plugin. 41 | * `source`: The source code itself. `RenderingPlugin.cpp` is the main logic, `RenderAPI*.*` files contain rendering implementations for different APIs. 42 | * `projects/VisualStudio2022`: Visual Studio 2022 project files for regular Windows plugin 43 | * `projects/UWPVisualStudio2022`: Visual Studio 2022 project files for Windows Store (UWP) plugin 44 | * `projects/Xcode`: Apple Xcode project file for Mac OS X plugin, Xcode 10.3 on macOS 10.14 was tested 45 | * `projects/GNUMake`: Makefile for Linux 46 | * `projects/EmbeddedLinux`: Windows .bat files to build plugins for different architectures 47 | * `projects/QNX`: Makefile for Linux requires QNX to be installed and environment variables to be set 48 | * `UnityProject` is the Unity (2023.1.15f1 was tested) project. 49 | * Single `scene` that contains the plugin sample scene. 50 | 51 | 52 | ### What license are the graphics samples shipped under? 53 | 54 | Just like with most other samples, the license is MIT/X11. 55 | -------------------------------------------------------------------------------- /UnityProject/Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 085eeda524261654b88f97ea61b33090 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /UnityProject/Assets/Editor/MyBuildPostprocessor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using UnityEditor.Callbacks; 4 | using System.IO; 5 | 6 | public class MyBuildPostprocessor 7 | { 8 | // Build postprocessor. Currently only needed on: 9 | // - iOS: no dynamic libraries, so plugin source files have to be copied into Xcode project 10 | [PostProcessBuild] 11 | public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) 12 | { 13 | if (target == BuildTarget.iOS || target == BuildTarget.tvOS) 14 | OnPostprocessBuildIOS(pathToBuiltProject); 15 | } 16 | 17 | private static void OnPostprocessBuildIOS(string pathToBuiltProject) 18 | { 19 | // We use UnityEditor.iOS.Xcode API which only exists in iOS editor module 20 | #if UNITY_IOS || UNITY_TVOS 21 | string projPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj"; 22 | 23 | UnityEditor.iOS.Xcode.PBXProject proj = new UnityEditor.iOS.Xcode.PBXProject(); 24 | proj.ReadFromString(File.ReadAllText(projPath)); 25 | 26 | #if UNITY_2019_3_OR_NEWER 27 | string target = proj.GetUnityFrameworkTargetGuid(); 28 | #else 29 | string target = proj.TargetGuidByName("Unity-iPhone"); 30 | #endif 31 | 32 | string[] filesToCopy = new string[] { 33 | "PlatformBase.h", "RenderingPlugin.cpp", 34 | "RenderAPI_Metal.mm", "RenderAPI_OpenGLCoreES.cpp", "RenderAPI.cpp", "RenderAPI.h", 35 | }; 36 | for(int i = 0 ; i < filesToCopy.Length ; ++i) 37 | { 38 | string srcPath = Path.Combine("../PluginSource/source", filesToCopy[i]); 39 | string dstLocalPath = "Libraries/" + filesToCopy[i]; 40 | string dstPath = Path.Combine(pathToBuiltProject, dstLocalPath); 41 | File.Copy(srcPath, dstPath, true); 42 | proj.AddFileToBuild(target, proj.AddFile(dstLocalPath, dstLocalPath)); 43 | } 44 | 45 | File.WriteAllText(projPath, proj.WriteToString()); 46 | #endif 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /UnityProject/Assets/Editor/MyBuildPostprocessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eaa42aef09abb2341a3d3a5f0fadd805 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05a89afb32ff4cd48a0278f931aa903b 3 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92e6a5294af0b2e4f80eeaa03f1ae581 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/SDK81.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 42e8d35434e8b20449118c87c142191a 3 | folderAsset: yes 4 | timeCreated: 1435674010 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/SDK81/ARM.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 403625409137bf84fa02ef661077c6f3 3 | folderAsset: yes 4 | timeCreated: 1435674010 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/SDK81/ARM/RenderingPlugin.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeRenderingPlugin/f703c47a140d343c2c863a36d1aa5832586f3aaa/UnityProject/Assets/Plugins/Metro/SDK81/ARM/RenderingPlugin.dll -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/SDK81/ARM/RenderingPlugin.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 591201c97b7beb341bb69a327a9ad6d0 3 | timeCreated: 1435674011 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Any: 12 | enabled: 0 13 | settings: {} 14 | Editor: 15 | enabled: 0 16 | settings: 17 | DefaultValueInitialized: true 18 | WindowsStoreApps: 19 | enabled: 1 20 | settings: 21 | CPU: ARM 22 | SDK: SDK81 23 | userData: 24 | assetBundleName: 25 | assetBundleVariant: 26 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/SDK81/x64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5ed8b03c05682b45b5d7bf8d61c781f 3 | folderAsset: yes 4 | timeCreated: 1464351100 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/SDK81/x64/RenderingPlugin.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeRenderingPlugin/f703c47a140d343c2c863a36d1aa5832586f3aaa/UnityProject/Assets/Plugins/Metro/SDK81/x64/RenderingPlugin.dll -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/SDK81/x64/RenderingPlugin.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e67331147f555d428ab5428c115e4b5 3 | timeCreated: 1464351103 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Any: 12 | enabled: 0 13 | settings: {} 14 | Editor: 15 | enabled: 0 16 | settings: 17 | DefaultValueInitialized: true 18 | WindowsStoreApps: 19 | enabled: 1 20 | settings: 21 | CPU: x64 22 | SDK: SDK81 23 | userData: 24 | assetBundleName: 25 | assetBundleVariant: 26 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/SDK81/x86.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8a68bd45c8e5bc4882670fbf4b7d029 3 | folderAsset: yes 4 | timeCreated: 1435674010 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/SDK81/x86/RenderingPlugin.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeRenderingPlugin/f703c47a140d343c2c863a36d1aa5832586f3aaa/UnityProject/Assets/Plugins/Metro/SDK81/x86/RenderingPlugin.dll -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/SDK81/x86/RenderingPlugin.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 873e211cf85e76f44acb6ac7aa1e71dd 3 | timeCreated: 1435674011 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Any: 12 | enabled: 0 13 | settings: {} 14 | Editor: 15 | enabled: 0 16 | settings: 17 | DefaultValueInitialized: true 18 | WindowsStoreApps: 19 | enabled: 1 20 | settings: 21 | CPU: x86 22 | SDK: SDK81 23 | userData: 24 | assetBundleName: 25 | assetBundleVariant: 26 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/UWP.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc430ae2e2f5b2e4095495a2d12c0047 3 | folderAsset: yes 4 | timeCreated: 1464333125 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/UWP/ARM.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb838d465407800418f602790c37c724 3 | folderAsset: yes 4 | timeCreated: 1464333125 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/UWP/ARM/RenderingPlugin.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeRenderingPlugin/f703c47a140d343c2c863a36d1aa5832586f3aaa/UnityProject/Assets/Plugins/Metro/UWP/ARM/RenderingPlugin.dll -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/UWP/ARM/RenderingPlugin.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27ba0690e16dbc3428b61ecaddcef774 3 | timeCreated: 1464333127 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Any: 12 | enabled: 0 13 | settings: {} 14 | Editor: 15 | enabled: 0 16 | settings: 17 | DefaultValueInitialized: true 18 | WindowsStoreApps: 19 | enabled: 1 20 | settings: 21 | CPU: ARM 22 | SDK: UWP 23 | userData: 24 | assetBundleName: 25 | assetBundleVariant: 26 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/UWP/x64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4afbc9c13bc7cee48995d976a32ead3b 3 | folderAsset: yes 4 | timeCreated: 1464333125 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/UWP/x64/RenderingPlugin.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeRenderingPlugin/f703c47a140d343c2c863a36d1aa5832586f3aaa/UnityProject/Assets/Plugins/Metro/UWP/x64/RenderingPlugin.dll -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/UWP/x64/RenderingPlugin.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20c2b125ae0f499489f945dee41a5f54 3 | timeCreated: 1464333127 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Any: 12 | enabled: 0 13 | settings: {} 14 | Editor: 15 | enabled: 0 16 | settings: 17 | DefaultValueInitialized: true 18 | WindowsStoreApps: 19 | enabled: 1 20 | settings: 21 | CPU: x64 22 | SDK: UWP 23 | userData: 24 | assetBundleName: 25 | assetBundleVariant: 26 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/UWP/x86.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cda04d929bb7e6447bc03a112314c755 3 | folderAsset: yes 4 | timeCreated: 1464333125 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/UWP/x86/RenderingPlugin.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeRenderingPlugin/f703c47a140d343c2c863a36d1aa5832586f3aaa/UnityProject/Assets/Plugins/Metro/UWP/x86/RenderingPlugin.dll -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/Metro/UWP/x86/RenderingPlugin.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50023d2f1d3d422499d3da6bea976cd2 3 | timeCreated: 1464333127 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Any: 12 | enabled: 0 13 | settings: {} 14 | Editor: 15 | enabled: 0 16 | settings: 17 | DefaultValueInitialized: true 18 | WindowsStoreApps: 19 | enabled: 1 20 | settings: 21 | CPU: x86 22 | SDK: UWP 23 | userData: 24 | assetBundleName: 25 | assetBundleVariant: 26 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/RenderingPlugin.bundle.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ebb81bb4397a54246931fd6c44bad6ce 3 | folderAsset: yes 4 | timeCreated: 1464338084 5 | licenseType: Pro 6 | PluginImporter: 7 | serializedVersion: 1 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | platformData: 12 | Any: 13 | enabled: 0 14 | settings: {} 15 | Editor: 16 | enabled: 1 17 | settings: 18 | CPU: AnyCPU 19 | DefaultValueInitialized: true 20 | OS: OSX 21 | Linux: 22 | enabled: 0 23 | settings: 24 | CPU: x86 25 | Linux64: 26 | enabled: 0 27 | settings: 28 | CPU: x86_64 29 | OSXIntel: 30 | enabled: 1 31 | settings: 32 | CPU: AnyCPU 33 | OSXIntel64: 34 | enabled: 1 35 | settings: 36 | CPU: AnyCPU 37 | OSXUniversal: 38 | enabled: 1 39 | settings: {} 40 | Win: 41 | enabled: 0 42 | settings: 43 | CPU: AnyCPU 44 | Win64: 45 | enabled: 0 46 | settings: 47 | CPU: AnyCPU 48 | iOS: 49 | enabled: 0 50 | settings: 51 | CompileFlags: 52 | FrameworkDependencies: 53 | userData: 54 | assetBundleName: 55 | assetBundleVariant: 56 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/RenderingPlugin.bundle/Contents.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f755e08657c4d45a2964c48ee8fe540d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/RenderingPlugin.bundle/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 18G87 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | RenderingPlugin 11 | CFBundleIdentifier 12 | com.yourcompany.RenderingPlugin 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | RenderingPlugin 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleSupportedPlatforms 24 | 25 | MacOSX 26 | 27 | CFBundleVersion 28 | 1 29 | CFPlugInDynamicRegisterFunction 30 | 31 | CFPlugInDynamicRegistration 32 | NO 33 | CFPlugInFactories 34 | 35 | 00000000-0000-0000-0000-000000000000 36 | MyFactoryFunction 37 | 38 | CFPlugInTypes 39 | 40 | 00000000-0000-0000-0000-000000000000 41 | 42 | 00000000-0000-0000-0000-000000000000 43 | 44 | 45 | CFPlugInUnloadFunction 46 | 47 | DTCompiler 48 | com.apple.compilers.llvm.clang.1_0 49 | DTPlatformBuild 50 | 10G8 51 | DTPlatformVersion 52 | GM 53 | DTSDKBuild 54 | 18G74 55 | DTSDKName 56 | macosx10.14 57 | DTXcode 58 | 1030 59 | DTXcodeBuild 60 | 10G8 61 | 62 | 63 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/RenderingPlugin.bundle/Contents/Info.plist.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8aa00d77c9d59498d8afc6cc966ccedf 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/RenderingPlugin.bundle/Contents/MacOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea416e3a931c44c7dab7be3ff85af5da 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/RenderingPlugin.bundle/Contents/MacOS/RenderingPlugin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeRenderingPlugin/f703c47a140d343c2c863a36d1aa5832586f3aaa/UnityProject/Assets/Plugins/RenderingPlugin.bundle/Contents/MacOS/RenderingPlugin -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/RenderingPlugin.bundle/Contents/MacOS/RenderingPlugin.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f0b092cc71f8b465cbb5a657186a3267 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/WebGL.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 669849464df6db14c984043d5c7d604a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/WebGL/RenderingPlugin.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "../../../../PluginSource/source/RenderingPlugin.cpp" 3 | #include "../../../../PluginSource/source/RenderAPI.cpp" 4 | #include "../../../../PluginSource/source/RenderAPI_OpenGLCoreES.cpp" 5 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/WebGL/RenderingPlugin.cpp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3bd0a098afe459f4491b8537d2b6a3ea 3 | timeCreated: 1479289430 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Any: 12 | enabled: 0 13 | settings: {} 14 | Editor: 15 | enabled: 0 16 | settings: 17 | CPU: AnyCPU 18 | DefaultValueInitialized: true 19 | OS: AnyOS 20 | Linux: 21 | enabled: 0 22 | settings: 23 | CPU: x86 24 | Linux64: 25 | enabled: 0 26 | settings: 27 | CPU: x86_64 28 | LinuxUniversal: 29 | enabled: 0 30 | settings: 31 | CPU: None 32 | OSXIntel: 33 | enabled: 0 34 | settings: 35 | CPU: AnyCPU 36 | OSXIntel64: 37 | enabled: 0 38 | settings: 39 | CPU: AnyCPU 40 | OSXUniversal: 41 | enabled: 0 42 | settings: 43 | CPU: None 44 | WebGL: 45 | enabled: 1 46 | settings: {} 47 | Win: 48 | enabled: 0 49 | settings: 50 | CPU: AnyCPU 51 | Win64: 52 | enabled: 0 53 | settings: 54 | CPU: AnyCPU 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/iOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eae9d327517a94b3897325ec3297560f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/iOS/RegisterPlugin.mm: -------------------------------------------------------------------------------- 1 | #import "UnityAppController.h" 2 | #include "Unity/IUnityGraphics.h" 3 | 4 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces); 5 | extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload(); 6 | 7 | @interface MyAppController : UnityAppController 8 | { 9 | } 10 | - (void)shouldAttachRenderDelegate; 11 | @end 12 | @implementation MyAppController 13 | - (void)shouldAttachRenderDelegate 14 | { 15 | // unlike desktops where plugin dynamic library is automatically loaded and registered 16 | // we need to do that manually on iOS 17 | UnityRegisterRenderingPluginV5(&UnityPluginLoad, &UnityPluginUnload); 18 | } 19 | 20 | @end 21 | IMPL_APP_CONTROLLER_SUBCLASS(MyAppController); 22 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/iOS/RegisterPlugin.mm.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd7c597f242d742cd9d8d87782826684 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 0 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | iPhone: iOS 27 | second: 28 | enabled: 1 29 | settings: 30 | AddToEmbeddedBinaries: false 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/x86.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: facb0b329858041e59a1e97742695de8 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/x86/RenderingPlugin.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeRenderingPlugin/f703c47a140d343c2c863a36d1aa5832586f3aaa/UnityProject/Assets/Plugins/x86/RenderingPlugin.dll -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/x86/RenderingPlugin.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8f682a539c389d44b3c36ec86c47f6b 3 | timeCreated: 1435670817 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Any: 12 | enabled: 0 13 | settings: {} 14 | Editor: 15 | enabled: 1 16 | settings: 17 | CPU: x86 18 | DefaultValueInitialized: true 19 | OS: AnyOS 20 | Linux: 21 | enabled: 1 22 | settings: 23 | CPU: x86 24 | Linux64: 25 | enabled: 1 26 | settings: 27 | CPU: None 28 | LinuxUniversal: 29 | enabled: 1 30 | settings: 31 | CPU: AnyCPU 32 | OSXIntel: 33 | enabled: 1 34 | settings: 35 | CPU: AnyCPU 36 | OSXIntel64: 37 | enabled: 1 38 | settings: 39 | CPU: None 40 | OSXUniversal: 41 | enabled: 1 42 | settings: 43 | CPU: AnyCPU 44 | WP8: 45 | enabled: 0 46 | settings: 47 | CPU: AnyCPU 48 | DontProcess: False 49 | PlaceholderPath: 50 | Win: 51 | enabled: 1 52 | settings: 53 | CPU: AnyCPU 54 | Win64: 55 | enabled: 0 56 | settings: 57 | CPU: None 58 | WindowsStoreApps: 59 | enabled: 0 60 | settings: 61 | CPU: AnyCPU 62 | DontProcess: False 63 | PlaceholderPath: 64 | SDK: AnySDK 65 | userData: 66 | assetBundleName: 67 | assetBundleVariant: 68 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/x86/libRenderingPlugin.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeRenderingPlugin/f703c47a140d343c2c863a36d1aa5832586f3aaa/UnityProject/Assets/Plugins/x86/libRenderingPlugin.so -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/x86/libRenderingPlugin.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7277e3b816a84d47ba31144e08e82d8 3 | timeCreated: 1464363171 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | isOverridable: 0 11 | platformData: 12 | Any: 13 | enabled: 0 14 | settings: 15 | Exclude Editor: 0 16 | Exclude Linux: 0 17 | Exclude Linux64: 0 18 | Exclude LinuxUniversal: 0 19 | Exclude OSXIntel: 0 20 | Exclude OSXIntel64: 0 21 | Exclude OSXUniversal: 0 22 | Exclude WebGL: 1 23 | Exclude Win: 0 24 | Exclude Win64: 0 25 | Editor: 26 | enabled: 1 27 | settings: 28 | CPU: x86 29 | DefaultValueInitialized: true 30 | OS: Linux 31 | Linux: 32 | enabled: 1 33 | settings: 34 | CPU: x86 35 | Linux64: 36 | enabled: 1 37 | settings: 38 | CPU: None 39 | LinuxUniversal: 40 | enabled: 1 41 | settings: 42 | CPU: AnyCPU 43 | OSXIntel: 44 | enabled: 1 45 | settings: 46 | CPU: AnyCPU 47 | OSXIntel64: 48 | enabled: 1 49 | settings: 50 | CPU: None 51 | OSXUniversal: 52 | enabled: 1 53 | settings: 54 | CPU: AnyCPU 55 | Win: 56 | enabled: 1 57 | settings: 58 | CPU: AnyCPU 59 | Win64: 60 | enabled: 1 61 | settings: 62 | CPU: None 63 | userData: 64 | assetBundleName: 65 | assetBundleVariant: 66 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/x86_64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7a9474ad6c3e47f5a83c677268a10a3 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/x86_64/RenderingPlugin.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeRenderingPlugin/f703c47a140d343c2c863a36d1aa5832586f3aaa/UnityProject/Assets/Plugins/x86_64/RenderingPlugin.dll -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/x86_64/RenderingPlugin.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e71a6d1f4f34b9b4d802a4fa44b2c2c4 3 | timeCreated: 1435670817 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Any: 12 | enabled: 0 13 | settings: {} 14 | Editor: 15 | enabled: 1 16 | settings: 17 | CPU: x86_64 18 | DefaultValueInitialized: true 19 | OS: AnyOS 20 | Linux: 21 | enabled: 1 22 | settings: 23 | CPU: None 24 | Linux64: 25 | enabled: 1 26 | settings: 27 | CPU: x86_64 28 | LinuxUniversal: 29 | enabled: 1 30 | settings: 31 | CPU: AnyCPU 32 | OSXIntel: 33 | enabled: 1 34 | settings: 35 | CPU: None 36 | OSXIntel64: 37 | enabled: 1 38 | settings: 39 | CPU: AnyCPU 40 | OSXUniversal: 41 | enabled: 1 42 | settings: 43 | CPU: AnyCPU 44 | WP8: 45 | enabled: 0 46 | settings: 47 | CPU: AnyCPU 48 | DontProcess: False 49 | PlaceholderPath: 50 | Win: 51 | enabled: 0 52 | settings: 53 | CPU: None 54 | Win64: 55 | enabled: 1 56 | settings: 57 | CPU: AnyCPU 58 | WindowsStoreApps: 59 | enabled: 0 60 | settings: 61 | CPU: AnyCPU 62 | DontProcess: False 63 | PlaceholderPath: 64 | SDK: AnySDK 65 | userData: 66 | assetBundleName: 67 | assetBundleVariant: 68 | -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/x86_64/libRenderingPlugin.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/NativeRenderingPlugin/f703c47a140d343c2c863a36d1aa5832586f3aaa/UnityProject/Assets/Plugins/x86_64/libRenderingPlugin.so -------------------------------------------------------------------------------- /UnityProject/Assets/Plugins/x86_64/libRenderingPlugin.so.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa11b36258b4d49d1b8e65a9d6da75e0 3 | timeCreated: 1464357787 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | isOverridable: 0 11 | platformData: 12 | Any: 13 | enabled: 0 14 | settings: 15 | Exclude Editor: 0 16 | Exclude Linux: 0 17 | Exclude Linux64: 0 18 | Exclude LinuxUniversal: 0 19 | Exclude OSXIntel: 0 20 | Exclude OSXIntel64: 0 21 | Exclude OSXUniversal: 0 22 | Exclude WebGL: 1 23 | Exclude Win: 0 24 | Exclude Win64: 0 25 | Editor: 26 | enabled: 1 27 | settings: 28 | CPU: x86_64 29 | DefaultValueInitialized: true 30 | OS: Linux 31 | Linux: 32 | enabled: 1 33 | settings: 34 | CPU: None 35 | Linux64: 36 | enabled: 1 37 | settings: 38 | CPU: x86_64 39 | LinuxUniversal: 40 | enabled: 1 41 | settings: 42 | CPU: x86_64 43 | OSXIntel: 44 | enabled: 1 45 | settings: 46 | CPU: None 47 | OSXIntel64: 48 | enabled: 1 49 | settings: 50 | CPU: AnyCPU 51 | OSXUniversal: 52 | enabled: 1 53 | settings: 54 | CPU: x86_64 55 | Win: 56 | enabled: 1 57 | settings: 58 | CPU: None 59 | Win64: 60 | enabled: 1 61 | settings: 62 | CPU: AnyCPU 63 | userData: 64 | assetBundleName: 65 | assetBundleVariant: 66 | -------------------------------------------------------------------------------- /UnityProject/Assets/UseRenderingPlugin.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System; 3 | using System.Collections; 4 | using System.Runtime.InteropServices; 5 | using UnityEngine.Rendering; 6 | 7 | 8 | public class UseRenderingPlugin : MonoBehaviour 9 | { 10 | // Native plugin rendering events are only called if a plugin is used 11 | // by some script. This means we have to DllImport at least 12 | // one function in some active script. 13 | // For this example, we'll call into plugin's SetTimeFromUnity 14 | // function and pass the current time so the plugin can animate. 15 | 16 | #if (PLATFORM_IOS || PLATFORM_TVOS || PLATFORM_BRATWURST || PLATFORM_SWITCH) && !UNITY_EDITOR 17 | [DllImport("__Internal")] 18 | #else 19 | [DllImport("RenderingPlugin")] 20 | #endif 21 | private static extern void SetTimeFromUnity(float t); 22 | 23 | 24 | // We'll also pass native pointer to a texture in Unity. 25 | // The plugin will fill texture data from native code. 26 | #if (PLATFORM_IOS || PLATFORM_TVOS || PLATFORM_BRATWURST || PLATFORM_SWITCH) && !UNITY_EDITOR 27 | [DllImport("__Internal")] 28 | #else 29 | [DllImport("RenderingPlugin")] 30 | #endif 31 | private static extern void SetTextureFromUnity(System.IntPtr texture, int w, int h); 32 | 33 | // We'll pass native pointer to the mesh vertex buffer. 34 | // Also passing source unmodified mesh data. 35 | // The plugin will fill vertex data from native code. 36 | #if (PLATFORM_IOS || PLATFORM_TVOS || PLATFORM_BRATWURST || PLATFORM_SWITCH) && !UNITY_EDITOR 37 | [DllImport("__Internal")] 38 | #else 39 | [DllImport("RenderingPlugin")] 40 | #endif 41 | private static extern void SetMeshBuffersFromUnity(IntPtr vertexBuffer, int vertexCount, IntPtr sourceVertices, IntPtr sourceNormals, IntPtr sourceUVs); 42 | 43 | #if (PLATFORM_IOS || PLATFORM_TVOS || PLATFORM_BRATWURST || PLATFORM_SWITCH) && !UNITY_EDITOR 44 | [DllImport("__Internal")] 45 | #else 46 | [DllImport("RenderingPlugin")] 47 | #endif 48 | private static extern IntPtr GetRenderEventFunc(); 49 | 50 | #if PLATFORM_SWITCH && !UNITY_EDITOR 51 | [DllImport("__Internal")] 52 | private static extern void RegisterPlugin(); 53 | #endif 54 | 55 | // DX12 plugin has a few additional exported functions 56 | 57 | #if (UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_WSA_10_0) 58 | [DllImport("RenderingPlugin")] 59 | private static extern IntPtr GetRenderTexture(); 60 | 61 | [DllImport("RenderingPlugin")] 62 | private static extern void SetRenderTexture(IntPtr rb); 63 | 64 | [DllImport("RenderingPlugin")] 65 | private static extern bool IsSwapChainAvailable(); 66 | 67 | [DllImport("RenderingPlugin")] 68 | private static extern uint GetPresentFlags(); 69 | 70 | [DllImport("RenderingPlugin")] 71 | private static extern uint GetBackBufferWidth(); 72 | 73 | [DllImport("RenderingPlugin")] 74 | private static extern uint GetSyncInterval(); 75 | 76 | [DllImport("RenderingPlugin")] 77 | private static extern uint GetBackBufferHeight(); 78 | 79 | private static RenderTexture renderTex; 80 | private static GameObject pluginInfo; 81 | 82 | private void CreateRenderTexture() 83 | { 84 | renderTex = new RenderTexture(256, 256, 16, RenderTextureFormat.ARGB32); 85 | renderTex.Create(); 86 | IntPtr nativeBufPTr = renderTex.colorBuffer.GetNativeRenderBufferPtr(); 87 | SetRenderTexture(nativeBufPTr); 88 | GameObject sphere = GameObject.Find("Sphere"); 89 | sphere.transform.rotation = Quaternion.Euler(0.0f, 180.0f, 0.0f); 90 | sphere.GetComponent().material.mainTexture = renderTex; 91 | } 92 | 93 | #else 94 | private void CreateRenderTexture() { } 95 | private void SetRenderTexture(IntPtr rb) { } 96 | #endif 97 | 98 | IEnumerator Start() 99 | { 100 | #if PLATFORM_SWITCH && !UNITY_EDITOR 101 | RegisterPlugin(); 102 | #endif 103 | 104 | if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12) 105 | { 106 | CreateRenderTexture(); 107 | } 108 | 109 | CreateTextureAndPassToPlugin(); 110 | SendMeshBuffersToPlugin(); 111 | yield return StartCoroutine("CallPluginAtEndOfFrames"); 112 | } 113 | 114 | void OnDisable() 115 | { 116 | if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12) 117 | { 118 | // Signals the plugin that renderTex will be destroyed 119 | SetRenderTexture(IntPtr.Zero); 120 | } 121 | } 122 | 123 | private void CreateTextureAndPassToPlugin() 124 | { 125 | // Create a texture 126 | Texture2D tex = new Texture2D(256, 256, TextureFormat.ARGB32, false); 127 | // Set point filtering just so we can see the pixels clearly 128 | tex.filterMode = FilterMode.Point; 129 | // Call Apply() so it's actually uploaded to the GPU 130 | tex.Apply(); 131 | 132 | // Set texture onto our material 133 | GetComponent().material.mainTexture = tex; 134 | 135 | // Pass texture pointer to the plugin 136 | SetTextureFromUnity(tex.GetNativeTexturePtr(), tex.width, tex.height); 137 | } 138 | 139 | private void SendMeshBuffersToPlugin() 140 | { 141 | var filter = GetComponent(); 142 | var mesh = filter.mesh; 143 | 144 | // This is equivalent to MeshVertex in RenderingPlugin.cpp 145 | var desiredVertexLayout = new[] 146 | { 147 | new VertexAttributeDescriptor(VertexAttribute.Position, VertexAttributeFormat.Float32, 3), 148 | new VertexAttributeDescriptor(VertexAttribute.Normal, VertexAttributeFormat.Float32, 3), 149 | new VertexAttributeDescriptor(VertexAttribute.Color, VertexAttributeFormat.Float32, 4), 150 | new VertexAttributeDescriptor(VertexAttribute.TexCoord0, VertexAttributeFormat.Float32, 2) 151 | }; 152 | 153 | // Let's be certain we'll get the vertex buffer layout we want in native code 154 | mesh.SetVertexBufferParams(mesh.vertexCount, desiredVertexLayout); 155 | 156 | // The plugin will want to modify the vertex buffer -- on many platforms 157 | // for that to work we have to mark mesh as "dynamic" (which makes the buffers CPU writable -- 158 | // by default they are immutable and only GPU-readable). 159 | mesh.MarkDynamic(); 160 | 161 | // However, mesh being dynamic also means that the CPU on most platforms can not 162 | // read from the vertex buffer. Our plugin also wants original mesh data, 163 | // so let's pass it as pointers to regular C# arrays. 164 | // This bit shows how to pass array pointers to native plugins without doing an expensive 165 | // copy: you have to get a GCHandle, and get raw address of that. 166 | var vertices = mesh.vertices; 167 | var normals = mesh.normals; 168 | var uvs = mesh.uv; 169 | GCHandle gcVertices = GCHandle.Alloc(vertices, GCHandleType.Pinned); 170 | GCHandle gcNormals = GCHandle.Alloc(normals, GCHandleType.Pinned); 171 | GCHandle gcUV = GCHandle.Alloc(uvs, GCHandleType.Pinned); 172 | 173 | SetMeshBuffersFromUnity(mesh.GetNativeVertexBufferPtr(0), mesh.vertexCount, gcVertices.AddrOfPinnedObject(), gcNormals.AddrOfPinnedObject(), gcUV.AddrOfPinnedObject()); 174 | 175 | gcVertices.Free(); 176 | gcNormals.Free(); 177 | gcUV.Free(); 178 | } 179 | 180 | // custom "time" for deterministic results 181 | int updateTimeCounter = 0; 182 | 183 | private IEnumerator CallPluginAtEndOfFrames() 184 | { 185 | while (true) 186 | { 187 | // Wait until all frame rendering is done 188 | yield return new WaitForEndOfFrame(); 189 | 190 | // Set time for the plugin 191 | // Unless it is D3D12 whose renderer is allowed to overlap with the next frame update and would cause instabilities due to no synchronization. 192 | // On Switch, with multithreaded mode, setting the time for frame 1 may overlap with the render thread calling the plugin event for frame 0 resulting in the plugin writing data for frame 1 at frame 0. 193 | if (SystemInfo.graphicsDeviceType != GraphicsDeviceType.Direct3D12 && SystemInfo.graphicsDeviceType != GraphicsDeviceType.Switch) 194 | { 195 | ++updateTimeCounter; 196 | SetTimeFromUnity((float)updateTimeCounter * 0.016f); 197 | } 198 | 199 | // Issue a plugin event with arbitrary integer identifier. 200 | // The plugin can distinguish between different 201 | // things it needs to do based on this ID. 202 | // On some backends the choice of eventID matters e.g on DX12 where 203 | // eventID == 1 means the plugin callback will be called from the render thread 204 | // and eventID == 2 means the callback is called from the submission thread 205 | GL.IssuePluginEvent(GetRenderEventFunc(), 1); 206 | 207 | if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12) 208 | { 209 | GL.IssuePluginEvent(GetRenderEventFunc(), 2); 210 | } 211 | } 212 | } 213 | } 214 | -------------------------------------------------------------------------------- /UnityProject/Assets/UseRenderingPlugin.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1ad34d2576df73428a8586fc566c6cb 3 | MonoImporter: 4 | importerVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | -------------------------------------------------------------------------------- /UnityProject/Assets/scene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c159f2591a9b5c843b0a0442451f78f8 3 | -------------------------------------------------------------------------------- /UnityProject/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.2d.sprite": "1.0.0", 4 | "com.unity.2d.tilemap": "1.0.0", 5 | "com.unity.ai.navigation": "1.1.4", 6 | "com.unity.ide.rider": "3.0.24", 7 | "com.unity.ide.visualstudio": "2.0.18", 8 | "com.unity.test-framework": "1.3.9", 9 | "com.unity.textmeshpro": "3.0.6", 10 | "com.unity.timeline": "1.8.2", 11 | "com.unity.ugui": "1.0.0", 12 | "com.unity.xr.legacyinputhelpers": "2.1.10", 13 | "com.unity.modules.ai": "1.0.0", 14 | "com.unity.modules.androidjni": "1.0.0", 15 | "com.unity.modules.animation": "1.0.0", 16 | "com.unity.modules.assetbundle": "1.0.0", 17 | "com.unity.modules.audio": "1.0.0", 18 | "com.unity.modules.cloth": "1.0.0", 19 | "com.unity.modules.director": "1.0.0", 20 | "com.unity.modules.imageconversion": "1.0.0", 21 | "com.unity.modules.imgui": "1.0.0", 22 | "com.unity.modules.jsonserialize": "1.0.0", 23 | "com.unity.modules.particlesystem": "1.0.0", 24 | "com.unity.modules.physics": "1.0.0", 25 | "com.unity.modules.physics2d": "1.0.0", 26 | "com.unity.modules.screencapture": "1.0.0", 27 | "com.unity.modules.terrain": "1.0.0", 28 | "com.unity.modules.terrainphysics": "1.0.0", 29 | "com.unity.modules.tilemap": "1.0.0", 30 | "com.unity.modules.ui": "1.0.0", 31 | "com.unity.modules.uielements": "1.0.0", 32 | "com.unity.modules.umbra": "1.0.0", 33 | "com.unity.modules.unityanalytics": "1.0.0", 34 | "com.unity.modules.unitywebrequest": "1.0.0", 35 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 36 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 37 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 38 | "com.unity.modules.unitywebrequestwww": "1.0.0", 39 | "com.unity.modules.vehicles": "1.0.0", 40 | "com.unity.modules.video": "1.0.0", 41 | "com.unity.modules.vr": "1.0.0", 42 | "com.unity.modules.wind": "1.0.0", 43 | "com.unity.modules.xr": "1.0.0" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | m_SpeedOfSound: 347 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_DSPBufferSize: 0 12 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | m_Gravity: {x: 0, y: -9.81000042, z: 0} 7 | m_DefaultMaterial: {fileID: 0} 8 | m_BounceThreshold: 2 9 | m_SleepVelocity: .150000006 10 | m_SleepAngularVelocity: .140000001 11 | m_MaxAngularVelocity: 7 12 | m_MinPenetrationForPenalty: .00999999978 13 | m_SolverIterationCount: 6 14 | m_RaycastsHitTriggers: 1 15 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 16 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/scene.unity 10 | guid: c159f2591a9b5c843b0a0442451f78f8 11 | m_configObjects: {} 12 | m_UseUCBPForAssetBundles: 0 13 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_WebSecurityEmulationEnabled: 0 10 | m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d 11 | m_DefaultBehaviorMode: 0 12 | m_SpritePackerMode: 2 13 | m_SpritePackerPaddingPower: 1 14 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 15 | m_ProjectGenerationRootNamespace: 16 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_SpritesDefault: 32 | m_Mode: 1 33 | m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 34 | m_AlwaysIncludedShaders: 35 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 40 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 41 | m_PreloadedShaders: [] 42 | m_ShaderSettings_Tier1: 43 | useCascadedShadowMaps: 0 44 | useSinglePassStereoRendering: 0 45 | standardShaderQuality: 0 46 | useReflectionProbeBoxProjection: 0 47 | useReflectionProbeBlending: 0 48 | m_ShaderSettings_Tier2: 49 | useCascadedShadowMaps: 1 50 | useSinglePassStereoRendering: 0 51 | standardShaderQuality: 2 52 | useReflectionProbeBoxProjection: 1 53 | useReflectionProbeBlending: 1 54 | m_ShaderSettings_Tier3: 55 | useCascadedShadowMaps: 1 56 | useSinglePassStereoRendering: 0 57 | standardShaderQuality: 2 58 | useReflectionProbeBoxProjection: 1 59 | useReflectionProbeBlending: 1 60 | m_BuildTargetShaderSettings: [] 61 | m_LightmapStripping: 0 62 | m_FogStripping: 0 63 | m_LightmapKeepPlain: 1 64 | m_LightmapKeepDirCombined: 1 65 | m_LightmapKeepDirSeparate: 1 66 | m_LightmapKeepDynamicPlain: 1 67 | m_LightmapKeepDynamicDirCombined: 1 68 | m_LightmapKeepDynamicDirSeparate: 1 69 | m_FogKeepLinear: 1 70 | m_FogKeepExp: 1 71 | m_FogKeepExp2: 1 72 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | m_Axes: 7 | - serializedVersion: 3 8 | m_Name: Horizontal 9 | descriptiveName: 10 | descriptiveNegativeName: 11 | negativeButton: left 12 | positiveButton: right 13 | altNegativeButton: a 14 | altPositiveButton: d 15 | gravity: 3 16 | dead: .00100000005 17 | sensitivity: 3 18 | snap: 1 19 | invert: 0 20 | type: 0 21 | axis: 0 22 | joyNum: 0 23 | - serializedVersion: 3 24 | m_Name: Vertical 25 | descriptiveName: 26 | descriptiveNegativeName: 27 | negativeButton: down 28 | positiveButton: up 29 | altNegativeButton: s 30 | altPositiveButton: w 31 | gravity: 3 32 | dead: .00100000005 33 | sensitivity: 3 34 | snap: 1 35 | invert: 0 36 | type: 0 37 | axis: 0 38 | joyNum: 0 39 | - serializedVersion: 3 40 | m_Name: Fire1 41 | descriptiveName: 42 | descriptiveNegativeName: 43 | negativeButton: 44 | positiveButton: left ctrl 45 | altNegativeButton: 46 | altPositiveButton: mouse 0 47 | gravity: 1000 48 | dead: .00100000005 49 | sensitivity: 1000 50 | snap: 0 51 | invert: 0 52 | type: 0 53 | axis: 0 54 | joyNum: 0 55 | - serializedVersion: 3 56 | m_Name: Fire2 57 | descriptiveName: 58 | descriptiveNegativeName: 59 | negativeButton: 60 | positiveButton: left alt 61 | altNegativeButton: 62 | altPositiveButton: mouse 1 63 | gravity: 1000 64 | dead: .00100000005 65 | sensitivity: 1000 66 | snap: 0 67 | invert: 0 68 | type: 0 69 | axis: 0 70 | joyNum: 0 71 | - serializedVersion: 3 72 | m_Name: Fire3 73 | descriptiveName: 74 | descriptiveNegativeName: 75 | negativeButton: 76 | positiveButton: left cmd 77 | altNegativeButton: 78 | altPositiveButton: mouse 2 79 | gravity: 1000 80 | dead: .00100000005 81 | sensitivity: 1000 82 | snap: 0 83 | invert: 0 84 | type: 0 85 | axis: 0 86 | joyNum: 0 87 | - serializedVersion: 3 88 | m_Name: Jump 89 | descriptiveName: 90 | descriptiveNegativeName: 91 | negativeButton: 92 | positiveButton: space 93 | altNegativeButton: 94 | altPositiveButton: 95 | gravity: 1000 96 | dead: .00100000005 97 | sensitivity: 1000 98 | snap: 0 99 | invert: 0 100 | type: 0 101 | axis: 0 102 | joyNum: 0 103 | - serializedVersion: 3 104 | m_Name: Mouse X 105 | descriptiveName: 106 | descriptiveNegativeName: 107 | negativeButton: 108 | positiveButton: 109 | altNegativeButton: 110 | altPositiveButton: 111 | gravity: 0 112 | dead: 0 113 | sensitivity: .100000001 114 | snap: 0 115 | invert: 0 116 | type: 1 117 | axis: 0 118 | joyNum: 0 119 | - serializedVersion: 3 120 | m_Name: Mouse Y 121 | descriptiveName: 122 | descriptiveNegativeName: 123 | negativeButton: 124 | positiveButton: 125 | altNegativeButton: 126 | altPositiveButton: 127 | gravity: 0 128 | dead: 0 129 | sensitivity: .100000001 130 | snap: 0 131 | invert: 0 132 | type: 1 133 | axis: 1 134 | joyNum: 0 135 | - serializedVersion: 3 136 | m_Name: Mouse ScrollWheel 137 | descriptiveName: 138 | descriptiveNegativeName: 139 | negativeButton: 140 | positiveButton: 141 | altNegativeButton: 142 | altPositiveButton: 143 | gravity: 0 144 | dead: 0 145 | sensitivity: .100000001 146 | snap: 0 147 | invert: 0 148 | type: 1 149 | axis: 2 150 | joyNum: 0 151 | - serializedVersion: 3 152 | m_Name: Window Shake X 153 | descriptiveName: 154 | descriptiveNegativeName: 155 | negativeButton: 156 | positiveButton: 157 | altNegativeButton: 158 | altPositiveButton: 159 | gravity: 0 160 | dead: 0 161 | sensitivity: .100000001 162 | snap: 0 163 | invert: 0 164 | type: 3 165 | axis: 0 166 | joyNum: 0 167 | - serializedVersion: 3 168 | m_Name: Window Shake Y 169 | descriptiveName: 170 | descriptiveNegativeName: 171 | negativeButton: 172 | positiveButton: 173 | altNegativeButton: 174 | altPositiveButton: 175 | gravity: 0 176 | dead: 0 177 | sensitivity: .100000001 178 | snap: 0 179 | invert: 0 180 | type: 3 181 | axis: 1 182 | joyNum: 0 183 | - serializedVersion: 3 184 | m_Name: Horizontal 185 | descriptiveName: 186 | descriptiveNegativeName: 187 | negativeButton: 188 | positiveButton: 189 | altNegativeButton: 190 | altPositiveButton: 191 | gravity: 0 192 | dead: .189999998 193 | sensitivity: 1 194 | snap: 0 195 | invert: 0 196 | type: 2 197 | axis: 0 198 | joyNum: 0 199 | - serializedVersion: 3 200 | m_Name: Vertical 201 | descriptiveName: 202 | descriptiveNegativeName: 203 | negativeButton: 204 | positiveButton: 205 | altNegativeButton: 206 | altPositiveButton: 207 | gravity: 0 208 | dead: .189999998 209 | sensitivity: 1 210 | snap: 0 211 | invert: 1 212 | type: 2 213 | axis: 1 214 | joyNum: 0 215 | - serializedVersion: 3 216 | m_Name: Fire1 217 | descriptiveName: 218 | descriptiveNegativeName: 219 | negativeButton: 220 | positiveButton: joystick button 0 221 | altNegativeButton: 222 | altPositiveButton: 223 | gravity: 1000 224 | dead: .00100000005 225 | sensitivity: 1000 226 | snap: 0 227 | invert: 0 228 | type: 0 229 | axis: 0 230 | joyNum: 0 231 | - serializedVersion: 3 232 | m_Name: Fire2 233 | descriptiveName: 234 | descriptiveNegativeName: 235 | negativeButton: 236 | positiveButton: joystick button 1 237 | altNegativeButton: 238 | altPositiveButton: 239 | gravity: 1000 240 | dead: .00100000005 241 | sensitivity: 1000 242 | snap: 0 243 | invert: 0 244 | type: 0 245 | axis: 0 246 | joyNum: 0 247 | - serializedVersion: 3 248 | m_Name: Fire3 249 | descriptiveName: 250 | descriptiveNegativeName: 251 | negativeButton: 252 | positiveButton: joystick button 2 253 | altNegativeButton: 254 | altPositiveButton: 255 | gravity: 1000 256 | dead: .00100000005 257 | sensitivity: 1000 258 | snap: 0 259 | invert: 0 260 | type: 0 261 | axis: 0 262 | joyNum: 0 263 | - serializedVersion: 3 264 | m_Name: Jump 265 | descriptiveName: 266 | descriptiveNegativeName: 267 | negativeButton: 268 | positiveButton: joystick button 3 269 | altNegativeButton: 270 | altPositiveButton: 271 | gravity: 1000 272 | dead: .00100000005 273 | sensitivity: 1000 274 | snap: 0 275 | invert: 0 276 | type: 0 277 | axis: 0 278 | joyNum: 0 279 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshLayers: 5 | m_ObjectHideFlags: 0 6 | Built-in Layer 0: 7 | name: Default 8 | cost: 1 9 | editType: 2 10 | Built-in Layer 1: 11 | name: Not Walkable 12 | cost: 1 13 | editType: 0 14 | Built-in Layer 2: 15 | name: Jump 16 | cost: 2 17 | editType: 2 18 | User Layer 0: 19 | name: 20 | cost: 1 21 | editType: 3 22 | User Layer 1: 23 | name: 24 | cost: 1 25 | editType: 3 26 | User Layer 2: 27 | name: 28 | cost: 1 29 | editType: 3 30 | User Layer 3: 31 | name: 32 | cost: 1 33 | editType: 3 34 | User Layer 4: 35 | name: 36 | cost: 1 37 | editType: 3 38 | User Layer 5: 39 | name: 40 | cost: 1 41 | editType: 3 42 | User Layer 6: 43 | name: 44 | cost: 1 45 | editType: 3 46 | User Layer 7: 47 | name: 48 | cost: 1 49 | editType: 3 50 | User Layer 8: 51 | name: 52 | cost: 1 53 | editType: 3 54 | User Layer 9: 55 | name: 56 | cost: 1 57 | editType: 3 58 | User Layer 10: 59 | name: 60 | cost: 1 61 | editType: 3 62 | User Layer 11: 63 | name: 64 | cost: 1 65 | editType: 3 66 | User Layer 12: 67 | name: 68 | cost: 1 69 | editType: 3 70 | User Layer 13: 71 | name: 72 | cost: 1 73 | editType: 3 74 | User Layer 14: 75 | name: 76 | cost: 1 77 | editType: 3 78 | User Layer 15: 79 | name: 80 | cost: 1 81 | editType: 3 82 | User Layer 16: 83 | name: 84 | cost: 1 85 | editType: 3 86 | User Layer 17: 87 | name: 88 | cost: 1 89 | editType: 3 90 | User Layer 18: 91 | name: 92 | cost: 1 93 | editType: 3 94 | User Layer 19: 95 | name: 96 | cost: 1 97 | editType: 3 98 | User Layer 20: 99 | name: 100 | cost: 1 101 | editType: 3 102 | User Layer 21: 103 | name: 104 | cost: 1 105 | editType: 3 106 | User Layer 22: 107 | name: 108 | cost: 1 109 | editType: 3 110 | User Layer 23: 111 | name: 112 | cost: 1 113 | editType: 3 114 | User Layer 24: 115 | name: 116 | cost: 1 117 | editType: 3 118 | User Layer 25: 119 | name: 120 | cost: 1 121 | editType: 3 122 | User Layer 26: 123 | name: 124 | cost: 1 125 | editType: 3 126 | User Layer 27: 127 | name: 128 | cost: 1 129 | editType: 3 130 | User Layer 28: 131 | name: 132 | cost: 1 133 | editType: 3 134 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/NavMeshLayers.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshLayers: 5 | m_ObjectHideFlags: 0 6 | Built-in Layer 0: 7 | name: Default 8 | cost: 1 9 | editType: 2 10 | Built-in Layer 1: 11 | name: Not Walkable 12 | cost: 1 13 | editType: 0 14 | Built-in Layer 2: 15 | name: Jump 16 | cost: 2 17 | editType: 2 18 | User Layer 0: 19 | name: 20 | cost: 1 21 | editType: 3 22 | User Layer 1: 23 | name: 24 | cost: 1 25 | editType: 3 26 | User Layer 2: 27 | name: 28 | cost: 1 29 | editType: 3 30 | User Layer 3: 31 | name: 32 | cost: 1 33 | editType: 3 34 | User Layer 4: 35 | name: 36 | cost: 1 37 | editType: 3 38 | User Layer 5: 39 | name: 40 | cost: 1 41 | editType: 3 42 | User Layer 6: 43 | name: 44 | cost: 1 45 | editType: 3 46 | User Layer 7: 47 | name: 48 | cost: 1 49 | editType: 3 50 | User Layer 8: 51 | name: 52 | cost: 1 53 | editType: 3 54 | User Layer 9: 55 | name: 56 | cost: 1 57 | editType: 3 58 | User Layer 10: 59 | name: 60 | cost: 1 61 | editType: 3 62 | User Layer 11: 63 | name: 64 | cost: 1 65 | editType: 3 66 | User Layer 12: 67 | name: 68 | cost: 1 69 | editType: 3 70 | User Layer 13: 71 | name: 72 | cost: 1 73 | editType: 3 74 | User Layer 14: 75 | name: 76 | cost: 1 77 | editType: 3 78 | User Layer 15: 79 | name: 80 | cost: 1 81 | editType: 3 82 | User Layer 16: 83 | name: 84 | cost: 1 85 | editType: 3 86 | User Layer 17: 87 | name: 88 | cost: 1 89 | editType: 3 90 | User Layer 18: 91 | name: 92 | cost: 1 93 | editType: 3 94 | User Layer 19: 95 | name: 96 | cost: 1 97 | editType: 3 98 | User Layer 20: 99 | name: 100 | cost: 1 101 | editType: 3 102 | User Layer 21: 103 | name: 104 | cost: 1 105 | editType: 3 106 | User Layer 22: 107 | name: 108 | cost: 1 109 | editType: 3 110 | User Layer 23: 111 | name: 112 | cost: 1 113 | editType: 3 114 | User Layer 24: 115 | name: 116 | cost: 1 117 | editType: 3 118 | User Layer 25: 119 | name: 120 | cost: 1 121 | editType: 3 122 | User Layer 26: 123 | name: 124 | cost: 1 125 | editType: 3 126 | User Layer 27: 127 | name: 128 | cost: 1 129 | editType: 3 130 | User Layer 28: 131 | name: 132 | cost: 1 133 | editType: 3 134 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_MinPenetrationForPenalty: 0.01 17 | m_BaumgarteScale: 0.2 18 | m_BaumgarteTimeOfImpactScale: 0.75 19 | m_TimeToSleep: 0.5 20 | m_LinearSleepTolerance: 0.01 21 | m_AngularSleepTolerance: 2 22 | m_QueriesHitTriggers: 1 23 | m_QueriesStartInColliders: 1 24 | m_ChangeStopsCallbacks: 0 25 | m_AlwaysShowColliders: 0 26 | m_ShowColliderSleep: 1 27 | m_ShowColliderContacts: 0 28 | m_ContactArrowScale: 0.2 29 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 30 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 31 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 32 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 33 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: [] 7 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2023.1.15f1 2 | m_EditorVersionWithRevision: 2023.1.15f1 (831263a4172c) 3 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 0 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Good 11 | pixelLightCount: 2 12 | shadows: 2 13 | shadowResolution: 1 14 | shadowProjection: 1 15 | shadowCascades: 2 16 | shadowDistance: 20 17 | shadowNearPlaneOffset: 2 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | blendWeights: 2 21 | textureQuality: 0 22 | anisotropicTextures: 1 23 | antiAliasing: 0 24 | softParticles: 0 25 | softVegetation: 1 26 | realtimeReflectionProbes: 1 27 | billboardsFaceCameraPosition: 1 28 | vSyncCount: 1 29 | lodBias: 1 30 | maximumLODLevel: 0 31 | particleRaycastBudget: 256 32 | asyncUploadTimeSlice: 2 33 | asyncUploadBufferSize: 4 34 | excludedTargetPlatforms: [] 35 | m_PerPlatformDefaultQuality: 36 | Android: 0 37 | FlashPlayer: 0 38 | GLES Emulation: 0 39 | PS3: 0 40 | Standalone: 0 41 | Web: 0 42 | Wii: 0 43 | XBOX360: 0 44 | iPhone: 0 45 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | tags: 6 | - 7 | Builtin Layer 0: Default 8 | Builtin Layer 1: TransparentFX 9 | Builtin Layer 2: Ignore Raycast 10 | Builtin Layer 3: 11 | Builtin Layer 4: Water 12 | Builtin Layer 5: 13 | Builtin Layer 6: 14 | Builtin Layer 7: 15 | User Layer 8: 16 | User Layer 9: 17 | User Layer 10: 18 | User Layer 11: 19 | User Layer 12: 20 | User Layer 13: 21 | User Layer 14: 22 | User Layer 15: 23 | User Layer 16: 24 | User Layer 17: 25 | User Layer 18: 26 | User Layer 19: 27 | User Layer 20: 28 | User Layer 21: 29 | User Layer 22: 30 | User Layer 23: 31 | User Layer 24: 32 | User Layer 25: 33 | User Layer 26: 34 | User Layer 27: 35 | User Layer 28: 36 | User Layer 29: 37 | User Layer 30: 38 | User Layer 31: 39 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: .0199999996 7 | Maximum Allowed Timestep: .333333343 8 | m_TimeScale: 1 9 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 0 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 0 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | --------------------------------------------------------------------------------