- Code: Select all
MTLTextureSwizzleChannels
For example:
- Code: Select all
MTLTextureSwizzleChannels channels;
if (bitDepth == blackmagicRawResourceFormatRGBAU16) {
//---------------------------------------------------------
// 16-bit (Unsigned 16bit interleaved RGBA):
//---------------------------------------------------------
bitsPerPixel = 64;
brawPixelFormat = MTLPixelFormatRGBA16Unorm;
bytesPerRow = (bitsPerPixel * processedImageWidthPixels) / 8U;
channels = MTLTextureSwizzleChannelsDefault;
} else if (bitDepth == blackmagicRawResourceFormatBGRAF32) {
//---------------------------------------------------------
// 32-bit (Floating point interleaved RGB)
//---------------------------------------------------------
bitsPerPixel = 128;
brawPixelFormat = MTLPixelFormatRGBA32Float;
bytesPerRow = (bitsPerPixel * processedImageWidthPixels) / 8U;
channels = MTLTextureSwizzleChannelsMake(MTLTextureSwizzleBlue, MTLTextureSwizzleGreen, MTLTextureSwizzleRed, MTLTextureSwizzleAlpha);
} else {
//---------------------------------------------------------
// 8-bit (Unsigned 8bit interleaved RGBA):
//---------------------------------------------------------
bitsPerPixel = 32;
brawPixelFormat = MTLPixelFormatRGBA8Unorm;
bytesPerRow = (bitsPerPixel * processedImageWidthPixels) / 8U;
channels = MTLTextureSwizzleChannelsDefault;
}