Skip to content

Commit ad10217

Browse files
committed
Fix RGB_to_RGBA
1 parent 00237a1 commit ad10217

File tree

1 file changed

+3
-3
lines changed
  • src/libutils/oglapphelpers

1 file changed

+3
-3
lines changed

src/libutils/oglapphelpers/msl.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ void RGB_to_RGBA(const float* lutValues, int valueCount, std::vector<float>& flo
7575
throw Exception("Missing texture data");
7676
}
7777

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

8281
MTLTextureDescriptor* texDescriptor = [MTLTextureDescriptor new];
8382

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

129129
MTLTextureDescriptor* texDescriptor = [MTLTextureDescriptor new];

0 commit comments

Comments
 (0)