summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-cpp.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-emit-cpp.h')
-rw-r--r--source/slang/slang-emit-cpp.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/source/slang/slang-emit-cpp.h b/source/slang/slang-emit-cpp.h
new file mode 100644
index 000000000..d5d95507c
--- /dev/null
+++ b/source/slang/slang-emit-cpp.h
@@ -0,0 +1,40 @@
+// slang-emit-cpp.h
+#ifndef SLANG_EMIT_CPP_H
+#define SLANG_EMIT_CPP_H
+
+#include "slang-emit-c-like.h"
+
+namespace Slang
+{
+
+class CPPSourceEmitter: public CLikeSourceEmitter
+{
+public:
+ typedef CLikeSourceEmitter Super;
+
+ enum class BuiltInCOp
+ {
+ Splat, //< Splat a single value to all values of a vector or matrix type
+ Init, //< Initialize with parameters (must match the type)
+ };
+
+ CPPSourceEmitter(const Desc& desc) :
+ Super(desc)
+ {}
+
+protected:
+
+ void _emitCVecType(IROp op, Int size);
+ void _emitCMatType(IROp op, IRIntegerValue rowCount, IRIntegerValue colCount);
+ void _emitCFunc(BuiltInCOp cop, IRType* type);
+
+ virtual void emitParameterGroupImpl(IRGlobalParam* varDecl, IRUniformParameterGroupType* type) SLANG_OVERRIDE;
+ virtual void emitEntryPointAttributesImpl(IRFunc* irFunc, EntryPointLayout* entryPointLayout) SLANG_OVERRIDE;
+ virtual void emitSimpleTypeImpl(IRType* type) SLANG_OVERRIDE;
+ virtual void emitVectorTypeNameImpl(IRType* elementType, IRIntegerValue elementCount) SLANG_OVERRIDE;
+
+ virtual bool tryEmitInstExprImpl(IRInst* inst, IREmitMode mode, const EmitOpInfo& inOuterPrec) SLANG_OVERRIDE;
+};
+
+}
+#endif