diff --git a/src/libutils/oglapphelpers/msl.mm b/src/libutils/oglapphelpers/msl.mm index 899e94ec34..83b23bffc9 100644 --- a/src/libutils/oglapphelpers/msl.mm +++ b/src/libutils/oglapphelpers/msl.mm @@ -75,9 +75,8 @@ void RGB_to_RGBA(const float* lutValues, int valueCount, std::vector& flo throw Exception("Missing texture data"); } - // MTLPixelFormatRGB32Float not supported on metal. Adapt to MTLPixelFormatRGBA32Float std::vector float4AdaptedLutValues; - RGB_to_RGBA(lutValues, 3*edgelen*edgelen*edgelen, float4AdaptedLutValues); + memcpy(lutValues, 4*edgelen*edgelen*edgelen, float4AdaptedLutValues); MTLTextureDescriptor* texDescriptor = [MTLTextureDescriptor new]; @@ -123,7 +122,8 @@ void RGB_to_RGBA(const float* lutValues, int valueCount, std::vector& 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];