From a8ee70f23dc36c0f78964692445ed441586bcd2a Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Tue, 14 Feb 2017 13:04:14 +0100 Subject: [PATCH] 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. --- .gitmodules | 3 + GPU/D3D11/D3D11Util.cpp | 11 ++ GPU/D3D11/D3D11Util.h | 1 + Windows/PPSSPP.sln | 15 +++ android/.gitignore | 1 + android/jni/Application.mk | 2 +- ext/.gitignore | 2 + ext/CMakeLists.txt | 1 + ext/SPIRV-Cross | 1 + ext/SPIRV-Cross.vcxproj | 177 ++++++++++++++++++++++++++++++++ ext/SPIRV-Cross.vcxproj.filters | 24 +++++ 11 files changed, 237 insertions(+), 1 deletion(-) create mode 100644 ext/.gitignore create mode 160000 ext/SPIRV-Cross create mode 100644 ext/SPIRV-Cross.vcxproj create mode 100644 ext/SPIRV-Cross.vcxproj.filters diff --git a/.gitmodules b/.gitmodules index 826c2a7908..57a0d7933e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/GPU/D3D11/D3D11Util.cpp b/GPU/D3D11/D3D11Util.cpp index 256f57616a..12069a17b8 100644 --- a/GPU/D3D11/D3D11Util.cpp +++ b/GPU/D3D11/D3D11Util.cpp @@ -34,6 +34,7 @@ ID3D11VertexShader *CreateVertexShaderD3D11(ID3D11Device *device, const char *co std::vector 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 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; diff --git a/GPU/D3D11/D3D11Util.h b/GPU/D3D11/D3D11Util.h index 4718756731..1329b13399 100644 --- a/GPU/D3D11/D3D11Util.h +++ b/GPU/D3D11/D3D11Util.h @@ -66,6 +66,7 @@ private: ID3D11VertexShader *CreateVertexShaderD3D11(ID3D11Device *device, const char *code, size_t codeSize, std::vector *byteCodeOut); ID3D11PixelShader *CreatePixelShaderD3D11(ID3D11Device *device, const char *code, size_t codeSize); +ID3D11ComputeShader *CreateComputeShaderD3D11(ID3D11Device *device, const char *code, size_t codeSize); class StockObjectsD3D11 { public: diff --git a/Windows/PPSSPP.sln b/Windows/PPSSPP.sln index 327f0ff81a..ed6f8d09d4 100644 --- a/Windows/PPSSPP.sln +++ b/Windows/PPSSPP.sln @@ -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 diff --git a/android/.gitignore b/android/.gitignore index 31bce7aa41..9cf56195f9 100644 --- a/android/.gitignore +++ b/android/.gitignore @@ -1,5 +1,6 @@ gen obj +android.iml #ui_atlas.zim ui_atlas.zim.png #assets/ui_atlas.zim diff --git a/android/jni/Application.mk b/android/jni/Application.mk index 484b88d80e..b53a911f7e 100644 --- a/android/jni/Application.mk +++ b/android/jni/Application.mk @@ -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 diff --git a/ext/.gitignore b/ext/.gitignore new file mode 100644 index 0000000000..a69091e773 --- /dev/null +++ b/ext/.gitignore @@ -0,0 +1,2 @@ +Win32 +x64 diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index 286249188e..db447e0318 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -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) diff --git a/ext/SPIRV-Cross b/ext/SPIRV-Cross new file mode 160000 index 0000000000..603673629e --- /dev/null +++ b/ext/SPIRV-Cross @@ -0,0 +1 @@ +Subproject commit 603673629ebfe8915b50600a7c98b4ee1d3a1cfe diff --git a/ext/SPIRV-Cross.vcxproj b/ext/SPIRV-Cross.vcxproj new file mode 100644 index 0000000000..976fe901da --- /dev/null +++ b/ext/SPIRV-Cross.vcxproj @@ -0,0 +1,177 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {4328A62C-F1E9-47ED-B816-A1A81DAF4363} + Win32Proj + SPIRVCross + + + + + + StaticLibrary + true + v140_xp + Unicode + + + StaticLibrary + false + v140_xp + true + Unicode + + + StaticLibrary + true + v140_xp + Unicode + + + StaticLibrary + false + v140_xp + true + Unicode + + + + + + + + + + + + + + + + + + + + + $(SolutionDir)$(Platform)\SPIRV-Cross$(Configuration)\ + $(Platform)\SPIRV-Cross$(Configuration)\ + + + $(SolutionDir)$(Platform)\SPIRV-Cross$(Configuration)\ + $(Platform)\SPIRV-Cross$(Configuration)\ + + + $(Platform)\SPIRV-Cross$(Configuration)\ + $(SolutionDir)$(Platform)\SPIRV-Cross$(Configuration)\ + + + $(Platform)\SPIRV-Cross$(Configuration)\ + $(SolutionDir)$(Platform)\SPIRV-Cross$(Configuration)\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + false + MultiThreadedDebug + + + Windows + + + + + + + Level3 + Disabled + _DEBUG;_LIB;%(PreprocessorDefinitions) + false + MultiThreadedDebug + + + Windows + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + false + + + Windows + true + true + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + false + + + Windows + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ext/SPIRV-Cross.vcxproj.filters b/ext/SPIRV-Cross.vcxproj.filters new file mode 100644 index 0000000000..a7292be06c --- /dev/null +++ b/ext/SPIRV-Cross.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file