Skip to content

Commit

Permalink
Fix RGB_to_RGBA
Browse files Browse the repository at this point in the history
  • Loading branch information
wRosie committed Sep 18, 2024
1 parent 00237a1 commit ad10217
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libutils/oglapphelpers/msl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ void RGB_to_RGBA(const float* lutValues, int valueCount, std::vector<float>& flo
throw Exception("Missing texture data");
}

// MTLPixelFormatRGB32Float not supported on metal. Adapt to MTLPixelFormatRGBA32Float
std::vector<float> float4AdaptedLutValues;
RGB_to_RGBA(lutValues, 3*edgelen*edgelen*edgelen, float4AdaptedLutValues);
memcpy(lutValues, 4*edgelen*edgelen*edgelen, float4AdaptedLutValues);

MTLTextureDescriptor* texDescriptor = [MTLTextureDescriptor new];

Expand Down Expand Up @@ -123,7 +122,8 @@ void RGB_to_RGBA(const float* lutValues, int valueCount, std::vector<float>& flo
}
else
{
RGB_to_RGBA(values, 3*width*height, adaptedLutValues);
adaptedLutValues.resize(4 * width * height);
memcpy(adaptedLutValues.data(), values, 4 * width * height * sizeof(float));
}

MTLTextureDescriptor* texDescriptor = [MTLTextureDescriptor new];
Expand Down

0 comments on commit ad10217

Please sign in to comment.