WIP: integrate source CST primary pipeline and independent module disclosure; validation pending
这个提交包含在:
1 父节点
76537da0a6
当前提交
d2bf0696bd
19 个文件已更改
+7972
-79
没有与搜索条件相匹配的文件
+28
-1
@@ -38,12 +38,17 @@ fragment half4 dyFragment(DYRaster in [[stage_in]],
|
||||
texture3d<float> colorGrading [[texture(9)]],
|
||||
constant DYUniforms& uniforms [[buffer(0)]],
|
||||
constant float& sceneLevel [[buffer(1)]],
|
||||
constant DYRenderOptions& options [[buffer(2)]]) {
|
||||
constant DYRenderOptions& options [[buffer(2)]],
|
||||
constant DYUniforms& colorUniforms [[buffer(3)]]) {
|
||||
constexpr sampler sampleFilter(coord::normalized, address::clamp_to_edge, filter::linear);
|
||||
half4 sample = source.sample(sampleFilter, in.uv);
|
||||
if (!(sample.a > half(0.0))) return half4(0.0h);
|
||||
half4 result = dy_grade(sample, in.uv, source, preLUT, look1, look2, look3,
|
||||
look4, look5, hslMixer, whiteBalance, colorGrading, uniforms, sceneLevel);
|
||||
if(options.blackWhiteMix>0.0f && options.blackWhiteMix<1.0f) {
|
||||
half4 color=dy_grade(sample,in.uv,source,preLUT,look1,look2,look3,look4,look5,hslMixer,whiteBalance,colorGrading,colorUniforms,sceneLevel);
|
||||
result.rgb=mix(color.rgb,result.rgb,half(options.blackWhiteMix));
|
||||
}
|
||||
result.a = sample.a;
|
||||
if (options.outputPremultiplied) result.rgb *= result.a;
|
||||
return result;
|
||||
@@ -110,3 +115,25 @@ kernel void dyInputAnalysis(texture2d<half> source [[texture(0)]],
|
||||
encoded=round(clamp(encoded,0.0f,1.0f)*255.0f)/255.0f;
|
||||
outRGBA[pixel.y*320+pixel.x]=float4(encoded,float(sample.a));
|
||||
}
|
||||
|
||||
// CST/BASIS arithmetic is reused verbatim from the versioned dayu-cst source.
|
||||
float4 cst_air(half4 sample, constant CSTParams& params);
|
||||
float4 basis_air(half4 sample, constant BasisParams& params);
|
||||
inline float3 dyEncode(float3 linear) {
|
||||
return select(1.055f*pow(max(linear,float3(0)),float3(1.0f/2.4f))-.055f,linear*12.92f,linear<=.0031308f);
|
||||
}
|
||||
inline float3 dyDecode(float3 encoded) {
|
||||
return select(pow(max((encoded+.055f)/1.055f,float3(0)),float3(2.4f)),encoded/12.92f,encoded<=.04045f);
|
||||
}
|
||||
kernel void dyColorManagement(texture2d<float,access::read> source [[texture(0)]],
|
||||
texture2d<half,access::write> destination [[texture(1)]],
|
||||
constant DayuRenderParams& p [[buffer(0)]],constant float& amount [[buffer(1)]],uint2 pos [[thread_position_in_grid]]) {
|
||||
if(pos.x>=source.get_width()||pos.y>=source.get_height())return;
|
||||
float4 sample=source.read(pos);if(!(sample.a>0)){destination.write(half4(0),pos);return;}
|
||||
float4 raw=float4(dyEncode(sample.rgb),sample.a),c=raw;
|
||||
if(p.stages&1)c=cst_air(half4(c),p.input);
|
||||
if(p.stages&2){if(p.reserved&8)c=cst_air(half4(c),p.basisInput);c=basis_air(half4(c),p.basis);if(p.reserved&8)c=cst_air(half4(c),p.basisOutput);}
|
||||
if(p.stages&4)c=cst_air(half4(c),p.output);
|
||||
c.rgb=mix(raw.rgb,c.rgb,amount);
|
||||
destination.write(half4(half3(dyDecode(c.rgb)),half(sample.a)),pos);
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户