Fix idle default face analysis and unnecessary polygon-mask rendering in 1.19.1
这个提交包含在:
1 父节点
b3597bb4e4
当前提交
3642a1dba6
7 个文件已更改
+63
-7
没有与搜索条件相匹配的文件
+18
-1
@@ -78,6 +78,22 @@ static void bypassIdleSkin(DYUniforms *u){
|
||||
for(int i=0;i<13;i++){BOOL group=(i>=6&&i<=9)?u->colorSectionEnabled>.5:u->baseSectionEnabled>.5;if(group&&enabled[i]>.5&&values[i]!=0)return;}
|
||||
u->skinProtection.x=0;
|
||||
}
|
||||
// Decide face work from the same effective operations that textures: and the
|
||||
// legacy renderer actually execute. Saved strengths remain 1 for empty LUT
|
||||
// slots, and B&W's eye remains on at a zero mix; neither changes the image.
|
||||
static DYUniforms DYEffectiveFaceUniforms(DYUniforms u,NSDictionary *paths,NSDictionary *tools){
|
||||
DYApplyRemovedBaseTools(&u,tools);
|
||||
paths=DYVisibleBaseToolPaths(paths,tools);
|
||||
BOOL input=u.primarySectionEnabled>.5&&u.inputSectionEnabled>.5&&!managed(u,paths);
|
||||
if(!input||(![paths[@"input"]length]&&u.inputProfile<.5))u.preLUTStrength=0;
|
||||
for(int i=0;i<5;i++)if(u.lookSectionEnabled<.5||(i&&u.extraLookSectionEnableds[i-1]<.5)||![paths[[NSString stringWithFormat:@"look%d",i]]length]){
|
||||
if(i==0)u.postLUTStrength=0;else u.extraPostLUTStrengths[i-1]=0;
|
||||
}
|
||||
bypassNeutralTools(&u);
|
||||
if(u.cm.blackWhiteMix<=0)u.blackWhiteSectionEnabled=0;
|
||||
bypassIdleSkin(&u);
|
||||
return u;
|
||||
}
|
||||
// Admission and identity bypass for the explicitly bounded finishing domain.
|
||||
static NSArray *DYManagedActiveFinishing(DYUniforms u,NSDictionary *paths,NSData *spider,NSDictionary *tools){
|
||||
bypassNeutralTools(&u);bypassIdleSkin(&u);if(u.cm.blackWhiteMix<=0)u.blackWhiteSectionEnabled=0;
|
||||
@@ -224,7 +240,8 @@ static NSArray *DYPrimaryActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
|
||||
}
|
||||
if([e[@"spiderActive"]boolValue]){spiderBuffer=e[@"spiderBuffer"];spiderSize={ [e[@"spiderHues"]intValue],[e[@"spiderRings"]intValue]};}
|
||||
}
|
||||
DYToolMaskHeader maskHeader{};id<MTLBuffer>maskBuffer=(masks.count||segmented||u.skinFaceOnly>.5||_faceEntries.length)?[self maskBuffer:masks tile:src device:d header:&maskHeader]:nil;maskHeader.faceOnly=u.skinFaceOnly>.5;BOOL hasMasks=maskHeader.count>0||maskHeader.faceOnly;if((hasMasks||segmented)&&!maskBuffer)return fail(err,@"无法分配蒙版缓冲区");
|
||||
BOOL faceOnly=u.skinProtection.x>.5&&(u.skinProtection.y>0||u.skinVisualize>.5)&&u.skinFaceOnly>.5;
|
||||
DYToolMaskHeader maskHeader{};id<MTLBuffer>maskBuffer=(masks.count||segmented||faceOnly||_faceEntries.length)?[self maskBuffer:masks tile:src device:d header:&maskHeader]:nil;maskHeader.faceOnly=faceOnly;BOOL hasMasks=maskHeader.count>0||maskHeader.faceOnly;if((hasMasks||segmented)&&!maskBuffer)return fail(err,@"无法分配蒙版缓冲区");
|
||||
NSMutableDictionary*ps=e[@"pipelines"];NSString*format=[NSString stringWithFormat:@"%lu-%d-%d",(unsigned long)output.pixelFormat,hasMasks,segmented];id<MTLRenderPipelineState>pipeline=ps[format];if(!pipeline){MTLRenderPipelineDescriptor*p=[MTLRenderPipelineDescriptor new];p.vertexFunction=[e[@"library"]newFunctionWithName:@"dyVertex"];p.fragmentFunction=[e[@"library"]newFunctionWithName:segmented?@"dySegmentFragment":hasMasks?@"dyMaskedFragment":@"dyFragment"];p.colorAttachments[0].pixelFormat=output.pixelFormat;pipeline=[d newRenderPipelineStateWithDescriptor:p error:err];[p.vertexFunction release];[p.fragmentFunction release];[p release];if(!pipeline)return NO;ps[format]=pipeline;[pipeline release];}
|
||||
MTLTextureDescriptor*td=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:input.width height:input.height mipmapped:NO];td.storageMode=MTLStorageModePrivate;td.usage=MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite;id<MTLTexture>straight=[d newTextureWithDescriptor:td];if(!straight)return fail(err,@"无法分配调色缓冲区");
|
||||
id<MTLCommandBuffer>cb=[e[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyUnpremultiply"]];[ce setTexture:input atIndex:0];[ce setTexture:straight atIndex:1];[ce dispatchThreads:MTLSizeMake(input.width,input.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];
|
||||
|
||||
在新工单中引用
屏蔽一个用户