From e21d5ad650130631e17662ce8f22d15315ab597a Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 21 Nov 2018 13:41:34 -0500 Subject: Feature/early depth stencil (#727) * First pass support for early depth stencil. * Add a simple test to check if output has attributes. * Use cross compilation to test [earlydepthstencil] on glsl. * If target is dxil, use dxc to test against. Add hlsl to test earlydepthstencil against. * * Added spSessionHasCompileTargetSupport * Made slang-test use spSessionHasCompileTargetSupport to ignore tests that cannot run --- source/slang/compiler.cpp | 58 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'source/slang/compiler.cpp') diff --git a/source/slang/compiler.cpp b/source/slang/compiler.cpp index cab6355c1..1e514812a 100644 --- a/source/slang/compiler.cpp +++ b/source/slang/compiler.cpp @@ -181,6 +181,64 @@ namespace Slang } + bool hasCodeGenTarget(Session* session, CodeGenTarget target) + { + switch (target) + { + case CodeGenTarget::Unknown: return false; + case CodeGenTarget::None: return true; + case CodeGenTarget::GLSL: + case CodeGenTarget::GLSL_Vulkan: + case CodeGenTarget::GLSL_Vulkan_OneDesc: + { + // Can always output GLSL + return true; + } + case CodeGenTarget::HLSL: + { + // Can always output HLSL + return true; + } + case CodeGenTarget::SPIRVAssembly: + case CodeGenTarget::SPIRV: + { +#if SLANG_ENABLE_GLSLANG_SUPPORT + return session->getOrLoadSharedLibrary(Slang::SharedLibraryType::Glslang, nullptr) != nullptr; +#else + return false; +#endif + } + case CodeGenTarget::DXBytecode: + case CodeGenTarget::DXBytecodeAssembly: + { +#if SLANG_ENABLE_DXBC_SUPPORT + // Must have fxc + return session->getOrLoadSharedLibrary(SharedLibraryType::Fxc, nullptr) != nullptr; +#else + return false; +#endif + } + + case CodeGenTarget::DXIL: + case CodeGenTarget::DXILAssembly: + { +#if SLANG_ENABLE_DXIL_SUPPORT + // Must have dxc + return session->getOrLoadSharedLibrary(SharedLibraryType::Dxc, nullptr) && + session->getOrLoadSharedLibrary(SharedLibraryType::Dxil, nullptr); +#else + return false; +#endif + } + + default: + { + SLANG_ASSERT(!"Unhandled target"); + return false; + } + } + } + // String emitHLSLForEntryPoint( -- cgit v1.2.3