Preserve NSError across render pools and prepare input LUT before mode activation; build 55

这个提交包含在:
mac 于 2026-11-03 13:07:42 +08:00 提交
1 父节点 8bd2ba91fa
当前提交 11a8851828
8 个文件已更改
+38 -23

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

@@ -33,7 +33,7 @@
for(NSDictionary *inputSpace in DYManagedInputSpaces()){@autoreleasepool{state[@"input"]=inputSpace[@"id"];Pixels gpuFrame=managed(state,u,empty.document,[NSString stringWithFormat:@"cms-input-%@-render",inputSpace[@"id"]]);Difference delta=difference(gpuFrame,cpuOutput(cpuInput(),1));run.record([NSString stringWithFormat:@"cms-input-%@-cpu-parity",inputSpace[@"id"]],delta.nonfinite==0&&delta.maximum<.01,measure(delta));}}state[@"input"]=@109;
// Identity input LUT must be the same declared-input path, not an extra DRT.
NSString *identityPath=[runtime stringByAppendingPathComponent:@"cms-identity-input.cube"];NSMutableString *identity=[NSMutableString stringWithString:@"LUT_3D_SIZE 2\n"];for(int z=0;z<2;z++)for(int y=0;y<2;y++)for(int x=0;x<2;x++)[identity appendFormat:@"%d %d %d\n",x,y,z];[identity writeToFile:identityPath atomically:YES encoding:NSUTF8StringEncoding error:&error];
state[@"output"]=@1;Pixels camera=managed(state,u,empty.document,@"cms-camera-identity-LUT-reference");state[@"mode"]=@3;error=nil;BOOL lutOK=[cmsRenderer renderSource:source destination:destination uniforms:u paths:@{@"input":identityPath} spider:nil tools:empty.document colorManagement:state hostPrimaries:kFxColorPrimaries_Rec709 error:&error];Difference lutDelta=difference(camera,read(destination,gpu));run.record(@"cms-input-LUT-same-single-input-and-ODT-chain",lutOK&&lutDelta.maximum<.001&&lutDelta.nonfinite==0,measure(lutDelta));error=nil;BOOL missingLUT=[cmsRenderer renderSource:source destination:destination uniforms:u paths:@{} spider:nil tools:empty.document colorManagement:state hostPrimaries:kFxColorPrimaries_Rec709 error:&error];run.record(@"cms-input-LUT-missing-resource-fails-explicitly",!missingLUT&&error!=nil);state[@"mode"]=@2;
state[@"output"]=@1;Pixels camera=managed(state,u,empty.document,@"cms-camera-identity-LUT-reference");state[@"mode"]=@3;error=nil;BOOL lutOK=[cmsRenderer renderSource:source destination:destination uniforms:u paths:@{@"input":identityPath} spider:nil tools:empty.document colorManagement:state hostPrimaries:kFxColorPrimaries_Rec709 error:&error];Difference lutDelta=difference(camera,read(destination,gpu));run.record(@"cms-input-LUT-same-single-input-and-ODT-chain",lutOK&&lutDelta.maximum<.001&&lutDelta.nonfinite==0,measure(lutDelta));error=nil;BOOL missingLUT=[cmsRenderer renderSource:source destination:destination uniforms:u paths:@{} spider:nil tools:empty.document colorManagement:state hostPrimaries:kFxColorPrimaries_Rec709 error:&error];run.record(@"cms-input-LUT-missing-resource-fails-explicitly",!missingLUT&&[error.domain isEqual:@"com.dayu.color"]&&error.localizedDescription.length>0);state[@"mode"]=@2;
state[@"output"]=@3;DYUniforms print=u;print.filmPrint.x=1;print.filmPrint.y=.6;print.film.mix=.8;Pixels base=managed(state,u,empty.document,@"cms-print-baseline-p3"),printed=managed(state,print,empty.document,@"cms-print-before-p3-output");
NSMutableDictionary *printDoc=DYMutablePlist(empty.document),*printNode=(id)DYInsertTool(printDoc,@"film",@"base:film");printNode[@"values"][@"filmPrintLook"]=@1;printNode[@"values"][@"filmPrintStrength"]=@.6;printNode[@"values"][@"filmMix"]=@.8;Pixels extraPrint=managed(state,u,printDoc,@"cms-independent-print-before-output");run.record(@"cms-root-and-extra-print-same-pre-output-result",difference(printed,extraPrint).maximum==0&&difference(printed,base).different>20);
// A CPU tetrahedral lookup in AP1/ACEScct, mixed in AP1 linear, then ODT.
@@ -42,7 +42,7 @@
if(readLook)for(auto &pixel:scene){if(!(pixel.a>0))continue;float c[3]={pixel.r/pixel.a,pixel.g/pixel.a,pixel.b/pixel.a},f[3];int cell[3],axis[3]={0,1,2};for(int k=0;k<3;k++){float x=fmaxf(0,fminf(1,c[k]))*(lookSide-1);cell[k]=MIN((int)floorf(x),(int)lookSide-2);f[k]=x-cell[k];}std::sort(axis,axis+3,[&](int x,int y){return f[x]>f[y];});
float weights[4]={1-f[axis[0]],f[axis[0]]-f[axis[1]],f[axis[1]]-f[axis[2]],f[axis[2]]},value[3]={};for(int j=0;j<4;j++){size_t offset=((cell[2]*lookSide+cell[1])*lookSide+cell[0])*4;for(int k=0;k<3;k++)value[k]+=look[offset+k]*weights[j];if(j<3)cell[axis[j]]++;}float out[3];for(int k=0;k<3;k++)out[k]=dyPrintCCTEncode(dyPrintCCTDecode(c[k])*.52f+dyPrintCCTDecode(value[k])*.48f)*pixel.a;pixel.r=out[0];pixel.g=out[1];pixel.b=out[2];}
Difference printDelta=difference(printed,cpuOutput(scene,3));run.record(@"cms-print-cpu-reference-before-ODT-linear-mix",readLook&&printDelta.maximum<.01&&printDelta.nonfinite==0,measure(printDelta));
state[@"output"]=@6;DYUniforms bounded=u;bounded.hslHueA.x=20;NSError *blocked=nil;BOOL hdr=[cmsRenderer renderSource:source destination:destination uniforms:bounded paths:@{} spider:nil tools:empty.document colorManagement:state hostPrimaries:kFxColorPrimaries_Rec709 error:&blocked];run.record(@"cms-hdr-refuses-unvalidated-bounded-finishing",!hdr&&blocked!=nil);
state[@"output"]=@6;DYUniforms bounded=u;bounded.hslHueA.x=20;NSError *blocked=nil;BOOL hdr=[cmsRenderer renderSource:source destination:destination uniforms:bounded paths:@{} spider:nil tools:empty.document colorManagement:state hostPrimaries:kFxColorPrimaries_Rec709 error:&blocked];run.record(@"cms-hdr-refuses-unvalidated-bounded-finishing",!hdr&&[blocked.domain isEqual:@"com.dayu.color"]&&blocked.localizedDescription.length>0);
state[@"output"]=@1;NSURL *cube=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"cms-v2.cube"]];error=nil;BOOL exportOK=[cmsRenderer exportLUT:cube uniforms:u paths:@{} spider:nil tools:empty.document colorManagement:state error:&error];std::vector<float>table;NSUInteger size=0;BOOL parse=exportOK&&DYLUTReadCube(cube.path,table,size,&error);run.record(@"cms-v2-cube-65-declared-output-contract",parse&&size==65,@{@"error":reason(error),@"size":@(size)});
// Static Cube interpolation at off-grid values must match the complete path.
Pixels direct=managed(state,u,empty.document,@"cms-cube-off-grid-direct-reference");double cubeError=0;