WIP restore primary CST controls and defer main output; shader and Release build pass

这个提交包含在:
mac 于 2026-11-04 07:46:31 +08:00 提交
1 父节点 2cf93fafe5
当前提交 0b1b4454b4
16 个文件已更改
+130 -24

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

+2 -1
查看文件
@@ -98,6 +98,7 @@ static NSArray *DYManagedActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
@end
@implementation DYRenderer
#include "DYFilmRender.inc.h"
#include "DYPrimaryRender.inc.h"
#include "DYManagedRender.inc.h"
#include "DYToolRender.inc.h"
- (instancetype)init{if((self=[super init])){_previewLock=[NSObject new];_devices=[NSMutableDictionary new];_luts=[NSMutableDictionary new];_preparedLUTs=[NSMutableDictionary new];_activeLUTPaths=[NSSet new];_lutPreparationQueue=dispatch_queue_create("com.dayu.color.lut-upload",DISPATCH_QUEUE_SERIAL);dispatch_set_target_queue(_lutPreparationQueue,dispatch_get_global_queue(QOS_CLASS_USER_INITIATED,0));_tables=[DYColorTables new];}return self;}
@@ -238,7 +239,7 @@ static NSArray *DYManagedActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
if(ok)[output getBytes:_exportManagedState?(void*)precise.data():(void*)values.data() bytesPerRow:width*(_exportManagedState?16:8) fromRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0];[input release];[output release];if(!ok)return NO;
NSMutableString *text=[NSMutableString stringWithString:@"TITLE \"大鱼调色\"\n# 包含 CST 与逐像素颜色;不包含纹理、清晰度和逐画面分析。\nLUT_3D_SIZE 33\nDOMAIN_MIN 0 0 0\nDOMAIN_MAX 1 1 1\n"];
for(NSUInteger i=0;i<count;i++){float rgb[3];for(int c=0;c<3;c++){float v=_exportManagedState?precise[i*4+c]:(float)values[i*4+c];rgb[c]=v<=.0031308f?v*12.92f:1.055f*powf(v,1/2.4f)-.055f;if(!std::isfinite(rgb[c]))return fail(err,@"LUT 输出含无效值");}[text appendFormat:@"%.8f %.8f %.8f\n",rgb[0],rgb[1],rgb[2]];}
if(_exportManagedState){NSData *metadata=[NSJSONSerialization dataWithJSONObject:_exportManagedState options:NSJSONWritingSortedKeys error:nil];if(metadata)[text insertString:[NSString stringWithFormat:@"# DAYU_CMS_STATE %@\n",[[[NSString alloc]initWithData:metadata encoding:NSUTF8StringEncoding]autorelease]] atIndex:0];[text replaceOccurrencesOfString:@"LUT_3D_SIZE 33" withString:@"LUT_3D_SIZE 65" options:0 range:NSMakeRange(0,text.length)];[text insertString:@"# V2 input: declared camera/LUT code values, or sRGB in host mode. Output: sRGB / Rec.709.\n" atIndex:0];}
if(_exportManagedState){NSData *metadata=[NSJSONSerialization dataWithJSONObject:_exportManagedState options:NSJSONWritingSortedKeys error:nil];if(metadata)[text insertString:[NSString stringWithFormat:@"# DAYU_CMS_STATE %@\n",[[[NSString alloc]initWithData:metadata encoding:NSUTF8StringEncoding]autorelease]] atIndex:0];[text replaceOccurrencesOfString:@"LUT_3D_SIZE 33" withString:@"LUT_3D_SIZE 65" options:0 range:NSMakeRange(0,text.length)];if(DYPrimaryColorState(_exportManagedState)){[text insertString:[NSString stringWithFormat:@"# V3 input: primary CST declared code values. Output: declared primary CST encoding.\n# PRIMARY_CST input=%d/%d working=%d/%d output=%d/%d mapping=%d\n",(int)u.cm.inputTransfer,(int)u.cm.inputGamut,(int)u.cm.workingTransfer,(int)u.cm.workingGamut,(int)u.cm.outputTransfer,(int)u.cm.outputGamut,(int)u.cm.toneMapping] atIndex:0];}else [text insertString:@"# V2 input: declared camera/LUT code values, or sRGB in host mode. Output: sRGB / Rec.709.\n" atIndex:0];}
return [text writeToURL:url atomically:YES encoding:NSUTF8StringEncoding error:err];
}}
@end