summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-cpp.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-01-10 15:00:13 -0500
committerGitHub <noreply@github.com>2020-01-10 15:00:13 -0500
commitef41dfc605f7868c0ccc7dde05982232b7d49589 (patch)
treea2abe79250c234c65f968976db2578341ec77437 /source/slang/slang-emit-cpp.h
parentf2a123d727316d8203820a332da1348f78ad9ad6 (diff)
WIP: CPU like CUDA binding (#1164)
* CUDA generated first test compiles. * WIP on enabling CUDA in render-test. * Detect CUDA_PATH environmental variable to build build cuda support into render-test. Added WIP cuda-compute-util.cpp/h Added CUDA as a renderer type. * Fix libraries needed for cuda in premake. * Added -enable-cuda premake option. Defaults to false. * Creates CUDA device, loads PTX and finds entry point. * Fix some erroneous cruft from slang-cuda-prelude.h * Made CUDA use C++ like ABI for generated code. Fix small bug in C++ output semantics.
Diffstat (limited to 'source/slang/slang-emit-cpp.h')
-rw-r--r--source/slang/slang-emit-cpp.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/slang/slang-emit-cpp.h b/source/slang/slang-emit-cpp.h
index d71983c92..df1dec380 100644
--- a/source/slang/slang-emit-cpp.h
+++ b/source/slang/slang-emit-cpp.h
@@ -37,6 +37,18 @@ public:
int colCount;
};
+ struct GlobalParamInfo
+ {
+ typedef GlobalParamInfo ThisType;
+ bool operator<(const ThisType& rhs) const { return offset < rhs.offset; }
+ bool operator==(const ThisType& rhs) const { return offset == rhs.offset; }
+ bool operator!=(const ThisType& rhs) const { return !(*this == rhs); }
+
+ IRInst* inst;
+ UInt offset;
+ UInt size;
+ };
+
virtual void useType(IRType* type);
virtual void emitCall(const HLSLIntrinsic* specOp, IRInst* inst, const IRUse* operands, int numOperands, const EmitOpInfo& inOuterPrec);
virtual void emitTypeDefinition(IRType* type);
@@ -69,12 +81,17 @@ protected:
// Replaceable for classes derived from CPPSourceEmitter
virtual SlangResult calcTypeName(IRType* type, CodeGenTarget target, StringBuilder& out);
+
void emitIntrinsicCallExpr(
IRCall* inst,
IRTargetIntrinsicDecoration* targetIntrinsic,
EmitOpInfo const& inOuterPrec);
+ void _emitForwardDeclarations(const List<EmitAction>& actions);
+ void _calcGlobalParams(const List<EmitAction>& actions, List<GlobalParamInfo>& outParams, IRGlobalParam** outEntryPointGlobalParams);
+ void _emitUniformStateMembers(const List<EmitAction>& actions, IRGlobalParam** outEntryPointGlobalParams);
+
void _emitVecMatMulDefinition(const UnownedStringSlice& funcName, const HLSLIntrinsic* specOp);
void _emitAryDefinition(const HLSLIntrinsic* specOp);
@@ -119,6 +136,8 @@ protected:
HLSLIntrinsic* _addIntrinsic(HLSLIntrinsic::Op op, IRType* returnType, IRType*const* argTypes, Index argTypeCount);
+ static bool _isVariable(IROp op);
+
Dictionary<IRType*, StringSlicePool::Handle> m_typeNameMap;
Dictionary<const HLSLIntrinsic*, StringSlicePool::Handle> m_intrinsicNameMap;