summaryrefslogtreecommitdiffstats
path: root/source/slang/compiler.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-11-21 13:41:34 -0500
committerGitHub <noreply@github.com>2018-11-21 13:41:34 -0500
commite21d5ad650130631e17662ce8f22d15315ab597a (patch)
treea1f5053efebc6184d21b0151e38ba1a52e74b07c /source/slang/compiler.cpp
parent9bb11b69a08c66e2857f439837e2253658aed9a4 (diff)
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
Diffstat (limited to 'source/slang/compiler.cpp')
-rw-r--r--source/slang/compiler.cpp58
1 files changed, 58 insertions, 0 deletions
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(