Import SPIRV-Cross. This will be used later to translate post-processing shaders to the various shader languages we use.

Eventually, this will make it possible to use post-processing with
Vulkan and D3D11. Probably not DX9, though maybe.

Not adding to Android build, there's some strangeness with STL.
This commit is contained in:
Henrik Rydgard 2017-02-14 13:04:14 +01:00
parent 3653b12dac
commit a8ee70f23d
11 changed files with 237 additions and 1 deletions

3
.gitmodules vendored
View file

@ -16,3 +16,6 @@
[submodule "ext/glslang"]
path = ext/glslang
url = https://github.com/hrydgard/glslang.git
[submodule "ext/SPIRV-Cross"]
path = ext/SPIRV-Cross
url = https://github.com/KhronosGroup/SPIRV-Cross.git

View file

@ -34,6 +34,7 @@ ID3D11VertexShader *CreateVertexShaderD3D11(ID3D11Device *device, const char *co
std::vector<uint8_t> byteCode = CompileShaderToBytecode(code, codeSize, "vs_5_0");
if (byteCode.empty())
return nullptr;
ID3D11VertexShader *vs;
device->CreateVertexShader(byteCode.data(), byteCode.size(), nullptr, &vs);
if (byteCodeOut)
@ -51,6 +52,16 @@ ID3D11PixelShader *CreatePixelShaderD3D11(ID3D11Device *device, const char *code
return ps;
}
ID3D11ComputeShader *CreateComputeShaderD3D11(ID3D11Device *device, const char *code, size_t codeSize) {
std::vector<uint8_t> byteCode = CompileShaderToBytecode(code, codeSize, "cs_5_0");
if (byteCode.empty())
return nullptr;
ID3D11ComputeShader *cs;
device->CreateComputeShader(byteCode.data(), byteCode.size(), nullptr, &cs);
return cs;
}
void StockObjectsD3D11::Create(ID3D11Device *device) {
D3D11_BLEND_DESC blend_desc{};
blend_desc.RenderTarget[0].BlendEnable = false;

View file

@ -66,6 +66,7 @@ private:
ID3D11VertexShader *CreateVertexShaderD3D11(ID3D11Device *device, const char *code, size_t codeSize, std::vector<uint8_t> *byteCodeOut);
ID3D11PixelShader *CreatePixelShaderD3D11(ID3D11Device *device, const char *code, size_t codeSize);
ID3D11ComputeShader *CreateComputeShaderD3D11(ID3D11Device *device, const char *code, size_t codeSize);
class StockObjectsD3D11 {
public:

View file

@ -23,6 +23,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\ext\zlib\zlib.vc
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GPU", "..\GPU\GPU.vcxproj", "{457F45D2-556F-47BC-A31D-AFF0D15BEAED}"
ProjectSection(ProjectDependencies) = postProject
{4328A62C-F1E9-47ED-B816-A1A81DAF4363} = {4328A62C-F1E9-47ED-B816-A1A81DAF4363}
{3FCDBAE2-5103-4350-9A8E-848CE9C73195} = {3FCDBAE2-5103-4350-9A8E-848CE9C73195}
EndProjectSection
EndProject
@ -74,6 +75,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libarmips", "..\ext\libarmi
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glslang", "..\ext\glslang.vcxproj", "{EDFA2E87-8AC1-4853-95D4-D7594FF81947}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPIRV-Cross", "..\ext\SPIRV-Cross.vcxproj", "{4328A62C-F1E9-47ED-B816-A1A81DAF4363}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -228,6 +231,18 @@ Global
{EDFA2E87-8AC1-4853-95D4-D7594FF81947}.Tests|Win32.Build.0 = Release|Win32
{EDFA2E87-8AC1-4853-95D4-D7594FF81947}.Tests|x64.ActiveCfg = Release|x64
{EDFA2E87-8AC1-4853-95D4-D7594FF81947}.Tests|x64.Build.0 = Release|x64
{4328A62C-F1E9-47ED-B816-A1A81DAF4363}.Debug|Win32.ActiveCfg = Debug|Win32
{4328A62C-F1E9-47ED-B816-A1A81DAF4363}.Debug|Win32.Build.0 = Debug|Win32
{4328A62C-F1E9-47ED-B816-A1A81DAF4363}.Debug|x64.ActiveCfg = Debug|x64
{4328A62C-F1E9-47ED-B816-A1A81DAF4363}.Debug|x64.Build.0 = Debug|x64
{4328A62C-F1E9-47ED-B816-A1A81DAF4363}.Release|Win32.ActiveCfg = Release|Win32
{4328A62C-F1E9-47ED-B816-A1A81DAF4363}.Release|Win32.Build.0 = Release|Win32
{4328A62C-F1E9-47ED-B816-A1A81DAF4363}.Release|x64.ActiveCfg = Release|x64
{4328A62C-F1E9-47ED-B816-A1A81DAF4363}.Release|x64.Build.0 = Release|x64
{4328A62C-F1E9-47ED-B816-A1A81DAF4363}.Tests|Win32.ActiveCfg = Release|Win32
{4328A62C-F1E9-47ED-B816-A1A81DAF4363}.Tests|Win32.Build.0 = Release|Win32
{4328A62C-F1E9-47ED-B816-A1A81DAF4363}.Tests|x64.ActiveCfg = Release|x64
{4328A62C-F1E9-47ED-B816-A1A81DAF4363}.Tests|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

1
android/.gitignore vendored
View file

@ -1,5 +1,6 @@
gen
obj
android.iml
#ui_atlas.zim
ui_atlas.zim.png
#assets/ui_atlas.zim

View file

@ -1,5 +1,5 @@
APP_STL := gnustl_static
APP_PLATFORM := android-9
APP_ABI := arm64-v8a armeabi-v7a x86 x86_64
APP_GNUSTL_CPP_FEATURES :=
APP_GNUSTL_CPP_FEATURES := exceptions
NDK_TOOLCHAIN_VERSION := clang

2
ext/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
Win32
x64

View file

@ -7,3 +7,4 @@ set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "let's not build binaries we don't ne
add_subdirectory(glslang)
add_subdirectory(snappy)
add_subdirectory(udis86)
add_subdirectory(SPIRV-Cross)

1
ext/SPIRV-Cross Submodule

@ -0,0 +1 @@
Subproject commit 603673629ebfe8915b50600a7c98b4ee1d3a1cfe

177
ext/SPIRV-Cross.vcxproj Normal file
View file

@ -0,0 +1,177 @@
<?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>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{4328A62C-F1E9-47ED-B816-A1A81DAF4363}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>SPIRVCross</RootNamespace>
<WindowsTargetPlatformVersion>
</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup 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" />
</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" />
</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" />
</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" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Platform)\SPIRV-Cross$(Configuration)\</OutDir>
<IntDir>$(Platform)\SPIRV-Cross$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Platform)\SPIRV-Cross$(Configuration)\</OutDir>
<IntDir>$(Platform)\SPIRV-Cross$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IntDir>$(Platform)\SPIRV-Cross$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)$(Platform)\SPIRV-Cross$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IntDir>$(Platform)\SPIRV-Cross$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)$(Platform)\SPIRV-Cross$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="SPIRV-Cross\spirv.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_cfg.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_common.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_cpp.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_cross.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_glsl.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_hlsl.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_msl.hpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="SPIRV-Cross\spirv_cfg.cpp" />
<ClCompile Include="SPIRV-Cross\spirv_cpp.cpp" />
<ClCompile Include="SPIRV-Cross\spirv_cross.cpp" />
<ClCompile Include="SPIRV-Cross\spirv_glsl.cpp" />
<ClCompile Include="SPIRV-Cross\spirv_hlsl.cpp" />
<ClCompile Include="SPIRV-Cross\spirv_msl.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="SPIRV-Cross\spirv.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_cfg.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_common.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_cpp.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_cross.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_glsl.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_hlsl.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_msl.hpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="SPIRV-Cross\spirv_cfg.cpp" />
<ClCompile Include="SPIRV-Cross\spirv_cpp.cpp" />
<ClCompile Include="SPIRV-Cross\spirv_cross.cpp" />
<ClCompile Include="SPIRV-Cross\spirv_glsl.cpp" />
<ClCompile Include="SPIRV-Cross\spirv_hlsl.cpp" />
<ClCompile Include="SPIRV-Cross\spirv_msl.cpp" />
</ItemGroup>
</Project>