Skip to content

Commit

Permalink
Merge pull request #847 from TomHarte/MetalTones
Browse files Browse the repository at this point in the history
Corrects R4G4B4 and R2G2B2 output in Metal.
  • Loading branch information
TomHarte authored Nov 8, 2020
2 parents 3aa47f9 + 7aea3dc commit b5fa574
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions OSBindings/Mac/Clock Signal/ScanTarget/ScanTarget.metal
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,12 @@ half3 convertRed8Green8Blue8(SourceInterpolator vert, texture2d<half> texture) {

half3 convertRed4Green4Blue4(SourceInterpolator vert, texture2d<ushort> texture) {
const auto sample = texture.sample(standardSampler, vert.textureCoordinates).rg;
return clamp(half3(sample.r&15, (sample.g >> 4)&15, sample.g&15), half(0.0f), half(1.0f));
return half3(sample.r&15, (sample.g >> 4)&15, sample.g&15) / 15.0f;
}

half3 convertRed2Green2Blue2(SourceInterpolator vert, texture2d<ushort> texture) {
const auto sample = texture.sample(standardSampler, vert.textureCoordinates).r;
return clamp(half3((sample >> 4)&3, (sample >> 2)&3, sample&3), half(0.0f), half(1.0f));
return half3((sample >> 4)&3, (sample >> 2)&3, sample&3) / 3.0f;
}

half3 convertRed1Green1Blue1(SourceInterpolator vert, texture2d<ushort> texture) {
Expand Down

0 comments on commit b5fa574

Please sign in to comment.