WIP: insert initialized tools at anchors with matching render order, enlarge mask controls and rebuild native pen editing; integration checks pending

这个提交包含在:
mac 于 2026-11-01 23:09:52 +08:00 提交
1 父节点 745aa1626e
当前提交 38adc259e0
20 个文件已更改
+405 -105

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

+26 -1
查看文件
@@ -28,6 +28,31 @@ def masked_kernel(source):
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)
# A second, explicitly ranged entry lets anchored extra tools interrupt the
# existing native instruction order. The historical entry above is unchanged.
segment = body.replace('@dy_gradeMasked(', '@dy_gradeSegment(', 1)
segment = segment.replace(') local_unnamed_addr #0 {', ', i32 %dyStageFirst, i32 %dyStageLast, <3 x float> %dyExternalSkinReference) local_unnamed_addr #0 {', 1)
for stage, (value, before, section) in enumerate(stages):
target = f' %dyScalar{value} = insertelement <3 x float> undef, float %dyWeight{section}, i64 0'
replacement = '\n'.join([
f' %dyAtOrAfter{value} = icmp ule i32 %dyStageFirst, {stage}',
f' %dyAtOrBefore{value} = icmp uge i32 %dyStageLast, {stage}',
f' %dyStageActive{value} = and i1 %dyAtOrAfter{value}, %dyAtOrBefore{value}',
f' %dyEffective{value} = select i1 %dyStageActive{value}, float %dyWeight{section}, float 0.000000e+00',
target.replace(f'%dyWeight{section}', f'%dyEffective{value}')])
assert target in segment
segment = segment.replace(target, replacement, 1)
skin_call = ' %dyRaw669 = tail call fast fastcc <3 x float> @_ZL19applySkinProtection'
assert skin_call in segment
segment = segment.replace(skin_call, ' %dyHasLocalSkinReference = icmp ule i32 %dyStageFirst, 5\n %dySkinReference = select i1 %dyHasLocalSkinReference, <3 x float> %v411, <3 x float> %dyExternalSkinReference\n'+skin_call, 1)
segment = segment.replace('(<3 x float> %v668, <3 x float> %v411,', '(<3 x float> %v668, <3 x float> %dySkinReference,', 1)
clamp = next(line for line in segment.splitlines() if line.startswith(' %v672 = '))
segment = segment.replace(clamp, '\n'.join([
clamp.replace('%v672 = ', '%dyClamped672 = ', 1),
' %dyIncludesFinalFirst = icmp ule i32 %dyStageFirst, 11',
' %dyIncludesFinalLast = icmp uge i32 %dyStageLast, 11',
' %dyIncludesFinal = and i1 %dyIncludesFinalFirst, %dyIncludesFinalLast',
' %v672 = select i1 %dyIncludesFinal, <3 x float> %dyClamped672, <3 x float> %v669']), 1)
skin='''
define <3 x float> @dy_skinExtra(<3 x float> %color, <3 x float> %reference, %struct.DYUniforms addrspace(2)* %uniforms) {
entry:
@@ -35,4 +60,4 @@ entry:
ret <3 x float> %result
}
'''
return source+'\n'+body+'\n'+skin
return source+'\n'+body+'\n'+segment+'\n'+skin