Files
mirage/tools/compiler.py
2025-06-18 16:33:11 +08:00

26 lines
793 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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)