Skip to content

Commit

Permalink
Adding optimized gamma correct shader for Apple Silicon. Not used by …
Browse files Browse the repository at this point in the history
…pipeline yet - but tests out the shader library builds.
  • Loading branch information
colincornaby committed Apr 18, 2024
1 parent ff3076c commit efc699c
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,17 @@ fragment half4 gammaCorrectFragment(GammaVertexOut in [[stage_in]]
1.0
};
}

#if defined(__METAL_IOS__) || __METAL_VERSION__ >= 230
fragment half4 gammaCorrectFragmentInPlace(GammaVertexOut in [[stage_in]],
half4 color [[color(0)]],
texture1d_array<ushort> LUT [[texture(1)]])
{
return {
half(float(LUT.sample(lutSampler, color.r, 0).x)/USHRT_MAX),
half(float(LUT.sample(lutSampler, color.g, 1).x)/USHRT_MAX),
half(float(LUT.sample(lutSampler, color.b, 2).x)/USHRT_MAX),
1.0
};
}
#endif

0 comments on commit efc699c

Please sign in to comment.