diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2015-10-21 03:46:28 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2015-10-21 03:46:28 +0000 |
| commit | 9ccee73baca0fd7ecb95c90cb983133b737c6c55 (patch) | |
| tree | 66fea1e6521df31727431520fe3c1ead1896bc5d /Graphics/GraphicsTools | |
| download | DiligentCore-9ccee73baca0fd7ecb95c90cb983133b737c6c55.tar.gz DiligentCore-9ccee73baca0fd7ecb95c90cb983133b737c6c55.zip | |
Release v1.0.0
Diffstat (limited to 'Graphics/GraphicsTools')
22 files changed, 1992 insertions, 0 deletions
diff --git a/Graphics/GraphicsTools/build/Windows/EngineRoot.props b/Graphics/GraphicsTools/build/Windows/EngineRoot.props new file mode 100644 index 00000000..6e4b958b --- /dev/null +++ b/Graphics/GraphicsTools/build/Windows/EngineRoot.props @@ -0,0 +1,18 @@ +<?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"> + <EngineRoot>..\..\..\..</EngineRoot> + <GraphicsRoot>..\..\..</GraphicsRoot> + </PropertyGroup> + <PropertyGroup /> + <ItemDefinitionGroup /> + <ItemGroup> + <BuildMacro Include="EngineRoot"> + <Value>$(EngineRoot)</Value> + </BuildMacro> + <BuildMacro Include="GraphicsRoot"> + <Value>$(GraphicsRoot)</Value> + </BuildMacro> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Graphics/GraphicsTools/build/Windows/GraphicsTools-Debug.vgdbsettings b/Graphics/GraphicsTools/build/Windows/GraphicsTools-Debug.vgdbsettings new file mode 100644 index 00000000..3f5b24b1 --- /dev/null +++ b/Graphics/GraphicsTools/build/Windows/GraphicsTools-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/Graphics/GraphicsTools/build/Windows/GraphicsTools-Release.vgdbsettings b/Graphics/GraphicsTools/build/Windows/GraphicsTools-Release.vgdbsettings new file mode 100644 index 00000000..669691f2 --- /dev/null +++ b/Graphics/GraphicsTools/build/Windows/GraphicsTools-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/Graphics/GraphicsTools/build/Windows/GraphicsTools.props b/Graphics/GraphicsTools/build/Windows/GraphicsTools.props new file mode 100644 index 00000000..22851e71 --- /dev/null +++ b/Graphics/GraphicsTools/build/Windows/GraphicsTools.props @@ -0,0 +1,10 @@ +<?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>$(GraphicsRoot)\GraphicsTools\include;$(GraphicsRoot)\GraphicsEngine\interface;$(GraphicsRoot)\TextureLoader\interface;$(EngineRoot)\Common\include;$(EngineRoot)\Common\interface;$(EngineRoot)\Platforms\interface;$(VC_IncludePath);$(WindowsSDK_IncludePath);$(IncludePath)</IncludePath> + </PropertyGroup> + <ItemDefinitionGroup /> + <ItemGroup /> +</Project>
\ No newline at end of file diff --git a/Graphics/GraphicsTools/build/Windows/GraphicsTools.vcxproj b/Graphics/GraphicsTools/build/Windows/GraphicsTools.vcxproj new file mode 100644 index 00000000..c90a589b --- /dev/null +++ b/Graphics/GraphicsTools/build/Windows/GraphicsTools.vcxproj @@ -0,0 +1,181 @@ +<?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> + <PropertyGroup Label="Globals"> + <ProjectGuid>{C6014499-0CF2-43EC-A773-A4E354FB2D74}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>GraphicsTools</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</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="..\WindowsStore\GraphicsTools.Shared\GraphicsTools.Shared.vcxitems" Label="Shared" Condition="Exists('..\WindowsStore\GraphicsTools.Shared\GraphicsTools.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="..\..\..\..\Shared\build\Windows\Win32d.props" /> + <Import Project="EngineRoot.props" /> + <Import Project="GraphicsTools.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="..\..\..\..\Shared\build\Windows\Win64d.props" /> + <Import Project="EngineRoot.props" /> + <Import Project="GraphicsTools.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="..\..\..\..\Shared\build\Windows\Win32r.props" /> + <Import Project="EngineRoot.props" /> + <Import Project="GraphicsTools.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="..\..\..\..\Shared\build\Windows\Win64r.props" /> + <Import Project="EngineRoot.props" /> + <Import Project="GraphicsTools.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <Import Project="..\..\..\..\Shared\build\Windows\Android32d.props" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <Import Project="..\..\..\..\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> + </Link> + </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> + </Link> + </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> + </Link> + </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> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <Text Include="ReadMe.txt" /> + </ItemGroup> + <ItemGroup> + <None Include="jni\Android.mk" /> + <None Include="jni\Application.mk" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\BasicShaderSourceStreamFactory.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\GraphicsUtilities.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> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Graphics/GraphicsTools/build/Windows/GraphicsTools.vcxproj.filters b/Graphics/GraphicsTools/build/Windows/GraphicsTools.vcxproj.filters new file mode 100644 index 00000000..89d44e9e --- /dev/null +++ b/Graphics/GraphicsTools/build/Windows/GraphicsTools.vcxproj.filters @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="android_src"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="jni"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <Text Include="ReadMe.txt" /> + </ItemGroup> + <ItemGroup> + <None Include="jni\Android.mk"> + <Filter>jni</Filter> + </None> + <None Include="jni\Application.mk"> + <Filter>jni</Filter> + </None> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\BasicShaderSourceStreamFactory.cpp"> + <Filter>android_src</Filter> + </ClCompile> + <ClCompile Include="..\..\src\GraphicsUtilities.cpp"> + <Filter>android_src</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Graphics/GraphicsTools/build/Windows/jni/Android.mk b/Graphics/GraphicsTools/build/Windows/jni/Android.mk new file mode 100644 index 00000000..2b02dd54 --- /dev/null +++ b/Graphics/GraphicsTools/build/Windows/jni/Android.mk @@ -0,0 +1,25 @@ +# 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 := GraphicsTools +LOCAL_CFLAGS := -std=c++11 +LOCAL_CPP_FEATURES := exceptions +LOCAL_STATIC_LIBRARIES += + +# Include paths +PROJECT_ROOT := $(LOCAL_PATH)/../../.. +GRAPHICS_ROOT := $(PROJECT_ROOT)/.. +SOLUTION_ROOT := $(GRAPHICS_ROOT)/.. +LOCAL_C_INCLUDES := $(PROJECT_ROOT)/include $(SOLUTION_ROOT)/Common/include $(SOLUTION_ROOT)/Common/interface $(SOLUTION_ROOT)/Platforms/interface $(GRAPHICS_ROOT)/GraphicsEngine/interface $(GRAPHICS_ROOT)/GraphicsTools/include $(GRAPHICS_ROOT)/TextureLoader/interface + +# Source files +#VisualGDBAndroid: AutoUpdateSourcesInNextLine +LOCAL_SRC_FILES := ../../../src/BasicShaderSourceStreamFactory.cpp ../../../src/GraphicsUtilities.cpp + +include $(BUILD_STATIC_LIBRARY) diff --git a/Graphics/GraphicsTools/build/Windows/jni/Application.mk b/Graphics/GraphicsTools/build/Windows/jni/Application.mk new file mode 100644 index 00000000..063ff721 --- /dev/null +++ b/Graphics/GraphicsTools/build/Windows/jni/Application.mk @@ -0,0 +1,7 @@ +# Generated by VisualGDB + +DEPENDENCY_PATH := $(call my-dir) +LOCAL_PATH := $(abspath $(DEPENDENCY_PATH)) +include $(LOCAL_PATH)/../../../../../Common/make/AppCommon.mk + +APP_MODULES := GraphicsTools
\ No newline at end of file diff --git a/Graphics/GraphicsTools/build/WindowsStore/EngineRoot.props b/Graphics/GraphicsTools/build/WindowsStore/EngineRoot.props new file mode 100644 index 00000000..fcb891c0 --- /dev/null +++ b/Graphics/GraphicsTools/build/WindowsStore/EngineRoot.props @@ -0,0 +1,18 @@ +<?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"> + <EngineRoot>..\..\..\..\..</EngineRoot> + <GraphicsRoot>..\..\..\..</GraphicsRoot> + </PropertyGroup> + <PropertyGroup /> + <ItemDefinitionGroup /> + <ItemGroup> + <BuildMacro Include="EngineRoot"> + <Value>$(EngineRoot)</Value> + </BuildMacro> + <BuildMacro Include="GraphicsRoot"> + <Value>$(GraphicsRoot)</Value> + </BuildMacro> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.Shared/GraphicsTools.Shared.vcxitems b/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.Shared/GraphicsTools.Shared.vcxitems new file mode 100644 index 00000000..6a1aa429 --- /dev/null +++ b/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.Shared/GraphicsTools.Shared.vcxitems @@ -0,0 +1,32 @@ +<?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>{3bb4f2ac-1d2f-4af6-b9cc-bdc17bb8bc39}</ItemsProjectGuid> + <ItemsRootNamespace>GraphicsTools</ItemsRootNamespace> + <ItemsProjectName>GraphicsTools.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)..\..\..\include\BasicShaderSourceStreamFactory.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\GraphicsUtilities.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\pch.h" /> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ShaderMacroHelper.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\BasicShaderSourceStreamFactory.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\GraphicsUtilities.cpp" /> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\pch.cpp"> + <PrecompiledHeader>Create</PrecompiledHeader> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.Shared/GraphicsTools.Shared.vcxitems.filters b/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.Shared/GraphicsTools.Shared.vcxitems.filters new file mode 100644 index 00000000..ed522894 --- /dev/null +++ b/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.Shared/GraphicsTools.Shared.vcxitems.filters @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="include"> + <UniqueIdentifier>{610cb4a4-ad9a-42e0-936c-239055f0caa6}</UniqueIdentifier> + </Filter> + <Filter Include="src"> + <UniqueIdentifier>{2fa69c92-b6b7-4e73-9ccd-49a715515cc8}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\pch.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\BasicShaderSourceStreamFactory.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\GraphicsUtilities.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\include\ShaderMacroHelper.h"> + <Filter>include</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\pch.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\BasicShaderSourceStreamFactory.cpp"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\src\GraphicsUtilities.cpp"> + <Filter>src</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.Windows/GraphicsTools.Windows.vcxproj b/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.Windows/GraphicsTools.Windows.vcxproj new file mode 100644 index 00000000..85152c29 --- /dev/null +++ b/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.Windows/GraphicsTools.Windows.vcxproj @@ -0,0 +1,205 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="12.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> + <PropertyGroup Label="Globals"> + <ProjectGuid>{dac331f3-c5a2-4568-8714-9213c3487a49}</ProjectGuid> + <RootNamespace>GraphicsTools</RootNamespace> + <DefaultLanguage>en-US</DefaultLanguage> + <MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion> + <AppContainerApplication>true</AppContainerApplication> + <ApplicationType>Windows Store</ApplicationType> + <ApplicationTypeRevision>8.1</ApplicationTypeRevision> + <ConvergedProjectType>CodeSharingStaticLibrary</ConvergedProjectType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v120</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v120</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v120</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v120</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v120</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v120</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <Import Project="..\GraphicsTools.Shared\GraphicsTools.Shared.vcxitems" Label="Shared" /> + <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="..\..\..\..\..\Shared\build\WindowsStore\WinStore32Dbg.props" /> + <Import Project="..\EngineRoot.props" /> + <Import Project="..\..\Windows\GraphicsTools.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="..\..\..\..\..\Shared\build\WindowsStore\WinStore32Rel.props" /> + <Import Project="..\EngineRoot.props" /> + <Import Project="..\..\Windows\GraphicsTools.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="..\..\..\..\..\Shared\build\WindowsStore\WinStoreArmDbg.props" /> + <Import Project="..\EngineRoot.props" /> + <Import Project="..\..\Windows\GraphicsTools.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="..\..\..\..\..\Shared\build\WindowsStore\WinStoreArmRel.props" /> + <Import Project="..\EngineRoot.props" /> + <Import Project="..\..\Windows\GraphicsTools.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="..\..\..\..\..\Shared\build\WindowsStore\WinStore64Dbg.props" /> + <Import Project="..\EngineRoot.props" /> + <Import Project="..\..\Windows\GraphicsTools.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="..\..\..\..\..\Shared\build\WindowsStore\WinStore64Rel.props" /> + <Import Project="..\EngineRoot.props" /> + <Import Project="..\..\Windows\GraphicsTools.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <GenerateManifest>false</GenerateManifest> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <GenerateManifest>false</GenerateManifest> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <GenerateManifest>false</GenerateManifest> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <GenerateManifest>false</GenerateManifest> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <GenerateManifest>false</GenerateManifest> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <GenerateManifest>false</GenerateManifest> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <CompileAsWinRT>false</CompileAsWinRT> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateWindowsMetadata>false</GenerateWindowsMetadata> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <CompileAsWinRT>false</CompileAsWinRT> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateWindowsMetadata>false</GenerateWindowsMetadata> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <CompileAsWinRT>false</CompileAsWinRT> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateWindowsMetadata>false</GenerateWindowsMetadata> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|arm'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <CompileAsWinRT>false</CompileAsWinRT> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateWindowsMetadata>false</GenerateWindowsMetadata> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <CompileAsWinRT>false</CompileAsWinRT> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateWindowsMetadata>false</GenerateWindowsMetadata> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <CompileAsWinRT>false</CompileAsWinRT> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateWindowsMetadata>false</GenerateWindowsMetadata> + </Link> + </ItemDefinitionGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.Windows/GraphicsTools.Windows.vcxproj.filters b/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.Windows/GraphicsTools.Windows.vcxproj.filters new file mode 100644 index 00000000..a7761ab0 --- /dev/null +++ b/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.Windows/GraphicsTools.Windows.vcxproj.filters @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + </ItemGroup> +</Project> diff --git a/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.WindowsPhone/GraphicsTools.WindowsPhone.vcxproj b/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.WindowsPhone/GraphicsTools.WindowsPhone.vcxproj new file mode 100644 index 00000000..e99bf6b4 --- /dev/null +++ b/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.WindowsPhone/GraphicsTools.WindowsPhone.vcxproj @@ -0,0 +1,144 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="12.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="Release|ARM"> + <Configuration>Release</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{2f340c0e-43b2-471f-b4f3-7cdce69f6e1f}</ProjectGuid> + <RootNamespace>GraphicsTools</RootNamespace> + <DefaultLanguage>en-US</DefaultLanguage> + <MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion> + <AppContainerApplication>true</AppContainerApplication> + <ApplicationType>Windows Phone</ApplicationType> + <ApplicationTypeRevision>8.1</ApplicationTypeRevision> + <ConvergedProjectType>CodeSharingStaticLibrary</ConvergedProjectType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v120_wp81</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v120_wp81</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v120_wp81</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v120_wp81</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <Import Project="..\GraphicsTools.Shared\GraphicsTools.Shared.vcxitems" Label="Shared" /> + <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="..\..\..\..\..\Shared\build\WindowsStore\WinStore32Dbg.props" /> + <Import Project="..\EngineRoot.props" /> + <Import Project="..\..\Windows\GraphicsTools.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="..\..\..\..\..\Shared\build\WindowsStore\WinStore32Rel.props" /> + <Import Project="..\EngineRoot.props" /> + <Import Project="..\..\Windows\GraphicsTools.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="..\..\..\..\..\Shared\build\WindowsStore\WinStoreArmDbg.props" /> + <Import Project="..\EngineRoot.props" /> + <Import Project="..\..\Windows\GraphicsTools.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="..\..\..\..\..\Shared\build\WindowsStore\WinStoreArmRel.props" /> + <Import Project="..\EngineRoot.props" /> + <Import Project="..\..\Windows\GraphicsTools.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <GenerateManifest>false</GenerateManifest> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <GenerateManifest>false</GenerateManifest> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <GenerateManifest>false</GenerateManifest> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <GenerateManifest>false</GenerateManifest> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <CompileAsWinRT>false</CompileAsWinRT> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateWindowsMetadata>false</GenerateWindowsMetadata> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <CompileAsWinRT>false</CompileAsWinRT> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateWindowsMetadata>false</GenerateWindowsMetadata> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|arm'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <CompileAsWinRT>false</CompileAsWinRT> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateWindowsMetadata>false</GenerateWindowsMetadata> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|arm'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <CompileAsWinRT>false</CompileAsWinRT> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> + <GenerateWindowsMetadata>false</GenerateWindowsMetadata> + </Link> + </ItemDefinitionGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.WindowsPhone/GraphicsTools.WindowsPhone.vcxproj.filters b/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.WindowsPhone/GraphicsTools.WindowsPhone.vcxproj.filters new file mode 100644 index 00000000..a7761ab0 --- /dev/null +++ b/Graphics/GraphicsTools/build/WindowsStore/GraphicsTools.WindowsPhone/GraphicsTools.WindowsPhone.vcxproj.filters @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + </ItemGroup> +</Project> diff --git a/Graphics/GraphicsTools/include/BasicShaderSourceStreamFactory.h b/Graphics/GraphicsTools/include/BasicShaderSourceStreamFactory.h new file mode 100644 index 00000000..76adc056 --- /dev/null +++ b/Graphics/GraphicsTools/include/BasicShaderSourceStreamFactory.h @@ -0,0 +1,41 @@ +/* Copyright 2015 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +#include "BasicFileStream.h" +#include "Shader.h" + +namespace Diligent +{ + class BasicShaderSourceStreamFactory : public IShaderSourceInputStreamFactory + { + public: + BasicShaderSourceStreamFactory( const Char *SearchDirectories = nullptr ); + + virtual void CreateInputStream( const Diligent::Char *Name, IFileStream **ppStream )override; + + private: + std::vector<Diligent::String> m_SearchDirectories; + }; +} diff --git a/Graphics/GraphicsTools/include/GraphicsUtilities.h b/Graphics/GraphicsTools/include/GraphicsUtilities.h new file mode 100644 index 00000000..78002d01 --- /dev/null +++ b/Graphics/GraphicsTools/include/GraphicsUtilities.h @@ -0,0 +1,201 @@ +/* Copyright 2015 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + +/// \file +/// Defines graphics engine utilities + +#include "GraphicsTypes.h" +#include "Shader.h" +#include "Texture.h" +#include "Buffer.h" +#include "RenderDevice.h" + +namespace Diligent +{ + +/// Template structure to convert VALUE_TYPE enumeration into C-type +template<VALUE_TYPE ValType> +struct VALUE_TYPE2CType +{}; + +/// VALUE_TYPE2CType<> template specialization for 8-bit integer value type. + +/// Usage example: +/// +/// VALUE_TYPE2CType<VT_INT8>::CType MyInt8Var; +template<>struct VALUE_TYPE2CType<VT_INT8> { typedef Int8 CType; }; + +/// VALUE_TYPE2CType<> template specialization for 16-bit integer value type. + +/// Usage example: +/// +/// VALUE_TYPE2CType<VT_INT16>::CType MyInt16Var; +template<>struct VALUE_TYPE2CType<VT_INT16> { typedef Int16 CType; }; + +/// VALUE_TYPE2CType<> template specialization for 32-bit integer value type. + +/// Usage example: +/// +/// VALUE_TYPE2CType<VT_INT32>::CType MyInt32Var; +template<>struct VALUE_TYPE2CType<VT_INT32> { typedef Int32 CType; }; + +/// VALUE_TYPE2CType<> template specialization for 8-bit unsigned-integer value type. + +/// Usage example: +/// +/// VALUE_TYPE2CType<VT_UINT8>::CType MyUint8Var; +template<>struct VALUE_TYPE2CType<VT_UINT8> { typedef Uint8 CType; }; + +/// VALUE_TYPE2CType<> template specialization for 16-bit unsigned-integer value type. + +/// Usage example: +/// +/// VALUE_TYPE2CType<VT_UINT16>::CType MyUint16Var; +template<>struct VALUE_TYPE2CType<VT_UINT16>{ typedef Uint16 CType; }; + +/// VALUE_TYPE2CType<> template specialization for 32-bit unsigned-integer value type. + +/// Usage example: +/// +/// VALUE_TYPE2CType<VT_UINT32>::CType MyUint32Var; +template<>struct VALUE_TYPE2CType<VT_UINT32>{ typedef Uint32 CType; }; + +/// VALUE_TYPE2CType<> template specialization for half-precision 16-bit floating-point value type. + +/// Usage example: +/// +/// VALUE_TYPE2CType<VT_FLOAT16>::CType MyFloat16Var; +/// +/// \note 16-bit floating-point values have no corresponding C++ type and are translated to Uint16 +template<>struct VALUE_TYPE2CType<VT_FLOAT16>{ typedef Uint16 CType; }; + +/// VALUE_TYPE2CType<> template specialization for full-precision 32-bit floating-point value type. + +/// Usage example: +/// +/// VALUE_TYPE2CType<VT_FLOAT32>::CType MyFloat32Var; +template<>struct VALUE_TYPE2CType<VT_FLOAT32>{ typedef Float32 CType; }; + + +/// Returns the size of the specified value type +Uint32 GetValueSize( VALUE_TYPE Val ); + +/// Returns the string representing the specified value type +const Char* GetValueTypeString( VALUE_TYPE Val ); + +/// Returns invariant texture format attributes, see TextureFormatAttribs for details. + +/// \param [in] Format - Texture format which attributes are requested for. +/// \return Constant reference to the TextureFormatAttribs structure containing +/// format attributes. +const TextureFormatAttribs& GetTextureFormatAttribs(TEXTURE_FORMAT Format); + + +/// Returns the literal name of a texture view type. For instance, +/// for a shader resource view, "TEXTURE_VIEW_SHADER_RESOURCE" will be returned. + +/// \param [in] ViewType - Texture view type. +/// \return Literal name of the texture view type. +const Char *GetTexViewTypeLiteralName(TEXTURE_VIEW_TYPE ViewType); + +/// Returns the literal name of a buffer view type. For instance, +/// for an unordered access view, "BUFFER_VIEW_UNORDERED_ACCESS" will be returned. + +/// \param [in] ViewType - Buffer view type. +/// \return Literal name of the buffer view type. +const Char *GetBufferViewTypeLiteralName(BUFFER_VIEW_TYPE ViewType); + +/// Returns the literal name of a shader type. For instance, +/// for a pixel shader, "SHADER_TYPE_PIXEL" will be returned. + +/// \param [in] ShaderType - Shader type. +/// \return Literal name of the shader type. +const Char *GetShaderTypeLiteralName(SHADER_TYPE ShaderType); + +/// Overloaded function that returns the literal name of a texture view type. +/// see GetTexViewTypeLiteralName(). +inline const Char* GetViewTypeLiteralName(TEXTURE_VIEW_TYPE TexViewType) +{ + return GetTexViewTypeLiteralName( TexViewType ); +} + +/// Overloaded function that returns the literal name of a buffer view type. +/// see GetBufferViewTypeLiteralName(). +inline const Char* GetViewTypeLiteralName(BUFFER_VIEW_TYPE BuffViewType) +{ + return GetBufferViewTypeLiteralName( BuffViewType ); +} + +/// Returns the string containing the usage +const Char* GetUsageString(USAGE Usage); + +/// Returns the string containing the texture type +const Char* GetTextureTypeString( TEXTURE_TYPE TexType ); + +/// Returns the string containing the bind flags +String GetBindFlagsString( Uint32 BindFlags ); + +/// Returns the string containing the CPU access flags +String GetCPUAccessFlagsString( Uint32 CpuAccessFlags ); + +/// Returns the string containing the texture description +String GetTextureDescString(const TextureDesc &Desc); + +/// Returns the string containing the buffer description +String GetBufferDescString(const BufferDesc &Desc); + + +/// Helper template function that converts object description into a string +template<typename TObjectDescType> +String GetObjectDescString( const TObjectDescType& ) +{ + return ""; +} + +/// Template specialization for texture description +template<> +inline String GetObjectDescString( const TextureDesc& TexDesc ) +{ + String Str( "Tex desc: " ); + Str += GetTextureDescString( TexDesc ); + return Str; +} + +/// Template specialization for buffer description +template<> +inline String GetObjectDescString( const BufferDesc& BuffDesc ) +{ + String Str( "Buff desc: " ); + Str += GetBufferDescString( BuffDesc ); + return Str; +} + +Uint32 ComputeMipLevelsCount( Uint32 Width ); +Uint32 ComputeMipLevelsCount( Uint32 Width, Uint32 Height ); +Uint32 ComputeMipLevelsCount( Uint32 Width, Uint32 Height, Uint32 Depth ); + +void CreateUniformBuffer( IRenderDevice *pDevice, Uint32 Size, IBuffer **ppBuffer, USAGE Usage = USAGE_DYNAMIC, Uint32 BindFlag = BIND_UNIFORM_BUFFER, Uint32 CPUAccessFlags = CPU_ACCESS_WRITE ); + +} diff --git a/Graphics/GraphicsTools/include/ShaderMacroHelper.h b/Graphics/GraphicsTools/include/ShaderMacroHelper.h new file mode 100644 index 00000000..bcfc3e52 --- /dev/null +++ b/Graphics/GraphicsTools/include/ShaderMacroHelper.h @@ -0,0 +1,122 @@ +/* Copyright 2015 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +//-------------------------------------------------------------------------------------- +// Copyright 2013 Intel Corporation +// All Rights Reserved +// +// Permission is granted to use, copy, distribute and prepare derivative works of this +// software for any purpose and without fee, provided, that the above copyright notice +// and this statement appear in all copies. Intel makes no representations about the +// suitability of this software for any purpose. THIS SOFTWARE IS PROVIDED "AS IS." +// INTEL SPECIFICALLY DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, AND ALL LIABILITY, +// INCLUDING CONSEQUENTIAL AND OTHER INDIRECT DAMAGES, FOR THE USE OF THIS SOFTWARE, +// INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PROPRIETARY RIGHTS, AND INCLUDING THE +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Intel does not +// assume any responsibility for any errors which may appear in this software nor any +// responsibility to update it. +//-------------------------------------------------------------------------------------- + +#include <set> +#include <vector> +#include <sstream> +#include <iomanip> +#include "BasicTypes.h" +#include "DebugUtilities.h" +#include "Shader.h" + +namespace Diligent +{ + +class ShaderMacroHelper +{ +public: + ShaderMacroHelper() : m_bIsFinalized(false) {} + + template<typename DefintionType> + void AddShaderMacro( const Diligent::Char* Name, DefintionType Definition ) + { + assert( !m_bIsFinalized ); + std::ostringstream ss; + ss << Definition; + AddShaderMacro<const Diligent::Char*>( Name, ss.str().c_str() ); + } + + void Finalize() + { + ShaderMacro LastMacro = {NULL, NULL}; + m_Macros.push_back(LastMacro); + m_bIsFinalized = true; + } + + operator const ShaderMacro* () + { + assert( !m_Macros.size() || m_bIsFinalized ); + if( m_Macros.size() && !m_bIsFinalized ) + Finalize(); + return m_Macros.size() ? &m_Macros[0] : NULL; + } + +private: + + std::vector< ShaderMacro > m_Macros; + std::set< std::string > m_DefinitionsPull; + bool m_bIsFinalized; +}; + +template<> +inline void ShaderMacroHelper::AddShaderMacro( const Diligent::Char* Name, const Diligent::Char* Definition ) +{ + VERIFY_EXPR( !m_bIsFinalized ); + ShaderMacro NewMacro = + { + Name, + m_DefinitionsPull.insert(Definition).first->c_str() + }; + m_Macros.push_back(NewMacro); +} + +template<> +inline void ShaderMacroHelper::AddShaderMacro( const Diligent::Char* Name, bool Definition ) +{ + assert( !m_bIsFinalized ); + AddShaderMacro( Name, Definition ? "1" : "0"); +} + +template<> +inline void ShaderMacroHelper::AddShaderMacro( const Diligent::Char* Name, float Definition ) +{ + assert( !m_bIsFinalized ); + std::ostringstream ss; + + // Make sure that when floating point represents integer, it is still + // written as float: 1024.0, but not 1024. This is essnetial to + // avoid type conversion issues in GLES. + if( Definition == static_cast<float>(static_cast<int>(Definition)) ) + ss << std::fixed << std::setprecision( 1 ); + + ss << Definition; + AddShaderMacro<const Diligent::Char*>( Name, ss.str().c_str() ); +} + +} diff --git a/Graphics/GraphicsTools/include/pch.h b/Graphics/GraphicsTools/include/pch.h new file mode 100644 index 00000000..b2893486 --- /dev/null +++ b/Graphics/GraphicsTools/include/pch.h @@ -0,0 +1,26 @@ +/* Copyright 2015 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#pragma once + + diff --git a/Graphics/GraphicsTools/src/BasicShaderSourceStreamFactory.cpp b/Graphics/GraphicsTools/src/BasicShaderSourceStreamFactory.cpp new file mode 100644 index 00000000..fa69c7c1 --- /dev/null +++ b/Graphics/GraphicsTools/src/BasicShaderSourceStreamFactory.cpp @@ -0,0 +1,87 @@ +/* Copyright 2015 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "pch.h" +#include "BasicShaderSourceStreamFactory.h" +#include "RefCntAutoPtr.h" + +namespace Diligent +{ + BasicShaderSourceStreamFactory::BasicShaderSourceStreamFactory( const Char *SearchDirectories ) + { + while( SearchDirectories ) + { + const char* Semicolon = strchr( SearchDirectories, ';' ); + String SearchPath; + if( Semicolon == nullptr ) + { + SearchPath = SearchDirectories; + SearchDirectories = nullptr; + } + else + { + SearchPath = String( SearchDirectories, Semicolon ); + SearchDirectories = Semicolon + 1; + } + + if( SearchPath.length() > 0 ) + { + if( SearchPath.back() != '\\' && SearchPath.back() != '/' ) + SearchPath.push_back( '\\' ); + m_SearchDirectories.push_back( SearchPath ); + } + } + m_SearchDirectories.push_back( "" ); + } + + void BasicShaderSourceStreamFactory::CreateInputStream( const Diligent::Char *Name, IFileStream **ppStream ) + { + bool bFileCreated = false; + Diligent::RefCntAutoPtr<BasicFileStream> pBasicFileStream; + for( const auto &SearchDir : m_SearchDirectories ) + { + String FullPath = SearchDir + ( (Name[0] == '\\' || Name[0] == '/') ? Name + 1 : Name); + if( !FileSystem::FileExists( FullPath.c_str() ) ) + continue; + pBasicFileStream = new BasicFileStream( FullPath.c_str(), EFileAccessMode::Read ); + if( pBasicFileStream->IsValid() ) + { + bFileCreated = true; + break; + } + else + { + pBasicFileStream.Release(); + } + } + if( bFileCreated ) + { + pBasicFileStream->QueryInterface( IID_FileStream, reinterpret_cast<IObject**>(ppStream) ); + } + else + { + *ppStream = nullptr; + LOG_ERROR_AND_THROW( "Failed to create input stream for source file ", Name ) + } + } +}
\ No newline at end of file diff --git a/Graphics/GraphicsTools/src/GraphicsUtilities.cpp b/Graphics/GraphicsTools/src/GraphicsUtilities.cpp new file mode 100644 index 00000000..05cc0a3a --- /dev/null +++ b/Graphics/GraphicsTools/src/GraphicsUtilities.cpp @@ -0,0 +1,621 @@ +/* Copyright 2015 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "pch.h" +#include "GraphicsUtilities.h" +#include "DebugUtilities.h" +#include <algorithm> + +namespace Diligent +{ + +Uint32 GetValueSize( VALUE_TYPE Val ) +{ + static Uint32 Sizes[VT_NUM_TYPES] = {}; + static bool bIsInit = false; + // Note that this implementation is thread-safe + // Even if two threads try to call the function at the same time, + // the worst thing that might happen is that the array will be + // initialized multiple times. But the result will always be correct + if( !bIsInit ) + { + Sizes[VT_UNDEFINED] = 0; +#define INIT_VALUE_SIZE( ValType ) Sizes[ValType] = sizeof(VALUE_TYPE2CType<ValType>::CType) + INIT_VALUE_SIZE( VT_INT8 ); + INIT_VALUE_SIZE( VT_INT16 ); + INIT_VALUE_SIZE( VT_INT32 ); + INIT_VALUE_SIZE( VT_UINT8 ); + INIT_VALUE_SIZE( VT_UINT16 ); + INIT_VALUE_SIZE( VT_UINT32 ); + INIT_VALUE_SIZE( VT_FLOAT16 ); + INIT_VALUE_SIZE( VT_FLOAT32 ); +#undef INIT_VALUE_SIZE + static_assert(VT_NUM_TYPES == VT_FLOAT32 + 1, "Not all value type sizes initialized."); + bIsInit = true; + } + + if( Val > VT_UNDEFINED && Val < VT_NUM_TYPES ) + { + return Sizes[Val]; + } + else + { + UNEXPECTED( "Incorrect value type (", Val, ")" ) + return 0; + } +} + +const Char* GetValueTypeString( VALUE_TYPE Val ) +{ + static const Char* ValueTypeStrings[VT_NUM_TYPES] = {}; + static bool bIsInit = false; + if( !bIsInit ) + { +#define INIT_VALUE_TYPE_STR( ValType ) ValueTypeStrings[ValType] = #ValType + INIT_VALUE_TYPE_STR( VT_UNDEFINED ); + INIT_VALUE_TYPE_STR( VT_INT8 ); + INIT_VALUE_TYPE_STR( VT_INT16 ); + INIT_VALUE_TYPE_STR( VT_INT32 ); + INIT_VALUE_TYPE_STR( VT_UINT8 ); + INIT_VALUE_TYPE_STR( VT_UINT16 ); + INIT_VALUE_TYPE_STR( VT_UINT32 ); + INIT_VALUE_TYPE_STR( VT_FLOAT16 ); + INIT_VALUE_TYPE_STR( VT_FLOAT32 ); +#undef INIT_VALUE_TYPE_STR + static_assert(VT_NUM_TYPES == VT_FLOAT32 + 1, "Not all value type strings initialized."); + bIsInit = true; + } + + if( Val >= VT_UNDEFINED && Val < VT_NUM_TYPES ) + { + return ValueTypeStrings[Val]; + } + else + { + UNEXPECTED( "Incorrect value type (", Val, ")" ) + return "unknown value type"; + } +} + +const TextureFormatAttribs& GetTextureFormatAttribs( TEXTURE_FORMAT Format ) +{ + static TextureFormatAttribs FmtAttribs[TEX_FORMAT_NUM_FORMATS] = {}; + static bool bIsInit = false; + // Note that this implementation is thread-safe + // Even if two threads try to call the function at the same time, + // the worst thing that might happen is that the array will be + // initialized multiple times. But the result will always be correct. + if( !bIsInit ) + { +#define INIT_TEX_FORMAT_INFO(TexFmt, ComponentSize, NumComponents, ComponentType) \ + FmtAttribs[ TexFmt ] = TextureFormatAttribs(TexFmt, #TexFmt, ComponentSize, NumComponents, ComponentType); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA32_TYPELESS, 4, 4, COMPONENT_TYPE_UNDEFINED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA32_FLOAT, 4, 4, COMPONENT_TYPE_FLOAT ); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA32_UINT, 4, 4, COMPONENT_TYPE_UINT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA32_SINT, 4, 4, COMPONENT_TYPE_SINT); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGB32_TYPELESS, 4, 3, COMPONENT_TYPE_UNDEFINED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGB32_FLOAT, 4, 3, COMPONENT_TYPE_FLOAT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGB32_UINT, 4, 3, COMPONENT_TYPE_UINT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGB32_SINT, 4, 3, COMPONENT_TYPE_SINT); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA16_TYPELESS, 2, 4, COMPONENT_TYPE_UNDEFINED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA16_FLOAT, 2, 4, COMPONENT_TYPE_FLOAT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA16_UNORM, 2, 4, COMPONENT_TYPE_UNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA16_UINT, 2, 4, COMPONENT_TYPE_UINT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA16_SNORM, 2, 4, COMPONENT_TYPE_SNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA16_SINT, 2, 4, COMPONENT_TYPE_SINT); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG32_TYPELESS, 4, 2, COMPONENT_TYPE_UNDEFINED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG32_FLOAT, 4, 2, COMPONENT_TYPE_FLOAT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG32_UINT, 4, 2, COMPONENT_TYPE_UINT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG32_SINT, 4, 2, COMPONENT_TYPE_SINT); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R32G8X24_TYPELESS, 4, 2, COMPONENT_TYPE_DEPTH_STENCIL); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_D32_FLOAT_S8X24_UINT, 4, 2, COMPONENT_TYPE_DEPTH_STENCIL); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R32_FLOAT_X8X24_TYPELESS,4, 2, COMPONENT_TYPE_DEPTH_STENCIL); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_X32_TYPELESS_G8X24_UINT, 4, 2, COMPONENT_TYPE_DEPTH_STENCIL); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGB10A2_TYPELESS, 4, 1, COMPONENT_TYPE_COMPOUND); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGB10A2_UNORM, 4, 1, COMPONENT_TYPE_COMPOUND); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGB10A2_UINT, 4, 1, COMPONENT_TYPE_COMPOUND); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R11G11B10_FLOAT, 4, 1, COMPONENT_TYPE_COMPOUND); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA8_TYPELESS, 1, 4, COMPONENT_TYPE_UNDEFINED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA8_UNORM, 1, 4, COMPONENT_TYPE_UNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA8_UNORM_SRGB, 1, 4, COMPONENT_TYPE_UNORM_SRGB); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA8_UINT, 1, 4, COMPONENT_TYPE_UINT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA8_SNORM, 1, 4, COMPONENT_TYPE_SNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGBA8_SINT, 1, 4, COMPONENT_TYPE_SINT); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG16_TYPELESS, 2, 2, COMPONENT_TYPE_UNDEFINED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG16_FLOAT, 2, 2, COMPONENT_TYPE_FLOAT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG16_UNORM, 2, 2, COMPONENT_TYPE_UNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG16_UINT, 2, 2, COMPONENT_TYPE_UINT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG16_SNORM, 2, 2, COMPONENT_TYPE_SNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG16_SINT, 2, 2, COMPONENT_TYPE_SINT); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R32_TYPELESS, 4, 1, COMPONENT_TYPE_UNDEFINED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_D32_FLOAT, 4, 1, COMPONENT_TYPE_DEPTH); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R32_FLOAT, 4, 1, COMPONENT_TYPE_FLOAT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R32_UINT, 4, 1, COMPONENT_TYPE_UINT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R32_SINT, 4, 1, COMPONENT_TYPE_SINT); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R24G8_TYPELESS, 4, 1, COMPONENT_TYPE_DEPTH_STENCIL); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_D24_UNORM_S8_UINT, 4, 1, COMPONENT_TYPE_DEPTH_STENCIL); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R24_UNORM_X8_TYPELESS, 4, 1, COMPONENT_TYPE_DEPTH_STENCIL); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_X24_TYPELESS_G8_UINT, 4, 1, COMPONENT_TYPE_DEPTH_STENCIL); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG8_TYPELESS, 1, 2, COMPONENT_TYPE_UNDEFINED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG8_UNORM, 1, 2, COMPONENT_TYPE_UNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG8_UINT, 1, 2, COMPONENT_TYPE_UINT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG8_SNORM, 1, 2, COMPONENT_TYPE_SNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG8_SINT, 1, 2, COMPONENT_TYPE_SINT); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R16_TYPELESS, 2, 1, COMPONENT_TYPE_UNDEFINED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R16_FLOAT, 2, 1, COMPONENT_TYPE_FLOAT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_D16_UNORM, 2, 1, COMPONENT_TYPE_DEPTH); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R16_UNORM, 2, 1, COMPONENT_TYPE_UNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R16_UINT, 2, 1, COMPONENT_TYPE_UINT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R16_SNORM, 2, 1, COMPONENT_TYPE_SNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R16_SINT, 2, 1, COMPONENT_TYPE_SINT); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R8_TYPELESS, 1, 1, COMPONENT_TYPE_UNDEFINED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R8_UNORM, 1, 1, COMPONENT_TYPE_UNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R8_UINT, 1, 1, COMPONENT_TYPE_UINT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R8_SNORM, 1, 1, COMPONENT_TYPE_SNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R8_SINT, 1, 1, COMPONENT_TYPE_SINT); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_A8_UNORM, 1, 1, COMPONENT_TYPE_UNORM); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R1_UNORM, 1, 1, COMPONENT_TYPE_UNORM); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RGB9E5_SHAREDEXP, 4, 1, COMPONENT_TYPE_COMPOUND); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_RG8_B8G8_UNORM, 1, 4, COMPONENT_TYPE_UNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_G8R8_G8B8_UNORM, 1, 4, COMPONENT_TYPE_UNORM); + + // http://www.g-truc.net/post-0335.html + // http://renderingpipeline.com/2012/07/texture-compression/ + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC1_TYPELESS, 8, 3, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC1_UNORM, 8, 3, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC1_UNORM_SRGB, 8, 3, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC2_TYPELESS, 16, 4, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC2_UNORM, 16, 4, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC2_UNORM_SRGB, 16, 4, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC3_TYPELESS, 16, 4, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC3_UNORM, 16, 4, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC3_UNORM_SRGB, 16, 4, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC4_TYPELESS, 8, 1, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC4_UNORM, 8, 1, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC4_SNORM, 8, 1, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC5_TYPELESS, 16, 2, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC5_UNORM, 16, 2, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC5_SNORM, 16, 2, COMPONENT_TYPE_COMPRESSED); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_B5G6R5_UNORM, 2, 1, COMPONENT_TYPE_COMPOUND); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_B5G5R5A1_UNORM, 2, 1, COMPONENT_TYPE_COMPOUND); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BGRA8_UNORM, 1, 4, COMPONENT_TYPE_UNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BGRX8_UNORM, 1, 4, COMPONENT_TYPE_UNORM); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, 4, 1, COMPONENT_TYPE_COMPOUND); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BGRA8_TYPELESS, 1, 4, COMPONENT_TYPE_UNDEFINED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BGRA8_UNORM_SRGB, 1, 4, COMPONENT_TYPE_UNORM_SRGB); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BGRX8_TYPELESS, 1, 4, COMPONENT_TYPE_UNDEFINED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BGRX8_UNORM_SRGB, 1, 4, COMPONENT_TYPE_UNORM_SRGB); + + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC6H_TYPELESS, 16, 3, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC6H_UF16, 16, 3, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC6H_SF16, 16, 3, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC7_TYPELESS, 16, 4, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC7_UNORM, 16, 4, COMPONENT_TYPE_COMPRESSED); + INIT_TEX_FORMAT_INFO( TEX_FORMAT_BC7_UNORM_SRGB, 16, 4, COMPONENT_TYPE_COMPRESSED); +#undef INIT_TEX_FORMAT_INFO + static_assert(TEX_FORMAT_NUM_FORMATS == TEX_FORMAT_BC7_UNORM_SRGB + 1, "Not all texture formats initialized."); + +#ifdef _DEBUG + for( Uint32 Fmt = TEX_FORMAT_UNKNOWN; Fmt < TEX_FORMAT_NUM_FORMATS; ++Fmt ) + VERIFY(FmtAttribs[Fmt].Format == Fmt, "Uninitialized format"); +#endif + + bIsInit = true; + } + + if( Format >= TEX_FORMAT_UNKNOWN && Format < TEX_FORMAT_NUM_FORMATS ) + { + const auto &Attribs = FmtAttribs[Format]; + VERIFY( Attribs.Format == Format, "Unexpected format" ); + return Attribs; + } + else + { + UNEXPECTED( "Texture format (", Format, ") is out of allowed range [0, ", TEX_FORMAT_NUM_FORMATS-1, "]" ); + return FmtAttribs[0]; + } +} + + +const Char *GetTexViewTypeLiteralName( TEXTURE_VIEW_TYPE ViewType ) +{ + static const Char *TexViewLiteralNames[TEXTURE_VIEW_NUM_VIEWS] = {}; + static bool bIsInit = false; + // Note that this implementation is thread-safe + // Even if two threads try to call the function at the same time, + // the worst thing that might happen is that the array will be + // initialized multiple times. But the result will always be correct. + if( !bIsInit ) + { +#define INIT_TEX_VIEW_TYPE_NAME(ViewType)TexViewLiteralNames[ViewType] = #ViewType + INIT_TEX_VIEW_TYPE_NAME( TEXTURE_VIEW_UNDEFINED ); + INIT_TEX_VIEW_TYPE_NAME( TEXTURE_VIEW_SHADER_RESOURCE ); + INIT_TEX_VIEW_TYPE_NAME( TEXTURE_VIEW_RENDER_TARGET ); + INIT_TEX_VIEW_TYPE_NAME( TEXTURE_VIEW_DEPTH_STENCIL ); + INIT_TEX_VIEW_TYPE_NAME( TEXTURE_VIEW_UNORDERED_ACCESS ); +#undef INIT_TEX_VIEW_TYPE_NAME + static_assert(TEXTURE_VIEW_NUM_VIEWS == TEXTURE_VIEW_UNORDERED_ACCESS + 1, "Not all texture views names initialized."); + + bIsInit = true; + } + + if( ViewType >= TEXTURE_VIEW_UNDEFINED && ViewType < TEXTURE_VIEW_NUM_VIEWS ) + { + return TexViewLiteralNames[ViewType]; + } + else + { + UNEXPECTED("Texture view type (", ViewType, ") is out of allowed range [0, ", TEXTURE_VIEW_NUM_VIEWS-1, "]" ); + return "<Unknown texture view type>"; + } +} + +const Char *GetBufferViewTypeLiteralName( BUFFER_VIEW_TYPE ViewType ) +{ + static const Char *BuffViewLiteralNames[BUFFER_VIEW_NUM_VIEWS] = {}; + static bool bIsInit = false; + // Note that this implementation is thread-safe + // Even if two threads try to call the function at the same time, + // the worst thing that might happen is that the array will be + // initialized multiple times. But the result will always be correct. + if( !bIsInit ) + { +#define INIT_BUFF_VIEW_TYPE_NAME(ViewType)BuffViewLiteralNames[ViewType] = #ViewType + INIT_BUFF_VIEW_TYPE_NAME( BUFFER_VIEW_UNDEFINED ); + INIT_BUFF_VIEW_TYPE_NAME( BUFFER_VIEW_SHADER_RESOURCE ); + INIT_BUFF_VIEW_TYPE_NAME( BUFFER_VIEW_UNORDERED_ACCESS ); + #undef INIT_BUFF_VIEW_TYPE_NAME + static_assert(BUFFER_VIEW_NUM_VIEWS == BUFFER_VIEW_UNORDERED_ACCESS + 1, "Not all buffer views names initialized."); + + bIsInit = true; + } + + if( ViewType >= BUFFER_VIEW_UNDEFINED && ViewType < BUFFER_VIEW_NUM_VIEWS ) + { + return BuffViewLiteralNames[ViewType]; + } + else + { + UNEXPECTED( "Buffer view type (", ViewType, ") is out of allowed range [0, ", BUFFER_VIEW_NUM_VIEWS-1, "]" ) + return "<Unknown buffer view type>"; + } +} + +const Char *GetShaderTypeLiteralName( SHADER_TYPE ShaderType ) +{ + switch( ShaderType ) + { +#define RETURN_SHADER_TYPE_NAME(ShaderType)\ + case ShaderType: return #ShaderType; + + RETURN_SHADER_TYPE_NAME( SHADER_TYPE_UNKNOWN ) + RETURN_SHADER_TYPE_NAME( SHADER_TYPE_VERTEX ) + RETURN_SHADER_TYPE_NAME( SHADER_TYPE_PIXEL ) + RETURN_SHADER_TYPE_NAME( SHADER_TYPE_GEOMETRY) + RETURN_SHADER_TYPE_NAME( SHADER_TYPE_HULL ) + RETURN_SHADER_TYPE_NAME( SHADER_TYPE_DOMAIN ) + RETURN_SHADER_TYPE_NAME( SHADER_TYPE_COMPUTE ) +#undef RETURN_SHADER_TYPE_NAME + + default: UNEXPECTED( "Unknown shader type" ); return "<Unknown shader type>"; + } +} + +/// Returns the string containing the usage +const Char* GetUsageString( USAGE Usage ) +{ + static const Char* UsageStrings[4]; + static bool bUsageStringsInit = false; + if( !bUsageStringsInit ) + { +#define INIT_USGAGE_STR(Usage)UsageStrings[Usage] = #Usage + INIT_USGAGE_STR( USAGE_STATIC ); + INIT_USGAGE_STR( USAGE_DEFAULT ); + INIT_USGAGE_STR( USAGE_DYNAMIC ); + INIT_USGAGE_STR( USAGE_CPU_ACCESSIBLE ); +#undef INIT_USGAGE_STR + bUsageStringsInit = true; + } + if( Usage >= USAGE_STATIC && Usage <= USAGE_CPU_ACCESSIBLE ) + return UsageStrings[Usage]; + else + { + UNEXPECTED("Unknow usage" ) + return "Unknown usage"; + } +} + +const Char* GetTextureTypeString( TEXTURE_TYPE TexType ) +{ + static const Char* TexTypeStrings[TEXTURE_TYPE_NUM_TYPES]; + static bool bTexTypeStrsInit = false; + if( !bTexTypeStrsInit ) + { + TexTypeStrings[TEXTURE_TYPE_UNDEFINED] = "Undefined"; + TexTypeStrings[TEXTURE_TYPE_1D] = "1D"; + TexTypeStrings[TEXTURE_TYPE_1D_ARRAY] = "1D Array"; + TexTypeStrings[TEXTURE_TYPE_2D] = "2D"; + TexTypeStrings[TEXTURE_TYPE_2D_ARRAY] = "2D Array"; + TexTypeStrings[TEXTURE_TYPE_3D] = "3D"; + TexTypeStrings[TEXTURE_TYPE_2D_ARRAY] = "Cube"; + TexTypeStrings[TEXTURE_TYPE_3D] = "Cube Array"; + static_assert(TEXTURE_TYPE_NUM_TYPES == TEXTURE_TYPE_CUBE_ARRAY + 1, "Not all texture type strings initialized."); + + bTexTypeStrsInit = true; + } + if( TexType >= TEXTURE_TYPE_UNDEFINED && TexType < TEXTURE_TYPE_NUM_TYPES ) + return TexTypeStrings[TexType]; + else + { + UNEXPECTED("Unknow texture type") + return "Unknow texture type"; + } +} + +static const Char* GetSingleBindFlagString( Uint32 BindFlag ) +{ + VERIFY( (BindFlag & (BindFlag - 1)) == 0, "More than one bind flag specified" ); + switch( BindFlag ) + { +#define BIND_FLAG_STR_CASE(Flag) case Flag: return #Flag; + BIND_FLAG_STR_CASE( BIND_VERTEX_BUFFER ) + BIND_FLAG_STR_CASE( BIND_INDEX_BUFFER ) + BIND_FLAG_STR_CASE( BIND_UNIFORM_BUFFER ) + BIND_FLAG_STR_CASE( BIND_SHADER_RESOURCE ) + BIND_FLAG_STR_CASE( BIND_STREAM_OUTPUT ) + BIND_FLAG_STR_CASE( BIND_RENDER_TARGET ) + BIND_FLAG_STR_CASE( BIND_DEPTH_STENCIL ) + BIND_FLAG_STR_CASE( BIND_UNORDERED_ACCESS ) + BIND_FLAG_STR_CASE( BIND_INDIRECT_DRAW_ARGS ) +#undef BIND_FLAG_STR_CASE + default: UNEXPECTED( "Unexpected bind flag ", BindFlag ); return ""; + } +} + +String GetBindFlagsString( Uint32 BindFlags ) +{ + if( BindFlags == 0 ) + return "0"; + String Str; + for( Uint32 Flag = BIND_VERTEX_BUFFER; BindFlags && Flag <= BIND_INDIRECT_DRAW_ARGS; Flag <<= 1 ) + { + if( BindFlags&Flag ) + { + if( Str.length() ) + Str += '|'; + Str += GetSingleBindFlagString( Flag ); + BindFlags &= ~Flag; + } + } + VERIFY( BindFlags == 0, "Unknown bind flags left" ); + return Str; +} + + +static const Char* GetSingleCPUAccessFlagString( Uint32 CPUAccessFlag ) +{ + VERIFY( (CPUAccessFlag & (CPUAccessFlag - 1)) == 0, "More than one access flag specified" ); + switch( CPUAccessFlag ) + { +#define CPU_ACCESS_FLAG_STR_CASE(Flag) case Flag: return #Flag; + CPU_ACCESS_FLAG_STR_CASE( CPU_ACCESS_READ ) + CPU_ACCESS_FLAG_STR_CASE( CPU_ACCESS_WRITE ) +#undef CPU_ACCESS_FLAG_STR_CASE + default: UNEXPECTED( "Unexpected CPU access flag ", CPUAccessFlag ); return ""; + } +} + +String GetCPUAccessFlagsString( Uint32 CpuAccessFlags ) +{ + if( CpuAccessFlags == 0 ) + return "0"; + String Str; + for( Uint32 Flag = CPU_ACCESS_READ; CpuAccessFlags && Flag <= CPU_ACCESS_WRITE; Flag <<= 1 ) + { + if( CpuAccessFlags&Flag ) + { + if( Str.length() ) + Str += '|'; + Str += GetSingleCPUAccessFlagString( Flag ); + CpuAccessFlags &= ~Flag; + } + } + VERIFY( CpuAccessFlags == 0, "Unknown CPU access flags left" ); + return Str; +} + +// There is a nice standard function to_string, but there is a bug on gcc +// and it does not work +template<typename T> +String ToString( T Val ) +{ + std::stringstream ss; + ss << Val; + return ss.str(); +} + +String GetTextureDescString( const TextureDesc &Desc ) +{ + String Str = "Type: "; + Str += GetTextureTypeString(Desc.Type); + Str += "; size: "; + Str += ToString(Desc.Width); + if( Desc.Type == TEXTURE_TYPE_2D || Desc.Type == TEXTURE_TYPE_2D_ARRAY || Desc.Type == TEXTURE_TYPE_3D) + { + Str += "x"; + Str += ToString( Desc.Height ); + } + + if( Desc.Type == TEXTURE_TYPE_3D ) + { + Str += "x"; + Str += ToString( Desc.Depth ); + } + + if( Desc.Type == TEXTURE_TYPE_1D_ARRAY || Desc.Type == TEXTURE_TYPE_2D_ARRAY ) + { + Str += "; Num Slices: "; + Str += ToString( Desc.ArraySize ); + } + + auto FmtName = GetTextureFormatAttribs( Desc.Format ).Name; + Str += "; Format: "; + Str += FmtName; + + Str += "; Mip levels: "; + Str += ToString( Desc.MipLevels ); + + Str += "; Sample Count: "; + Str += ToString( Desc.SampleCount ); + + Str += "; Usage: "; + Str += GetUsageString(Desc.Usage); + + Str += "; Bind Flags: "; + Str += GetBindFlagsString(Desc.BindFlags); + + Str += "; CPU access: "; + Str += GetCPUAccessFlagsString(Desc.CPUAccessFlags); + + return Str; +} + +static const Char* GetBufferModeString( BUFFER_MODE Mode ) +{ + static const Char* BufferModeStrings[BUFFER_MODE_NUM_MODES]; + static bool bBuffModeStringsInit = false; + if( !bBuffModeStringsInit ) + { +#define INIT_BUFF_MODE_STR(Mode)BufferModeStrings[Mode] = #Mode + INIT_BUFF_MODE_STR( BUFFER_MODE_UNDEFINED ); + INIT_BUFF_MODE_STR( BUFFER_MODE_FORMATED ); + INIT_BUFF_MODE_STR( BUFFER_MODE_STRUCTURED ); +#undef INIT_BUFF_MODE_STR + static_assert(BUFFER_MODE_NUM_MODES == BUFFER_MODE_STRUCTURED + 1, "Not all buffer mode strings initialized."); + bBuffModeStringsInit = true; + } + if( Mode >= BUFFER_MODE_UNDEFINED && Mode < BUFFER_MODE_NUM_MODES ) + return BufferModeStrings[Mode]; + else + { + UNEXPECTED( "Unknown buffer mode" ); + return "Unknown buffer mode"; + } +} + +String GetBufferDescString( const BufferDesc &Desc ) +{ + String Str; + Str += "Size: "; + bool bIsLarge = false; + if( Desc.uiSizeInBytes > (1 << 20) ) + { + Str += ToString( Desc.uiSizeInBytes / (1<<20) ); + Str += " Mb ("; + bIsLarge = true; + } + else if( Desc.uiSizeInBytes > (1 << 10) ) + { + Str += ToString( Desc.uiSizeInBytes / (1<<10) ); + Str += " Kb ("; + bIsLarge = true; + } + + Str += ToString( Desc.uiSizeInBytes ); + Str += " bytes"; + if( bIsLarge ) + Str += ')'; + + Str += "; Mode: "; + Str += GetBufferModeString(Desc.Mode); + if( Desc.Mode == BUFFER_MODE_FORMATED ) + { + Str += "; Format: "; + Str += GetValueTypeString( Desc.Format.ValueType ); + if( Desc.Format.IsNormalized ) + Str += " norm"; + Str += " x "; + Str += ToString(Desc.Format.NumComponents); + } + + Str += "; Usage: "; + Str += GetUsageString(Desc.Usage); + + Str += "; Bind Flags: "; + Str += GetBindFlagsString(Desc.BindFlags); + + Str += "; CPU access: "; + Str += GetCPUAccessFlagsString(Desc.CPUAccessFlags); + + Str += "; stride: "; + Str += ToString( Desc.ElementByteStride ); + Str += " bytes"; + + return Str; +} + +Uint32 ComputeMipLevelsCount( Uint32 Width ) +{ + Uint32 MipLevels = 0; + while( (Width >> MipLevels) > 1 ) + ++MipLevels; + return MipLevels; +} + +Uint32 ComputeMipLevelsCount( Uint32 Width, Uint32 Height ) +{ + return ComputeMipLevelsCount( std::max( Width, Height ) ); +} + +Uint32 ComputeMipLevelsCount( Uint32 Width, Uint32 Height, Uint32 Depth ) +{ + return ComputeMipLevelsCount( std::max(std::max( Width, Height ), Depth) ); +} + +void CreateUniformBuffer( IRenderDevice *pDevice, Uint32 Size, IBuffer **ppBuffer, USAGE Usage, Uint32 BindFlag, Uint32 CPUAccessFlags) +{ + BufferDesc CBDesc; + CBDesc.uiSizeInBytes = Size; + CBDesc.Usage = Usage; + CBDesc.BindFlags = BindFlag; + CBDesc.CPUAccessFlags = CPUAccessFlags; + pDevice->CreateBuffer( CBDesc, BufferData(), ppBuffer ); +} + +} diff --git a/Graphics/GraphicsTools/src/pch.cpp b/Graphics/GraphicsTools/src/pch.cpp new file mode 100644 index 00000000..809315e1 --- /dev/null +++ b/Graphics/GraphicsTools/src/pch.cpp @@ -0,0 +1,24 @@ +/* Copyright 2015 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "pch.h" |
