WIP: independent tool documents, native panel routing and per-stage GPU masks; host canvas and tracking pending

这个提交包含在:
mac 于 2026-11-01 21:40:54 +08:00 提交
1 父节点 edfb74b171
当前提交 f72aa2609d
21 个文件已更改
+1067 -45

没有与搜索条件相匹配的文件

+10 -1
查看文件
@@ -3,6 +3,7 @@
from pathlib import Path
import argparse
import subprocess
from build_masked_kernel import masked_kernel
def main():
@@ -17,13 +18,21 @@ def main():
objects = []
for name in ('DYGradeKernel', 'DYStatisticsKernel', 'DYLUTExportKernel', 'CSTKernel', 'BasisKernel'):
target = work / (name + '.air')
subprocess.run(['xcrun', 'metal-opt', str(root / 'tools/kernels' / (name + '.ll')),
source = root / 'tools/kernels' / (name + '.ll')
if name == 'DYGradeKernel':
generated = work / 'DYGradeMasked.ll'
generated.write_text(masked_kernel(source.read_text()))
source = generated
subprocess.run(['xcrun', 'metal-opt', str(source),
'-o', str(target)], check=True)
objects.append(str(target))
wrapper = work / 'DYGradeWrapper.air'
subprocess.run(['xcrun', '-sdk', 'macosx', 'metal', '-std=metal3.1',
'-mmacosx-version-min=14.6', '-c',
str(root / '大鱼调色/Plugin/DYGrade.metal'), '-o', str(wrapper)], check=True)
tracking=work / 'DYTracking.air'
subprocess.run(['xcrun','-sdk','macosx','metal','-std=metal3.1','-mmacosx-version-min=14.6','-c',str(root/'大鱼调色/Plugin/DYTracking.metal'),'-o',str(tracking)],check=True)
objects.append(str(tracking))
subprocess.run(['xcrun', '-sdk', 'macosx', 'metallib', str(wrapper), *objects,
'-o', str(args.output)], check=True)
print(args.output)
+38
查看文件
@@ -0,0 +1,38 @@
"""Add per-stage coverage to a separate entry; preserve the legacy AIR function.
Anchors are exact SSA values of the versioned source, not guessed byte offsets.
No target runtime or installed reference binary is a build dependency.
"""
import re
def masked_kernel(source):
original = re.search(r'define <4 x half> @dy_grade\(.*?\n\}', source, re.S).group()
body = original.replace('@dy_grade(', '@dy_gradeMasked(', 1)
args = ', '.join(f'float %dyWeight{i}' for i in range(12))
body = body.replace(') local_unnamed_addr #0 {', ', '+args+') local_unnamed_addr #0 {', 1)
# Each stage mixes against its actual input. Split basic adjustment has
# two native locations; both use the same per-module coverage.
stages = [(82,53,0),(83,82,8),(408,83,2),(409,408,6),
(410,409,9),(411,410,11),(498,411,5),(519,498,7),
(520,519,2),(521,520,10),(668,521,4),(669,668,3)]
for value, before, section in stages:
target = f'%v{value}'
lines = body.splitlines()
index = next(i for i,l in enumerate(lines) if l.startswith(' '+target+' = '))
# Keep all PHIs first in a block, then insert the coverage operation.
end = index+1
while end<len(lines) and re.match(r' %\w+ = phi ',lines[end]): end+=1
lines[index] = lines[index].replace(target+' = ',f'%dyRaw{value} = ',1)
lines[end:end] = [
f' %dyScalar{value} = insertelement <3 x float> undef, float %dyWeight{section}, i64 0',
f' %dyVector{value} = shufflevector <3 x float> %dyScalar{value}, <3 x float> undef, <3 x i32> zeroinitializer',
f' {target} = tail call <3 x float> @air.mix.v3f32(<3 x float> %v{before}, <3 x float> %dyRaw{value}, <3 x float> %dyVector{value}) #1']
body='\n'.join(lines)
skin='''
define <3 x float> @dy_skinExtra(<3 x float> %color, <3 x float> %reference, %struct.DYUniforms addrspace(2)* %uniforms) {
entry:
%result = call fastcc <3 x float> @_ZL19applySkinProtectionDv3_fS_RU11MTLconstantK17DYUniforms(<3 x float> %color, <3 x float> %reference, %struct.DYUniforms addrspace(2)* %uniforms)
ret <3 x float> %result
}
'''
return source+'\n'+body+'\n'+skin