26 lines
793 B
Python
26 lines
793 B
Python
#!/usr/bin/env python3
|
||
"""
|
||
Slang Compiler - Main Compiler
|
||
主编译器类,整合所有功能模块
|
||
"""
|
||
|
||
from typing import List, Dict
|
||
|
||
from code_generator import CodeGenerator
|
||
from shader_parser import ShaderParser
|
||
from shader_reflection_type import ShaderReflection, ShaderInfos
|
||
|
||
|
||
class SlangCompiler:
|
||
def __init__(self):
|
||
self.parser = ShaderParser()
|
||
self.code_generator = CodeGenerator()
|
||
|
||
def parse_slang_shader(self) -> List[ShaderReflection]:
|
||
"""解析Slang着色器源码,提取资源信息"""
|
||
return self.parser.parse_slang_shader()
|
||
|
||
def generate_binding_functions(self, binding_infos: ShaderInfos, output_path: str):
|
||
"""生成C/C++绑定函数"""
|
||
self.code_generator.generate_binding_functions(binding_infos, output_path)
|