优化着色器类型判断逻辑,优化dxc编译器检查代码

This commit is contained in:
daiqingshuang
2025-06-11 17:38:33 +08:00
parent e4c9d42a60
commit 3648bd4c1b
2 changed files with 9 additions and 1 deletions

View File

@@ -90,7 +90,8 @@ class CodeGenerator:
writer.write() writer.write()
self._write_shader_bindings_class(writer, binding_infos) self._write_shader_bindings_class(writer, binding_infos)
writer.write() writer.write()
if len(binding_infos) == 2: # 查找是否有像素着色器或计算着色器的处理
if any(info['stage'] == ShaderStage.FRAGMENT.value for info in binding_infos):
self._write_handle_class(writer, 'pixel_shader_handle_t', binding_infos) self._write_handle_class(writer, 'pixel_shader_handle_t', binding_infos)
else: else:
self._write_handle_class(writer, 'compute_shader_handle_t', binding_infos) self._write_handle_class(writer, 'compute_shader_handle_t', binding_infos)

View File

@@ -105,3 +105,10 @@ if os.name == 'nt':
else: else:
# 如果没有找到dxcapsviewer.exe尝试直接查找dxc.exe # 如果没有找到dxcapsviewer.exe尝试直接查找dxc.exe
dxc_path = shutil.which('dxc.exe') dxc_path = shutil.which('dxc.exe')
# 检查是否有dxil.dll
if dxc_path:
dxil_dll_path = os.path.join(os.path.dirname(dxc_path), 'dxil.dll')
if not os.path.isfile(dxil_dll_path):
print("Warning: dxil.dll not found in the same directory as dxc.exe.")
dxc_path = None