diff --git a/.github/workflows/SwiftShader.yml b/.github/workflows/SwiftShader.yml index 3d3a72fee4..a5c54339bb 100644 --- a/.github/workflows/SwiftShader.yml +++ b/.github/workflows/SwiftShader.yml @@ -36,7 +36,7 @@ jobs: token: ${{ secrets.PUSHABLE_GITHUB_TOKEN }} - name: Checkout submodules, configure git run: | - git -c submodule.third_party/git-hooks.update=none submodule update --init --recursive + git -c submodule.third_party/git-hooks.update=none submodule update --init --recursive --depth 0 git config --local user.email "9011267+dotnet-bot@users.noreply.github.com" git config --local user.name "The Silk.NET Automaton" - name: Extra prerequisites @@ -50,10 +50,12 @@ jobs: .tmp ~/.nuget/packages key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }} - - name: Setup .NET 6.0 + - name: Setup .NET 6.0 and .NET 7.0 uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.201 + dotnet-version: | + 6.0.201 + 7.0.* - name: Build SwiftShader run: ${{ matrix.env.nuke_invoke }} SwiftShader env: diff --git a/.github/workflows/angle.yml b/.github/workflows/angle.yml index b2857d4b8a..57e8fed8a1 100644 --- a/.github/workflows/angle.yml +++ b/.github/workflows/angle.yml @@ -38,7 +38,7 @@ jobs: token: ${{ secrets.PUSHABLE_GITHUB_TOKEN }} - name: Checkout submodules, configure git run: | - git -c submodule.third_party/git-hooks.update=none submodule update --init --recursive + git -c submodule.third_party/git-hooks.update=none submodule update --init --recursive --depth 0 git config --local user.email "9011267+dotnet-bot@users.noreply.github.com" git config --local user.name "The Silk.NET Automaton" - name: Extra prerequisites @@ -52,10 +52,12 @@ jobs: .tmp ~/.nuget/packages key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }} - - name: Setup .NET 6.0 + - name: Setup .NET 6.0 and .NET 7.0 uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.201 + dotnet-version: | + 6.0.201 + 7.0.* - name: Build ANGLE run: ${{ matrix.env.nuke_invoke }} Angle env: diff --git a/.github/workflows/assimp.yml b/.github/workflows/assimp.yml index a5a0fb5d1c..d5e94f7bb6 100644 --- a/.github/workflows/assimp.yml +++ b/.github/workflows/assimp.yml @@ -36,17 +36,19 @@ jobs: token: ${{ secrets.PUSHABLE_GITHUB_TOKEN }} - name: Checkout submodules, configure git. run: | - git -c submodule.third_party/git-hooks.update=none submodule update --init --recursive + git -c submodule.third_party/git-hooks.update=none submodule update --init --recursive --depth 0 git config --local user.email "9011267+dotnet-bot@users.noreply.github.com" git config --local user.name "The Silk.NET Automaton" - name: Extra prerequisites run: | echo running extras ${{ matrix.env.extras }} - - name: Setup .NET 6.0 + - name: Setup .NET 6.0 and .NET 7.0 uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.201 + dotnet-version: | + 6.0.201 + 7.0.* - name: Build Assimp run: ${{ matrix.env.nuke_invoke }} assimp env: diff --git a/.github/workflows/dxvk.yml b/.github/workflows/dxvk.yml new file mode 100644 index 0000000000..c8cf192dfe --- /dev/null +++ b/.github/workflows/dxvk.yml @@ -0,0 +1,55 @@ +name: DXVK +on: + push: + paths: + - build/submodules/dxvk + - build/nuke/Build.Native.cs + - .github/workflows/dxvk.yml + branches-ignore: + - "ci/*" + - "develop/*" + - "main" +jobs: + Build: + strategy: + fail-fast: false + matrix: + env: + - os: ubuntu-latest + name: Linux + nuke_invoke: ./build.sh + extras: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip python3-setuptools python3-wheel ninja-build mingw-w64 glslang-dev glslang-tools + pip3 install meson + name: ${{ matrix.env.name }} Build + runs-on: ${{ matrix.env.os }} + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.PUSHABLE_GITHUB_TOKEN }} + - name: Checkout submodules, configure git + run: | + git submodule update --init --recursive --depth 0 build/submodules/dxvk + git config --local user.email "9011267+dotnet-bot@users.noreply.github.com" + git config --local user.name "The Silk.NET Automaton" + - name: Extra prerequisites + run: | + echo running extras + ${{ matrix.env.extras }} + - name: Cache .tmp, ~/.nuget/packages + uses: actions/cache@v2 + with: + path: | + .tmp + ~/.nuget/packages + key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }} + - name: Build DXVK + uses: Joshua-Ashton/arch-mingw-github-action@12cb3126180924c3be54025b08f42e4e14da080b + with: + command: | + pacman -Syu --needed --noconfirm dotnet-host dotnet-runtime dotnet-runtime-6.0 dotnet-sdk dotnet-sdk-6.0 dotnet-targeting-pack dotnet-targeting-pack-6.0 sdl2 lib32-sdl2 + + ${{ matrix.env.nuke_invoke }} Dxvk + env: + PUSHABLE_GITHUB_TOKEN: ${{ secrets.PUSHABLE_GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/glfw.yml b/.github/workflows/glfw.yml index ba45a06b15..1a6c784418 100644 --- a/.github/workflows/glfw.yml +++ b/.github/workflows/glfw.yml @@ -36,17 +36,19 @@ jobs: token: ${{ secrets.PUSHABLE_GITHUB_TOKEN }} - name: Checkout submodules, configure git run: | - git -c submodule.third_party/git-hooks.update=none submodule update --init --recursive + git -c submodule.third_party/git-hooks.update=none submodule update --init --recursive --depth 0 git config --local user.email "9011267+dotnet-bot@users.noreply.github.com" git config --local user.name "The Silk.NET Automaton" - name: Extra prerequisites run: | echo running extras ${{ matrix.env.extras }} - - name: Setup .NET 6.0 + - name: Setup .NET 6.0 and .NET 7.0 uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.201 + dotnet-version: | + 6.0.201 + 7.0.* - name: Build GLFW run: ${{ matrix.env.nuke_invoke }} glfw env: diff --git a/.github/workflows/vkd3d.yml b/.github/workflows/vkd3d.yml new file mode 100644 index 0000000000..769de31644 --- /dev/null +++ b/.github/workflows/vkd3d.yml @@ -0,0 +1,57 @@ +name: Vkd3d +on: + push: + branches-ignore: + - "ci/*" + - "develop/*" + - "main" + paths: + - "build/submodules/vkd3d" + - "build/submodules/vkd3d-no-ms-abi.patch" + - "build/nuke/Build.Native.cs" + - ".github/workflows/vkd3d.yml" + - "src/Microsoft/Vkd3dCompiler/*" +jobs: + Build: + strategy: + fail-fast: false + matrix: + env: + - os: ubuntu-latest + name: Linux + nuke_invoke: ./build.sh + extras: | + sudo apt-get update + sudo apt-get install -y xorg-dev libvulkan-dev spirv-headers wine64-development-tools cmake build-essential + + wget http://mirrors.kernel.org/ubuntu/pool/universe/s/spirv-tools/spirv-tools_2020.1-2_amd64.deb + sudo apt install ./spirv-tools_2020.1-2_amd64.deb + name: ${{ matrix.env.name }} Build + runs-on: ${{ matrix.env.os }} + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.PUSHABLE_GITHUB_TOKEN }} + - name: Checkout submodules, configure git + run: | + git submodule update --init --recursive --depth 0 build/submodules/vkd3d + git submodule update --init --recursive --depth 0 build/submodules/SPIRV-Tools + git config --local user.email "9011267+dotnet-bot@users.noreply.github.com" + git config --local user.name "The Silk.NET Automaton" + - name: Extra prerequisites + run: | + echo running extras + ${{ matrix.env.extras }} + - name: Install Zig + uses: goto-bus-stop/setup-zig@v2 + - name: Setup .NET 6.0 and .NET 7.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: | + 6.0.201 + 7.0.* + - name: Build vkd3d + run: ${{ matrix.env.nuke_invoke }} Vkd3d + env: + PUSHABLE_GITHUB_TOKEN: ${{ secrets.PUSHABLE_GITHUB_TOKEN }} + diff --git a/.github/workflows/vulkan-loader.yml b/.github/workflows/vulkan-loader.yml index 06b0092516..ec9c40d420 100644 --- a/.github/workflows/vulkan-loader.yml +++ b/.github/workflows/vulkan-loader.yml @@ -36,7 +36,7 @@ jobs: token: ${{ secrets.PUSHABLE_GITHUB_TOKEN }} - name: Checkout submodules, configure git run: | - git -c submodule.third_party/git-hooks.update=none submodule update --init --recursive + git -c submodule.third_party/git-hooks.update=none submodule update --init --recursive --depth 0 git config --local user.email "9011267+dotnet-bot@users.noreply.github.com" git config --local user.name "The Silk.NET Automaton" - name: Extra prerequisites @@ -50,10 +50,12 @@ jobs: .tmp ~/.nuget/packages key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }} - - name: Setup .NET 6.0 + - name: Setup .NET 6.0 and .NET 7.0 uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.201 + dotnet-version: | + 6.0.201 + 7.0.* - name: Build Vulkan Loader run: ${{ matrix.env.nuke_invoke }} VulkanLoader env: diff --git a/.gitmodules b/.gitmodules index 5ded8e5fac..b1879702e0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,3 +28,12 @@ [submodule "build/submodules/dawn"] path = build/submodules/dawn url = https://github.com/Beyley/dawn +[submodule "build/submodules/dxvk"] + path = build/submodules/dxvk + url = https://github.com/doitsujin/dxvk/ +[submodule "build/submodules/vkd3d"] + path = build/submodules/vkd3d + url = https://github.com/Beyley/vkd3d +[submodule "build/submodules/SPIRV-Tools"] + path = build/submodules/SPIRV-Tools + url = https://github.com/KhronosGroup/SPIRV-Tools diff --git a/Silk.NET.sln b/Silk.NET.sln index 360d06b09a..261c7deaad 100644 --- a/Silk.NET.sln +++ b/Silk.NET.sln @@ -562,6 +562,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.DirectComposition" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.WebGPU.Native.WGPU", "src\Native\Silk.NET.WebGPU.Native.WGPU\Silk.NET.WebGPU.Native.WGPU.csproj", "{4031A5EB-820B-478D-A656-85C93210054E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.DXVK.Native", "src\Native\Silk.NET.DXVK.Native\Silk.NET.DXVK.Native.csproj", "{79680317-F985-4727-81D3-8BF2228AEC20}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Vkd3d.Native", "src\Native\Silk.NET.Vkd3d.Native\Silk.NET.Vkd3d.Native.csproj", "{5DB2BB47-77D3-4EB7-8037-64D88FDE4785}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.DirectWrite", "src\Microsoft\Silk.NET.DirectWrite\Silk.NET.DirectWrite.csproj", "{EDEFAF88-EDD7-4D9C-B364-28B769672FB3}" EndProject Global @@ -3405,6 +3408,30 @@ Global {4031A5EB-820B-478D-A656-85C93210054E}.Release|x64.Build.0 = Release|Any CPU {4031A5EB-820B-478D-A656-85C93210054E}.Release|x86.ActiveCfg = Release|Any CPU {4031A5EB-820B-478D-A656-85C93210054E}.Release|x86.Build.0 = Release|Any CPU + {79680317-F985-4727-81D3-8BF2228AEC20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {79680317-F985-4727-81D3-8BF2228AEC20}.Debug|Any CPU.Build.0 = Debug|Any CPU + {79680317-F985-4727-81D3-8BF2228AEC20}.Debug|x64.ActiveCfg = Debug|Any CPU + {79680317-F985-4727-81D3-8BF2228AEC20}.Debug|x64.Build.0 = Debug|Any CPU + {79680317-F985-4727-81D3-8BF2228AEC20}.Debug|x86.ActiveCfg = Debug|Any CPU + {79680317-F985-4727-81D3-8BF2228AEC20}.Debug|x86.Build.0 = Debug|Any CPU + {79680317-F985-4727-81D3-8BF2228AEC20}.Release|Any CPU.ActiveCfg = Release|Any CPU + {79680317-F985-4727-81D3-8BF2228AEC20}.Release|Any CPU.Build.0 = Release|Any CPU + {79680317-F985-4727-81D3-8BF2228AEC20}.Release|x64.ActiveCfg = Release|Any CPU + {79680317-F985-4727-81D3-8BF2228AEC20}.Release|x64.Build.0 = Release|Any CPU + {79680317-F985-4727-81D3-8BF2228AEC20}.Release|x86.ActiveCfg = Release|Any CPU + {79680317-F985-4727-81D3-8BF2228AEC20}.Release|x86.Build.0 = Release|Any CPU + {5DB2BB47-77D3-4EB7-8037-64D88FDE4785}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5DB2BB47-77D3-4EB7-8037-64D88FDE4785}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5DB2BB47-77D3-4EB7-8037-64D88FDE4785}.Debug|x64.ActiveCfg = Debug|Any CPU + {5DB2BB47-77D3-4EB7-8037-64D88FDE4785}.Debug|x64.Build.0 = Debug|Any CPU + {5DB2BB47-77D3-4EB7-8037-64D88FDE4785}.Debug|x86.ActiveCfg = Debug|Any CPU + {5DB2BB47-77D3-4EB7-8037-64D88FDE4785}.Debug|x86.Build.0 = Debug|Any CPU + {5DB2BB47-77D3-4EB7-8037-64D88FDE4785}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5DB2BB47-77D3-4EB7-8037-64D88FDE4785}.Release|Any CPU.Build.0 = Release|Any CPU + {5DB2BB47-77D3-4EB7-8037-64D88FDE4785}.Release|x64.ActiveCfg = Release|Any CPU + {5DB2BB47-77D3-4EB7-8037-64D88FDE4785}.Release|x64.Build.0 = Release|Any CPU + {5DB2BB47-77D3-4EB7-8037-64D88FDE4785}.Release|x86.ActiveCfg = Release|Any CPU + {5DB2BB47-77D3-4EB7-8037-64D88FDE4785}.Release|x86.Build.0 = Release|Any CPU {EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Debug|Any CPU.Build.0 = Debug|Any CPU {EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -3690,6 +3717,8 @@ Global {82626916-C5F3-46E7-B0EC-1D38191450C7} = {58FECE86-7530-4E6F-BA61-512BE44DEA83} {8773396C-5EDF-498C-97D7-1D2728CB969B} = {F2CF5D32-4B41-425E-B229-8FFC48F88063} {4031A5EB-820B-478D-A656-85C93210054E} = {72E7FA64-5B1E-477D-BD30-63B7F206B3C4} + {79680317-F985-4727-81D3-8BF2228AEC20} = {72E7FA64-5B1E-477D-BD30-63B7F206B3C4} + {5DB2BB47-77D3-4EB7-8037-64D88FDE4785} = {72E7FA64-5B1E-477D-BD30-63B7F206B3C4} {EDEFAF88-EDD7-4D9C-B364-28B769672FB3} = {F2CF5D32-4B41-425E-B229-8FFC48F88063} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/Silk.NET.sln.DotSettings b/Silk.NET.sln.DotSettings index 15296a6115..8b2b19f6a6 100644 --- a/Silk.NET.sln.DotSettings +++ b/Silk.NET.sln.DotSettings @@ -26,6 +26,7 @@ True True True + True True True True diff --git a/build/nuke/Build.Native.cs b/build/nuke/Build.Native.cs index 1b03191461..87bd5b4ae9 100644 --- a/build/nuke/Build.Native.cs +++ b/build/nuke/Build.Native.cs @@ -403,6 +403,81 @@ string AndroidHome ) ); + AbsolutePath Vkd3dPath => RootDirectory / "build" / "submodules" / "vkd3d"; + AbsolutePath SPIRVToolsPath => RootDirectory / "build" / "submodules" / "SPIRV-Tools"; + + Target Vkd3d => CommonTarget + ( + x => x.Before(Compile) + .After(Clean) + .Executes + ( + () => + { + if(!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + throw new PlatformNotSupportedException("This task only runs on Linux!"); + } + + var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.Vkd3d.Native" / "runtimes"; + + var vkd3dBuild = SPIRVToolsPath / "build"; + EnsureCleanDirectory(vkd3dBuild); + + { //SPIRV-Tools + //Clone the SPIRV-Headers external repo + InheritedShell($"git clone https://github.com/KhronosGroup/SPIRV-Headers.git external/spirv-headers", SPIRVToolsPath).AssertZeroExitCode(); + + //Make the build scripts, with shared libs enabled + InheritedShell($"cmake .. -DBUILD_SHARED_LIBS=1", vkd3dBuild).AssertZeroExitCode(); + + //Compile SPIRV-Tools + InheritedShell($"cmake --build . --config Release", vkd3dBuild).AssertZeroExitCode(); + + //Run `strip -g` on the shared library file to remove debug info and shrink it from ~30mb down to only ~5.5mb + InheritedShell($"strip -g libSPIRV-Tools-shared.so", vkd3dBuild / "source").AssertZeroExitCode(); + + //Copy the resulting SPIRV-Tools shared library to the runtimes folder + CopyFile(vkd3dBuild / "source" / "libSPIRV-Tools-shared.so", runtimes / "linux-x64" / "native" / "libSPIRV-Tools-shared.so", FileExistsPolicy.Overwrite); + } + + { //Vkd3d + var dest = Vkd3dPath / "dest"; + var @out = Vkd3dPath / "build"; + + EnsureCleanDirectory(@out); + EnsureCleanDirectory(dest); + + //Run autogen + InheritedShell($"./autogen.sh", Vkd3dPath).AssertZeroExitCode(); + //Run configure to make a non-debug build, with no trace messages, with a prefix of /usr and with spirv-tools + InheritedShell($"./configure CPPFLAGS=\"-DNDEBUG -DVKD3D_NO_TRACE_MESSAGES -fPIC\" --prefix=/usr --with-spirv-tools", Vkd3dPath).AssertZeroExitCode(); + //Build vkd3d + InheritedShell($"make -j4", Vkd3dPath).AssertZeroExitCode(); + //Install vkd3d to the dest folder + InheritedShell($"make DESTDIR=\"{Vkd3dPath.ToString().TrimEnd('/')}/dest\" install", Vkd3dPath).AssertZeroExitCode(); + + var vkd3dShaderCompiler = RootDirectory / "src" / "Microsoft" / "Vkd3dCompiler"; + + //Copy libvkd3d-shader.a + CopyFile(@dest / "usr" / "lib" / "libvkd3d-shader.a", vkd3dShaderCompiler / "libvkd3d-shader.a"); + //Copy libvkd3d-shader.la + CopyFile(@dest / "usr" / "lib" / "libvkd3d-shader.la", vkd3dShaderCompiler / "libvkd3d-shader.la"); + //Copy libSPIRV-Tools-shared.so + CopyFile(vkd3dBuild / "source" / "libSPIRV-Tools-shared.so", vkd3dShaderCompiler / "libSPIRV-Tools-shared.so"); + + //Build the shader compiler + InheritedShell($"zig build -Doptimize=ReleaseSmall -Dtarget=x86_64-linux-gnu --verbose", vkd3dShaderCompiler).AssertZeroExitCode(); + + //Copy the resulting shader compiler to the native output + CopyFile(vkd3dShaderCompiler / "zig-out" / "lib" / "libd3dcompile_vkd3d.so", runtimes / "linux-x64" / "native" / "libd3dcompile_vkd3d.so", FileExistsPolicy.Overwrite); + } + + PrUpdatedNativeBinary("Vkd3d"); + } + ) + ); + AbsolutePath VulkanLoaderPath => RootDirectory / "build" / "submodules" / "Vulkan-Loader"; Target VulkanLoader => CommonTarget @@ -443,6 +518,135 @@ string AndroidHome } ) ); + + AbsolutePath DxvkPath => RootDirectory / "build" / "submodules" / "dxvk"; + + Target Dxvk => CommonTarget + ( + x => x.Before(Compile) + .After(Clean) + .Executes + ( + () => + { + if (!OperatingSystem.IsLinux()) + { + throw new Exception("This task can only run under Linux!"); + } + + var @out = DxvkPath / "output"; + var glfwOut = DxvkPath / "glfw-output"; + EnsureCleanDirectory(@out); + EnsureCleanDirectory(glfwOut); + + InheritedShell + ( + $"./package-release.sh master output --no-package", + DxvkPath + ) + .AssertZeroExitCode(); + + var win32GlfwLibs = @out.GlobFiles("dxvk-master/x32/*"); + + foreach (var lib in win32GlfwLibs) + { + var fileName = Path.GetFileName(lib); + RenameFile(lib.Parent / fileName, lib.Parent / "dxvk-" + fileName); + } + + var win64GlfwLibs = @out.GlobFiles("dxvk-master/x64/*"); + + foreach (var lib in win64GlfwLibs) + { + var fileName = Path.GetFileName(lib); + RenameFile(lib.Parent / fileName, lib.Parent / "dxvk-" + fileName); + } + + InheritedShell + ( + $"./package-native.sh master output --no-package", + DxvkPath + ) + .AssertZeroExitCode(); + + var mesonOptionsPath = Path.Combine(DxvkPath, "meson_options.txt"); + + //Replace `sdl2` with `glfw` in the meson options file, to build with GLFW WSI instead of SDL2 WSI + File.WriteAllText(mesonOptionsPath, File.ReadAllText(mesonOptionsPath).Replace("sdl2", "glfw")); + InheritedShell + ( + $"./package-native.sh master glfw-output --no-package", + DxvkPath + ) + .AssertZeroExitCode(); + + var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.DXVK.Native" / "runtimes"; + + //Copy the windows binaries + CopyAll(@out.GlobFiles("dxvk-master/x64/*"), runtimes / "win-x64" / "native"); + CopyAll(@out.GlobFiles("dxvk-master/x32/*"), runtimes / "win-x86" / "native"); + + var linux64SdlLibs = @out.GlobFiles("dxvk-native-master/usr/lib/*"); + + foreach (var lib in linux64SdlLibs) + { + var fileName = Path.GetFileName(lib); + RenameFile(lib.Parent / fileName, lib.Parent / "sdl2-" + fileName); + } + + var linux64GlfwLibs = glfwOut.GlobFiles("dxvk-native-master/usr/lib/*"); + + foreach (var lib in linux64GlfwLibs) + { + var fileName = Path.GetFileName(lib); + RenameFile(lib.Parent / fileName, lib.Parent / "glfw-" + fileName); + } + + var linux32SdlLibs = @out.GlobFiles("dxvk-native-master/usr/lib32/*"); + + foreach (var lib in linux32SdlLibs) + { + var fileName = Path.GetFileName(lib); + RenameFile(lib.Parent / fileName, lib.Parent / "sdl2-" + fileName); + } + + var linux32GlfwLibs = glfwOut.GlobFiles("dxvk-native-master/usr/lib32/*"); + + foreach (var lib in linux32GlfwLibs) + { + var fileName = Path.GetFileName(lib); + RenameFile(lib.Parent / fileName, lib.Parent / "glfw-" + fileName); + } + + //Copy the linux SDL binaries + CopyAll(@out.GlobFiles("dxvk-native-master/usr/lib/*"), runtimes / "linux-x64" / "native"); + CopyAll(@out.GlobFiles("dxvk-native-master/usr/lib32/*"), runtimes / "linux-x86" / "native"); + + //Copy the linux GLFW binaries + CopyAll(glfwOut.GlobFiles("dxvk-native-master/usr/lib/*"), runtimes / "linux-x64" / "native"); + CopyAll(glfwOut.GlobFiles("dxvk-native-master/usr/lib32/*"), runtimes / "linux-x86" / "native"); + + var winx64 = runtimes / "win-x64" / "native"; + var winx86 = runtimes / "win-x86" / "native"; + + var linuxx64 = runtimes / "linux-x64" / "native"; + var linuxx86 = runtimes / "linux-x86" / "native"; + + var glob = string.Empty; + var files = winx64.GlobFiles("*.dll") + .Concat(winx86.GlobFiles("*.dll")) + .Concat(linuxx64.GlobFiles("*.so")) + .Concat(linuxx86.GlobFiles("*.so")); + + glob = files.Aggregate(glob, (current, path) => current + $"\"{path}\" "); + + PrUpdatedNativeBinary + ( + "DXVK", glob + ); + } + ) + ); AbsolutePath AssimpPath => RootDirectory / "build" / "submodules" / "Assimp"; @@ -514,7 +718,7 @@ void CopyAs(AbsolutePath @out, string from, string to) ) ); - void PrUpdatedNativeBinary(string name) + void PrUpdatedNativeBinary(string name, [CanBeNull] string glob = null) { var pushableToken = EnvironmentInfo.GetVariable("PUSHABLE_GITHUB_TOKEN"); var curBranch = GitCurrentBranch(RootDirectory); @@ -527,23 +731,22 @@ void PrUpdatedNativeBinary(string name) !curBranch.StartsWith("develop/", StringComparison.OrdinalIgnoreCase)) { // it's assumed that the pushable token was used to checkout the repo - var suffix = string.Empty; if (OperatingSystem.IsWindows()) { - suffix = "/**/*.dll"; + glob ??= "src/Native/**/*.dll"; } else if (OperatingSystem.IsMacOS()) { - suffix = "/**/*.dylib"; + glob ??= "src/Native/**/*.dylib"; } else if (OperatingSystem.IsLinux()) { - suffix = "/**/*.so*"; + glob ??= "src/Native/**/*.so*"; } - + Git("fetch --all", RootDirectory); Git("pull"); - Git($"add src/Native{suffix}", RootDirectory); + Git($"add -f {glob}", RootDirectory); var newBranch = $"ci/{curBranch}/{name.ToLower().Replace(' ', '_')}_bins"; var curCommit = GitCurrentCommit(RootDirectory); var commitCmd = InheritedShell diff --git a/build/submodules/SDL b/build/submodules/SDL index f070c83a60..dca3fd8307 160000 --- a/build/submodules/SDL +++ b/build/submodules/SDL @@ -1 +1 @@ -Subproject commit f070c83a6059c604cbd098680ddaee391b0a7341 +Subproject commit dca3fd8307c2c9ebda8d8ea623bbbf19649f5e22 diff --git a/build/submodules/SPIRV-Tools b/build/submodules/SPIRV-Tools new file mode 160000 index 0000000000..fba26fd606 --- /dev/null +++ b/build/submodules/SPIRV-Tools @@ -0,0 +1 @@ +Subproject commit fba26fd60677c2f5bbb37eb36cefef263f3717b0 diff --git a/build/submodules/SwiftShader b/build/submodules/SwiftShader index 5f9ed9b169..3764eb8591 160000 --- a/build/submodules/SwiftShader +++ b/build/submodules/SwiftShader @@ -1 +1 @@ -Subproject commit 5f9ed9b16931c7155171d31f75004f73f0a3abc8 +Subproject commit 3764eb85917a601ca5201e289c37a22054a6d9e6 diff --git a/build/submodules/dxvk b/build/submodules/dxvk new file mode 160000 index 0000000000..306919047b --- /dev/null +++ b/build/submodules/dxvk @@ -0,0 +1 @@ +Subproject commit 306919047bffb3d8f30159c219722741728904e2 diff --git a/build/submodules/vkd3d b/build/submodules/vkd3d new file mode 160000 index 0000000000..57d92a15cf --- /dev/null +++ b/build/submodules/vkd3d @@ -0,0 +1 @@ +Subproject commit 57d92a15cf93d9448f2deb91a8614f9c4c085216 diff --git a/examples/CSharp/Direct3D11 Tutorials/Tutorial 1.2 - Hello quad/Program.cs b/examples/CSharp/Direct3D11 Tutorials/Tutorial 1.2 - Hello quad/Program.cs index f855555a4a..3ba233a728 100644 --- a/examples/CSharp/Direct3D11 Tutorials/Tutorial 1.2 - Hello quad/Program.cs +++ b/examples/CSharp/Direct3D11 Tutorials/Tutorial 1.2 - Hello quad/Program.cs @@ -69,9 +69,9 @@ float4 ps_main(vs_out input) : SV_TARGET { // Load the DXGI and Direct3D11 libraries for later use. // Given this is not tied to the window, this doesn't need to be done in the OnLoad event. -var dxgi = DXGI.GetApi(); -var d3d11 = D3D11.GetApi(); -var compiler = D3DCompiler.GetApi(); +DXGI dxgi = null!; +D3D11 d3d11 = null!; +D3DCompiler compiler = null!; // These variables are initialized within the Load event. ComPtr factory = default; @@ -112,6 +112,13 @@ float4 ps_main(vs_out input) : SV_TARGET { unsafe void OnLoad() { + //Whether or not to force use of DXVK on platforms where native DirectX implementations are available + const bool forceDxvk = false; + + dxgi = DXGI.GetApi(window, forceDxvk); + d3d11 = D3D11.GetApi(window, forceDxvk); + compiler = D3DCompiler.GetApi(); + // Set-up input context. var input = window.CreateInput(); foreach (var keyboard in input.Keyboards) @@ -137,9 +144,14 @@ ref deviceContext ) ); - // Log debug messages for this device (given that we've enabled the debug flag). Don't do this in release code! - device.SetInfoQueueCallback(msg => Console.WriteLine(SilkMarshal.PtrToString((nint) msg.PDescription))); - + //This is not supported under DXVK + //TODO: PR a stub into DXVK for this maybe? + if (OperatingSystem.IsWindows()) + { + // Log debug messages for this device (given that we've enabled the debug flag). Don't do this in release code! + device.SetInfoQueueCallback(msg => Console.WriteLine(SilkMarshal.PtrToString((nint) msg.PDescription))); + } + // Create our swapchain. var swapChainDesc = new SwapChainDesc1 { diff --git a/src/Core/Silk.NET.Core/Loader/LibraryLoader.cs b/src/Core/Silk.NET.Core/Loader/LibraryLoader.cs index a0378bc867..e76cfe89c9 100644 --- a/src/Core/Silk.NET.Core/Loader/LibraryLoader.cs +++ b/src/Core/Silk.NET.Core/Loader/LibraryLoader.cs @@ -28,6 +28,14 @@ public nint LoadNativeLibrary(string name) { return LoadNativeLibrary(name, PathResolver.Default); } + + public void RegisterDependencies(params string[] names) + { + foreach (var name in names) + { + LoadNativeLibrary(name); + } + } private static void ThrowLibNotFound(string name, PathResolver resolver) { diff --git a/src/Core/Silk.NET.Core/Native/DXSwapchainProvider.cs b/src/Core/Silk.NET.Core/Native/DXSwapchainProvider.cs new file mode 100644 index 0000000000..aa85d690d0 --- /dev/null +++ b/src/Core/Silk.NET.Core/Native/DXSwapchainProvider.cs @@ -0,0 +1,11 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Silk.NET.Core.Native; + +public enum DXSwapchainProvider +{ + Win32, + Glfw, + Sdl2 +} diff --git a/src/Lab/Experiments/D3D12Triangle/DX12Sample.cs b/src/Lab/Experiments/D3D12Triangle/DX12Sample.cs index 70c669c9f2..7aecaa7efb 100644 --- a/src/Lab/Experiments/D3D12Triangle/DX12Sample.cs +++ b/src/Lab/Experiments/D3D12Triangle/DX12Sample.cs @@ -33,7 +33,6 @@ public abstract unsafe class DX12Sample : DXSample private Box2D _scissorRect; private uint _rtvDescriptorSize; private Silk.NET.Direct3D12.D3D12 _d3d12; - private Silk.NET.DXGI.DXGI _dxgi; private ID3D12Fence* _fence; private ulong[] _fenceValues; @@ -56,13 +55,10 @@ protected DX12Sample(string name) : base(name) _fenceValues = new ulong[2]; _graphicsCommandLists = new ID3D12GraphicsCommandList*[2]; _d3d12 = Silk.NET.Direct3D12.D3D12.GetApi(); - _dxgi = DXGI.GetApi(); } public Silk.NET.Direct3D12.D3D12 D3D12 => _d3d12; - public Silk.NET.DXGI.DXGI Dxgi => _dxgi; - public ID3D12CommandAllocator* CommandAllocator => _commandAllocators[FrameIndex]; public ID3D12CommandQueue* CommandQueue => _commandQueue; diff --git a/src/Lab/Experiments/D3D12Triangle/DXSample.cs b/src/Lab/Experiments/D3D12Triangle/DXSample.cs index f4b5394bed..6e5c6d43a9 100644 --- a/src/Lab/Experiments/D3D12Triangle/DXSample.cs +++ b/src/Lab/Experiments/D3D12Triangle/DXSample.cs @@ -29,6 +29,7 @@ public abstract unsafe class DXSample : IDisposable private IWindow _window; private ILogger _logger; private ILoggerProvider _loggerProvider; + private DXGI _dxgi; protected DXSample(string name) { @@ -75,6 +76,8 @@ public Vector4 BackgroundColor public ILogger Log => _logger; + public DXGI Dxgi => _dxgi; + public void Dispose() { Dispose(isDisposing: true); @@ -98,6 +101,7 @@ public void OnInit bool useWarpDevice ) { + _dxgi = DXGI.GetApi(window); _backBufferFormat = (backBufferFormat != Format.FormatUnknown) ? backBufferFormat : Format.FormatR8G8B8A8Unorm; diff --git a/src/Microsoft/Silk.NET.DXGI/DXGI.cs b/src/Microsoft/Silk.NET.DXGI/DXGI.cs index 85449a1163..f2afb1e8ac 100644 --- a/src/Microsoft/Silk.NET.DXGI/DXGI.cs +++ b/src/Microsoft/Silk.NET.DXGI/DXGI.cs @@ -1,4 +1,6 @@ using System; +using System.Linq; +using System.Runtime.InteropServices; using Silk.NET.Core.Loader; using Silk.NET.Core.Native; using Silk.NET.Core.Attributes; @@ -10,9 +12,59 @@ namespace Silk.NET.DXGI { public partial class DXGI { - public static DXGI GetApi() + [Obsolete("Use the GetApi(INativeWindow window, bool forceDxvk = false) overload!")] + public static DXGI GetApi(DXSwapchainProvider swapchainProvider = DXSwapchainProvider.Win32, bool forceDxvk = false) { - return new DXGI(CreateDefaultContext(new DXGILibraryNameContainer().GetLibraryNames())); + switch (swapchainProvider) + { + case DXSwapchainProvider.Win32: + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + throw new PlatformNotSupportedException("The Win32 swapchain provider is only supported on Windows! Use the GetApi(INativeWindow) overload, or specify this correctly per platform!"); + } + + var names = new DXGILibraryNameContainer().GetLibraryNames(); + + return new DXGI(CreateDefaultContext(names.Select(x => forceDxvk ? $"dxvk-{x}" : x).ToArray())); + case DXSwapchainProvider.Glfw: + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + throw new PlatformNotSupportedException("The GLFW swapchain provider is not supported under Windows! This can only be used with non-windows builds of DXVK!"); + } + + return new DXGI(CreateDefaultContext(new DXGIGLFWLibraryNameContainer().GetLibraryNames())); + case DXSwapchainProvider.Sdl2: + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + throw new PlatformNotSupportedException("The SDL2 swapchain provider is not supported under Windows! This can only be used with non-windows builds of DXVK!"); + } + + return new DXGI(CreateDefaultContext(new DXGISdl2LibraryNameContainer().GetLibraryNames())); + default: + throw new ArgumentOutOfRangeException(nameof (swapchainProvider), swapchainProvider, null); + } + } + + public static DXGI GetApi(INativeWindowSource window, bool forceDxvk = false) + { +#pragma warning disable CS0618 + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + return GetApi(DXSwapchainProvider.Win32, forceDxvk); + } + + if (window.Native.Glfw.HasValue) + { + return GetApi(DXSwapchainProvider.Glfw, forceDxvk); + } + + if (window.Native.Sdl.HasValue) + { + return GetApi(DXSwapchainProvider.Sdl2, forceDxvk); + } +#pragma warning restore CS0618 + + throw new PlatformNotSupportedException("The passed window is not a GLFW or SDL2 window!"); } public bool TryGetExtension(out T ext) diff --git a/src/Microsoft/Silk.NET.DXGI/DXGIGLFWLibraryNameContainer.cs b/src/Microsoft/Silk.NET.DXGI/DXGIGLFWLibraryNameContainer.cs new file mode 100644 index 0000000000..d18823ce4c --- /dev/null +++ b/src/Microsoft/Silk.NET.DXGI/DXGIGLFWLibraryNameContainer.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Linq; +using Silk.NET.Core.Loader; + +namespace Silk.NET.DXGI; + +internal class DXGIGLFWLibraryNameContainer : DXGILibraryNameContainer +{ + public override string[] Linux => new[] { "glfw-libdxvk_dxgi.so" }.Concat(base.Linux).ToArray(); +} diff --git a/src/Microsoft/Silk.NET.DXGI/DXGISdl2LibraryNameContainer.cs b/src/Microsoft/Silk.NET.DXGI/DXGISdl2LibraryNameContainer.cs new file mode 100644 index 0000000000..62ec0e4979 --- /dev/null +++ b/src/Microsoft/Silk.NET.DXGI/DXGISdl2LibraryNameContainer.cs @@ -0,0 +1,13 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Linq; +using Silk.NET.Core.Loader; + +namespace Silk.NET.DXGI; + +internal class DXGISdl2LibraryNameContainer : DXGILibraryNameContainer +{ + public override string[] Linux => new[] { "sdl2-libdxvk_dxgi.so" }.Concat(base.Linux).ToArray(); +} diff --git a/src/Microsoft/Silk.NET.Direct3D.Compilers/D3DCompiler.cs b/src/Microsoft/Silk.NET.Direct3D.Compilers/D3DCompiler.cs index 6fbc575c7c..ceb1898b0a 100644 --- a/src/Microsoft/Silk.NET.Direct3D.Compilers/D3DCompiler.cs +++ b/src/Microsoft/Silk.NET.Direct3D.Compilers/D3DCompiler.cs @@ -3,6 +3,7 @@ using Silk.NET.Core.Native; using Silk.NET.Core.Contexts; using Silk.NET.Core.Attributes; +using System.Runtime.InteropServices; #pragma warning disable 1591 @@ -10,9 +11,19 @@ namespace Silk.NET.Direct3D.Compilers { public partial class D3DCompiler { + static D3DCompiler() + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + var loader = LibraryLoader.GetPlatformDefaultLoader(); + //d3dcompile_vkd3d on linux has a shared dependency on SPIRV-Tools, so register it + loader.RegisterDependencies("libSPIRV-Tools-shared.so"); + } + } + public static D3DCompiler GetApi() { - return new D3DCompiler(CreateDefaultContext(new D3DCompilerLibraryNameContainer().GetLibraryNames())); + return new D3DCompiler(CreateDefaultContext(new D3DCompilerLibraryNameContainer().GetLibraryNames())); } public bool TryGetExtension(out T ext) diff --git a/src/Microsoft/Silk.NET.Direct3D.Compilers/D3DCompilerLibraryNameContainer.cs b/src/Microsoft/Silk.NET.Direct3D.Compilers/D3DCompilerLibraryNameContainer.cs index d4dea0d2f4..b0c58d2990 100644 --- a/src/Microsoft/Silk.NET.Direct3D.Compilers/D3DCompilerLibraryNameContainer.cs +++ b/src/Microsoft/Silk.NET.Direct3D.Compilers/D3DCompilerLibraryNameContainer.cs @@ -11,7 +11,7 @@ namespace Silk.NET.Direct3D.Compilers internal class D3DCompilerLibraryNameContainer : SearchPathContainer { /// - public override string[] Linux => new[] { "libD3DCompiler_47.so" }; + public override string[] Linux => new[] { "libd3dcompile_vkd3d.so", "libD3DCompiler_47.so" }; /// public override string[] MacOS => new[] { "libD3DCompiler_47.dylib" }; diff --git a/src/Microsoft/Silk.NET.Direct3D11/D3D11.cs b/src/Microsoft/Silk.NET.Direct3D11/D3D11.cs index 6d73a35c32..892efced22 100644 --- a/src/Microsoft/Silk.NET.Direct3D11/D3D11.cs +++ b/src/Microsoft/Silk.NET.Direct3D11/D3D11.cs @@ -1,4 +1,6 @@ using System; +using System.Linq; +using System.Runtime.InteropServices; using Silk.NET.Core.Loader; using Silk.NET.Core.Native; using Silk.NET.Core.Attributes; @@ -10,9 +12,59 @@ namespace Silk.NET.Direct3D11 { public partial class D3D11 { - public static D3D11 GetApi() + [Obsolete("Use the GetApi(INativeWindow window, bool forceDxvk = false) overload!")] + public static D3D11 GetApi(DXSwapchainProvider swapchainProvider = DXSwapchainProvider.Win32, bool forceDxvk = false) { - return new D3D11(CreateDefaultContext(new D3D11LibraryNameContainer().GetLibraryNames())); + switch (swapchainProvider) + { + case DXSwapchainProvider.Win32: + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + throw new PlatformNotSupportedException("The Win32 swapchain provider is only supported on Windows! Use the GetApi(INativeWindow) overload, or specify this correctly per platform!"); + } + + var names = new D3D11LibraryNameContainer().GetLibraryNames(); + + return new D3D11(CreateDefaultContext(names.Select(x => forceDxvk ? $"dxvk-{x}" : x).ToArray())); + case DXSwapchainProvider.Glfw: + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + throw new PlatformNotSupportedException("The GLFW swapchain provider is not supported under Windows! This can only be used with non-windows builds of DXVK!"); + } + + return new D3D11(CreateDefaultContext(new D3D11GLFWLibraryNameContainer().GetLibraryNames())); + case DXSwapchainProvider.Sdl2: + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + throw new PlatformNotSupportedException("The SDL2 swapchain provider is not supported under Windows! This can only be used with non-windows builds of DXVK!"); + } + + return new D3D11(CreateDefaultContext(new D3D11Sdl2LibraryNameContainer().GetLibraryNames())); + default: + throw new ArgumentOutOfRangeException(nameof (swapchainProvider), swapchainProvider, null); + } + } + + public static D3D11 GetApi(INativeWindowSource window, bool forceDxvk = false) + { +#pragma warning disable CS0618 + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + return GetApi(DXSwapchainProvider.Win32, forceDxvk); + } + + if (window.Native.Glfw.HasValue) + { + return GetApi(DXSwapchainProvider.Glfw, forceDxvk); + } + + if (window.Native.Sdl.HasValue) + { + return GetApi(DXSwapchainProvider.Sdl2, forceDxvk); + } +#pragma warning restore CS0618 + + throw new PlatformNotSupportedException("The passed window is not a GLFW or SDL2 window!"); } public bool TryGetExtension(out T ext) diff --git a/src/Microsoft/Silk.NET.Direct3D11/D3D11GLFWLibraryNameContainer.cs b/src/Microsoft/Silk.NET.Direct3D11/D3D11GLFWLibraryNameContainer.cs new file mode 100644 index 0000000000..200b87a299 --- /dev/null +++ b/src/Microsoft/Silk.NET.Direct3D11/D3D11GLFWLibraryNameContainer.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Silk.NET.Core.Loader; +using System.Linq; + +namespace Silk.NET.Direct3D11 +{ + /// + /// Contains the library name of D3D11. + /// + internal class D3D11GLFWLibraryNameContainer : D3D11LibraryNameContainer + { + /// + public override string[] Linux => new[] { "glfw-libdxvk_d3d11.so" }.Concat(base.Linux).ToArray(); + } +} diff --git a/src/Microsoft/Silk.NET.Direct3D11/D3D11Sdl2LibraryNameContainer.cs b/src/Microsoft/Silk.NET.Direct3D11/D3D11Sdl2LibraryNameContainer.cs new file mode 100644 index 0000000000..9e9be34c5a --- /dev/null +++ b/src/Microsoft/Silk.NET.Direct3D11/D3D11Sdl2LibraryNameContainer.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Silk.NET.Core.Loader; +using System.Linq; + +namespace Silk.NET.Direct3D11 +{ + /// + /// Contains the library name of D3D11. + /// + internal class D3D11Sdl2LibraryNameContainer : D3D11LibraryNameContainer + { + /// + public override string[] Linux => new[] { "sdl2-libdxvk_d3d11.so" }.Concat(base.Linux).ToArray(); + } +} diff --git a/src/Microsoft/Silk.NET.Direct3D9/D3D9.cs b/src/Microsoft/Silk.NET.Direct3D9/D3D9.cs index 4914e98736..adf7bb9007 100644 --- a/src/Microsoft/Silk.NET.Direct3D9/D3D9.cs +++ b/src/Microsoft/Silk.NET.Direct3D9/D3D9.cs @@ -1,4 +1,6 @@ using System; +using System.Linq; +using System.Runtime.InteropServices; using Silk.NET.Core.Loader; using Silk.NET.Core.Native; using Silk.NET.Core.Contexts; @@ -10,9 +12,59 @@ namespace Silk.NET.Direct3D9 { public partial class D3D9 { - public static D3D9 GetApi() + [Obsolete("Use the GetApi(INativeWindow window, bool forceDxvk = false) overload!")] + public static D3D9 GetApi(DXSwapchainProvider swapchainProvider = DXSwapchainProvider.Win32, bool forceDxvk = false) { - return new D3D9(CreateDefaultContext(new D3D9LibraryNameContainer().GetLibraryNames())); + switch (swapchainProvider) + { + case DXSwapchainProvider.Win32: + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + throw new PlatformNotSupportedException("The Win32 swapchain provider is only supported on Windows! Use the GetApi(INativeWindow) overload, or specify this correctly per platform!"); + } + + var names = new D3D9LibraryNameContainer().GetLibraryNames(); + + return new D3D9(CreateDefaultContext(names.Select(x => forceDxvk ? $"dxvk-{x}" : x).ToArray())); + case DXSwapchainProvider.Glfw: + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + throw new PlatformNotSupportedException("The GLFW swapchain provider is not supported under Windows! This can only be used with non-windows builds of DXVK!"); + } + + return new D3D9(CreateDefaultContext(new D3D9GLFWLibraryNameContainer().GetLibraryNames())); + case DXSwapchainProvider.Sdl2: + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + throw new PlatformNotSupportedException("The SDL2 swapchain provider is not supported under Windows! This can only be used with non-windows builds of DXVK!"); + } + + return new D3D9(CreateDefaultContext(new D3D9Sdl2LibraryNameContainer().GetLibraryNames())); + default: + throw new ArgumentOutOfRangeException(nameof (swapchainProvider), swapchainProvider, null); + } + } + + public static D3D9 GetApi(INativeWindowSource window, bool forceDxvk = false) + { +#pragma warning disable CS0618 + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + return GetApi(DXSwapchainProvider.Win32, forceDxvk); + } + + if (window.Native.Glfw.HasValue) + { + return GetApi(DXSwapchainProvider.Glfw, forceDxvk); + } + + if (window.Native.Sdl.HasValue) + { + return GetApi(DXSwapchainProvider.Sdl2, forceDxvk); + } +#pragma warning restore CS0618 + + throw new PlatformNotSupportedException("The passed window is not a GLFW or SDL2 window!"); } public bool TryGetExtension(out T ext) diff --git a/src/Microsoft/Silk.NET.Direct3D9/D3D9GLFWLibraryNameContainer.cs b/src/Microsoft/Silk.NET.Direct3D9/D3D9GLFWLibraryNameContainer.cs new file mode 100644 index 0000000000..11e461e623 --- /dev/null +++ b/src/Microsoft/Silk.NET.Direct3D9/D3D9GLFWLibraryNameContainer.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Silk.NET.Core.Loader; +using System.Linq; + +namespace Silk.NET.Direct3D9 +{ + /// + /// Contains the library name of D3D9. + /// + internal class D3D9GLFWLibraryNameContainer : D3D9LibraryNameContainer + { + /// + public override string[] Linux => new[] { "glfw-libdxvk_d3d9.so" }.Concat(base.Linux).ToArray(); + } +} diff --git a/src/Microsoft/Silk.NET.Direct3D9/D3D9Sdl2LibraryNameContainer.cs b/src/Microsoft/Silk.NET.Direct3D9/D3D9Sdl2LibraryNameContainer.cs new file mode 100644 index 0000000000..7742667865 --- /dev/null +++ b/src/Microsoft/Silk.NET.Direct3D9/D3D9Sdl2LibraryNameContainer.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Linq; +using Silk.NET.Core.Loader; + +namespace Silk.NET.Direct3D9 +{ + /// + /// Contains the library name of D3D9. + /// + internal class D3D9Sdl2LibraryNameContainer : D3D9LibraryNameContainer + { + /// + public override string[] Linux => new[] { "sdl2-libdxvk_d3d9.so" }.Concat(base.Linux).ToArray(); + } +} diff --git a/src/Microsoft/Vkd3dCompiler/.gitignore b/src/Microsoft/Vkd3dCompiler/.gitignore new file mode 100644 index 0000000000..671b07b9cc --- /dev/null +++ b/src/Microsoft/Vkd3dCompiler/.gitignore @@ -0,0 +1,5 @@ +zig-cache/ +zig-out/ +lib.o +lib.o.d +*.so diff --git a/src/Microsoft/Vkd3dCompiler/LICENSE b/src/Microsoft/Vkd3dCompiler/LICENSE new file mode 100644 index 0000000000..e8c3f50515 --- /dev/null +++ b/src/Microsoft/Vkd3dCompiler/LICENSE @@ -0,0 +1,503 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + diff --git a/src/Microsoft/Vkd3dCompiler/build.sh b/src/Microsoft/Vkd3dCompiler/build.sh new file mode 100755 index 0000000000..6c9d0c1056 --- /dev/null +++ b/src/Microsoft/Vkd3dCompiler/build.sh @@ -0,0 +1,3 @@ +clang lib.c -fno-caret-diagnostics -D__GLIBC_MINOR__=36 -target x86_64-unknown-linux-gnu -fno-spell-checking -isystem /usr/include -Xclang -target-cpu -Xclang x86-64 -Xclang -target-feature -Xclang -16bit-mode -Xclang -target-feature -Xclang -32bit-mode -Xclang -target-feature -Xclang -3dnow -Xclang -target-feature -Xclang -3dnowa -Xclang -target-feature -Xclang +64bit -Xclang -target-feature -Xclang +adx -Xclang -target-feature -Xclang +aes -Xclang -target-feature -Xclang -amx-bf16 -Xclang -target-feature -Xclang -amx-int8 -Xclang -target-feature -Xclang -amx-tile -Xclang -target-feature -Xclang +avx -Xclang -target-feature -Xclang +avx2 -Xclang -target-feature -Xclang -avx512bf16 -Xclang -target-feature -Xclang -avx512bitalg -Xclang -target-feature -Xclang -avx512bw -Xclang -target-feature -Xclang -avx512cd -Xclang -target-feature -Xclang -avx512dq -Xclang -target-feature -Xclang -avx512er -Xclang -target-feature -Xclang -avx512f -Xclang -target-feature -Xclang -avx512fp16 -Xclang -target-feature -Xclang -avx512ifma -Xclang -target-feature -Xclang -avx512pf -Xclang -target-feature -Xclang -avx512vbmi -Xclang -target-feature -Xclang -avx512vbmi2 -Xclang -target-feature -Xclang -avx512vl -Xclang -target-feature -Xclang -avx512vnni -Xclang -target-feature -Xclang -avx512vp2intersect -Xclang -target-feature -Xclang -avx512vpopcntdq -Xclang -target-feature -Xclang -avxvnni -Xclang -target-feature -Xclang +bmi -Xclang -target-feature -Xclang +bmi2 -Xclang -target-feature -Xclang -branchfusion -Xclang -target-feature -Xclang -cldemote -Xclang -target-feature -Xclang +clflushopt -Xclang -target-feature -Xclang +clwb -Xclang -target-feature -Xclang -clzero -Xclang -target-feature -Xclang +cmov -Xclang -target-feature -Xclang -crc32 -Xclang -target-feature -Xclang +cx16 -Xclang -target-feature -Xclang +cx8 -Xclang -target-feature -Xclang -enqcmd -Xclang -target-feature -Xclang -ermsb -Xclang -target-feature -Xclang +f16c -Xclang -target-feature -Xclang -false-deps-getmant -Xclang -target-feature -Xclang -false-deps-lzcnt-tzcnt -Xclang -target-feature -Xclang -false-deps-mulc -Xclang -target-feature -Xclang -false-deps-mullq -Xclang -target-feature -Xclang -false-deps-perm -Xclang -target-feature -Xclang -false-deps-popcnt -Xclang -target-feature -Xclang -false-deps-range -Xclang -target-feature -Xclang -fast-11bytenop -Xclang -target-feature -Xclang -fast-15bytenop -Xclang -target-feature -Xclang -fast-7bytenop -Xclang -target-feature -Xclang -fast-bextr -Xclang -target-feature -Xclang -fast-gather -Xclang -target-feature -Xclang -fast-hops -Xclang -target-feature -Xclang -fast-lzcnt -Xclang -target-feature -Xclang -fast-movbe -Xclang -target-feature -Xclang -fast-scalar-fsqrt -Xclang -target-feature -Xclang -fast-scalar-shift-masks -Xclang -target-feature -Xclang -fast-shld-rotate -Xclang -target-feature -Xclang -fast-variable-crosslane-shuffle -Xclang -target-feature -Xclang -fast-variable-perlane-shuffle -Xclang -target-feature -Xclang -fast-vector-fsqrt -Xclang -target-feature -Xclang -fast-vector-shift-masks -Xclang -target-feature -Xclang +fma -Xclang -target-feature -Xclang -fma4 -Xclang -target-feature -Xclang +fsgsbase -Xclang -target-feature -Xclang -fsrm -Xclang -target-feature -Xclang +fxsr -Xclang -target-feature -Xclang +gfni -Xclang -target-feature -Xclang -harden-sls-ijmp -Xclang -target-feature -Xclang -harden-sls-ret -Xclang -target-feature -Xclang -hreset -Xclang -target-feature -Xclang -idivl-to-divb -Xclang -target-feature -Xclang +idivq-to-divl -Xclang -target-feature -Xclang +invpcid -Xclang -target-feature -Xclang -kl -Xclang -target-feature -Xclang -lea-sp -Xclang -target-feature -Xclang -lea-uses-ag -Xclang -target-feature -Xclang -lvi-cfi -Xclang -target-feature -Xclang -lvi-load-hardening -Xclang -target-feature -Xclang -lwp -Xclang -target-feature -Xclang +lzcnt -Xclang -target-feature -Xclang +macrofusion -Xclang -target-feature -Xclang +mmx -Xclang -target-feature -Xclang +movbe -Xclang -target-feature -Xclang +movdir64b -Xclang -target-feature -Xclang +movdiri -Xclang -target-feature -Xclang -mwaitx -Xclang -target-feature -Xclang +nopl -Xclang -target-feature -Xclang -pad-short-functions -Xclang -target-feature -Xclang +pclmul -Xclang -target-feature -Xclang +pconfig -Xclang -target-feature -Xclang +pku -Xclang -target-feature -Xclang +popcnt -Xclang -target-feature -Xclang -prefer-128-bit -Xclang -target-feature -Xclang -prefer-256-bit -Xclang -target-feature -Xclang -prefer-mask-registers -Xclang -target-feature -Xclang -prefetchwt1 -Xclang -target-feature -Xclang +prfchw -Xclang -target-feature -Xclang +ptwrite -Xclang -target-feature -Xclang +rdpid -Xclang -target-feature -Xclang -rdpru -Xclang -target-feature -Xclang +rdrnd -Xclang -target-feature -Xclang +rdseed -Xclang -target-feature -Xclang -retpoline -Xclang -target-feature -Xclang -retpoline-external-thunk -Xclang -target-feature -Xclang -retpoline-indirect-branches -Xclang -target-feature -Xclang -retpoline-indirect-calls -Xclang -target-feature -Xclang -rtm -Xclang -target-feature -Xclang +sahf -Xclang -target-feature -Xclang -sbb-dep-breaking -Xclang -target-feature -Xclang -serialize -Xclang -target-feature -Xclang -seses -Xclang -target-feature -Xclang -sgx -Xclang -target-feature -Xclang +sha -Xclang -target-feature -Xclang +shstk -Xclang -target-feature -Xclang +slow-3ops-lea -Xclang -target-feature -Xclang +slow-incdec -Xclang -target-feature -Xclang -slow-lea -Xclang -target-feature -Xclang -slow-pmaddwd -Xclang -target-feature -Xclang -slow-pmulld -Xclang -target-feature -Xclang -slow-shld -Xclang -target-feature -Xclang -slow-two-mem-ops -Xclang -target-feature -Xclang -slow-unaligned-mem-16 -Xclang -target-feature -Xclang -slow-unaligned-mem-32 -Xclang -target-feature -Xclang -soft-float -Xclang -target-feature -Xclang +sse -Xclang -target-feature -Xclang +sse2 -Xclang -target-feature -Xclang +sse3 -Xclang -target-feature -Xclang +sse4.1 -Xclang -target-feature -Xclang +sse4.2 -Xclang -target-feature -Xclang -sse4a -Xclang -target-feature -Xclang -sse-unaligned-mem -Xclang -target-feature -Xclang +ssse3 -Xclang -target-feature -Xclang -tagged-globals -Xclang -target-feature -Xclang -tbm -Xclang -target-feature -Xclang -tsxldtrk -Xclang -target-feature -Xclang -uintr -Xclang -target-feature -Xclang -use-glm-div-sqrt-costs -Xclang -target-feature -Xclang -use-slm-arith-costs -Xclang -target-feature -Xclang +vaes -Xclang -target-feature -Xclang +vpclmulqdq -Xclang -target-feature -Xclang +vzeroupper -Xclang -target-feature -Xclang +waitpkg -Xclang -target-feature -Xclang -wbnoinvd -Xclang -target-feature -Xclang -widekl -Xclang -target-feature -Xclang +x87 -Xclang -target-feature -Xclang -xop -Xclang -target-feature -Xclang +xsave -Xclang -target-feature -Xclang +xsavec -Xclang -target-feature -Xclang +xsaveopt -Xclang -target-feature -Xclang +xsaves -mred-zone -fomit-frame-pointer -fno-stack-protector -DNDEBUG -Os -fPIC -fno-unwind-tables -MD -MV -MF ./lib.o.d -isystem /home/beyley/Silk.NET/build/submodules/vkd3d/include -std=c99 -fPIC -c -o ./lib.o + +ld.lld --error-limit=0 -O3 --gc-sections -s -znow -m elf_x86_64 -shared -o libd3dcompile_vkd3d.so /usr/lib/crti.o -L . -L /usr/lib -dynamic-linker /lib64/ld-linux-x86-64.so.2 -soname libd3dcompile_vkd3d.so ./libvkd3d-shader.a ./lib.o --as-needed -lm -lpthread -lc -ldl -lrt -lutil /usr/lib/crtn.o \ No newline at end of file diff --git a/src/Microsoft/Vkd3dCompiler/build.zig b/src/Microsoft/Vkd3dCompiler/build.zig new file mode 100644 index 0000000000..1645fa3dc9 --- /dev/null +++ b/src/Microsoft/Vkd3dCompiler/build.zig @@ -0,0 +1,24 @@ +const std = @import("std"); +const fs = std.fs; + +pub fn build(b: *std.Build) void { + const target = b.standardTargetOptions(.{}); + const mode = b.standardOptimizeOption(.{}); + + const shared_lib_options: std.build.SharedLibraryOptions = .{ + .name = "d3dcompile_vkd3d", + .target = target, + .optimize = mode, + }; + + const vkd3d_compiler: *std.build.LibExeObjStep = b.addSharedLibrary(shared_lib_options); + vkd3d_compiler.addLibraryPath("."); + vkd3d_compiler.linkSystemLibraryName("vkd3d-shader"); + //Since we statically link with vkd3d-shader, we need to dynamically link against SPIRV-Tools ourselves + vkd3d_compiler.linkSystemLibraryName("SPIRV-Tools-shared"); + vkd3d_compiler.linkLibC(); + + vkd3d_compiler.addCSourceFiles(&.{"lib.c"}, &.{ "-std=c99", "-fPIC" }); + vkd3d_compiler.addSystemIncludePath("../../../build/submodules/vkd3d/include/"); + vkd3d_compiler.install(); +} diff --git a/src/Microsoft/Vkd3dCompiler/lib.c b/src/Microsoft/Vkd3dCompiler/lib.c new file mode 100644 index 0000000000..8f1e17fe14 --- /dev/null +++ b/src/Microsoft/Vkd3dCompiler/lib.c @@ -0,0 +1,178 @@ +#include +#include +#include + +#define COBJMACROS +#define CINTERFACE +#define COM_NO_WINDOWS_H + +/* Macros for COM interfaces */ +# define interface struct +# define BEGIN_INTERFACE +# define END_INTERFACE +# define MIDL_INTERFACE(x) struct + +#include +#include +#include +#include +#include + +#define D3DCOMPILE_DEBUG 0x00000001 + +extern int32_t D3DCompile2(const void *data, void* data_size, const char *filename, + const D3D_SHADER_MACRO *macros, ID3DInclude *include, const char *entry_point, + const char *profile, UINT flags, UINT effect_flags, UINT secondary_flags, + const void *secondary_data, SIZE_T secondary_data_size, ID3DBlob **shader_blob, + ID3DBlob **messages_blob) +{ + struct vkd3d_shader_preprocess_info preprocess_info; + struct vkd3d_shader_hlsl_source_info hlsl_info; + struct vkd3d_shader_compile_option options[2]; + struct vkd3d_shader_compile_info compile_info; + struct vkd3d_shader_compile_option *option; + struct vkd3d_shader_code byte_code; + const D3D_SHADER_MACRO *macro; + size_t profile_len, i; + char *messages; + HRESULT hr; + int ret; + + static const char * const d3dbc_profiles[] = + { + "fx_2_", + + "ps.1.", + "ps.2.", + "ps.3.", + + "ps_1_", + "ps_2_", + "ps_3_", + + "vs.1.", + "vs.2.", + "vs.3.", + + "vs_1_", + "vs_2_", + "vs_3_", + + "tx_1_", + }; + + // TRACE("data %p, data_size %lu, filename %s, macros %p, include %p, entry_point %s, " + // "profile %s, flags %#x, effect_flags %#x, secondary_flags %#x, secondary_data %p, " + // "secondary_data_size %lu, shader_blob %p, messages_blob %p.\n", + // data, data_size, debugstr_a(filename), macros, include, debugstr_a(entry_point), + // debugstr_a(profile), flags, effect_flags, secondary_flags, secondary_data, + // secondary_data_size, shader_blob, messages_blob); + + // if (flags & ~D3DCOMPILE_DEBUG) + // FIXME("Ignoring flags %#x.\n", flags); + // if (effect_flags) + // FIXME("Ignoring effect flags %#x.\n", effect_flags); + // if (secondary_flags) + // FIXME("Ignoring secondary flags %#x.\n", secondary_flags); + + if (messages_blob) + *messages_blob = NULL; + + option = &options[0]; + option->name = VKD3D_SHADER_COMPILE_OPTION_API_VERSION; + option->value = VKD3D_SHADER_API_VERSION_1_6; + + compile_info.type = VKD3D_SHADER_STRUCTURE_TYPE_COMPILE_INFO; + compile_info.next = &preprocess_info; + compile_info.source.code = data; + compile_info.source.size = (size_t)data_size; + compile_info.source_type = VKD3D_SHADER_SOURCE_HLSL; + compile_info.target_type = VKD3D_SHADER_TARGET_DXBC_TPF; + compile_info.options = options; + compile_info.option_count = 1; + compile_info.log_level = VKD3D_SHADER_LOG_INFO; + compile_info.source_name = filename; + + profile_len = strlen(profile); + for (i = 0; i < ARRAY_SIZE(d3dbc_profiles); ++i) + { + size_t len = strlen(d3dbc_profiles[i]); + + if (len <= profile_len && !memcmp(profile, d3dbc_profiles[i], len)) + { + compile_info.target_type = VKD3D_SHADER_TARGET_D3D_BYTECODE; + break; + } + } + + preprocess_info.type = VKD3D_SHADER_STRUCTURE_TYPE_PREPROCESS_INFO; + preprocess_info.next = &hlsl_info; + preprocess_info.macros = (const struct vkd3d_shader_macro *)macros; + preprocess_info.macro_count = 0; + if (macros) + { + for (macro = macros; macro->Name; ++macro) + ++preprocess_info.macro_count; + } + preprocess_info.pfn_open_include = NULL; + preprocess_info.pfn_close_include = NULL; + preprocess_info.include_context = include; + + hlsl_info.type = VKD3D_SHADER_STRUCTURE_TYPE_HLSL_SOURCE_INFO; + hlsl_info.next = NULL; + hlsl_info.profile = profile; + hlsl_info.entry_point = entry_point; + hlsl_info.secondary_code.code = secondary_data; + hlsl_info.secondary_code.size = secondary_data_size; + + if (!(flags & D3DCOMPILE_DEBUG)) + { + option = &options[compile_info.option_count++]; + option->name = VKD3D_SHADER_COMPILE_OPTION_STRIP_DEBUG; + option->value = true; + } + + ret = vkd3d_shader_compile(&compile_info, &byte_code, &messages); + + if (messages && messages_blob) + { + if (FAILED(hr = vkd3d_blob_create(messages, strlen(messages), messages_blob))) + { + vkd3d_shader_free_messages(messages); + vkd3d_shader_free_shader_code(&byte_code); + printf("Failed to create blob for messages.\n"); + return hr; + } + messages = NULL; + } + vkd3d_shader_free_messages(messages); + + if (!ret) + { + if (FAILED(hr = vkd3d_blob_create((void *)byte_code.code, byte_code.size, shader_blob))) + { + printf("Failed to create blob for bytecode.\n"); + vkd3d_shader_free_shader_code(&byte_code); + return hr; + } + } + + printf("got to end?.\n"); + return hresult_from_vkd3d_result(ret); +} + +extern int32_t D3DCompile(void* data, + void* data_size, + void* filename, + const void* macros, + void* include, + void* entrypoint, + void* profile, + int32_t flags, + int32_t effect_flags, + void* shader, + void* error_messages) { + + return D3DCompile2(data, data_size, filename, macros, include, entrypoint, profile, flags, + effect_flags, 0, NULL, 0, shader, error_messages); +} \ No newline at end of file diff --git a/src/Native/README.md b/src/Native/README.md index 89a2810368..fed06bea47 100644 --- a/src/Native/README.md +++ b/src/Native/README.md @@ -2,7 +2,7 @@ This folder contains NuGet distributions of the binaries for the various libraries we bind to. Previously, this had its own repository, but was coalesced into this repository to be reunited with the rest of Silk.NET. -In 3.0 we intend to move the packages to use the Silk.NET.\* prefix instead of old Ultz.\* prefix. The folder and +In 3.0 we intend to move the packages to use the Silk.NET.\* prefix instead of old Ultz.\* prefix (Silk.NET.DXVK.Native is *not* effected). The folder and project file names reflect this change today, but still use the old package IDs within them. The mapping of the old package IDs to the new project is as follows: @@ -17,3 +17,5 @@ compatibility with the rest of your solution: - Silk.NET.SDL.Native and Silk.NET.GLFW.Native: Zlib - Silk.NET.OpenAL.Soft.Native: LGPL-2.0-or-later - Silk.NET.WebGPU.Native.WGPU: MIT/Apache-2.0 +- Silk.NET.DXVK.Native: Zlib +- Silk.NET.Vkd3d.Native: [GPL-2.1](https://gitlab.winehq.org/wine/vkd3d/-/raw/master/LICENSE) \ No newline at end of file diff --git a/src/Native/Silk.NET.Assimp.Native/runtimes/linux-x64/native/libassimp.so.5 b/src/Native/Silk.NET.Assimp.Native/runtimes/linux-x64/native/libassimp.so.5 index 65c88f1ad1..22fa9c40a8 100755 Binary files a/src/Native/Silk.NET.Assimp.Native/runtimes/linux-x64/native/libassimp.so.5 and b/src/Native/Silk.NET.Assimp.Native/runtimes/linux-x64/native/libassimp.so.5 differ diff --git a/src/Native/Silk.NET.Assimp.Native/runtimes/win-x64/native/Assimp64.dll b/src/Native/Silk.NET.Assimp.Native/runtimes/win-x64/native/Assimp64.dll index f337f3b622..35c2b286a6 100644 Binary files a/src/Native/Silk.NET.Assimp.Native/runtimes/win-x64/native/Assimp64.dll and b/src/Native/Silk.NET.Assimp.Native/runtimes/win-x64/native/Assimp64.dll differ diff --git a/src/Native/Silk.NET.Assimp.Native/runtimes/win-x86/native/Assimp32.dll b/src/Native/Silk.NET.Assimp.Native/runtimes/win-x86/native/Assimp32.dll index 273988ea5c..cb73cf12de 100644 Binary files a/src/Native/Silk.NET.Assimp.Native/runtimes/win-x86/native/Assimp32.dll and b/src/Native/Silk.NET.Assimp.Native/runtimes/win-x86/native/Assimp32.dll differ diff --git a/src/Native/Silk.NET.DXVK.Native/Silk.NET.DXVK.Native.csproj b/src/Native/Silk.NET.DXVK.Native/Silk.NET.DXVK.Native.csproj new file mode 100644 index 0000000000..b7105e3a8b --- /dev/null +++ b/src/Native/Silk.NET.DXVK.Native/Silk.NET.DXVK.Native.csproj @@ -0,0 +1,74 @@ + + + + true + + + + + + netstandard2.0;net4.6.1 + Silk.NET.DXVK.Native + 2.17.0 + .NET Foundation and Contributors + true + Zlib + https://github.com/dotnet/Silk.NET + Multi-platform native library for DXVK. + git + https://github.com/doitsujin/dxvk + false + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Native/Silk.NET.DXVK.Native/build/net461/Silk.NET.DXVK.Native.props b/src/Native/Silk.NET.DXVK.Native/build/net461/Silk.NET.DXVK.Native.props new file mode 100644 index 0000000000..4ec223dbba --- /dev/null +++ b/src/Native/Silk.NET.DXVK.Native/build/net461/Silk.NET.DXVK.Native.props @@ -0,0 +1,45 @@ + + + + <_Silk_NativePackages_DXVK_IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true + <_Silk_NativePackages_DXVK_IsMacOS Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true + <_Silk_NativePackages_DXVK_IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true + + <_Silk_NativePackages_DXVK_NativeRuntime Condition=" '$(_Silk_NativePackages_DXVK_NativeRuntime)' == '' And '$(_Silk_NativePackages_DXVK_IsLinux)' == 'true' And ('$(Prefer32Bit)' == 'false' Or '$(PlatformTarget)' == 'x64')">linux-x64 + <_Silk_NativePackages_DXVK_NativeRuntime Condition=" '$(_Silk_NativePackages_DXVK_NativeRuntime)' == '' And '$(_Silk_NativePackages_DXVK_IsLinux)' == 'true' And ('$(Prefer32Bit)' == 'true' Or '$(PlatformTarget)' == 'x86')">linux-x86 + <_Silk_NativePackages_DXVK_NativeRuntime Condition=" '$(_Silk_NativePackages_DXVK_NativeRuntime)' == '' And '$(_Silk_NativePackages_DXVK_IsWindows)' == 'true' And ('$(Prefer32Bit)' == 'true' Or '$(PlatformTarget)' == 'x86')">win-x86 + <_Silk_NativePackages_DXVK_NativeRuntime Condition=" '$(_Silk_NativePackages_DXVK_NativeRuntime)' == '' And '$(_Silk_NativePackages_DXVK_IsWindows)' == 'true' And ('$(Prefer32Bit)' == 'false' Or '$(PlatformTarget)' == 'x64')">win-x64 + + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'win-x86'">dxvk-d3d11.dll + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'win-x86'">dxvk-dxgi.dll + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'win-x86'">dxvk-d3d9.dll + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'win-x86'">dxvk-d3d10core.dll + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'win-x64'">dxvk-d3d11.dll + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'win-x64'">dxvk-dxgi.dll + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'win-x64'">dxvk-d3d9.dll + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'win-x64'">dxvk-d3d10core.dll + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x64'">glfw-libdxvk_d3d9.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x64'">glfw-libdxvk_d3d10core.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x64'">glfw-libdxvk_d3d11.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x64'">glfw-libdxvk_dxgi.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x86'">glfw-libdxvk_d3d9.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x86'">glfw-libdxvk_d3d10core.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x86'">glfw-libdxvk_d3d11.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x86'">glfw-libdxvk_dxgi.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x64'">sdl2-libdxvk_d3d9.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x64'">sdl2-libdxvk_d3d10core.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x64'">sdl2-libdxvk_d3d11.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x64'">sdl2-libdxvk_dxgi.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x86'">sdl2-libdxvk_d3d9.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x86'">sdl2-libdxvk_d3d10core.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x86'">sdl2-libdxvk_d3d11.so + <_Silk_NativePackages_DXVK_NativeLibName Condition="'$(_Silk_NativePackages_DXVK_NativeRuntime)' == 'linux-x86'">sdl2-libdxvk_dxgi.so + + + + %(Filename)%(Extension) + Always + False + + + diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/glfw-libdxvk_d3d10core.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/glfw-libdxvk_d3d10core.so new file mode 100755 index 0000000000..a7ebe57227 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/glfw-libdxvk_d3d10core.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/glfw-libdxvk_d3d11.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/glfw-libdxvk_d3d11.so new file mode 100755 index 0000000000..2a22019805 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/glfw-libdxvk_d3d11.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/glfw-libdxvk_d3d9.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/glfw-libdxvk_d3d9.so new file mode 100755 index 0000000000..f7b684073d Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/glfw-libdxvk_d3d9.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/glfw-libdxvk_dxgi.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/glfw-libdxvk_dxgi.so new file mode 100755 index 0000000000..72c9ea21b9 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/glfw-libdxvk_dxgi.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/sdl2-libdxvk_d3d10core.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/sdl2-libdxvk_d3d10core.so new file mode 100755 index 0000000000..a7ebe57227 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/sdl2-libdxvk_d3d10core.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/sdl2-libdxvk_d3d11.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/sdl2-libdxvk_d3d11.so new file mode 100755 index 0000000000..7684b3471f Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/sdl2-libdxvk_d3d11.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/sdl2-libdxvk_d3d9.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/sdl2-libdxvk_d3d9.so new file mode 100755 index 0000000000..79b2168d10 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/sdl2-libdxvk_d3d9.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/sdl2-libdxvk_dxgi.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/sdl2-libdxvk_dxgi.so new file mode 100755 index 0000000000..65f0e258e9 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x64/native/sdl2-libdxvk_dxgi.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/glfw-libdxvk_d3d10core.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/glfw-libdxvk_d3d10core.so new file mode 100755 index 0000000000..da0dbfdde7 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/glfw-libdxvk_d3d10core.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/glfw-libdxvk_d3d11.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/glfw-libdxvk_d3d11.so new file mode 100755 index 0000000000..90c97278d6 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/glfw-libdxvk_d3d11.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/glfw-libdxvk_d3d9.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/glfw-libdxvk_d3d9.so new file mode 100755 index 0000000000..94391ed6d7 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/glfw-libdxvk_d3d9.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/glfw-libdxvk_dxgi.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/glfw-libdxvk_dxgi.so new file mode 100755 index 0000000000..a5ec13d800 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/glfw-libdxvk_dxgi.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/sdl2-libdxvk_d3d10core.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/sdl2-libdxvk_d3d10core.so new file mode 100755 index 0000000000..da0dbfdde7 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/sdl2-libdxvk_d3d10core.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/sdl2-libdxvk_d3d11.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/sdl2-libdxvk_d3d11.so new file mode 100755 index 0000000000..b85ffc51e0 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/sdl2-libdxvk_d3d11.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/sdl2-libdxvk_d3d9.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/sdl2-libdxvk_d3d9.so new file mode 100755 index 0000000000..dee2511004 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/sdl2-libdxvk_d3d9.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/sdl2-libdxvk_dxgi.so b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/sdl2-libdxvk_dxgi.so new file mode 100755 index 0000000000..b6bb60d1fa Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/linux-x86/native/sdl2-libdxvk_dxgi.so differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/win-x64/native/dxvk-d3d10core.dll b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x64/native/dxvk-d3d10core.dll new file mode 100755 index 0000000000..715efc0865 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x64/native/dxvk-d3d10core.dll differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/win-x64/native/dxvk-d3d11.dll b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x64/native/dxvk-d3d11.dll new file mode 100755 index 0000000000..966bf193c0 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x64/native/dxvk-d3d11.dll differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/win-x64/native/dxvk-d3d9.dll b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x64/native/dxvk-d3d9.dll new file mode 100755 index 0000000000..34f467e9e3 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x64/native/dxvk-d3d9.dll differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/win-x64/native/dxvk-dxgi.dll b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x64/native/dxvk-dxgi.dll new file mode 100755 index 0000000000..ad6c866bb9 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x64/native/dxvk-dxgi.dll differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/win-x86/native/dxvk-d3d10core.dll b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x86/native/dxvk-d3d10core.dll new file mode 100755 index 0000000000..0f78a87f04 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x86/native/dxvk-d3d10core.dll differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/win-x86/native/dxvk-d3d11.dll b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x86/native/dxvk-d3d11.dll new file mode 100755 index 0000000000..1a6d1b3529 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x86/native/dxvk-d3d11.dll differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/win-x86/native/dxvk-d3d9.dll b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x86/native/dxvk-d3d9.dll new file mode 100755 index 0000000000..47616fa50b Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x86/native/dxvk-d3d9.dll differ diff --git a/src/Native/Silk.NET.DXVK.Native/runtimes/win-x86/native/dxvk-dxgi.dll b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x86/native/dxvk-dxgi.dll new file mode 100755 index 0000000000..58ca644595 Binary files /dev/null and b/src/Native/Silk.NET.DXVK.Native/runtimes/win-x86/native/dxvk-dxgi.dll differ diff --git a/src/Native/Silk.NET.GLFW.Native/runtimes/linux-x64/native/libglfw.so b/src/Native/Silk.NET.GLFW.Native/runtimes/linux-x64/native/libglfw.so index dc7a5015ab..67a138597b 100755 Binary files a/src/Native/Silk.NET.GLFW.Native/runtimes/linux-x64/native/libglfw.so and b/src/Native/Silk.NET.GLFW.Native/runtimes/linux-x64/native/libglfw.so differ diff --git a/src/Native/Silk.NET.GLFW.Native/runtimes/osx-arm64/native/libglfw.3.dylib b/src/Native/Silk.NET.GLFW.Native/runtimes/osx-arm64/native/libglfw.3.dylib index d00d6f106d..e8633ae1ee 100755 Binary files a/src/Native/Silk.NET.GLFW.Native/runtimes/osx-arm64/native/libglfw.3.dylib and b/src/Native/Silk.NET.GLFW.Native/runtimes/osx-arm64/native/libglfw.3.dylib differ diff --git a/src/Native/Silk.NET.GLFW.Native/runtimes/osx-x64/native/libglfw.3.dylib b/src/Native/Silk.NET.GLFW.Native/runtimes/osx-x64/native/libglfw.3.dylib index 1bf0185b20..2ba5455a5a 100755 Binary files a/src/Native/Silk.NET.GLFW.Native/runtimes/osx-x64/native/libglfw.3.dylib and b/src/Native/Silk.NET.GLFW.Native/runtimes/osx-x64/native/libglfw.3.dylib differ diff --git a/src/Native/Silk.NET.GLFW.Native/runtimes/win-arm64/native/glfw3.dll b/src/Native/Silk.NET.GLFW.Native/runtimes/win-arm64/native/glfw3.dll index 06d21e5bae..56e276b1f8 100644 Binary files a/src/Native/Silk.NET.GLFW.Native/runtimes/win-arm64/native/glfw3.dll and b/src/Native/Silk.NET.GLFW.Native/runtimes/win-arm64/native/glfw3.dll differ diff --git a/src/Native/Silk.NET.GLFW.Native/runtimes/win-x64/native/glfw3.dll b/src/Native/Silk.NET.GLFW.Native/runtimes/win-x64/native/glfw3.dll index 9244b8fcb2..f76f4ffa86 100644 Binary files a/src/Native/Silk.NET.GLFW.Native/runtimes/win-x64/native/glfw3.dll and b/src/Native/Silk.NET.GLFW.Native/runtimes/win-x64/native/glfw3.dll differ diff --git a/src/Native/Silk.NET.GLFW.Native/runtimes/win-x86/native/glfw3.dll b/src/Native/Silk.NET.GLFW.Native/runtimes/win-x86/native/glfw3.dll index afeb1b6f90..579f8c3d95 100644 Binary files a/src/Native/Silk.NET.GLFW.Native/runtimes/win-x86/native/glfw3.dll and b/src/Native/Silk.NET.GLFW.Native/runtimes/win-x86/native/glfw3.dll differ diff --git a/src/Native/Silk.NET.Vkd3d.Native/Silk.NET.Vkd3d.Native.csproj b/src/Native/Silk.NET.Vkd3d.Native/Silk.NET.Vkd3d.Native.csproj new file mode 100644 index 0000000000..65e6e903d3 --- /dev/null +++ b/src/Native/Silk.NET.Vkd3d.Native/Silk.NET.Vkd3d.Native.csproj @@ -0,0 +1,31 @@ + + + + true + + + + + + netstandard2.0;net4.6.1 + Silk.NET.Vkd3d.Native + 2.17.0 + .NET Foundation and Contributors + true + Zlib + https://github.com/dotnet/Silk.NET + Native library for Vkd3d. + git + https://gitlab.winehq.org/wine/vkd3d/ + false + true + + + + + + + + + + diff --git a/src/Native/Silk.NET.Vkd3d.Native/build/net461/Silk.NET.Vkd3d.Native.props b/src/Native/Silk.NET.Vkd3d.Native/build/net461/Silk.NET.Vkd3d.Native.props new file mode 100644 index 0000000000..784e48c37c --- /dev/null +++ b/src/Native/Silk.NET.Vkd3d.Native/build/net461/Silk.NET.Vkd3d.Native.props @@ -0,0 +1,21 @@ + + + + <_Silk_NativePackages_Vkd3d_IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true + <_Silk_NativePackages_Vkd3d_IsMacOS Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true + <_Silk_NativePackages_Vkd3d_IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true + + <_Silk_NativePackages_Vkd3d_NativeRuntime Condition=" '$(_Silk_NativePackages_Vkd3d_NativeRuntime)' == '' And '$(_Silk_NativePackages_Vkd3d_IsLinux)' == 'true' And ('$(Prefer32Bit)' == 'false' Or '$(PlatformTarget)' == 'x64')">linux-x64 + <_Silk_NativePackages_Vkd3d_NativeRuntime Condition=" '$(_Silk_NativePackages_Vkd3d_NativeRuntime)' == '' And '$(_Silk_NativePackages_Vkd3d_IsLinux)' == 'true' And ('$(Prefer32Bit)' == 'true' Or '$(PlatformTarget)' == 'x86')">linux-x86 + + <_Silk_NativePackages_Vkd3d_NativeLibName Condition="'$(_Silk_NativePackages_Vkd3d_NativeRuntime)' == 'linux-x64'">libd3dcompile_vkd3d.so + <_Silk_NativePackages_Vkd3d_NativeLibName Condition="'$(_Silk_NativePackages_Vkd3d_NativeRuntime)' == 'linux-x64'">libSPIRV-Tools-shared.so + + + + %(Filename)%(Extension) + Always + False + + + diff --git a/src/Native/Silk.NET.Vkd3d.Native/runtimes/linux-x64/native/libSPIRV-Tools-shared.so b/src/Native/Silk.NET.Vkd3d.Native/runtimes/linux-x64/native/libSPIRV-Tools-shared.so new file mode 100755 index 0000000000..eaa2dcdfa1 Binary files /dev/null and b/src/Native/Silk.NET.Vkd3d.Native/runtimes/linux-x64/native/libSPIRV-Tools-shared.so differ diff --git a/src/Native/Silk.NET.Vkd3d.Native/runtimes/linux-x64/native/libd3dcompile_vkd3d.so b/src/Native/Silk.NET.Vkd3d.Native/runtimes/linux-x64/native/libd3dcompile_vkd3d.so new file mode 100755 index 0000000000..75f9c190e0 Binary files /dev/null and b/src/Native/Silk.NET.Vkd3d.Native/runtimes/linux-x64/native/libd3dcompile_vkd3d.so differ diff --git a/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/linux-x64/native/libvulkan.so b/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/linux-x64/native/libvulkan.so index 1b17822209..84f7dd299f 100755 Binary files a/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/linux-x64/native/libvulkan.so and b/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/linux-x64/native/libvulkan.so differ diff --git a/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/osx-x64/native/libvulkan.dylib b/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/osx-x64/native/libvulkan.dylib index 22111f08a5..0eaaeb8456 100755 Binary files a/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/osx-x64/native/libvulkan.dylib and b/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/osx-x64/native/libvulkan.dylib differ diff --git a/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/win-x64/native/vulkan-1.dll b/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/win-x64/native/vulkan-1.dll index 5dce2d3fff..1966e81e09 100644 Binary files a/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/win-x64/native/vulkan-1.dll and b/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/win-x64/native/vulkan-1.dll differ diff --git a/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/win-x86/native/vulkan-1.dll b/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/win-x86/native/vulkan-1.dll index 5dce2d3fff..1966e81e09 100644 Binary files a/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/win-x86/native/vulkan-1.dll and b/src/Native/Silk.NET.Vulkan.Loader.Native/runtimes/win-x86/native/vulkan-1.dll differ