diff --git a/compiler.py b/compiler.py index bd3bde8..1b7c7e0 100644 --- a/compiler.py +++ b/compiler.py @@ -46,6 +46,8 @@ class SDL3GPUSlangCompiler: with tempfile.NamedTemporaryFile(mode='w', suffix='.slang', delete=False, encoding='utf8') as tmp: tmp.write(modified_source) tmp_path = tmp.name + with tempfile.NamedTemporaryFile(mode='w', suffix='.cso', delete=False, encoding='utf8') as tmp: + signed_shader = tmp.name try: # 编译着色器 @@ -62,8 +64,6 @@ class SDL3GPUSlangCompiler: # 如果目标是DXIL,则需要签名 if global_vars.target == TargetFormat.DXIL: - with tempfile.NamedTemporaryFile(mode='w', suffix='.cso', delete=False, encoding='utf8') as tmp: - signed_shader = tmp.name self._compile_dxil(shader_info, shader_file, signed_shader) shader_file = signed_shader diff --git a/compiler_cmd.py b/compiler_cmd.py index c7e38d5..c5b1c69 100644 --- a/compiler_cmd.py +++ b/compiler_cmd.py @@ -31,6 +31,8 @@ def make_cmd(source_file: str, target: TargetFormat, stage: ShaderStage, entry_p '-o', output_path, '-target', target_flag, '-stage', stage_flag, + '-g3', # 生成调试信息 + '-O0', # 禁用优化,便于调试和验证 ] # 添加包含路径 for include_path in global_vars.include_dirs: