From 5adecbe837d27cf4e0a554ae13a0338743a8cb4b Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Sat, 29 Apr 2023 11:32:53 +0800 Subject: vkd3d and dxvk integration (#2823) * Add d3d sources for linux builds * Return NOT_IMPLEMENTED for shared handle support on Linux * Enable DirectX api on Linux * Do not report DX11 support without FXC * Initial version of SynchAPI emulation * Neaten dx library name handling * Neaten and use posix-synchapi * Add premake option for DirectX on Vulkan * s/SLANG_ENABLE_VKD3D_PROTON/SLANG_ENABLE_VKD3D * Skip failing tests on vkd3d * Regenerate vs projects * Silence unused var warning --- source/compiler-core/slang-fxc-compiler.cpp | 3 ++- source/core/slang-render-api-util.cpp | 16 +++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/compiler-core/slang-fxc-compiler.cpp b/source/compiler-core/slang-fxc-compiler.cpp index 4153585d3..b3b952796 100644 --- a/source/compiler-core/slang-fxc-compiler.cpp +++ b/source/compiler-core/slang-fxc-compiler.cpp @@ -363,7 +363,8 @@ SlangResult FXCDownstreamCompiler::convert(IArtifact* from, const ArtifactDesc& { ComPtr library; - SLANG_RETURN_ON_FAIL(DownstreamCompilerUtil::loadSharedLibrary(path, loader, nullptr, "d3dcompiler_47", library)); + const char* const libName = "d3dcompiler_47"; + SLANG_RETURN_ON_FAIL(DownstreamCompilerUtil::loadSharedLibrary(path, loader, nullptr, libName, library)); SLANG_ASSERT(library); if (!library) diff --git a/source/core/slang-render-api-util.cpp b/source/core/slang-render-api-util.cpp index ca58091af..334e9a9d1 100644 --- a/source/core/slang-render-api-util.cpp +++ b/source/core/slang-render-api-util.cpp @@ -245,7 +245,7 @@ static Token nextToken(Slang::UnownedStringSlice& textInOut, Slang::UnownedStrin return RenderApiType::Unknown; } -#if SLANG_WINDOWS_FAMILY +#if SLANG_ENABLE_DIRECTX static bool _canLoadSharedLibrary(const char* libName) { SharedLibrary::Handle handle; @@ -266,18 +266,16 @@ static bool _canLoadSharedLibrary(const char* libName) #if SLANG_WINDOWS_FAMILY case RenderApiType::OpenGl: return _canLoadSharedLibrary("opengl32"); case RenderApiType::Vulkan: return _canLoadSharedLibrary("vulkan-1") || _canLoadSharedLibrary("vk_swiftshader"); - case RenderApiType::D3D11: return _canLoadSharedLibrary("d3d11"); - case RenderApiType::D3D12: return _canLoadSharedLibrary("d3d12"); #elif SLANG_UNIX_FAMILY - case RenderApiType::D3D11: return false; - case RenderApiType::D3D12: return false; - // The below can be used once they're confirmed working with gfx - // case RenderApiType::D3D11: return _canLoadSharedLibrary("dxvk_d3d11"); - // case RenderApiType::D3D12: return _canLoadSharedLibrary("vkd3d-proton-d3d12"); - case RenderApiType::OpenGl: return true; case RenderApiType::Vulkan: return true; #endif + +#if SLANG_ENABLE_DIRECTX + case RenderApiType::D3D11: return _canLoadSharedLibrary(SLANG_ENABLE_DXVK ? "dxvk_d3d11" : "d3d11"); + case RenderApiType::D3D12: return _canLoadSharedLibrary(SLANG_ENABLE_VKD3D ? "vkd3d-proton-d3d12" : "d3d12"); +#endif + case RenderApiType::CPU: return true; // We'll assume CUDA is available, and if not, trying to create it will detect it case RenderApiType::CUDA: return true; -- cgit v1.2.3