/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
tet_infoline("UtcDaliPixelHasAlpha");
- TestPixelEnumSize(60);
+ TestPixelEnumSize(62);
DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::INVALID) == false); // For completeness
DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::R11G11B10F) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::CHROMINANCE_U) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::CHROMINANCE_V) == false);
+
END_TEST;
}
tet_infoline("UtcDaliPixelGetBytesPerPixel");
// Be sure that the number of cases tested below is correct:
- TestPixelEnumSize(60);
+ TestPixelEnumSize(62);
DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::INVALID) == 0); // For completeness
DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::DEPTH_FLOAT) == 4);
DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::DEPTH_STENCIL) == 4);
DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::R11G11B10F) == 4);
+
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::CHROMINANCE_U) == 1);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::CHROMINANCE_V) == 1);
+
END_TEST;
}
int bitMask = 0;
// Be sure that the number of cases tested below is correct:
- TestPixelEnumSize(60);
+ TestPixelEnumSize(62);
Pixel::GetAlphaOffsetAndMask(Pixel::INVALID, byteOffset, bitMask); // For completeness
DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
Pixel::GetAlphaOffsetAndMask(Pixel::R11G11B10F, byteOffset, bitMask);
DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::CHROMINANCE_U, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::CHROMINANCE_V, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+
END_TEST;
}
Dali::Integration::ConvertToGlFormat(Pixel::Format::R11G11B10F, pixelDataType, internalFormat);
DALI_TEST_CHECK(pixelDataType == GL_FLOAT);
DALI_TEST_CHECK(internalFormat == GL_R11F_G11F_B10F);
+
+ Dali::Integration::ConvertToGlFormat(Pixel::Format::CHROMINANCE_U, pixelDataType, internalFormat);
+ DALI_TEST_CHECK(pixelDataType == GL_UNSIGNED_BYTE);
+ DALI_TEST_CHECK(internalFormat == GL_LUMINANCE);
+
+ Dali::Integration::ConvertToGlFormat(Pixel::Format::CHROMINANCE_V, pixelDataType, internalFormat);
+ DALI_TEST_CHECK(pixelDataType == GL_UNSIGNED_BYTE);
+ DALI_TEST_CHECK(internalFormat == GL_LUMINANCE);
+
END_TEST;
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Pixel::RGB16F,
Pixel::RGB32F,
Pixel::R11G11B10F,
- };
+ Pixel::CHROMINANCE_U,
+ Pixel::CHROMINANCE_V};
for(auto format : formats)
{
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
break;
}
+ // Chrominance formats
+ case Pixel::CHROMINANCE_U:
+ {
+ pixelDataType = GL_UNSIGNED_BYTE;
+ internalFormat = GL_LUMINANCE; // GL doesn't support chrominance format. We should convert it in the shader.
+ break;
+ }
+ case Pixel::CHROMINANCE_V:
+ {
+ pixelDataType = GL_UNSIGNED_BYTE;
+ internalFormat = GL_LUMINANCE; // GL doesn't support chrominance format. We should convert it in the shader.
+ break;
+ }
+
case INVALID:
{
DALI_LOG_ERROR("Invalid pixel format for bitmap\n");
case Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR:
return Graphics::Format::ASTC_12x12_UNORM_BLOCK;
case Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
-
return Graphics::Format::ASTC_4x4_SRGB_BLOCK; // not type with alpha, but likely to use SRGB
case Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
return Graphics::Format::ASTC_5x4_SRGB_BLOCK;
return Graphics::Format::ASTC_12x10_SRGB_BLOCK;
case Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
return Graphics::Format::ASTC_12x12_SRGB_BLOCK;
+
case Pixel::RGB16F:
return Graphics::Format::R16G16B16_SFLOAT;
case Pixel::RGB32F:
return Graphics::Format::R32G32B32_SFLOAT;
case Pixel::R11G11B10F:
return Graphics::Format::R11G11B10_UFLOAT_PACK32;
+
+ case Pixel::CHROMINANCE_U:
+ return Graphics::Format::L8;
+ case Pixel::CHROMINANCE_V:
+ return Graphics::Format::L8;
}
return Graphics::Format::UNDEFINED;
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
case DEPTH_STENCIL:
case R11G11B10F:
case INVALID:
+ case CHROMINANCE_U:
+ case CHROMINANCE_V:
{
return false;
}
{
case L8:
case A8:
+ case CHROMINANCE_U:
+ case CHROMINANCE_V:
{
return 1;
}
case DEPTH_FLOAT:
case DEPTH_STENCIL:
case R11G11B10F:
+ case CHROMINANCE_U:
+ case CHROMINANCE_V:
case INVALID:
{
DALI_LOG_ERROR("Pixel formats are not compatible with simple masking-out of per-pixel alpha.\n");
#define DALI_PIXEL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
DEPTH_STENCIL, ///< Depth stencil 32-bit, 24 bit for depth, 8 bit for stencil. @SINCE_1_9.9
- R11G11B10F ///< Packed 32-bit, 11-11-10 unsigned floating point.
+ R11G11B10F, ///< Packed 32-bit, 11-11-10 unsigned floating point.
+
+ CHROMINANCE_U, ///< Color depth 8-bit, chrominance U
+ CHROMINANCE_V ///< Color depth 8-bit, chrominance V
///! Update LAST_VALID_PIXEL_FORMAT below if you add an enum value here.
};
*
* Sync it to the last value above.
*/
-const Format LAST_VALID_PIXEL_FORMAT = R11G11B10F;
+const Format LAST_VALID_PIXEL_FORMAT = CHROMINANCE_V;
/**
* @brief Whether specified pixel format contains an alpha value.