@@ -50,10 +50,10 @@ class CodegenUtility {
5050 vstd::unordered_map<vstd::string, std::pair<vstd::string, Type const *>> attributes;
5151 CodegenUtility ();
5252 ~CodegenUtility ();
53- uint IsBool (Type const &type);
54- bool GetConstName (uint64 hash, ConstantData const &data, vstd::StringBuilder &str);
55- void GetVariableName (Function func, Variable const &type, vstd::StringBuilder &str);
56- void GetVariableName (Function func, Variable::Tag type, uint id, vstd::StringBuilder &str);
53+ static uint IsBool (Type const &type);
54+ bool GetConstName (uint64 hash, ConstantData const &data, vstd::StringBuilder &str) const ;
55+ void GetVariableName (Function func, Variable const &type, vstd::StringBuilder &str) const ;
56+ void GetVariableName (Function func, Variable::Tag type, uint id, vstd::StringBuilder &str) const ;
5757 void GetTypeName (Type const &type, vstd::StringBuilder &str, Usage usage, bool local_var = true );
5858 void GetFunctionDecl (Function func, vstd::StringBuilder &str);
5959 void GetFunctionName (Function callable, vstd::StringBuilder &result);
@@ -70,20 +70,20 @@ class CodegenUtility {
7070 void CodegenWorkGraphNode (const WorkGraph &work_graph, size_t node_index, bool is_entry_point, vstd::StringBuilder &result, vstd::unordered_set<uint64_t > &callableMap, bool cbufferNonEmpty);
7171
7272 // Work graph helper methods
73- void GenerateMaxRecordsAttribute (uint max_records, vstd::StringBuilder &result);
73+ static void GenerateMaxRecordsAttribute (uint max_records, vstd::StringBuilder &result);
7474 void GenerateNodeOutputDecl (const Type *record_type, uint max_records, luisa::string_view var_name_prefix, int output_index, vstd::StringBuilder &result);
7575 void GenerateNodeInputDecl (const Type *record_type, luisa::string_view var_name, vstd::StringBuilder &result);
76- void GenerateNodeShaderAttributes (bool is_entry_point, luisa::string_view node_name, vstd::StringBuilder &result);
77- luisa::vector<luisa::vector<const luisa::compute::detail::WorkGraphEdge*>> CollectOutputEdgesByIndex (const luisa::compute::detail::WorkGraphNode &node);
78- const Type* GetOutputRecordType (const luisa::vector<const luisa::compute::detail::WorkGraphEdge*> &edges, const luisa::vector<luisa::compute::detail::WorkGraphNode> &nodes);
76+ static void GenerateNodeShaderAttributes (bool is_entry_point, luisa::string_view node_name, vstd::StringBuilder &result);
77+ static luisa::vector<luisa::vector<const luisa::compute::detail::WorkGraphEdge*>> CollectOutputEdgesByIndex (const luisa::compute::detail::WorkGraphNode &node);
78+ static const Type* GetOutputRecordType (const luisa::vector<const luisa::compute::detail::WorkGraphEdge*> &edges, const luisa::vector<luisa::compute::detail::WorkGraphNode> &nodes);
7979 void GenerateNodeFunctionSignature (Function node_func, const luisa::compute::detail::WorkGraphNode &node, const luisa::vector<luisa::compute::detail::WorkGraphNode> &all_nodes, vstd::StringBuilder &result);
80- void GenerateWorkGraphOutputCall (int output_index, luisa::string_view record_var_name, vstd::StringBuilder &result);
80+ static void GenerateWorkGraphOutputCall (int output_index, luisa::string_view record_var_name, vstd::StringBuilder &result);
8181 void GenerateRecordStructDef (const Type *record_type, vstd::StringBuilder &result);
82- void GenerateNodeDispatchGrid (const uint3 &grid_size, vstd::StringBuilder &result);
82+ static void GenerateNodeDispatchGrid (const uint3 &grid_size, vstd::StringBuilder &result);
8383 void GenerateNodeFunctionBody (Function node_func, vstd::StringBuilder &result);
8484
85- bool IsCBufferNonEmpty (std::initializer_list<vstd::IRange<Variable> *> f);
86- bool IsCBufferNonEmpty (Function func);
85+ static bool IsCBufferNonEmpty (std::initializer_list<vstd::IRange<Variable> *> f);
86+ static bool IsCBufferNonEmpty (Function func);
8787 static vstd::MD5 GetTypeMD5 (vstd::span<Type const *const > types);
8888 static vstd::MD5 GetTypeMD5 (std::initializer_list<vstd::IRange<Variable> *> f);
8989 static vstd::MD5 GetTypeMD5 (Function func);
@@ -95,12 +95,12 @@ class CodegenUtility {
9595 CodegenResult::Properties &properties,
9696 vstd::StringBuilder &str,
9797 bool isSpirV,
98- uint &bind_count);
98+ uint &bind_count) const ;
9999 void PreprocessCodegenProperties (
100100 CodegenResult::Properties &properties,
101101 vstd::StringBuilder &varData,
102102 RegisterIndexer ®isterCount,
103- bool cbufferNonEmpty, bool isRaster, bool isSpirv, uint &bind_count);
103+ bool cbufferNonEmpty, bool isRaster, bool isSpirv, uint &bind_count) const ;
104104 void PostprocessCodegenProperties (vstd::StringBuilder &finalResult, bool use_autodiff);
105105 void CodegenProperties (
106106 CodegenResult::Properties &properties,
@@ -124,8 +124,8 @@ class CodegenUtility {
124124 bool noRegister = false
125125 );
126126 static vstd::string_view ReadInternalHLSLFile (vstd::string_view name);
127- uint AddPrinter (vstd::string_view name, luisa::compute::Type const *structType);
128- vstd::StringBuilder GetNewTempVarName ();
127+ uint AddPrinter (vstd::string_view name, luisa::compute::Type const *structType) const ;
128+ vstd::StringBuilder GetNewTempVarName () const ;
129129 bool TypeIsAliased (luisa::compute::Type const *t) const ;
130130 bool VectorShouldBeAliased (luisa::compute::Type const *t) const ;
131131 void OriginToAliased (luisa::compute::Type const *t, vstd::StringBuilder &sb);
0 commit comments