diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2017-11-13 04:14:15 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2017-11-13 04:14:15 +0000 |
| commit | 1b2530749ea3dc4937cdd7aa37e5a144e6d10183 (patch) | |
| tree | de2a77d6c8ce8a33c2b3070c66549f429e43a017 /unityplugin/GhostCubePlugin/PluginSource | |
| parent | Updated submodules (diff) | |
| download | DiligentEngine-1b2530749ea3dc4937cdd7aa37e5a144e6d10183.tar.gz DiligentEngine-1b2530749ea3dc4937cdd7aa37e5a144e6d10183.zip | |
Updated to version 2.1
Diffstat (limited to 'unityplugin/GhostCubePlugin/PluginSource')
29 files changed, 2241 insertions, 0 deletions
diff --git a/unityplugin/GhostCubePlugin/PluginSource/build/UWP/EngineRoot.props b/unityplugin/GhostCubePlugin/PluginSource/build/UWP/EngineRoot.props new file mode 100644 index 0000000..95f31c5 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/build/UWP/EngineRoot.props @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros"> + <ProjectRoot>..\..</ProjectRoot> + <EngineRoot>$(ProjectRoot)\..\..\..</EngineRoot> + <CoreRoot>$(EngineRoot)\diligentcore</CoreRoot> + <ToolsRoot>$(EngineRoot)\diligenttools</ToolsRoot> + </PropertyGroup> + <PropertyGroup /> + <ItemDefinitionGroup /> + <ItemGroup> + <BuildMacro Include="ProjectRoot"> + <Value>$(ProjectRoot)</Value> + </BuildMacro> + <BuildMacro Include="TerrainRoot"> + <Value>$(TerrainRoot)</Value> + </BuildMacro> + <BuildMacro Include="EngineRoot"> + <Value>$(EngineRoot)</Value> + </BuildMacro> + <BuildMacro Include="CoreRoot"> + <Value>$(CoreRoot)</Value> + </BuildMacro> + <BuildMacro Include="ToolsRoot"> + <Value>$(ToolsRoot)</Value> + </BuildMacro> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/unityplugin/GhostCubePlugin/PluginSource/build/UWP/GhostCubePlugin.vcxproj b/unityplugin/GhostCubePlugin/PluginSource/build/UWP/GhostCubePlugin.vcxproj new file mode 100644 index 0000000..c374b65 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/build/UWP/GhostCubePlugin.vcxproj @@ -0,0 +1,282 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|ARM"> + <Configuration>Debug</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM"> + <Configuration>Release</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{0ba2f2ac-6c53-4ce5-aa37-9c6ded067096}</ProjectGuid> + <Keyword>DirectXApp</Keyword> + <RootNamespace>GhostCubePlugin</RootNamespace> + <DefaultLanguage>en-US</DefaultLanguage> + <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> + <AppContainerApplication>true</AppContainerApplication> + <ApplicationType>Windows Store</ApplicationType> + <WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion> + <WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion> + <ApplicationTypeRevision>10.0</ApplicationTypeRevision> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v140</PlatformToolset> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v140</PlatformToolset> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v140</PlatformToolset> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + <Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ImageContentTask.props" /> + <Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\MeshContentTask.props" /> + <Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ShaderGraphContentTask.props" /> + </ImportGroup> + <ImportGroup Label="Shared"> + <Import Project="..\Windows.Shared\GhostCubePlugin.Shared.vcxitems" Label="Shared" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\..\diligentcore\Shared\build\UWP\UWP_Win32Dbg.props" /> + <Import Project="EngineRoot.props" /> + <Import Project="..\Windows.Shared\GhostCubePlugin.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\..\diligentcore\Shared\build\UWP\UWP_Win32Rel.props" /> + <Import Project="EngineRoot.props" /> + <Import Project="..\Windows.Shared\GhostCubePlugin.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\..\diligentcore\Shared\build\UWP\UWP_ArmDbg.props" /> + <Import Project="EngineRoot.props" /> + <Import Project="..\Windows.Shared\GhostCubePlugin.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\..\diligentcore\Shared\build\UWP\UWP_ArmRel.props" /> + <Import Project="EngineRoot.props" /> + <Import Project="..\Windows.Shared\GhostCubePlugin.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\..\diligentcore\Shared\build\UWP\UWP_X64Dbg.props" /> + <Import Project="EngineRoot.props" /> + <Import Project="..\Windows.Shared\GhostCubePlugin.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\..\diligentcore\Shared\build\UWP\UWP_X64Rel.props" /> + <Import Project="EngineRoot.props" /> + <Import Project="..\Windows.Shared\GhostCubePlugin.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <PackageCertificateKeyFile>GhostCubePlugin_TemporaryKey.pfx</PackageCertificateKeyFile> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <Link> + <AdditionalDependencies>d3d12.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm</AdditionalLibraryDirectories> + <ModuleDefinitionFile>..\..\src\RenderingPlugin.def</ModuleDefinitionFile> + </Link> + <ClCompile> + <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> + <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile> + <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <PreprocessorDefinitions>WINDOWS_UWP;UNITY_METRO;_WINDLL;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <PostBuildEvent> + <Command>copy $(OutDir)$(TargetName).dll $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\ARM\$(ProjectName).dll +copy $(OutDir)$(TargetName).pdb $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\ARM\$(ProjectName).pdb</Command> + <Message>copying $(TargetName).dll and $(TargetName).pdb to $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\ARM</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <Link> + <AdditionalDependencies>d3d12.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm</AdditionalLibraryDirectories> + <ModuleDefinitionFile>..\..\src\RenderingPlugin.def</ModuleDefinitionFile> + </Link> + <ClCompile> + <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> + <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile> + <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <PreprocessorDefinitions>WINDOWS_UWP;UNITY_METRO;_WINDLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <PostBuildEvent> + <Command>copy $(OutDir)$(TargetName).dll $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\ARM\$(ProjectName).dll +copy $(OutDir)$(TargetName).pdb $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\ARM\$(ProjectName).pdb</Command> + <Message>copying $(TargetName).dll and $(TargetName).pdb to $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\ARM</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Link> + <AdditionalDependencies>d3d12.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib</AdditionalLibraryDirectories> + <ModuleDefinitionFile>..\..\src\RenderingPlugin.def</ModuleDefinitionFile> + </Link> + <ClCompile> + <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> + <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile> + <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <PreprocessorDefinitions>WINDOWS_UWP;UNITY_METRO;_WINDLL;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <PostBuildEvent> + <Command>copy $(OutDir)$(TargetName).dll $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\x86\$(ProjectName).dll +copy $(OutDir)$(TargetName).pdb $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\x86\$(ProjectName).pdb</Command> + <Message>copying $(TargetName).dll and $(TargetName).pdb to $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\x86</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Link> + <AdditionalDependencies>d3d12.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib</AdditionalLibraryDirectories> + <ModuleDefinitionFile>..\..\src\RenderingPlugin.def</ModuleDefinitionFile> + </Link> + <ClCompile> + <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> + <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile> + <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <PreprocessorDefinitions>WINDOWS_UWP;UNITY_METRO;_WINDLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <PostBuildEvent> + <Command>copy $(OutDir)$(TargetName).dll $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\x86\$(ProjectName).dll +copy $(OutDir)$(TargetName).pdb $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\x86\$(ProjectName).pdb</Command> + <Message>copying $(TargetName).dll and $(TargetName).pdb to $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\x86</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Link> + <AdditionalDependencies>d3d12.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64</AdditionalLibraryDirectories> + <ModuleDefinitionFile>..\..\src\RenderingPlugin.def</ModuleDefinitionFile> + </Link> + <ClCompile> + <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> + <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile> + <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <PreprocessorDefinitions>WINDOWS_UWP;UNITY_METRO;_WINDLL;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <PostBuildEvent> + <Command>copy $(OutDir)$(TargetName).dll $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\x64\$(ProjectName).dll +copy $(OutDir)$(TargetName).pdb $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\x64\$(ProjectName).pdb</Command> + <Message>copying $(TargetName).dll and $(TargetName).pdb to $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\x64</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Link> + <AdditionalDependencies>d3d12.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64</AdditionalLibraryDirectories> + <ModuleDefinitionFile>..\..\src\RenderingPlugin.def</ModuleDefinitionFile> + </Link> + <ClCompile> + <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> + <PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile> + <AdditionalIncludeDirectories>$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <PreprocessorDefinitions>WINDOWS_UWP;UNITY_METRO;_WINDLL;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <PostBuildEvent> + <Command>copy $(OutDir)$(TargetName).dll $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\x64\$(ProjectName).dll +copy $(OutDir)$(TargetName).pdb $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\x64\$(ProjectName).pdb</Command> + <Message>copying $(TargetName).dll and $(TargetName).pdb to $(ProjectRoot)\..\UnityProject\Assets\Plugins\Metro\UWP\x64</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\..\diligentcore\Common\build\UWP\Common.vcxproj"> + <Project>{6de3eb2b-8a56-4d27-8a39-587f7a70584c}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Graphics\GraphicsEngineD3D11\build\UWP\GraphicsEngineD3D11.vcxproj"> + <Project>{29acd2a7-4c49-4973-9673-8f57ef37070f}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Graphics\GraphicsEngineD3D12\build\UWP\GraphicsEngineD3D12.vcxproj"> + <Project>{1a5a1c1d-c717-4680-a929-40e6324fe048}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Graphics\GraphicsEngineD3DBase\build\UWP\GraphicsEngineD3DBase.vcxproj"> + <Project>{acd6f956-ff3b-4fe9-8be3-c0eecfdbbf93}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Graphics\GraphicsEngine\build\UWP\GraphicsEngine.vcxproj"> + <Project>{dfe6435d-cc9d-4ca1-bf4e-5640c522d815}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Graphics\GraphicsTools\build\UWP\GraphicsTools.vcxproj"> + <Project>{7a1a6e2c-3952-4a57-ad30-abd92aa39c69}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Platforms\Basic\build\UWP\BasicPlatform.vcxproj"> + <Project>{ff7d4949-dc3e-488b-8f78-1d32f1ca3b4c}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Platforms\UWP\build\UWP\UniversalWindowsPlatform.vcxproj"> + <Project>{91adc1dd-aa8e-492a-ac19-3e0dab9ad665}</Project> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <None Include="..\..\src\RenderingPlugin.def" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + <Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ImageContentTask.targets" /> + <Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\MeshContentTask.targets" /> + <Import Project="$(VSINSTALLDIR)\Common7\IDE\Extensions\Microsoft\VsGraphics\ShaderGraphContentTask.targets" /> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/unityplugin/GhostCubePlugin/PluginSource/build/UWP/GhostCubePlugin.vcxproj.filters b/unityplugin/GhostCubePlugin/PluginSource/build/UWP/GhostCubePlugin.vcxproj.filters new file mode 100644 index 0000000..26ca0eb --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/build/UWP/GhostCubePlugin.vcxproj.filters @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <None Include="..\..\src\RenderingPlugin.def" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/unityplugin/GhostCubePlugin/PluginSource/build/Win32/EngineRoot.props b/unityplugin/GhostCubePlugin/PluginSource/build/Win32/EngineRoot.props new file mode 100644 index 0000000..95f31c5 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/build/Win32/EngineRoot.props @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros"> + <ProjectRoot>..\..</ProjectRoot> + <EngineRoot>$(ProjectRoot)\..\..\..</EngineRoot> + <CoreRoot>$(EngineRoot)\diligentcore</CoreRoot> + <ToolsRoot>$(EngineRoot)\diligenttools</ToolsRoot> + </PropertyGroup> + <PropertyGroup /> + <ItemDefinitionGroup /> + <ItemGroup> + <BuildMacro Include="ProjectRoot"> + <Value>$(ProjectRoot)</Value> + </BuildMacro> + <BuildMacro Include="TerrainRoot"> + <Value>$(TerrainRoot)</Value> + </BuildMacro> + <BuildMacro Include="EngineRoot"> + <Value>$(EngineRoot)</Value> + </BuildMacro> + <BuildMacro Include="CoreRoot"> + <Value>$(CoreRoot)</Value> + </BuildMacro> + <BuildMacro Include="ToolsRoot"> + <Value>$(ToolsRoot)</Value> + </BuildMacro> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/unityplugin/GhostCubePlugin/PluginSource/build/Win32/GhostCubePlugin-Debug.vgdbsettings b/unityplugin/GhostCubePlugin/PluginSource/build/Win32/GhostCubePlugin-Debug.vgdbsettings new file mode 100644 index 0000000..3f5b24b --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/build/Win32/GhostCubePlugin-Debug.vgdbsettings @@ -0,0 +1,76 @@ +<?xml version="1.0"?> +<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <ConfigurationName>Debug</ConfigurationName> + <Project xsi:type="com.visualgdb.project.android"> + <CustomSourceDirectories> + <Directories /> + <PathStyle>MinGWWindowsSlash</PathStyle> + </CustomSourceDirectories> + <AndroidProjectPath>$(ProjectDir)</AndroidProjectPath> + </Project> + <Build xsi:type="com.visualgdb.build.android"> + <AndroidPlatform>android-19</AndroidPlatform> + <IsDebugConfiguration>true</IsDebugConfiguration> + <JNIOnlyBuild>true</JNIOnlyBuild> + <AdditionalDirectoriesToDeleteOnClean>bin;obj</AdditionalDirectoriesToDeleteOnClean> + <DeleteANTFilesOnClean>false</DeleteANTFilesOnClean> + <DoNotEditAndroidManifest>false</DoNotEditAndroidManifest> + <CustomActions /> + </Build> + <Debug xsi:type="com.visualgdb.debug.android"> + <AdditionalStartupCommands /> + <AdditionalGDBSettings> + <FilterSpuriousStoppedNotifications>false</FilterSpuriousStoppedNotifications> + <ForceSingleThreadedMode>false</ForceSingleThreadedMode> + <PendingBreakpointsSupported>true</PendingBreakpointsSupported> + <DisableChildRanges>false</DisableChildRanges> + <UseAppleExtensions>false</UseAppleExtensions> + <CanAcceptCommandsWhileRunning>false</CanAcceptCommandsWhileRunning> + <MakeLogFile>false</MakeLogFile> + <IgnoreModuleEventsWhileStepping>true</IgnoreModuleEventsWhileStepping> + <UseRelativePathsOnly>false</UseRelativePathsOnly> + <ExitAction>KillApp</ExitAction> + <Features> + <DisableAutoDetection>false</DisableAutoDetection> + <UseFrameParameter>false</UseFrameParameter> + <SimpleValuesFlagSupported>false</SimpleValuesFlagSupported> + <ListLocalsSupported>false</ListLocalsSupported> + <ByteLevelMemoryCommandsAvailable>false</ByteLevelMemoryCommandsAvailable> + <ThreadInfoSupported>false</ThreadInfoSupported> + <PendingBreakpointsSupported>false</PendingBreakpointsSupported> + <SupportTargetCommand>false</SupportTargetCommand> + </Features> + <DisableDisassembly>false</DisableDisassembly> + <ExamineMemoryWithXCommand>false</ExamineMemoryWithXCommand> + <StepIntoNewInstanceEntry>main</StepIntoNewInstanceEntry> + <ExamineRegistersInRawFormat>true</ExamineRegistersInRawFormat> + </AdditionalGDBSettings> + <LaunchGDBSettings xsi:type="GDBLaunchParametersAndroid" /> + <GenerateCtrlBreakInsteadOfCtrlC>false</GenerateCtrlBreakInsteadOfCtrlC> + <UseDefaultInstallDir>false</UseDefaultInstallDir> + <RemotePort>5039</RemotePort> + <LocalPort>5039</LocalPort> + <GDBServerStartupTimeout>10000</GDBServerStartupTimeout> + <AdditionalGDBServerStartupDelay>0</AdditionalGDBServerStartupDelay> + <DoubleSlashWorkaround>false</DoubleSlashWorkaround> + <AlreadyRunningDecision>Ask</AlreadyRunningDecision> + <ShowLogCat>true</ShowLogCat> + <EnableThreadNameWatcher>true</EnableThreadNameWatcher> + </Debug> + <CustomBuild> + <PreBuildActions /> + <PostBuildActions /> + <PreCleanActions /> + <PostCleanActions /> + </CustomBuild> + <CustomDebug> + <PreDebugActions /> + <PostDebugActions /> + <BreakMode>Default</BreakMode> + </CustomDebug> + <CustomShortcuts> + <Shortcuts /> + <ShowMessageAfterExecuting>true</ShowMessageAfterExecuting> + </CustomShortcuts> + <UserDefinedVariables /> +</VisualGDBProjectSettings2>
\ No newline at end of file diff --git a/unityplugin/GhostCubePlugin/PluginSource/build/Win32/GhostCubePlugin-Release.vgdbsettings b/unityplugin/GhostCubePlugin/PluginSource/build/Win32/GhostCubePlugin-Release.vgdbsettings new file mode 100644 index 0000000..669691f --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/build/Win32/GhostCubePlugin-Release.vgdbsettings @@ -0,0 +1,76 @@ +<?xml version="1.0"?> +<VisualGDBProjectSettings2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <ConfigurationName>Release</ConfigurationName> + <Project xsi:type="com.visualgdb.project.android"> + <CustomSourceDirectories> + <Directories /> + <PathStyle>MinGWWindowsSlash</PathStyle> + </CustomSourceDirectories> + <AndroidProjectPath>$(ProjectDir)</AndroidProjectPath> + </Project> + <Build xsi:type="com.visualgdb.build.android"> + <AndroidPlatform>android-19</AndroidPlatform> + <IsDebugConfiguration>false</IsDebugConfiguration> + <JNIOnlyBuild>true</JNIOnlyBuild> + <AdditionalDirectoriesToDeleteOnClean>bin;obj</AdditionalDirectoriesToDeleteOnClean> + <DeleteANTFilesOnClean>false</DeleteANTFilesOnClean> + <DoNotEditAndroidManifest>false</DoNotEditAndroidManifest> + <CustomActions /> + </Build> + <Debug xsi:type="com.visualgdb.debug.android"> + <AdditionalStartupCommands /> + <AdditionalGDBSettings> + <FilterSpuriousStoppedNotifications>false</FilterSpuriousStoppedNotifications> + <ForceSingleThreadedMode>false</ForceSingleThreadedMode> + <PendingBreakpointsSupported>true</PendingBreakpointsSupported> + <DisableChildRanges>false</DisableChildRanges> + <UseAppleExtensions>false</UseAppleExtensions> + <CanAcceptCommandsWhileRunning>false</CanAcceptCommandsWhileRunning> + <MakeLogFile>false</MakeLogFile> + <IgnoreModuleEventsWhileStepping>true</IgnoreModuleEventsWhileStepping> + <UseRelativePathsOnly>false</UseRelativePathsOnly> + <ExitAction>KillApp</ExitAction> + <Features> + <DisableAutoDetection>false</DisableAutoDetection> + <UseFrameParameter>false</UseFrameParameter> + <SimpleValuesFlagSupported>false</SimpleValuesFlagSupported> + <ListLocalsSupported>false</ListLocalsSupported> + <ByteLevelMemoryCommandsAvailable>false</ByteLevelMemoryCommandsAvailable> + <ThreadInfoSupported>false</ThreadInfoSupported> + <PendingBreakpointsSupported>false</PendingBreakpointsSupported> + <SupportTargetCommand>false</SupportTargetCommand> + </Features> + <DisableDisassembly>false</DisableDisassembly> + <ExamineMemoryWithXCommand>false</ExamineMemoryWithXCommand> + <StepIntoNewInstanceEntry>main</StepIntoNewInstanceEntry> + <ExamineRegistersInRawFormat>true</ExamineRegistersInRawFormat> + </AdditionalGDBSettings> + <LaunchGDBSettings xsi:type="GDBLaunchParametersAndroid" /> + <GenerateCtrlBreakInsteadOfCtrlC>false</GenerateCtrlBreakInsteadOfCtrlC> + <UseDefaultInstallDir>false</UseDefaultInstallDir> + <RemotePort>5039</RemotePort> + <LocalPort>5039</LocalPort> + <GDBServerStartupTimeout>10000</GDBServerStartupTimeout> + <AdditionalGDBServerStartupDelay>0</AdditionalGDBServerStartupDelay> + <DoubleSlashWorkaround>false</DoubleSlashWorkaround> + <AlreadyRunningDecision>Ask</AlreadyRunningDecision> + <ShowLogCat>true</ShowLogCat> + <EnableThreadNameWatcher>true</EnableThreadNameWatcher> + </Debug> + <CustomBuild> + <PreBuildActions /> + <PostBuildActions /> + <PreCleanActions /> + <PostCleanActions /> + </CustomBuild> + <CustomDebug> + <PreDebugActions /> + <PostDebugActions /> + <BreakMode>Default</BreakMode> + </CustomDebug> + <CustomShortcuts> + <Shortcuts /> + <ShowMessageAfterExecuting>true</ShowMessageAfterExecuting> + </CustomShortcuts> + <UserDefinedVariables /> +</VisualGDBProjectSettings2>
\ No newline at end of file diff --git a/unityplugin/GhostCubePlugin/PluginSource/build/Win32/GhostCubePlugin.vcxproj b/unityplugin/GhostCubePlugin/PluginSource/build/Win32/GhostCubePlugin.vcxproj new file mode 100644 index 0000000..4166510 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/build/Win32/GhostCubePlugin.vcxproj @@ -0,0 +1,255 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|ARM"> + <Configuration>Debug</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM"> + <Configuration>Release</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\..\diligentcore\Common\build\Win32\Common.vcxproj"> + <Project>{7380f7e6-315f-4b4e-92eb-e6aeee865298}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Graphics\GraphicsEngineD3D11\build\Win32\GraphicsEngineD3D11.vcxproj"> + <Project>{fe289cc7-15d6-4a76-b9cb-f61cab3192c9}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Graphics\GraphicsEngineD3D12\build\Win32\GraphicsEngineD3D12.vcxproj"> + <Project>{fff8071a-db82-485b-adc3-f0b675296869}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Graphics\GraphicsEngineD3DBase\build\Win32\GraphicsEngineD3DBase.vcxproj"> + <Project>{40fd58ed-aabc-4cbd-bee4-33116995a626}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Graphics\GraphicsEngineOpenGL\build\Win32\GraphicsEngineOpenGL.vcxproj"> + <Project>{15e346d3-fde6-4b29-88b7-fca14dada501}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Graphics\GraphicsEngine\build\Win32\GraphicsEngine.vcxproj"> + <Project>{052dd700-477c-4512-a7f4-b05ebef5c80e}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Graphics\GraphicsTools\build\Win32\GraphicsTools.vcxproj"> + <Project>{c6014499-0cf2-43ec-a773-a4e354fb2d74}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Graphics\HLSL2GLSLConverterLib\build\Win32\HLSL2GLSLConverterLib.vcxproj"> + <Project>{1a782154-a5bd-4a05-b837-efc77f126c84}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Platforms\Android\build\Windows\AndroidPlatform.vcxproj"> + <Project>{e333476e-15e3-4d43-a4cf-8748058b3be9}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Platforms\Basic\build\Win32\BasicPlatform.vcxproj"> + <Project>{8ada5f93-7a38-4ad8-b8f5-1ffd4d4f630c}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\..\diligentcore\Platforms\Win32\build\Win32\WindowsPlatform.vcxproj"> + <Project>{58f32677-436b-412a-bbf8-2b1310d82cd8}</Project> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <None Include="..\..\src\RenderingPlugin.def" /> + <None Include="jni\Android.mk" /> + <None Include="jni\Application.mk" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\RenderAPI.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\..\src\RenderAPI_OpenGLCoreES.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\..\src\RenderingPlugin.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\..\src\SamplePlugin.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + </ClCompile> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{EDA960FC-AA6C-44B3-8ABB-90765DA4D516}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>GhostCubePlugin</RootNamespace> + <WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <PlatformToolset>v120</PlatformToolset> + <ConfigurationType>Makefile</ConfigurationType> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <PlatformToolset>v120</PlatformToolset> + <ConfigurationType>Makefile</ConfigurationType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + <Import Project="..\Windows.Shared\GhostCubePlugin.Shared.vcxitems" Label="Shared" Condition="Exists('..\Windows.Shared\GhostCubePlugin.Shared.vcxitems')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\..\diligentcore\Shared\build\Windows\Win32d.props" /> + <Import Project="EngineRoot.props" /> + <Import Project="..\Windows.Shared\GhostCubePlugin.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\..\diligentcore\Shared\build\Windows\Win64d.props" /> + <Import Project="EngineRoot.props" /> + <Import Project="..\Windows.Shared\GhostCubePlugin.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\..\diligentcore\Shared\build\Windows\Win32r.props" /> + <Import Project="EngineRoot.props" /> + <Import Project="..\Windows.Shared\GhostCubePlugin.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\..\diligentcore\Shared\build\Windows\Win64r.props" /> + <Import Project="EngineRoot.props" /> + <Import Project="..\Windows.Shared\GhostCubePlugin.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <Import Project="..\..\..\..\..\diligentcore\Shared\build\Windows\Android32d.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <Import Project="..\..\..\..\..\diligentcore\Shared\build\Windows\Android32r.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ModuleDefinitionFile>..\..\src\RenderingPlugin.def</ModuleDefinitionFile> + <AdditionalDependencies>dxgi.lib;d3d12.lib;d3d11.lib;d3dcompiler.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + <PostBuildEvent> + <Command>copy $(OutDir)$(TargetName).dll $(ProjectRoot)\..\UnityProject\Assets\Plugins\x86\$(ProjectName).dll +copy $(OutDir)$(TargetName).pdb $(ProjectRoot)\..\UnityProject\Assets\Plugins\x86\$(ProjectName).pdb</Command> + <Message>copying $(TargetName).dll and $(TargetName).pdb to $(ProjectRoot)\..\UnityProject\Assets\Plugins\x86</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ModuleDefinitionFile>..\..\src\RenderingPlugin.def</ModuleDefinitionFile> + <AdditionalDependencies>dxgi.lib;d3d12.lib;d3d11.lib;d3dcompiler.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + <PostBuildEvent> + <Command>copy $(OutDir)$(TargetName).dll $(ProjectRoot)\..\UnityProject\Assets\Plugins\x86_64\$(ProjectName).dll +copy $(OutDir)$(TargetName).pdb $(ProjectRoot)\..\UnityProject\Assets\Plugins\x86_64\$(ProjectName).pdb</Command> + <Message>copying $(TargetName).dll and $(TargetName).pdb to $(ProjectRoot)\..\UnityProject\Assets\Plugins\x86_64</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <ModuleDefinitionFile>..\..\src\RenderingPlugin.def</ModuleDefinitionFile> + <AdditionalDependencies>dxgi.lib;d3d12.lib;d3d11.lib;d3dcompiler.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + <PostBuildEvent> + <Command>copy $(OutDir)$(TargetName).dll $(ProjectRoot)\..\UnityProject\Assets\Plugins\x86\$(ProjectName).dll +copy $(OutDir)$(TargetName).pdb $(ProjectRoot)\..\UnityProject\Assets\Plugins\x86\$(ProjectName).pdb</Command> + <Message>copying $(TargetName).dll and $(TargetName).pdb to $(ProjectRoot)\..\UnityProject\Assets\Plugins\x86</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Windows</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <ModuleDefinitionFile>..\..\src\RenderingPlugin.def</ModuleDefinitionFile> + <AdditionalDependencies>dxgi.lib;d3d12.lib;d3d11.lib;d3dcompiler.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + <PostBuildEvent> + <Command>copy $(OutDir)$(TargetName).dll $(ProjectRoot)\..\UnityProject\Assets\Plugins\x86_64\$(ProjectName).dll +copy $(OutDir)$(TargetName).pdb $(ProjectRoot)\..\UnityProject\Assets\Plugins\x86_64\$(ProjectName).pdb</Command> + <Message>copying $(TargetName).dll and $(TargetName).pdb to $(ProjectRoot)\..\UnityProject\Assets\Plugins\x86_64</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/unityplugin/GhostCubePlugin/PluginSource/build/Win32/GhostCubePlugin.vcxproj.filters b/unityplugin/GhostCubePlugin/PluginSource/build/Win32/GhostCubePlugin.vcxproj.filters new file mode 100644 index 0000000..d6b075f --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/build/Win32/GhostCubePlugin.vcxproj.filters @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <None Include="..\..\src\RenderingPlugin.def" /> + <None Include="jni\Android.mk"> + <Filter>Android\jni</Filter> + </None> + <None Include="jni\Application.mk"> + <Filter>Android\jni</Filter> + </None> + </ItemGroup> + <ItemGroup> + <Filter Include="Android"> + <UniqueIdentifier>{11b4220e-29bf-4572-bee2-1fd8d75f0c48}</UniqueIdentifier> + </Filter> + <Filter Include="Android\src"> + <UniqueIdentifier>{f09afa4f-3ec1-407b-acef-eeded2cb895d}</UniqueIdentifier> + </Filter> + <Filter Include="Android\jni"> + <UniqueIdentifier>{c3a3aa9e-0f29-4329-92ef-929a34b932fb}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\RenderAPI.cpp"> + <Filter>Android\src</Filter> + </ClCompile> + <ClCompile Include="..\..\src\RenderAPI_OpenGLCoreES.cpp"> + <Filter>Android\src</Filter> + </ClCompile> + <ClCompile Include="..\..\src\RenderingPlugin.cpp"> + <Filter>Android\src</Filter> + </ClCompile> + <ClCompile Include="..\..\src\SamplePlugin.cpp"> + <Filter>Android\src</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/unityplugin/GhostCubePlugin/PluginSource/build/Win32/jni/Android.mk b/unityplugin/GhostCubePlugin/PluginSource/build/Win32/jni/Android.mk new file mode 100644 index 0000000..37ea10d --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/build/Win32/jni/Android.mk @@ -0,0 +1,80 @@ +# Android NDK project makefile autogenerated by Premake + +# Preamble +DEPENDENCY_PATH := $(call my-dir) +LOCAL_PATH := $(abspath $(DEPENDENCY_PATH)) +include $(CLEAR_VARS) + + +# Project configuration +LOCAL_MODULE := GhostCubePlugin +LOCAL_CFLAGS := -std=c++11 -DUSE_GL3_STUB=0 -DUNITY_ANDROID -fvisibility=hidden +LOCAL_CPP_FEATURES := exceptions rtti +LOCAL_STATIC_LIBRARIES += GraphicsEngineOpenGL_static-prebuilt GraphicsEngine-prebuilt HLSL2GLSLConverterLib-prebuilt AndroidPlatform-prebuilt BasicPlatform-prebuilt GraphicsTools-prebuilt Common-prebuilt +LOCAL_LDLIBS := -lGLESv3 -lEGL -llog -landroid + +# Include paths +PROJECT_ROOT := $(LOCAL_PATH)/../../.. +ENGINE_ROOT := $(PROJECT_ROOT)/../../.. +CORE_ROOT := $(ENGINE_ROOT)/diligentcore +LOCAL_C_INCLUDES := $(PROJECT_ROOT)/include $(PROJECT_ROOT)/interface + +# Source files +#VisualGDBAndroid: AutoUpdateSourcesInNextLine +LOCAL_SRC_FILES := ../../../src/RenderAPI.cpp ../../../src/RenderAPI_OpenGLCoreES.cpp ../../../src/RenderingPlugin.cpp ../../../src/SamplePlugin.cpp + +#VisualGDBAndroid: VSExcludeListLocation +VISUALGDB_VS_EXCLUDED_FILES_Release := ../../../src/DLLMain.cpp ../../../src/GLContextWindows.cpp +VISUALGDB_VS_EXCLUDED_FILES_Debug := +LOCAL_SRC_FILES := $(filter-out $(VISUALGDB_VS_EXCLUDED_FILES_$(VGDB_VSCONFIG)),$(LOCAL_SRC_FILES)) + +include $(BUILD_SHARED_LIBRARY) + +include $(CLEAR_VARS) +# Declare pre-built Common library +LOCAL_MODULE := Common-prebuilt +LOCAL_EXPORT_C_INCLUDES := $(CORE_ROOT)/Common/include $(CORE_ROOT)/Common/interface +LOCAL_SRC_FILES := $(CORE_ROOT)/Common/build/Win32/obj/local/$(TARGET_ARCH_ABI)/libCommon.a +include $(PREBUILT_STATIC_LIBRARY) + + +include $(CLEAR_VARS) +# Declare pre-built AndroidPlatform library +LOCAL_MODULE := AndroidPlatform-prebuilt +LOCAL_SRC_FILES := $(CORE_ROOT)/Platforms/Android/build/Windows/obj/local/$(TARGET_ARCH_ABI)/libAndroidPlatform.a +LOCAL_EXPORT_C_INCLUDES := $(CORE_ROOT)/Platforms/interface +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +# Declare pre-built BasicPlatform library +LOCAL_MODULE := BasicPlatform-prebuilt +LOCAL_SRC_FILES := $(CORE_ROOT)/Platforms/Basic/build/Win32/obj/local/$(TARGET_ARCH_ABI)/libBasicPlatform.a +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +# Declare pre-built GraphicsEngine library +LOCAL_MODULE := GraphicsEngine-prebuilt +LOCAL_SRC_FILES := $(CORE_ROOT)/Graphics/GraphicsEngine/build/Win32/obj/local/$(TARGET_ARCH_ABI)/libGraphicsEngine.a +LOCAL_EXPORT_C_INCLUDES := $(CORE_ROOT)/Graphics/GraphicsEngine/include $(CORE_ROOT)/Graphics/GraphicsEngine/interface +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +# Declare pre-built Graphics Tools library +LOCAL_MODULE := GraphicsTools-prebuilt +LOCAL_SRC_FILES := $(CORE_ROOT)/Graphics/GraphicsTools/build/Win32/obj/local/$(TARGET_ARCH_ABI)/libGraphicsTools.a +LOCAL_EXPORT_C_INCLUDES := $(CORE_ROOT)/Graphics/GraphicsTools/include +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +# Declare pre-built HLSL2GLSLConverterLib library +LOCAL_MODULE := HLSL2GLSLConverterLib-prebuilt +LOCAL_SRC_FILES := $(CORE_ROOT)/Graphics/HLSL2GLSLConverterLib/build/Win32/obj/local/$(TARGET_ARCH_ABI)/libHLSL2GLSLConverterLib.a +LOCAL_EXPORT_C_INCLUDES := $(CORE_ROOT)/Graphics/HLSL2GLSLConverterLib/include $(CORE_ROOT)/Graphics/HLSL2GLSLConverterLib/interface +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +# Declare pre-built GraphicsEngineOpenGL library +LOCAL_MODULE := GraphicsEngineOpenGL_static-prebuilt +LOCAL_SRC_FILES := $(CORE_ROOT)/Graphics/GraphicsEngineOpenGL/build/Win32/obj/local/$(TARGET_ARCH_ABI)/libGraphicsEngineOpenGL.a +LOCAL_EXPORT_C_INCLUDES := $(CORE_ROOT)/Graphics/GraphicsEngineOpenGL/interface +include $(PREBUILT_STATIC_LIBRARY) diff --git a/unityplugin/GhostCubePlugin/PluginSource/build/Win32/jni/Application.mk b/unityplugin/GhostCubePlugin/PluginSource/build/Win32/jni/Application.mk new file mode 100644 index 0000000..2a28528 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/build/Win32/jni/Application.mk @@ -0,0 +1,7 @@ +# Generated by VisualGDB + +DEPENDENCY_PATH := $(call my-dir) +LOCAL_PATH := $(abspath $(DEPENDENCY_PATH)) +include $(LOCAL_PATH)/../../../../../../diligentcore/Common/make/AppCommon.mk + +APP_MODULES := GhostCubePlugin
\ No newline at end of file diff --git a/unityplugin/GhostCubePlugin/PluginSource/build/Windows.Shared/GhostCubePlugin.Shared.vcxitems b/unityplugin/GhostCubePlugin/PluginSource/build/Windows.Shared/GhostCubePlugin.Shared.vcxitems new file mode 100644 index 0000000..6cda2ea --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/build/Windows.Shared/GhostCubePlugin.Shared.vcxitems @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup Label="Globals"> + <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> + <HasSharedItems>true</HasSharedItems> + <ItemsProjectGuid>{27b0c157-0a7a-46b0-aed3-919e7af5ef4b}</ItemsProjectGuid> + <ItemsRootNamespace>TerrainCore</ItemsRootNamespace> + <ItemsProjectName>GhostCubePlugin.Shared</ItemsProjectName> + <CodeSharingProject>248F659F-DAC5-46E8-AC09-60EC9FC95053</CodeSharingProject> + </PropertyGroup> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)</AdditionalIncludeDirectories> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup> + <ProjectCapability Include="SourceItemsFromImports" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\PlatformBase.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\RenderAPI.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\SamplePlugin.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\Unity\IUnityGraphics.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\Unity\IUnityGraphicsD3D11.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\Unity\IUnityGraphicsD3D12.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\Unity\IUnityGraphicsD3D9.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\Unity\IUnityGraphicsMetal.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\Unity\IUnityInterface.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\RenderAPI.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\RenderAPI_D3D11.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\RenderAPI_D3D12.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\RenderAPI_OpenGLCoreES.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\RenderingPlugin.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\SamplePlugin.cpp" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/unityplugin/GhostCubePlugin/PluginSource/build/Windows.Shared/GhostCubePlugin.Shared.vcxitems.filters b/unityplugin/GhostCubePlugin/PluginSource/build/Windows.Shared/GhostCubePlugin.Shared.vcxitems.filters new file mode 100644 index 0000000..faac556 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/build/Windows.Shared/GhostCubePlugin.Shared.vcxitems.filters @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Unity"> + <UniqueIdentifier>{1cabdf31-0e7d-4669-8f9a-fe963ebfd442}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\Unity\IUnityGraphicsD3D12.h"> + <Filter>Unity</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\Unity\IUnityGraphicsMetal.h"> + <Filter>Unity</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\Unity\IUnityInterface.h"> + <Filter>Unity</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\Unity\IUnityGraphics.h"> + <Filter>Unity</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\Unity\IUnityGraphicsD3D9.h"> + <Filter>Unity</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\Unity\IUnityGraphicsD3D11.h"> + <Filter>Unity</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\PlatformBase.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\RenderAPI.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\src\SamplePlugin.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\RenderingPlugin.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\RenderAPI_D3D12.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\RenderAPI_OpenGLCoreES.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\RenderAPI.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\RenderAPI_D3D11.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\src\SamplePlugin.cpp" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/unityplugin/GhostCubePlugin/PluginSource/build/Windows.Shared/GhostCubePlugin.props b/unityplugin/GhostCubePlugin/PluginSource/build/Windows.Shared/GhostCubePlugin.props new file mode 100644 index 0000000..343679b --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/build/Windows.Shared/GhostCubePlugin.props @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <IncludePath>$(CoreRoot)\Graphics\GraphicsEngine\interface;$(CoreRoot)\Graphics\GraphicsEngineD3D11\interface;$(CoreRoot)\Graphics\GraphicsEngineD3D12\interface;$(CoreRoot)\Graphics\GraphicsEngineOpenGL\interface;$(CoreRoot)\Graphics\HLSL2GLSLConverterLib\interface;$(CoreRoot)\Common\include;$(CoreRoot)\Common\interface;$(CoreRoot)\Platforms\interface;$(CoreRoot)\Graphics\GraphicsTools\include;$(IncludePath)</IncludePath> + <OutDir>$(SolutionDir)\bin\DLLs\$(PlatformShortName)\</OutDir> + <TargetName>$(ProjectName)_$(ConfigSuffix)</TargetName> + </PropertyGroup> + <ItemDefinitionGroup> + <ClCompile> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + </ClCompile> + </ItemDefinitionGroup> + <ItemGroup /> +</Project>
\ No newline at end of file diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/PlatformBase.h b/unityplugin/GhostCubePlugin/PluginSource/src/PlatformBase.h new file mode 100644 index 0000000..b691136 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/PlatformBase.h @@ -0,0 +1,58 @@ +#pragma once + +// Standard base includes, defines that indicate our current platform, etc. + +#include <stddef.h> + + +// Which platform we are on? +// UNITY_WIN - Windows (regular win32) +// UNITY_OSX - Mac OS X +// UNITY_LINUX - Linux +// UNITY_IPHONE - iOS +// UNITY_ANDROID - Android +// UNITY_METRO - WSA or UWP +// UNITY_WEBGL - WebGL +#if _MSC_VER + #define UNITY_WIN 1 +#elif defined(__APPLE__) + #if defined(__arm__) || defined(__arm64__) + #define UNITY_IPHONE 1 + #else + #define UNITY_OSX 1 + #endif +#elif defined(UNITY_METRO) || defined(UNITY_ANDROID) || defined(UNITY_LINUX) || defined(UNITY_WEBGL) + // these are defined externally +#elif defined(__EMSCRIPTEN__) + // this is already defined in Unity 5.6 + #define UNITY_WEBGL 1 +#else + #error "Unknown platform!" +#endif + + + +// Which graphics device APIs we possibly support? +#if UNITY_METRO + #define SUPPORT_D3D11 1 + #if WINDOWS_UWP + #define SUPPORT_D3D12 1 + #endif +#elif UNITY_WIN + #define SUPPORT_D3D11 1 + #define SUPPORT_D3D12 1 + #define SUPPORT_OPENGL_UNIFIED 1 + #define SUPPORT_OPENGL_CORE 1 +#elif UNITY_IPHONE || UNITY_ANDROID || UNITY_WEBGL + #define SUPPORT_OPENGL_UNIFIED 1 + #define SUPPORT_OPENGL_ES 1 +#elif UNITY_OSX || UNITY_LINUX + #define SUPPORT_OPENGL_LEGACY 1 + #define SUPPORT_OPENGL_UNIFIED 1 + #define SUPPORT_OPENGL_CORE 1 +#endif + +#if UNITY_IPHONE || UNITY_OSX + #define SUPPORT_METAL 1 +#endif + diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI.cpp new file mode 100644 index 0000000..18278e7 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI.cpp @@ -0,0 +1,29 @@ +#include "RenderAPI.h" +#include "PlatformBase.h" +#include "Unity/IUnityGraphics.h" +#include "GraphicsUtilities.h" + +using namespace Diligent; + +void RenderAPI::CreateTextureViews(Diligent::ITexture *pRenderTarget, Diligent::ITexture *pDepthBuffer) +{ + m_RTV.Release(); + m_DSV.Release(); + { + const auto &RTDesc = pRenderTarget->GetDesc(); + TextureViewDesc RTVDesc; + RTVDesc.ViewType = TEXTURE_VIEW_RENDER_TARGET; + m_RenderTargetFormat = GetDefaultTextureViewFormat(RTDesc, TEXTURE_VIEW_RENDER_TARGET); + RTVDesc.Format = m_RenderTargetFormat; + pRenderTarget->CreateView(RTVDesc, &m_RTV); + } + + { + const auto &TexDesc = pDepthBuffer->GetDesc(); + TextureViewDesc DSVDesc; + DSVDesc.ViewType = TEXTURE_VIEW_DEPTH_STENCIL; + m_DepthBufferFormat = GetDefaultTextureViewFormat(TexDesc, TEXTURE_VIEW_DEPTH_STENCIL); + DSVDesc.Format = m_DepthBufferFormat; + pDepthBuffer->CreateView(DSVDesc, &m_DSV); + } +} diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI.h b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI.h new file mode 100644 index 0000000..8d80f6e --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI.h @@ -0,0 +1,51 @@ +#pragma once + +#include "Unity/IUnityGraphics.h" +#include "RenderDevice.h" +#include "DeviceContext.h" +#include "RefCntAutoPtr.h" + +struct IUnityInterfaces; + +class RenderAPI +{ +public: + virtual ~RenderAPI() { } + + // Process general event like initialization, shutdown, device loss/reset etc. + virtual void ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces) = 0; + + virtual void AttachToNativeRenderTexture(void *nativeRenderTargetHandle, void *nativeDepthTextureHandle) = 0; + + // Is the API using "reversed" (1.0 at near plane, 0.0 at far plane) depth buffer? + // Reversed Z is used on modern platforms, and improves depth buffer precision. + virtual bool GetUsesReverseZ() = 0; + + virtual void BeginRendering() {} + + virtual void EndRendering() + { + if (m_Context) + m_Context->InvalidateState(); + } + + virtual bool IsDX() = 0; + + Diligent::IRenderDevice *GetDevice() { return m_Device; } + Diligent::IDeviceContext *GetDeviceContext() { return m_Context; } + + Diligent::TEXTURE_FORMAT GetRenderTargetFormat()const { return m_RenderTargetFormat; }; + Diligent::TEXTURE_FORMAT GetDepthBufferFormat()const { return m_DepthBufferFormat; }; + + void CreateTextureViews(Diligent::ITexture *pRenderTarget, Diligent::ITexture *pDepthBuffer); + +protected: + Diligent::RefCntAutoPtr<Diligent::IRenderDevice> m_Device; + Diligent::RefCntAutoPtr<Diligent::IDeviceContext> m_Context; + + Diligent::RefCntAutoPtr<Diligent::ITextureView> m_RTV; + Diligent::RefCntAutoPtr<Diligent::ITextureView> m_DSV; + + Diligent::TEXTURE_FORMAT m_RenderTargetFormat = Diligent::TEX_FORMAT_UNKNOWN; + Diligent::TEXTURE_FORMAT m_DepthBufferFormat = Diligent::TEX_FORMAT_UNKNOWN; +}; diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D11.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D11.cpp new file mode 100644 index 0000000..85c81ba --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D11.cpp @@ -0,0 +1,93 @@ +#include "PlatformBase.h" + +// Direct3D 11 implementation of RenderAPI. + +#if SUPPORT_D3D11 + +#include <d3d11.h> +#include <atlbase.h> + +#include "RenderAPI.h" +#include "Unity/IUnityGraphicsD3D11.h" +#include "RenderDeviceFactoryD3D11.h" +#include "RenderDeviceD3D11.h" + +using namespace Diligent; + + +class RenderAPI_D3D11 : public RenderAPI +{ +public: + virtual void ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces)override final; + + virtual bool GetUsesReverseZ()override final { return (int)m_d3d11Device->GetFeatureLevel() >= (int)D3D_FEATURE_LEVEL_10_0; } + + virtual bool IsDX()override final { return true; } + + virtual void BeginRendering()override final; + + virtual void AttachToNativeRenderTexture(void *nativeRenderTargetHandle, void *nativeDepthTextureHandle)override final; + + +private: + ID3D11Device* m_d3d11Device = nullptr; +}; + + +RenderAPI* CreateRenderAPI_D3D11() +{ + return new RenderAPI_D3D11(); +} + +void RenderAPI_D3D11::ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces) +{ + switch (type) + { + case kUnityGfxDeviceEventInitialize: + { + IUnityGraphicsD3D11* d3d = interfaces->Get<IUnityGraphicsD3D11>(); + m_d3d11Device = d3d->GetDevice(); + CComPtr<ID3D11DeviceContext> d3d11ImmediateContext; + m_d3d11Device->GetImmediateContext(&d3d11ImmediateContext); + auto *pFactoryD3d11 = GetEngineFactoryD3D11(); + EngineD3D11Attribs Attribs; + pFactoryD3d11->AttachToD3D11Device(m_d3d11Device, d3d11ImmediateContext, Attribs, &m_Device, &m_Context, 0); + break; + } + + case kUnityGfxDeviceEventShutdown: + m_Context.Release(); + m_Device.Release(); + break; + } +} + + +void RenderAPI_D3D11::BeginRendering() +{ + ITextureView *RTVs[] = { m_RTV }; + m_Context->SetRenderTargets(1, RTVs, m_DSV); +} + +void RenderAPI_D3D11::AttachToNativeRenderTexture(void *nativeRenderTargetHandle, void *nativeDepthTextureHandle) +{ + m_RTV.Release(); + m_DSV.Release(); + + if (nativeRenderTargetHandle != nullptr && nativeDepthTextureHandle != nullptr) + { + RefCntAutoPtr<IRenderDeviceD3D11> pDeviceD3D11(m_Device, IID_RenderDeviceD3D11); + + auto *pd3d11RenderTarget = reinterpret_cast<ID3D11Texture2D *>(nativeRenderTargetHandle); + RefCntAutoPtr<ITexture> pRenderTarget; + pDeviceD3D11->CreateTextureFromD3DResource(pd3d11RenderTarget, &pRenderTarget); + + auto *pd3d11DepthBuffer = reinterpret_cast<ID3D11Texture2D *>(nativeDepthTextureHandle); + RefCntAutoPtr<ITexture> pDepthBuffer; + pDeviceD3D11->CreateTextureFromD3DResource(pd3d11DepthBuffer, &pDepthBuffer); + + CreateTextureViews(pRenderTarget, pDepthBuffer); + } +} + +#endif // #if SUPPORT_D3D11 diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp new file mode 100644 index 0000000..a29c492 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_D3D12.cpp @@ -0,0 +1,195 @@ +#include "PlatformBase.h" + +// Direct3D 12 implementation of RenderAPI. + +#if SUPPORT_D3D12 + +#include <algorithm> + +#define NOMINMAX +#include <d3d12.h> + +#include "RenderAPI.h" +#include "Unity/IUnityGraphicsD3D12.h" +#include "RenderDeviceFactoryD3D12.h" +#include "RenderDeviceD3D12.h" +#include "CommandQueueD3D12.h" +#include "TextureD3D12.h" +#include "ObjectBase.h" +#include "DefaultRawMemoryAllocator.h" + +using namespace Diligent; + +class UnityCommandQueueImpl : public ObjectBase<ICommandQueueD3D12> +{ +public: + using TBase = ObjectBase<ICommandQueueD3D12>; + UnityCommandQueueImpl(IReferenceCounters *pRefCounters, IUnityGraphicsD3D12v2* pUnityGraphicsD3D12) : + TBase(pRefCounters), + m_pUnityGraphicsD3D12(pUnityGraphicsD3D12), + m_WaitForGPUEventHandle( CreateEvent(nullptr, false, false, nullptr) ) + { + VERIFY_EXPR(m_WaitForGPUEventHandle != INVALID_HANDLE_VALUE); + } + + ~UnityCommandQueueImpl() + { + CloseHandle(m_WaitForGPUEventHandle); + } + + IMPLEMENT_QUERY_INTERFACE_IN_PLACE( IID_CommandQueueD3D12, TBase ) + + // Returns the fence value that will be signaled next time + virtual UINT64 GetNextFenceValue()override final + { + return m_pUnityGraphicsD3D12->GetNextFrameFenceValue(); + } + + // Executes a given command list + virtual UINT64 ExecuteCommandList(ID3D12GraphicsCommandList* commandList)override final + { + auto NextFenceValue = m_pUnityGraphicsD3D12->GetNextFrameFenceValue(); + m_CurrentFenceValue = m_pUnityGraphicsD3D12->ExecuteCommandList(commandList, static_cast<int>(m_ResourcesToTransition.size()), m_ResourcesToTransition.empty() ? nullptr : m_ResourcesToTransition.data()); + VERIFY(m_CurrentFenceValue >= NextFenceValue, "Current fence value returned by ExecuteCommandList() is less than the next fence value previously queried through GetNextFrameFenceValue()") + m_ResourcesToTransition.clear(); + return std::max(m_CurrentFenceValue, NextFenceValue); + } + + // Returns D3D12 command queue. May return null if queue is anavailable + virtual ID3D12CommandQueue* GetD3D12CommandQueue() + { + return nullptr; + } + + // Returns value of the last completed fence + virtual Uint64 GetCompletedFenceValue() + { + return m_pUnityGraphicsD3D12->GetFrameFence()->GetCompletedValue(); + } + + // Blocks execution until all pending GPU commands are complete + virtual void IdleGPU() + { + if (m_CurrentFenceValue < GetCompletedFenceValue()) + { + auto d3d12Fence = m_pUnityGraphicsD3D12->GetFrameFence(); + d3d12Fence->SetEventOnCompletion(m_CurrentFenceValue, m_WaitForGPUEventHandle); + WaitForSingleObject(m_WaitForGPUEventHandle, INFINITE); + VERIFY(GetCompletedFenceValue() >= m_CurrentFenceValue, "Unexpected signaled fence value"); + } + } + + void TransitionResource(const UnityGraphicsD3D12ResourceState &ResourceState) + { + m_ResourcesToTransition.push_back(ResourceState); + } + +private: + IUnityGraphicsD3D12v2* const m_pUnityGraphicsD3D12; + HANDLE m_WaitForGPUEventHandle = {}; + UINT64 m_CurrentFenceValue = 0; + std::vector<UnityGraphicsD3D12ResourceState> m_ResourcesToTransition; +}; + + +class RenderAPI_D3D12 : public RenderAPI +{ +public: + virtual void ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces)override final; + + virtual bool GetUsesReverseZ()override final { return true; } + + virtual void BeginRendering()override final; + + virtual void EndRendering()override final; + + virtual bool IsDX()override final { return true; } + + virtual void AttachToNativeRenderTexture(void *nativeRenderTargetHandle, void *nativeDepthTextureHandle)override final; + +private: + IUnityGraphicsD3D12v2* m_UnityGraphicsD3D12 = nullptr; + RefCntAutoPtr<IRenderDeviceD3D12> m_RenderDeviceD3D12; + RefCntAutoPtr<UnityCommandQueueImpl> m_CmdQueue; + + RefCntAutoPtr<ITextureD3D12> m_RenderTarget; + RefCntAutoPtr<ITextureD3D12> m_DepthBuffer; +}; + + +RenderAPI* CreateRenderAPI_D3D12() +{ + return new RenderAPI_D3D12(); +} + +const UINT kNodeMask = 0; + +void RenderAPI_D3D12::ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces) +{ + switch (type) + { + case kUnityGfxDeviceEventInitialize: + { + m_UnityGraphicsD3D12 = interfaces->Get<IUnityGraphicsD3D12v2>(); + auto d3d12Device = m_UnityGraphicsD3D12->GetDevice(); + auto &DefaultAllocator = DefaultRawMemoryAllocator::GetAllocator(); + m_CmdQueue = NEW_RC_OBJ(DefaultAllocator, "UnityCommandQueueImpl instance", UnityCommandQueueImpl)(m_UnityGraphicsD3D12); + auto *pFactoryD3D12 = GetEngineFactoryD3D12(); + EngineD3D12Attribs Attribs; + pFactoryD3D12->AttachToD3D12Device(d3d12Device, m_CmdQueue, Attribs, &m_Device, &m_Context, 0); + m_Device->QueryInterface(IID_RenderDeviceD3D12, reinterpret_cast<IObject**>(static_cast<IRenderDeviceD3D12**>(&m_RenderDeviceD3D12))); + } + break; + + case kUnityGfxDeviceEventShutdown: + m_Context.Release(); + m_Device.Release(); + m_RenderDeviceD3D12.Release(); + break; + } +} + +void RenderAPI_D3D12::BeginRendering() +{ + m_CmdQueue->TransitionResource({ m_RenderTarget->GetD3D12Texture(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_RENDER_TARGET }); + m_CmdQueue->TransitionResource({ m_DepthBuffer->GetD3D12Texture(), D3D12_RESOURCE_STATE_DEPTH_WRITE, D3D12_RESOURCE_STATE_DEPTH_WRITE }); + m_RenderTarget->SetD3D12ResourceState(D3D12_RESOURCE_STATE_RENDER_TARGET); + m_DepthBuffer->SetD3D12ResourceState(D3D12_RESOURCE_STATE_DEPTH_WRITE); + ITextureView *RTVs[] = { m_RTV }; + m_Context->SetRenderTargets(1, RTVs, m_DSV); +} + +void RenderAPI_D3D12::EndRendering() +{ + m_Context->Flush(); + m_Context->InvalidateState(); + m_RenderDeviceD3D12->FinishFrame(); +} + +void RenderAPI_D3D12::AttachToNativeRenderTexture(void *nativeRenderTargetHandle, void *nativeDepthTextureHandle) +{ + if (nativeRenderTargetHandle != nullptr && nativeDepthTextureHandle != nullptr) + { + m_RenderTarget.Release(); + m_DepthBuffer.Release(); + + RefCntAutoPtr<IRenderDeviceD3D12> pDeviceD3D12(m_Device, IID_RenderDeviceD3D12); + + { + auto *pd3d12RenderTarget = reinterpret_cast<ID3D12Resource*>(nativeRenderTargetHandle); + RefCntAutoPtr<ITexture> pRenderTarget; + pDeviceD3D12->CreateTextureFromD3DResource(pd3d12RenderTarget, &pRenderTarget); + pRenderTarget->QueryInterface(IID_TextureD3D12, reinterpret_cast<IObject**>(static_cast<ITextureD3D12**>(&m_RenderTarget))); + } + + { + auto *pd3d12DepthBuffer = reinterpret_cast<ID3D12Resource *>(nativeDepthTextureHandle); + RefCntAutoPtr<ITexture> pDepthBuffer; + pDeviceD3D12->CreateTextureFromD3DResource(pd3d12DepthBuffer, &pDepthBuffer); + pDepthBuffer->QueryInterface(IID_TextureD3D12, reinterpret_cast<IObject**>(static_cast<ITextureD3D12**>(&m_DepthBuffer))); + } + CreateTextureViews(m_RenderTarget, m_DepthBuffer); + } +} + +#endif // #if SUPPORT_D3D12 diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_OpenGLCoreES.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_OpenGLCoreES.cpp new file mode 100644 index 0000000..0b100d1 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderAPI_OpenGLCoreES.cpp @@ -0,0 +1,118 @@ +#include "PlatformBase.h" + +// OpenGL Core profile (desktop) or OpenGL ES (mobile) implementation of RenderAPI. +// Supports several flavors: Core, ES3 + +#if SUPPORT_OPENGL_UNIFIED + +#include "RenderAPI.h" +#include "RenderDeviceFactoryOpenGL.h" +#include "DeviceContextGL.h" +#include "RenderDeviceGL.h" + +using namespace Diligent; + + +class RenderAPI_OpenGLCoreES : public RenderAPI +{ +public: + RenderAPI_OpenGLCoreES(UnityGfxRenderer apiType) : m_APIType(apiType) {} + + virtual void ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces)override final; + + virtual bool GetUsesReverseZ()override final { return false; } + + virtual void BeginRendering()override final; + + virtual bool IsDX()override final { return false; } + + virtual void AttachToNativeRenderTexture(void *nativeRenderTargetHandle, void *nativeDepthTextureHandle)override final; + + void CreateRenderTargetAndDepthBuffer(); + +private: + UnityGfxRenderer m_APIType; + RefCntAutoPtr<IDeviceContextGL> m_DeviceCtxGL; + Uint32 m_GLRenderTargetHandle = 0; + Uint32 m_GLDepthTextureHandle = 0; + bool m_bGLTexturesUpToDate = false; +}; + + +RenderAPI* CreateRenderAPI_OpenGLCoreES(UnityGfxRenderer apiType) +{ + return new RenderAPI_OpenGLCoreES(apiType); +} + +void RenderAPI_OpenGLCoreES::ProcessDeviceEvent(UnityGfxDeviceEventType type, IUnityInterfaces* interfaces) +{ + if (type == kUnityGfxDeviceEventInitialize) + { + auto *pFactoryGL = GetEngineFactoryOpenGL(); + EngineCreationAttribs Attribs; + pFactoryGL->AttachToActiveGLContext(Attribs, &m_Device, &m_Context); + if (m_Context) + { + m_Context->QueryInterface(IID_DeviceContextGL, reinterpret_cast<IObject**>(static_cast<IDeviceContextGL**>(&m_DeviceCtxGL))); + } + } + else if (type == kUnityGfxDeviceEventShutdown) + { + m_Context.Release(); + m_Device.Release(); + } +} + +void RenderAPI_OpenGLCoreES::CreateRenderTargetAndDepthBuffer() +{ + RefCntAutoPtr<IRenderDeviceGL> pDeviceGL(m_Device, IID_RenderDeviceGL); + + m_RTV.Release(); + m_DSV.Release(); + + RefCntAutoPtr<ITexture> pRenderTarget; + TextureDesc RenderTargetDesc; + RenderTargetDesc.Type = RESOURCE_DIM_TEX_2D; + RenderTargetDesc.BindFlags = BIND_RENDER_TARGET; + RenderTargetDesc.Usage = USAGE_DEFAULT; + RenderTargetDesc.Name = "Unity render target"; + pDeviceGL->CreateTextureFromGLHandle(m_GLRenderTargetHandle, RenderTargetDesc, &pRenderTarget); + + RefCntAutoPtr<ITexture> pDepthBuffer; + TextureDesc DepthBufferDesc; + DepthBufferDesc.Type = RESOURCE_DIM_TEX_2D; + DepthBufferDesc.BindFlags = BIND_DEPTH_STENCIL; + DepthBufferDesc.Usage = USAGE_DEFAULT; + DepthBufferDesc.Name = "Unity depth buffer"; + pDeviceGL->CreateTextureFromGLHandle(m_GLDepthTextureHandle, DepthBufferDesc, &pDepthBuffer); + + CreateTextureViews(pRenderTarget, pDepthBuffer); +} + +void RenderAPI_OpenGLCoreES::BeginRendering() +{ + if(!m_DeviceCtxGL->UpdateCurrentGLContext()) + return; + + RenderAPI::BeginRendering(); + + if (!m_bGLTexturesUpToDate) + { + CreateRenderTargetAndDepthBuffer(); + m_bGLTexturesUpToDate = true; + } + + ITextureView *RTVs[] = { m_RTV }; + m_Context->SetRenderTargets(1, RTVs, m_DSV); +} + +void RenderAPI_OpenGLCoreES::AttachToNativeRenderTexture(void *nativeRenderTargetHandle, void *nativeDepthTextureHandle) +{ + m_GLRenderTargetHandle = static_cast<Uint32>(reinterpret_cast<size_t>(nativeRenderTargetHandle)); + m_GLDepthTextureHandle = static_cast<Uint32>(reinterpret_cast<size_t>(nativeDepthTextureHandle)); + m_bGLTexturesUpToDate = false; + // There is no active OpenGL context when this function is called for the first time, + // so we cannot create RTV and DSV here +} + +#endif // #if SUPPORT_OPENGL_UNIFIED diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderingPlugin.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/RenderingPlugin.cpp new file mode 100644 index 0000000..169404f --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderingPlugin.cpp @@ -0,0 +1,210 @@ +// Example low level rendering Unity plugin + +#include "PlatformBase.h" +#include "Unity/IUnityGraphics.h" +#include "RenderAPI.h" +#include "SamplePlugin.h" + +#include <vector> + +using namespace Diligent; + +static IUnityInterfaces* s_UnityInterfaces = nullptr; +static IUnityGraphics* s_Graphics = nullptr; + +static std::unique_ptr<RenderAPI> s_CurrentAPI; +static UnityGfxRenderer s_DeviceType = kUnityGfxRendererNull; +static std::unique_ptr<SamplePlugin> g_SamplePlugin; + + +static float4x4 g_Matrix; +extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API SetMatrixFromUnity + (float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23, + float m30, float m31, float m32, float m33) +{ + g_Matrix = float4x4( + m00, m01, m02, m03, + m10, m11, m12, m13, + m20, m21, m22, m23, + m30, m31, m32, m33); +} + +static void* g_RenderTargetHandle = nullptr; +static void* g_DepthBufferHandle = nullptr; +extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API SetTexturesFromUnity(void* renderTargetHandle, void *depthBufferHandle) +{ + if (s_CurrentAPI) + { + if (g_RenderTargetHandle != renderTargetHandle || + g_DepthBufferHandle != depthBufferHandle) + { + g_RenderTargetHandle = renderTargetHandle; + g_DepthBufferHandle = depthBufferHandle; + g_SamplePlugin.reset(); + s_CurrentAPI->AttachToNativeRenderTexture(g_RenderTargetHandle, g_DepthBufferHandle); + } + } +} + + +// -------------------------------------------------------------------------- +// UnitySetInterfaces + +static void UNITY_INTERFACE_API OnGraphicsDeviceEvent(UnityGfxDeviceEventType eventType); + + +extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces) +{ +#if (defined(PLATFORM_WIN32) || defined(PLATFORM_UNIVERSAL_WINDOWS)) && (defined(_DEBUG) || defined(DEBUG)) + _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); +#endif + + s_UnityInterfaces = unityInterfaces; + s_Graphics = s_UnityInterfaces->Get<IUnityGraphics>(); + s_Graphics->RegisterDeviceEventCallback(OnGraphicsDeviceEvent); + + // Run OnGraphicsDeviceEvent(initialize) manually on plugin load + OnGraphicsDeviceEvent(kUnityGfxDeviceEventInitialize); +} + +extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload() +{ + s_Graphics->UnregisterDeviceEventCallback(OnGraphicsDeviceEvent); +} + +#if UNITY_WEBGL +typedef void (UNITY_INTERFACE_API * PluginLoadFunc)(IUnityInterfaces* unityInterfaces); +typedef void (UNITY_INTERFACE_API * PluginUnloadFunc)(); + +extern "C" void UnityRegisterRenderingPlugin(PluginLoadFunc loadPlugin, PluginUnloadFunc unloadPlugin); + +extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API RegisterPlugin() +{ + UnityRegisterRenderingPlugin(UnityPluginLoad, UnityPluginUnload); +} +#endif + +// -------------------------------------------------------------------------- +// GraphicsDeviceEvent + + +void CreateRenderAPI(UnityGfxRenderer apiType) +{ +# if SUPPORT_D3D11 + if (apiType == kUnityGfxRendererD3D11) + { + extern RenderAPI* CreateRenderAPI_D3D11(); + s_CurrentAPI.reset( CreateRenderAPI_D3D11() ); + } + # endif // if SUPPORT_D3D11 + +# if SUPPORT_D3D9 + if (apiType == kUnityGfxRendererD3D9) + { + UNSUPPORTED("D3D9 not supported") + } +# endif // if SUPPORT_D3D9 + +# if SUPPORT_D3D12 + if (apiType == kUnityGfxRendererD3D12) + { + extern RenderAPI* CreateRenderAPI_D3D12(); + s_CurrentAPI.reset( CreateRenderAPI_D3D12() ); + } +# endif // if SUPPORT_D3D9 + + +# if SUPPORT_OPENGL_UNIFIED + if (apiType == kUnityGfxRendererOpenGLCore || apiType == kUnityGfxRendererOpenGLES30) + { + extern RenderAPI* CreateRenderAPI_OpenGLCoreES(UnityGfxRenderer apiType); + s_CurrentAPI.reset( CreateRenderAPI_OpenGLCoreES(apiType) ); + } +# endif // if SUPPORT_OPENGL_UNIFIED + +# if SUPPORT_OPENGL_LEGACY + if (apiType == kUnityGfxRendererOpenGL) + { + UNSUPPORTED("Legacy Opengl not supported") + } +# endif // if SUPPORT_OPENGL_LEGACY + +# if SUPPORT_METAL + if (apiType == kUnityGfxRendererMetal) + { + UNSUPPORTED("Metal not supported") + } +# endif // if SUPPORT_METAL +} + + +static void UNITY_INTERFACE_API OnGraphicsDeviceEvent(UnityGfxDeviceEventType eventType) +{ + // Create graphics API implementation upon initialization + if (eventType == kUnityGfxDeviceEventInitialize) + { + VERIFY_EXPR(!s_CurrentAPI); + s_DeviceType = s_Graphics->GetRenderer(); + CreateRenderAPI(s_DeviceType); + if (s_CurrentAPI) + { + s_CurrentAPI->ProcessDeviceEvent(eventType, s_UnityInterfaces); + } + } + else if (eventType == kUnityGfxDeviceEventShutdown) + { + // Cleanup graphics API implementation upon shutdown + // We must destroy all resources before releasing the API + g_SamplePlugin.reset(); + if (s_CurrentAPI) + { + s_CurrentAPI->ProcessDeviceEvent(eventType, s_UnityInterfaces); + s_CurrentAPI.reset(); + } + s_DeviceType = kUnityGfxRendererNull; + } + else if (s_CurrentAPI) + { + // Let the implementation process the device related events + s_CurrentAPI->ProcessDeviceEvent(eventType, s_UnityInterfaces); + } +} + + + +// -------------------------------------------------------------------------- +// OnRenderEvent +// This will be called for GL.IssuePluginEvent script calls; eventID will +// be the integer passed to IssuePluginEvent. In this example, we just ignore +// that value. + +static void UNITY_INTERFACE_API OnRenderEvent(int eventID) +{ + // Unknown / unsupported graphics device type? Do nothing + if (s_CurrentAPI == nullptr || g_RenderTargetHandle == nullptr || g_DepthBufferHandle == nullptr) + return; + + s_CurrentAPI->BeginRendering(); + + if (!g_SamplePlugin) + { + auto RTFormat = s_CurrentAPI->GetRenderTargetFormat(); + auto DepthFormat = s_CurrentAPI->GetDepthBufferFormat(); + g_SamplePlugin.reset(new SamplePlugin(s_CurrentAPI->GetDevice(), s_CurrentAPI->GetUsesReverseZ(), RTFormat, DepthFormat)); + } + g_SamplePlugin->Render(s_CurrentAPI->GetDeviceContext(), g_Matrix ); + + s_CurrentAPI->EndRendering(); +} + + +// -------------------------------------------------------------------------- +// GetRenderEventFunc, an example function we export which is used to get a rendering event callback function. + +extern "C" UnityRenderingEvent UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API GetRenderEventFunc() +{ + return OnRenderEvent; +} + diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/RenderingPlugin.def b/unityplugin/GhostCubePlugin/PluginSource/src/RenderingPlugin.def new file mode 100644 index 0000000..99b4ea5 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/RenderingPlugin.def @@ -0,0 +1,11 @@ +; file used by Visual Studio plugin builds, mostly for 32-bit +; to stop mangling our exported function names + +LIBRARY + +EXPORTS + UnityPluginLoad + UnityPluginUnload + GetRenderEventFunc + SetMatrixFromUnity + SetTexturesFromUnity
\ No newline at end of file diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp b/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp new file mode 100644 index 0000000..39a771b --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.cpp @@ -0,0 +1,174 @@ + +#include "SamplePlugin.h" +#include "GraphicsUtilities.h" +#include "MapHelper.h" + +using namespace Diligent; + +static const Char* VSSource = R"( +cbuffer Constants +{ + float4x4 g_WorldViewProj; +}; + +struct PSInput +{ + float4 Pos : SV_POSITION; + float4 Color : COLOR0; +}; + +PSInput main(float3 pos : ATTRIB0, float4 color : ATTRIB1) +{ + PSInput ps; + ps.Pos = mul( float4(pos,1.0), g_WorldViewProj); + ps.Color = color; + return ps; +} +)"; + +static const Char* PSSource = R"( +struct PSInput +{ + float4 Pos : SV_POSITION; + float4 Color : COLOR0; +}; + +float4 main(PSInput ps_in) : SV_TARGET +{ + return ps_in.Color; +} +)"; + +SamplePlugin::SamplePlugin(Diligent::IRenderDevice *pDevice, bool UseReverseZ, TEXTURE_FORMAT RTVFormat, TEXTURE_FORMAT DSVFormat) +{ + auto deviceType = pDevice->GetDeviceCaps().DevType; + { + PipelineStateDesc PSODesc; + PSODesc.IsComputePipeline = false; + PSODesc.Name = "Render sample cube PSO"; + PSODesc.GraphicsPipeline.NumRenderTargets = 1; + PSODesc.GraphicsPipeline.RTVFormats[0] = RTVFormat; + PSODesc.GraphicsPipeline.DSVFormat = DSVFormat; + PSODesc.GraphicsPipeline.PrimitiveTopologyType = PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; + PSODesc.GraphicsPipeline.RasterizerDesc.CullMode = CULL_MODE_BACK; + PSODesc.GraphicsPipeline.RasterizerDesc.FrontCounterClockwise = deviceType == DeviceType::D3D11 || deviceType == DeviceType::D3D12 ? true : false; + PSODesc.GraphicsPipeline.DepthStencilDesc.DepthFunc = UseReverseZ ? COMPARISON_FUNC_GREATER_EQUAL : COMPARISON_FUNC_LESS_EQUAL; + + PSODesc.GraphicsPipeline.BlendDesc.RenderTargets[0].BlendEnable = True; + PSODesc.GraphicsPipeline.BlendDesc.RenderTargets[0].SrcBlend = BLEND_FACTOR_SRC_ALPHA; + PSODesc.GraphicsPipeline.BlendDesc.RenderTargets[0].DestBlend = BLEND_FACTOR_INV_SRC_ALPHA; + PSODesc.GraphicsPipeline.BlendDesc.RenderTargets[0].SrcBlendAlpha = BLEND_FACTOR_ZERO; + PSODesc.GraphicsPipeline.BlendDesc.RenderTargets[0].DestBlendAlpha = BLEND_FACTOR_ONE; + + ShaderCreationAttribs CreationAttribs; + CreationAttribs.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL; + CreationAttribs.Desc.DefaultVariableType = SHADER_VARIABLE_TYPE_STATIC; + + CreateUniformBuffer(pDevice, sizeof(float4x4), "SamplePlugin: VS constants CB", &m_VSConstants); + + RefCntAutoPtr<IShader> pVS; + { + CreationAttribs.Desc.ShaderType = SHADER_TYPE_VERTEX; + CreationAttribs.EntryPoint = "main"; + CreationAttribs.Desc.Name = "Sample cube VS"; + CreationAttribs.Source = VSSource; + pDevice->CreateShader(CreationAttribs, &pVS); + pVS->GetShaderVariable("Constants")->Set(m_VSConstants); + } + + RefCntAutoPtr<IShader> pPS; + { + CreationAttribs.Desc.ShaderType = SHADER_TYPE_PIXEL; + CreationAttribs.EntryPoint = "main"; + CreationAttribs.Desc.Name = "Sample cube PS"; + CreationAttribs.Source = PSSource; + pDevice->CreateShader(CreationAttribs, &pPS); + } + + LayoutElement LayoutElems[] = + { + LayoutElement(0, 0, 3, VT_FLOAT32, False), + LayoutElement(1, 0, 4, VT_FLOAT32, False) + }; + + PSODesc.GraphicsPipeline.pVS = pVS; + PSODesc.GraphicsPipeline.pPS = pPS; + PSODesc.GraphicsPipeline.InputLayout.LayoutElements = LayoutElems; + PSODesc.GraphicsPipeline.InputLayout.NumElements = _countof(LayoutElems); + pDevice->CreatePipelineState(PSODesc, &m_PSO); + } + + { + struct Vertex + { + float3 pos; + float4 color; + }; + Vertex CubeVerts[8] = + { + {float3(-1,-1,-1), float4(1,0,0,0.5)}, + {float3(-1,+1,-1), float4(0,1,0,0.5)}, + {float3(+1,+1,-1), float4(0,0,1,0.5)}, + {float3(+1,-1,-1), float4(1,1,1,0.5)}, + + {float3(-1,-1,+1), float4(1,1,0,0.5)}, + {float3(-1,+1,+1), float4(0,1,1,0.5)}, + {float3(+1,+1,+1), float4(1,0,1,0.5)}, + {float3(+1,-1,+1), float4(0.2f,0.2f,0.2f,0.5)}, + }; + BufferDesc VertBuffDesc; + VertBuffDesc.Name = "SamplePlugin: cube vertex buffer"; + VertBuffDesc.Usage = USAGE_DEFAULT; + VertBuffDesc.BindFlags = BIND_VERTEX_BUFFER; + VertBuffDesc.uiSizeInBytes = sizeof(CubeVerts); + BufferData VBData; + VBData.pData = CubeVerts; + VBData.DataSize = sizeof(CubeVerts); + pDevice->CreateBuffer(VertBuffDesc, VBData, &m_CubeVertexBuffer); + } + + { + Uint32 Indices[] = + { + 2,0,1, 2,3,0, + 4,6,5, 4,7,6, + 0,7,4, 0,3,7, + 1,0,4, 1,4,5, + 1,5,2, 5,6,2, + 3,6,7, 3,2,6 + }; + BufferDesc IndBuffDesc; + IndBuffDesc.Name = "SamplePlugin: cube index buffer"; + IndBuffDesc.Usage = USAGE_DEFAULT; + IndBuffDesc.BindFlags = BIND_INDEX_BUFFER; + IndBuffDesc.uiSizeInBytes = sizeof(Indices); + BufferData IBData; + IBData.pData = Indices; + IBData.DataSize = sizeof(Indices); + pDevice->CreateBuffer(IndBuffDesc, IBData, &m_CubeIndexBuffer); + } +} + +void SamplePlugin::Render(Diligent::IDeviceContext *pContext, const float4x4 &ViewProjMatrix) +{ + { + MapHelper<float4x4> CBConstants(pContext, m_VSConstants, MAP_WRITE, MAP_FLAG_DISCARD); + *CBConstants = transposeMatrix(ViewProjMatrix); + } + + Uint32 stride = sizeof(float) * 7; + Uint32 offset = 0; + IBuffer *pBuffs[] = {m_CubeVertexBuffer}; + pContext->SetVertexBuffers(0, 1, pBuffs, &stride, &offset, SET_VERTEX_BUFFERS_FLAG_RESET); + pContext->SetIndexBuffer(m_CubeIndexBuffer, 0); + + pContext->SetPipelineState(m_PSO); + pContext->CommitShaderResources(nullptr, COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES); + + DrawAttribs DrawAttrs; + DrawAttrs.IsIndexed = true; + DrawAttrs.IndexType = VT_UINT32; + DrawAttrs.NumIndices = 36; + DrawAttrs.Topology = PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; + pContext->Draw(DrawAttrs); +} diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.h b/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.h new file mode 100644 index 0000000..56b4a33 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/SamplePlugin.h @@ -0,0 +1,20 @@ +#pragma once + +#include "RenderDevice.h" +#include "DeviceContext.h" +#include "RefCntAutoPtr.h" +#include "RenderAPI.h" +#include "BasicMath.h" + +class SamplePlugin +{ +public: + SamplePlugin(Diligent::IRenderDevice *pDevice, bool UseReverseZ, Diligent::TEXTURE_FORMAT RTVFormat, Diligent::TEXTURE_FORMAT DSVFormat); + void Render(Diligent::IDeviceContext *pContext, const float4x4 &ViewProjMatrix); + +private: + Diligent::RefCntAutoPtr<Diligent::IBuffer> m_CubeVertexBuffer; + Diligent::RefCntAutoPtr<Diligent::IBuffer> m_CubeIndexBuffer; + Diligent::RefCntAutoPtr<Diligent::IBuffer> m_VSConstants; + Diligent::RefCntAutoPtr<Diligent::IPipelineState> m_PSO; +}; diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphics.h b/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphics.h new file mode 100644 index 0000000..f8c8e07 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphics.h @@ -0,0 +1,49 @@ +#pragma once +#include "IUnityInterface.h" + +typedef enum UnityGfxRenderer +{ + kUnityGfxRendererOpenGL = 0, // Legacy OpenGL + kUnityGfxRendererD3D9 = 1, // Direct3D 9 + kUnityGfxRendererD3D11 = 2, // Direct3D 11 + kUnityGfxRendererGCM = 3, // PlayStation 3 + kUnityGfxRendererNull = 4, // "null" device (used in batch mode) + kUnityGfxRendererXenon = 6, // Xbox 360 + kUnityGfxRendererOpenGLES20 = 8, // OpenGL ES 2.0 + kUnityGfxRendererOpenGLES30 = 11, // OpenGL ES 3.x + kUnityGfxRendererGXM = 12, // PlayStation Vita + kUnityGfxRendererPS4 = 13, // PlayStation 4 + kUnityGfxRendererXboxOne = 14, // Xbox One + kUnityGfxRendererMetal = 16, // iOS Metal + kUnityGfxRendererOpenGLCore = 17, // OpenGL core + kUnityGfxRendererD3D12 = 18, // Direct3D 12 +} UnityGfxRenderer; + +typedef enum UnityGfxDeviceEventType +{ + kUnityGfxDeviceEventInitialize = 0, + kUnityGfxDeviceEventShutdown = 1, + kUnityGfxDeviceEventBeforeReset = 2, + kUnityGfxDeviceEventAfterReset = 3, +} UnityGfxDeviceEventType; + +typedef void (UNITY_INTERFACE_API * IUnityGraphicsDeviceEventCallback)(UnityGfxDeviceEventType eventType); + +// Should only be used on the rendering thread unless noted otherwise. +UNITY_DECLARE_INTERFACE(IUnityGraphics) +{ + UnityGfxRenderer (UNITY_INTERFACE_API * GetRenderer)(); // Thread safe + + // This callback will be called when graphics device is created, destroyed, reset, etc. + // It is possible to miss the kUnityGfxDeviceEventInitialize event in case plugin is loaded at a later time, + // when the graphics device is already created. + void (UNITY_INTERFACE_API * RegisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); + void (UNITY_INTERFACE_API * UnregisterDeviceEventCallback)(IUnityGraphicsDeviceEventCallback callback); +}; +UNITY_REGISTER_INTERFACE_GUID(0x7CBA0A9CA4DDB544ULL,0x8C5AD4926EB17B11ULL,IUnityGraphics) + + + +// Certain Unity APIs (GL.IssuePluginEvent, CommandBuffer.IssuePluginEvent) can callback into native plugins. +// Provide them with an address to a function of this signature. +typedef void (UNITY_INTERFACE_API * UnityRenderingEvent)(int eventId); diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphicsD3D11.h b/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphicsD3D11.h new file mode 100644 index 0000000..a3f4c8b --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphicsD3D11.h @@ -0,0 +1,9 @@ +#pragma once +#include "IUnityInterface.h" + +// Should only be used on the rendering thread unless noted otherwise. +UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D11) +{ + ID3D11Device* (UNITY_INTERFACE_API * GetDevice)(); +}; +UNITY_REGISTER_INTERFACE_GUID(0xAAB37EF87A87D748ULL,0xBF76967F07EFB177ULL,IUnityGraphicsD3D11) diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphicsD3D12.h b/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphicsD3D12.h new file mode 100644 index 0000000..11893f7 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphicsD3D12.h @@ -0,0 +1,48 @@ +#pragma once +#include "IUnityInterface.h" +#ifndef __cplusplus + #include <stdbool.h> +#endif + +typedef struct UnityGraphicsD3D12ResourceState UnityGraphicsD3D12ResourceState; +struct UnityGraphicsD3D12ResourceState +{ + ID3D12Resource* resource; // Resource to barrier. + D3D12_RESOURCE_STATES expected; // Expected resource state before this command list is executed. + D3D12_RESOURCE_STATES current; // State this resource will be in after this command list is executed. +}; + +// Should only be used on the main thread. +UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12v2) +{ + ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); + + ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); + // Returns the value set on the frame fence once the current frame completes or the GPU is flushed + UINT64 (UNITY_INTERFACE_API * GetNextFrameFenceValue)(); + + // Executes a given command list on a worker thread. + // [Optional] Declares expected and post-execution resource states. + // Returns the fence value. + UINT64 (UNITY_INTERFACE_API * ExecuteCommandList)(ID3D12GraphicsCommandList* commandList, int stateCount, UnityGraphicsD3D12ResourceState* states); +}; +UNITY_REGISTER_INTERFACE_GUID(0xEC39D2F18446C745ULL,0xB1A2626641D6B11FULL,IUnityGraphicsD3D12v2) + + + +// Obsolete +UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D12) +{ + ID3D12Device* (UNITY_INTERFACE_API * GetDevice)(); + ID3D12CommandQueue* (UNITY_INTERFACE_API * GetCommandQueue)(); + + ID3D12Fence* (UNITY_INTERFACE_API * GetFrameFence)(); + // Returns the value set on the frame fence once the current frame completes or the GPU is flushed + UINT64 (UNITY_INTERFACE_API * GetNextFrameFenceValue)(); + + // Returns the state a resource will be in after the last command list is executed + bool (UNITY_INTERFACE_API * GetResourceState)(ID3D12Resource* resource, D3D12_RESOURCE_STATES* outState); + // Specifies the state a resource will be in after a plugin command list with resource barriers is executed + void (UNITY_INTERFACE_API * SetResourceState)(ID3D12Resource* resource, D3D12_RESOURCE_STATES state); +}; +UNITY_REGISTER_INTERFACE_GUID(0xEF4CEC88A45F4C4CULL,0xBD295B6F2A38D9DEULL,IUnityGraphicsD3D12) diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphicsD3D9.h b/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphicsD3D9.h new file mode 100644 index 0000000..202b8b2 --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphicsD3D9.h @@ -0,0 +1,10 @@ +#pragma once +#include "IUnityInterface.h" + +// Should only be used on the rendering thread unless noted otherwise. +UNITY_DECLARE_INTERFACE(IUnityGraphicsD3D9) +{ + IDirect3D9* (UNITY_INTERFACE_API * GetD3D)(); + IDirect3DDevice9* (UNITY_INTERFACE_API * GetDevice)(); +}; +UNITY_REGISTER_INTERFACE_GUID(0xE90746A523D53C4CULL,0xAC825B19B6F82AC3ULL,IUnityGraphicsD3D9) diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphicsMetal.h b/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphicsMetal.h new file mode 100644 index 0000000..c31518f --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityGraphicsMetal.h @@ -0,0 +1,47 @@ +#pragma once +#include "IUnityInterface.h" + +#ifndef __OBJC__ + #error metal plugin is objc code. +#endif +#ifndef __clang__ + #error only clang compiler is supported. +#endif +#if !__has_feature(objc_arc) + #error metal demands ARC enabled. +#endif + +@class NSBundle; +@protocol MTLDevice; +@protocol MTLCommandBuffer; +@protocol MTLCommandEncoder; +@protocol MTLTexture; + +struct RenderSurfaceBase; +typedef struct RenderSurfaceBase* UnityRenderBuffer; + +// Should only be used on the rendering thread unless noted otherwise. +UNITY_DECLARE_INTERFACE(IUnityGraphicsMetal) +{ + NSBundle* (UNITY_INTERFACE_API * MetalBundle)(); + id<MTLDevice> (UNITY_INTERFACE_API * MetalDevice)(); + + id<MTLCommandBuffer> (UNITY_INTERFACE_API * CurrentCommandBuffer)(); + + // for custom rendering support there are two scenarios: + // you want to use current in-flight MTLCommandEncoder (NB: it might be nil) + id<MTLCommandEncoder> (UNITY_INTERFACE_API * CurrentCommandEncoder)(); + // or you might want to create your own encoder. + // In that case you should end unity's encoder before creating your own and end yours before returning control to unity + void (UNITY_INTERFACE_API * EndCurrentCommandEncoder)(); + + // access to RenderBuffer's texure + // NB: you pass here *native* RenderBuffer, acquired by calling (C#) RenderBuffer.GetNativeRenderBufferPtr + // AAResolvedTextureFromRenderBuffer will return nil in case of non-AA RenderBuffer or if called for depth RenderBuffer + // StencilTextureFromRenderBuffer will return nil in case of no-stencil RenderBuffer or if called for color RenderBuffer + id<MTLTexture> (UNITY_INTERFACE_API * TextureFromRenderBuffer)(UnityRenderBuffer buffer); + id<MTLTexture> (UNITY_INTERFACE_API * AAResolvedTextureFromRenderBuffer)(UnityRenderBuffer buffer); + id<MTLTexture> (UNITY_INTERFACE_API * StencilTextureFromRenderBuffer)(UnityRenderBuffer buffer); + +}; +UNITY_REGISTER_INTERFACE_GUID(0x992C8EAEA95811E5ULL,0x9A62C4B5B9876117ULL,IUnityGraphicsMetal) diff --git a/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityInterface.h b/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityInterface.h new file mode 100644 index 0000000..b080f1a --- /dev/null +++ b/unityplugin/GhostCubePlugin/PluginSource/src/Unity/IUnityInterface.h @@ -0,0 +1,149 @@ +#pragma once + +// Unity native plugin API +// Compatible with C99 + +#if defined(__CYGWIN32__) + #define UNITY_INTERFACE_API __stdcall + #define UNITY_INTERFACE_EXPORT __declspec(dllexport) +#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WINAPI_FAMILY) + #define UNITY_INTERFACE_API __stdcall + #define UNITY_INTERFACE_EXPORT// __declspec(dllexport) - this is not needed since all exported functions are listed in .def file, + // while this header can also be used by +#elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) || defined(__QNX__) + #define UNITY_INTERFACE_API + #define UNITY_INTERFACE_EXPORT __attribute__((visibility("default"))) +#else + #define UNITY_INTERFACE_API + #define UNITY_INTERFACE_EXPORT +#endif + + + +// Unity Interface GUID +// Ensures cross plugin uniqueness. +// +// Template specialization is used to produce a means of looking up a GUID from it's payload type at compile time. +// The net result should compile down to passing around the GUID. +// +// UNITY_REGISTER_INTERFACE_GUID should be placed in the header file of any payload definition outside of all namespaces. +// The payload structure and the registration GUID are all that is required to expose the interface to other systems. +struct UnityInterfaceGUID +{ +#ifdef __cplusplus + UnityInterfaceGUID(unsigned long long high, unsigned long long low) + : m_GUIDHigh(high) + , m_GUIDLow(low) + { + } + + UnityInterfaceGUID(const UnityInterfaceGUID& other) + { + m_GUIDHigh = other.m_GUIDHigh; + m_GUIDLow = other.m_GUIDLow; + } + + UnityInterfaceGUID& operator=(const UnityInterfaceGUID& other) + { + m_GUIDHigh = other.m_GUIDHigh; + m_GUIDLow = other.m_GUIDLow; + return *this; + } + + bool Equals(const UnityInterfaceGUID& other) const { return m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow == other.m_GUIDLow; } + bool LessThan(const UnityInterfaceGUID& other) const { return m_GUIDHigh < other.m_GUIDHigh || (m_GUIDHigh == other.m_GUIDHigh && m_GUIDLow < other.m_GUIDLow); } +#endif + unsigned long long m_GUIDHigh; + unsigned long long m_GUIDLow; +}; +#ifdef __cplusplus +inline bool operator==(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.Equals(right); } +inline bool operator!=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !left.Equals(right); } +inline bool operator< (const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return left.LessThan(right); } +inline bool operator> (const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return right.LessThan(left); } +inline bool operator>=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator< (left,right); } +inline bool operator<=(const UnityInterfaceGUID& left, const UnityInterfaceGUID& right) { return !operator> (left,right); } +#else +typedef struct UnityInterfaceGUID UnityInterfaceGUID; +#endif + + + +#define UNITY_GET_INTERFACE_GUID(TYPE) TYPE##_GUID +#define UNITY_GET_INTERFACE(INTERFACES, TYPE) (TYPE*)INTERFACES->GetInterface(UNITY_GET_INTERFACE_GUID(TYPE)); + +#ifdef __cplusplus + #define UNITY_DECLARE_INTERFACE(NAME) \ + struct NAME : IUnityInterface + + template<typename TYPE> \ + inline const UnityInterfaceGUID GetUnityInterfaceGUID(); \ + + #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ + const UnityInterfaceGUID TYPE##_GUID(HASHH, HASHL); \ + template<> \ + inline const UnityInterfaceGUID GetUnityInterfaceGUID<TYPE>() \ + { \ + return UNITY_GET_INTERFACE_GUID(TYPE); \ + } +#else + #define UNITY_DECLARE_INTERFACE(NAME) \ + typedef struct NAME NAME; \ + struct NAME + + #define UNITY_REGISTER_INTERFACE_GUID(HASHH, HASHL, TYPE) \ + const UnityInterfaceGUID TYPE##_GUID = {HASHH, HASHL}; +#endif + + + +#ifdef __cplusplus +struct IUnityInterface +{ +}; +#else +typedef void IUnityInterface; +#endif + + + +typedef struct IUnityInterfaces +{ + // Returns an interface matching the guid. + // Returns nullptr if the given interface is unavailable in the active Unity runtime. + IUnityInterface* (UNITY_INTERFACE_API * GetInterface)(UnityInterfaceGUID guid); + + // Registers a new interface. + void (UNITY_INTERFACE_API * RegisterInterface)(UnityInterfaceGUID guid, IUnityInterface* ptr); + +#ifdef __cplusplus + // Helper for GetInterface. + template <typename INTERFACE> + INTERFACE* Get() + { + return static_cast<INTERFACE*>(GetInterface(GetUnityInterfaceGUID<INTERFACE>())); + } + + // Helper for RegisterInterface. + template <typename INTERFACE> + void Register(IUnityInterface* ptr) + { + RegisterInterface(GetUnityInterfaceGUID<INTERFACE>(), ptr); + } +#endif +} IUnityInterfaces; + + + +#ifdef __cplusplus +extern "C" { +#endif + +// If exported by a plugin, this function will be called when the plugin is loaded. +//void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces); +// If exported by a plugin, this function will be called when the plugin is about to be unloaded. +//void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload(); + +#ifdef __cplusplus +} +#endif |
