summaryrefslogtreecommitdiffstats
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-08-12 13:14:15 -0700
committerGitHub <noreply@github.com>2021-08-12 13:14:15 -0700
commit6406523511037987d8b8ab881aea41389afd57eb (patch)
tree79f24b6cba377340c2f4d3dcf9fed78fc586f3e0 /source/slang/slang.cpp
parent389d21d982da34815b65b10cae63088c397eecc8 (diff)
Further implementation of SPIRV direct emit. (#1920)
* Further implementation of SPIRV direct emit. This change implements: - Struct, Vector, Matrix and Unsized Array types. - Basic arithmetic opcodes, vector construct, swizzle etc. - getElementPtr, getElement, fieldAddress, extractField. - SPIRV target intrinsics with SPIRV asm code in stdlib. - RWStructuredBuffer and StructuredBuffer. - Pointer storage class propagation. - Control flow. * Fix.
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index ef92558cc..913be346e 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -1100,6 +1100,11 @@ void TargetRequest::addCapability(CapabilityAtom capability)
cookedCapabilities = CapabilitySet::makeEmpty();
}
+void TargetRequest::setDirectSPIRVEmitMode()
+{
+ m_emitSPIRVDirectly = true;
+ cookedCapabilities.makeEmpty();
+}
CapabilitySet TargetRequest::getTargetCaps()
{
@@ -1131,9 +1136,18 @@ CapabilitySet TargetRequest::getTargetCaps()
case CodeGenTarget::GLSL:
case CodeGenTarget::GLSL_Vulkan:
case CodeGenTarget::GLSL_Vulkan_OneDesc:
+ atoms.add(CapabilityAtom::GLSL);
+ break;
case CodeGenTarget::SPIRV:
case CodeGenTarget::SPIRVAssembly:
- atoms.add(CapabilityAtom::GLSL);
+ if (m_emitSPIRVDirectly)
+ {
+ atoms.add(CapabilityAtom::SPIRV_DIRECT);
+ }
+ else
+ {
+ atoms.add(CapabilityAtom::GLSL);
+ }
break;
case CodeGenTarget::HLSL: