1 #ifndef DALI_GRAPHICS_GLES_TYPES_H
2 #define DALI_GRAPHICS_GLES_TYPES_H
5 #include <dali/graphics-api/graphics-types.h>
6 #include <dali/integration-api/gl-abstraction.h>
7 #include <dali/integration-api/gl-defines.h>
9 namespace Dali::Graphics::GLES
12 // Conversion functions
14 * Stucture delivers format and type that can be used
15 * when creating GL texture
17 struct GLTextureFormatType
20 * Constuctor from Graphics::Format
23 constexpr GLTextureFormatType(Graphics::Format value)
28 case Graphics::Format::UNDEFINED:
35 case Graphics::Format::L8:
37 Assign(GL_LUMINANCE, GL_UNSIGNED_BYTE);
40 case Graphics::Format::L8A8:
42 Assign(GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE);
46 // Packed formats (TODO: find supported)
47 case Graphics::Format::R4G4_UNORM_PACK8:
52 case Graphics::Format::R4G4B4A4_UNORM_PACK16:
57 case Graphics::Format::B4G4R4A4_UNORM_PACK16:
62 case Graphics::Format::R5G6B5_UNORM_PACK16:
67 case Graphics::Format::B5G6R5_UNORM_PACK16:
72 case Graphics::Format::R5G5B5A1_UNORM_PACK16:
77 case Graphics::Format::B5G5R5A1_UNORM_PACK16:
82 case Graphics::Format::A1R5G5B5_UNORM_PACK16:
89 case Graphics::Format::R8_UNORM:
91 Assign(GL_RED, GL_UNSIGNED_BYTE);
94 case Graphics::Format::R8_SNORM:
96 Assign(GL_RED, GL_BYTE);
99 case Graphics::Format::R8_USCALED:
101 Assign(GL_RED, GL_UNSIGNED_BYTE);
104 case Graphics::Format::R8_SSCALED:
106 Assign(GL_RED, GL_BYTE);
109 case Graphics::Format::R8_UINT:
111 Assign(GL_RED, GL_UNSIGNED_BYTE);
114 case Graphics::Format::R8_SINT:
116 Assign(GL_RED, GL_BYTE);
119 case Graphics::Format::R8_SRGB:
121 Assign(GL_RED, GL_BYTE);
124 case Graphics::Format::R8G8_UNORM:
126 Assign(GL_RG, GL_UNSIGNED_BYTE);
129 case Graphics::Format::R8G8_SNORM:
131 Assign(GL_RG, GL_BYTE);
134 case Graphics::Format::R8G8_USCALED:
136 Assign(GL_RG, GL_UNSIGNED_BYTE);
139 case Graphics::Format::R8G8_SSCALED:
141 Assign(GL_RG, GL_BYTE);
144 case Graphics::Format::R8G8_UINT:
146 Assign(GL_RG, GL_UNSIGNED_BYTE);
149 case Graphics::Format::R8G8_SINT:
151 Assign(GL_RG, GL_BYTE);
154 case Graphics::Format::R8G8_SRGB:
156 Assign(GL_RG, GL_BYTE);
159 case Graphics::Format::R8G8B8_UNORM:
161 Assign(GL_RGB, GL_UNSIGNED_BYTE);
164 case Graphics::Format::R8G8B8_SNORM:
166 Assign(GL_RGB, GL_BYTE);
169 case Graphics::Format::R8G8B8_USCALED:
171 Assign(GL_RGB, GL_UNSIGNED_BYTE);
174 case Graphics::Format::R8G8B8_SSCALED:
176 Assign(GL_RGB, GL_BYTE);
179 case Graphics::Format::R8G8B8_UINT:
181 Assign(GL_RGB, GL_UNSIGNED_BYTE);
184 case Graphics::Format::R8G8B8_SINT:
186 Assign(GL_RGB, GL_BYTE);
189 case Graphics::Format::R8G8B8_SRGB:
191 Assign(GL_RGB, GL_BYTE);
195 // BGR not supported in GLES
196 case Graphics::Format::B8G8R8_UNORM:
201 case Graphics::Format::B8G8R8_SNORM:
206 case Graphics::Format::B8G8R8_USCALED:
211 case Graphics::Format::B8G8R8_SSCALED:
216 case Graphics::Format::B8G8R8_UINT:
221 case Graphics::Format::B8G8R8_SINT:
226 case Graphics::Format::B8G8R8_SRGB:
233 case Graphics::Format::R8G8B8A8_UNORM:
235 Assign(GL_RGBA, GL_UNSIGNED_BYTE);
238 case Graphics::Format::R8G8B8A8_SNORM:
240 Assign(GL_RGBA, GL_BYTE);
243 case Graphics::Format::R8G8B8A8_USCALED:
245 Assign(GL_RGBA, GL_UNSIGNED_BYTE);
248 case Graphics::Format::R8G8B8A8_SSCALED:
250 Assign(GL_RGBA, GL_BYTE);
253 case Graphics::Format::R8G8B8A8_UINT:
255 Assign(GL_RGBA, GL_UNSIGNED_BYTE);
258 case Graphics::Format::R8G8B8A8_SINT:
260 Assign(GL_RGBA, GL_BYTE);
263 case Graphics::Format::R8G8B8A8_SRGB:
265 Assign(GL_RGBA, GL_BYTE);
269 // BGRA (seems to be not supported)
270 case Graphics::Format::B8G8R8A8_UNORM:
272 Assign(0, GL_UNSIGNED_BYTE);
275 case Graphics::Format::B8G8R8A8_SNORM:
280 case Graphics::Format::B8G8R8A8_USCALED:
282 Assign(0, GL_UNSIGNED_BYTE);
285 case Graphics::Format::B8G8R8A8_SSCALED:
290 case Graphics::Format::B8G8R8A8_UINT:
292 Assign(0, GL_UNSIGNED_BYTE);
295 case Graphics::Format::B8G8R8A8_SINT:
300 case Graphics::Format::B8G8R8A8_SRGB:
306 // ABGR not supported
307 case Graphics::Format::A8B8G8R8_UNORM_PACK32:
312 case Graphics::Format::A8B8G8R8_SNORM_PACK32:
317 case Graphics::Format::A8B8G8R8_USCALED_PACK32:
322 case Graphics::Format::A8B8G8R8_SSCALED_PACK32:
327 case Graphics::Format::A8B8G8R8_UINT_PACK32:
332 case Graphics::Format::A8B8G8R8_SINT_PACK32:
337 case Graphics::Format::A8B8G8R8_SRGB_PACK32:
343 // TBD which of the formats are supported
344 case Graphics::Format::A2R10G10B10_UNORM_PACK32:
349 case Graphics::Format::A2R10G10B10_SNORM_PACK32:
354 case Graphics::Format::A2R10G10B10_USCALED_PACK32:
359 case Graphics::Format::A2R10G10B10_SSCALED_PACK32:
364 case Graphics::Format::A2R10G10B10_UINT_PACK32:
369 case Graphics::Format::A2R10G10B10_SINT_PACK32:
374 case Graphics::Format::A2B10G10R10_UNORM_PACK32:
379 case Graphics::Format::A2B10G10R10_SNORM_PACK32:
384 case Graphics::Format::A2B10G10R10_USCALED_PACK32:
389 case Graphics::Format::A2B10G10R10_SSCALED_PACK32:
394 case Graphics::Format::A2B10G10R10_UINT_PACK32:
399 case Graphics::Format::A2B10G10R10_SINT_PACK32:
404 case Graphics::Format::R16_UNORM:
409 case Graphics::Format::R16_SNORM:
414 case Graphics::Format::R16_USCALED:
419 case Graphics::Format::R16_SSCALED:
424 case Graphics::Format::R16_UINT:
429 case Graphics::Format::R16_SINT:
434 case Graphics::Format::R16_SFLOAT:
439 case Graphics::Format::R16G16_UNORM:
444 case Graphics::Format::R16G16_SNORM:
449 case Graphics::Format::R16G16_USCALED:
454 case Graphics::Format::R16G16_SSCALED:
459 case Graphics::Format::R16G16_UINT:
464 case Graphics::Format::R16G16_SINT:
469 case Graphics::Format::R16G16_SFLOAT:
474 case Graphics::Format::R16G16B16_UNORM:
479 case Graphics::Format::R16G16B16_SNORM:
484 case Graphics::Format::R16G16B16_USCALED:
489 case Graphics::Format::R16G16B16_SSCALED:
494 case Graphics::Format::R16G16B16_UINT:
499 case Graphics::Format::R16G16B16_SINT:
504 case Graphics::Format::R16G16B16_SFLOAT:
509 case Graphics::Format::R16G16B16A16_UNORM:
514 case Graphics::Format::R16G16B16A16_SNORM:
519 case Graphics::Format::R16G16B16A16_USCALED:
524 case Graphics::Format::R16G16B16A16_SSCALED:
529 case Graphics::Format::R16G16B16A16_UINT:
534 case Graphics::Format::R16G16B16A16_SINT:
539 case Graphics::Format::R16G16B16A16_SFLOAT:
544 case Graphics::Format::R32_UINT:
549 case Graphics::Format::R32_SINT:
554 case Graphics::Format::R32_SFLOAT:
559 case Graphics::Format::R32G32_UINT:
564 case Graphics::Format::R32G32_SINT:
569 case Graphics::Format::R32G32_SFLOAT:
574 case Graphics::Format::R32G32B32_UINT:
579 case Graphics::Format::R32G32B32_SINT:
584 case Graphics::Format::R32G32B32_SFLOAT:
589 case Graphics::Format::R32G32B32A32_UINT:
594 case Graphics::Format::R32G32B32A32_SINT:
599 case Graphics::Format::R32G32B32A32_SFLOAT:
604 case Graphics::Format::R64_UINT:
609 case Graphics::Format::R64_SINT:
614 case Graphics::Format::R64_SFLOAT:
619 case Graphics::Format::R64G64_UINT:
624 case Graphics::Format::R64G64_SINT:
629 case Graphics::Format::R64G64_SFLOAT:
634 case Graphics::Format::R64G64B64_UINT:
639 case Graphics::Format::R64G64B64_SINT:
644 case Graphics::Format::R64G64B64_SFLOAT:
649 case Graphics::Format::R64G64B64A64_UINT:
654 case Graphics::Format::R64G64B64A64_SINT:
659 case Graphics::Format::R64G64B64A64_SFLOAT:
664 case Graphics::Format::B10G11R11_UFLOAT_PACK32:
669 case Graphics::Format::E5B9G9R9_UFLOAT_PACK32:
674 case Graphics::Format::D16_UNORM:
679 case Graphics::Format::X8_D24_UNORM_PACK32:
684 case Graphics::Format::D32_SFLOAT:
689 case Graphics::Format::S8_UINT:
694 case Graphics::Format::D16_UNORM_S8_UINT:
699 case Graphics::Format::D24_UNORM_S8_UINT:
704 case Graphics::Format::D32_SFLOAT_S8_UINT:
709 case Graphics::Format::BC1_RGB_UNORM_BLOCK:
714 case Graphics::Format::BC1_RGB_SRGB_BLOCK:
719 case Graphics::Format::BC1_RGBA_UNORM_BLOCK:
724 case Graphics::Format::BC1_RGBA_SRGB_BLOCK:
729 case Graphics::Format::BC2_UNORM_BLOCK:
734 case Graphics::Format::BC2_SRGB_BLOCK:
739 case Graphics::Format::BC3_UNORM_BLOCK:
744 case Graphics::Format::BC3_SRGB_BLOCK:
749 case Graphics::Format::BC4_UNORM_BLOCK:
754 case Graphics::Format::BC4_SNORM_BLOCK:
759 case Graphics::Format::BC5_UNORM_BLOCK:
764 case Graphics::Format::BC5_SNORM_BLOCK:
769 case Graphics::Format::BC6H_UFLOAT_BLOCK:
774 case Graphics::Format::BC6H_SFLOAT_BLOCK:
779 case Graphics::Format::BC7_UNORM_BLOCK:
784 case Graphics::Format::BC7_SRGB_BLOCK:
789 case Graphics::Format::ETC2_R8G8B8_UNORM_BLOCK:
794 case Graphics::Format::ETC2_R8G8B8_SRGB_BLOCK:
799 case Graphics::Format::ETC2_R8G8B8A1_UNORM_BLOCK:
804 case Graphics::Format::ETC2_R8G8B8A1_SRGB_BLOCK:
809 case Graphics::Format::ETC2_R8G8B8A8_UNORM_BLOCK:
814 case Graphics::Format::ETC2_R8G8B8A8_SRGB_BLOCK:
819 case Graphics::Format::EAC_R11_UNORM_BLOCK:
824 case Graphics::Format::EAC_R11_SNORM_BLOCK:
829 case Graphics::Format::EAC_R11G11_UNORM_BLOCK:
834 case Graphics::Format::EAC_R11G11_SNORM_BLOCK:
839 case Graphics::Format::ASTC_4x4_UNORM_BLOCK:
844 case Graphics::Format::ASTC_4x4_SRGB_BLOCK:
849 case Graphics::Format::ASTC_5x4_UNORM_BLOCK:
854 case Graphics::Format::ASTC_5x4_SRGB_BLOCK:
859 case Graphics::Format::ASTC_5x5_UNORM_BLOCK:
864 case Graphics::Format::ASTC_5x5_SRGB_BLOCK:
869 case Graphics::Format::ASTC_6x5_UNORM_BLOCK:
874 case Graphics::Format::ASTC_6x5_SRGB_BLOCK:
879 case Graphics::Format::ASTC_6x6_UNORM_BLOCK:
884 case Graphics::Format::ASTC_6x6_SRGB_BLOCK:
889 case Graphics::Format::ASTC_8x5_UNORM_BLOCK:
894 case Graphics::Format::ASTC_8x5_SRGB_BLOCK:
899 case Graphics::Format::ASTC_8x6_UNORM_BLOCK:
904 case Graphics::Format::ASTC_8x6_SRGB_BLOCK:
909 case Graphics::Format::ASTC_8x8_UNORM_BLOCK:
914 case Graphics::Format::ASTC_8x8_SRGB_BLOCK:
919 case Graphics::Format::ASTC_10x5_UNORM_BLOCK:
924 case Graphics::Format::ASTC_10x5_SRGB_BLOCK:
929 case Graphics::Format::ASTC_10x6_UNORM_BLOCK:
934 case Graphics::Format::ASTC_10x6_SRGB_BLOCK:
939 case Graphics::Format::ASTC_10x8_UNORM_BLOCK:
944 case Graphics::Format::ASTC_10x8_SRGB_BLOCK:
949 case Graphics::Format::ASTC_10x10_UNORM_BLOCK:
954 case Graphics::Format::ASTC_10x10_SRGB_BLOCK:
959 case Graphics::Format::ASTC_12x10_UNORM_BLOCK:
964 case Graphics::Format::ASTC_12x10_SRGB_BLOCK:
969 case Graphics::Format::ASTC_12x12_UNORM_BLOCK:
974 case Graphics::Format::ASTC_12x12_SRGB_BLOCK:
979 case Graphics::Format::PVRTC1_2BPP_UNORM_BLOCK_IMG:
984 case Graphics::Format::PVRTC1_4BPP_UNORM_BLOCK_IMG:
989 case Graphics::Format::PVRTC2_2BPP_UNORM_BLOCK_IMG:
994 case Graphics::Format::PVRTC2_4BPP_UNORM_BLOCK_IMG:
999 case Graphics::Format::PVRTC1_2BPP_SRGB_BLOCK_IMG:
1004 case Graphics::Format::PVRTC1_4BPP_SRGB_BLOCK_IMG:
1009 case Graphics::Format::PVRTC2_2BPP_SRGB_BLOCK_IMG:
1014 case Graphics::Format::PVRTC2_4BPP_SRGB_BLOCK_IMG:
1022 constexpr inline void Assign(uint32_t f, uint32_t t)
1032 struct GLSamplerFilter
1034 constexpr explicit GLSamplerFilter(Graphics::SamplerFilter filter)
1038 case Graphics::SamplerFilter::NEAREST:
1040 glFilter = GL_NEAREST;
1043 case Graphics::SamplerFilter::LINEAR:
1045 glFilter = GL_LINEAR;
1050 uint32_t glFilter{0};
1053 struct GLSamplerFilterAndMipMapMode
1055 constexpr explicit GLSamplerFilterAndMipMapMode(Graphics::SamplerFilter filter,
1056 Graphics::SamplerMipmapMode mipMapMode)
1060 case Graphics::SamplerFilter::NEAREST:
1064 case Graphics::SamplerMipmapMode::NONE:
1066 glFilter = GL_NEAREST;
1069 case Graphics::SamplerMipmapMode::NEAREST:
1071 glFilter = GL_NEAREST_MIPMAP_NEAREST;
1074 case Graphics::SamplerMipmapMode::LINEAR:
1076 glFilter = GL_NEAREST_MIPMAP_LINEAR;
1083 case Graphics::SamplerFilter::LINEAR:
1087 case Graphics::SamplerMipmapMode::NONE:
1089 glFilter = GL_LINEAR;
1092 case Graphics::SamplerMipmapMode::NEAREST:
1094 glFilter = GL_LINEAR_MIPMAP_NEAREST;
1097 case Graphics::SamplerMipmapMode::LINEAR:
1099 glFilter = GL_LINEAR_MIPMAP_LINEAR;
1108 inline explicit operator uint32_t() const
1113 inline operator int() const
1115 return static_cast<int>(glFilter);
1118 uint32_t glFilter{0};
1121 /** Converts vertex format to GL */
1122 struct GLVertexFormat
1124 constexpr explicit GLVertexFormat(Graphics::VertexInputFormat gfxFormat)
1128 case VertexInputFormat::FVECTOR2:
1134 case VertexInputFormat::FVECTOR3:
1140 case VertexInputFormat::FVECTOR4:
1146 case VertexInputFormat::FLOAT:
1152 case VertexInputFormat::INTEGER:
1158 case VertexInputFormat::IVECTOR2:
1164 case VertexInputFormat::IVECTOR3:
1170 case VertexInputFormat::IVECTOR4:
1176 case VertexInputFormat::UNDEFINED:
1189 struct GLTextureTarget
1191 constexpr explicit GLTextureTarget(Graphics::TextureType graphicsTextureType)
1193 switch(graphicsTextureType)
1195 case Graphics::TextureType::TEXTURE_2D:
1197 target = GL_TEXTURE_2D;
1200 case Graphics::TextureType::TEXTURE_3D:
1202 target = GL_TEXTURE_3D;
1205 case Graphics::TextureType::TEXTURE_CUBEMAP:
1207 target = GL_TEXTURE_CUBE_MAP;
1212 GLenum target{GL_TEXTURE_2D};
1215 struct GLAddressMode
1217 constexpr explicit GLAddressMode(Graphics::SamplerAddressMode graphicsAddressMode)
1219 switch(graphicsAddressMode)
1221 case Graphics::SamplerAddressMode::REPEAT:
1223 texParameter = GL_REPEAT;
1226 case Graphics::SamplerAddressMode::MIRRORED_REPEAT:
1228 texParameter = GL_MIRRORED_REPEAT;
1231 case Graphics::SamplerAddressMode::CLAMP_TO_EDGE:
1233 texParameter = GL_CLAMP_TO_EDGE;
1236 case Graphics::SamplerAddressMode::CLAMP_TO_BORDER:
1238 texParameter = GL_CLAMP_TO_EDGE;
1241 case Graphics::SamplerAddressMode::MIRROR_CLAMP_TO_EDGE:
1243 texParameter = GL_CLAMP_TO_EDGE;
1248 GLenum texParameter{GL_CLAMP_TO_EDGE};
1252 * @brief Descriptor of single buffer binding within
1255 struct VertexBufferBindingDescriptor
1257 const GLES::Buffer* buffer{nullptr};
1258 uint32_t offset{0u};
1262 * @brief Descriptor of ix buffer binding within
1265 struct IndexBufferBindingDescriptor
1267 const GLES::Buffer* buffer{nullptr};
1269 Graphics::Format format{};
1273 * @brief Descriptor of uniform buffer binding within
1276 struct UniformBufferBindingDescriptor
1278 const GLES::Buffer* buffer{nullptr};
1279 uint32_t binding{0u};
1280 uint32_t offset{0u};
1281 bool emulated; ///<true if UBO is emulated for old gfx API
1285 * @brief The descriptor of draw call
1287 struct DrawCallDescriptor
1290 * @brief Enum specifying type of the draw call
1296 DRAW_INDEXED_INDIRECT
1299 Type type{}; ///< Type of the draw call
1302 * Union contains data for all types of draw calls.
1307 * @brief Vertex array draw
1311 uint32_t vertexCount;
1312 uint32_t instanceCount;
1313 uint32_t firstVertex;
1314 uint32_t firstInstance;
1318 * @brief Indexed draw
1322 uint32_t indexCount;
1323 uint32_t instanceCount;
1324 uint32_t firstIndex;
1325 int32_t vertexOffset;
1326 uint32_t firstInstance;
1330 * @brief Indexed draw indirect
1334 const GLES::Buffer* buffer;
1338 } drawIndexedIndirect;
1343 * @brief Topologu conversion from Graphics to GLES
1347 explicit constexpr GLESTopology(PrimitiveTopology topology)
1351 case PrimitiveTopology::POINT_LIST:
1353 primitiveTopology = GL_POINTS;
1356 case PrimitiveTopology::LINE_LIST:
1358 primitiveTopology = GL_LINES;
1361 case PrimitiveTopology::LINE_LOOP:
1363 primitiveTopology = GL_LINE_LOOP;
1366 case PrimitiveTopology::LINE_STRIP:
1368 primitiveTopology = GL_LINE_STRIP;
1371 case PrimitiveTopology::TRIANGLE_LIST:
1373 primitiveTopology = GL_TRIANGLES;
1376 case PrimitiveTopology::TRIANGLE_STRIP:
1378 primitiveTopology = GL_TRIANGLE_STRIP;
1381 case PrimitiveTopology::TRIANGLE_FAN:
1383 primitiveTopology = GL_TRIANGLE_FAN;
1390 * @brief Explicit type conversion operator
1391 * @return converted value
1393 constexpr inline operator GLenum() const
1395 return primitiveTopology;
1398 GLenum primitiveTopology{0}; ///< Topology
1402 * @brief Index format conversion structure
1404 struct GLIndexFormat
1406 explicit constexpr GLIndexFormat(Format _format)
1410 // TODO: add more formats
1411 case Format::R16_UINT:
1413 format = GL_UNSIGNED_SHORT;
1424 * @brief Explicit type conversion operator
1425 * @return converted value
1427 constexpr inline operator GLenum() const
1432 GLenum format{0}; ///< Converted format
1436 * @brief Conversion of blending function factor
1440 constexpr explicit GLBlendFunc(Graphics::BlendFactor factor)
1444 case Graphics::BlendFactor::ZERO:
1449 case Graphics::BlendFactor::ONE:
1454 case Graphics::BlendFactor::SRC_COLOR:
1456 glFactor = GL_SRC_COLOR;
1459 case Graphics::BlendFactor::ONE_MINUS_SRC_COLOR:
1461 glFactor = GL_ONE_MINUS_SRC_COLOR;
1464 case Graphics::BlendFactor::DST_COLOR:
1466 glFactor = GL_DST_COLOR;
1469 case Graphics::BlendFactor::ONE_MINUS_DST_COLOR:
1471 glFactor = GL_ONE_MINUS_DST_COLOR;
1474 case Graphics::BlendFactor::SRC_ALPHA:
1476 glFactor = GL_SRC_ALPHA;
1479 case Graphics::BlendFactor::ONE_MINUS_SRC_ALPHA:
1481 glFactor = GL_ONE_MINUS_SRC_ALPHA;
1484 case Graphics::BlendFactor::DST_ALPHA:
1486 glFactor = GL_DST_ALPHA;
1489 case Graphics::BlendFactor::ONE_MINUS_DST_ALPHA:
1491 glFactor = GL_ONE_MINUS_DST_ALPHA;
1494 case Graphics::BlendFactor::CONSTANT_COLOR:
1496 glFactor = GL_CONSTANT_COLOR;
1499 case Graphics::BlendFactor::ONE_MINUS_CONSTANT_COLOR:
1501 glFactor = GL_ONE_MINUS_CONSTANT_COLOR;
1504 case Graphics::BlendFactor::CONSTANT_ALPHA:
1506 glFactor = GL_CONSTANT_ALPHA;
1509 case Graphics::BlendFactor::ONE_MINUS_CONSTANT_ALPHA:
1511 glFactor = GL_ONE_MINUS_CONSTANT_ALPHA;
1514 case Graphics::BlendFactor::SRC_ALPHA_SATURATE:
1516 glFactor = GL_SRC_ALPHA_SATURATE;
1519 // Below may be unsupported without extension
1520 case Graphics::BlendFactor::SRC1_COLOR:
1525 case Graphics::BlendFactor::ONE_MINUS_SRC1_COLOR:
1530 case Graphics::BlendFactor::SRC1_ALPHA:
1535 case Graphics::BlendFactor::ONE_MINUS_SRC1_ALPHA:
1544 * @brief Explicit type conversion operator
1545 * @return converted value
1547 constexpr inline operator GLenum() const
1552 GLenum glFactor{0u};
1556 * @brief Converts Blend Op to GL
1560 constexpr explicit GLBlendOp(Graphics::BlendOp blendOp)
1564 case Graphics::BlendOp::ADD:
1566 glBlendOp = GL_FUNC_ADD;
1569 case Graphics::BlendOp::SUBTRACT:
1571 glBlendOp = GL_FUNC_SUBTRACT;
1574 case Graphics::BlendOp::REVERSE_SUBTRACT:
1576 glBlendOp = GL_FUNC_REVERSE_SUBTRACT;
1579 case Graphics::BlendOp::MIN:
1584 case Graphics::BlendOp::MAX:
1593 * @brief Explicit type conversion operator
1594 * @return converted value
1596 constexpr inline operator GLenum() const
1601 GLenum glBlendOp{0u};
1605 * @brief Converts GL cull mode
1609 constexpr explicit GLCullMode(Graphics::CullMode cullMode)
1613 case Graphics::CullMode::NONE: // this isn't really accepted by GL!
1615 glCullMode = GL_NONE;
1618 case Graphics::CullMode::FRONT:
1620 glCullMode = GL_FRONT;
1623 case Graphics::CullMode::BACK:
1625 glCullMode = GL_BACK;
1628 case Graphics::CullMode::FRONT_AND_BACK:
1630 glCullMode = GL_FRONT_AND_BACK;
1637 * @brief Explicit type conversion operator
1638 * @return converted value
1640 constexpr inline operator GLenum() const
1645 GLenum glCullMode{0u};
1649 * @brief enum with GL types
1654 FLOAT_VEC2 = 0x8B50,
1655 FLOAT_VEC3 = 0x8B51,
1656 FLOAT_VEC4 = 0x8B52,
1664 FLOAT_MAT2 = 0x8B5A,
1665 FLOAT_MAT3 = 0x8B5B,
1666 FLOAT_MAT4 = 0x8B5C,
1667 SAMPLER_2D = 0x8B5E,
1668 SAMPLER_CUBE = 0x8B60,
1670 UNSIGNED_BYTE = 0x1401,
1672 UNSIGNED_SHORT = 0x1403,
1674 UNSIGNED_INT = 0x1405,
1680 * @brief GL type conversion (used with reflection)
1682 struct GLTypeConversion
1684 constexpr explicit GLTypeConversion(GLenum value)
1690 type = GLType::FLOAT_VEC2;
1695 type = GLType::FLOAT_VEC3;
1700 type = GLType::FLOAT_VEC4;
1705 type = GLType::INT_VEC2;
1710 type = GLType::INT_VEC3;
1715 type = GLType::INT_VEC4;
1720 type = GLType::BOOL;
1725 type = GLType::BOOL_VEC2;
1730 type = GLType::BOOL_VEC3;
1735 type = GLType::BOOL_VEC4;
1740 type = GLType::FLOAT_MAT2;
1745 type = GLType::FLOAT_MAT3;
1750 type = GLType::FLOAT_MAT4;
1755 type = GLType::SAMPLER_2D;
1758 case GL_SAMPLER_CUBE:
1760 type = GLType::SAMPLER_CUBE;
1765 type = GLType::FLOAT;
1770 type = GLType::UNDEFINED;
1775 GLType type{GLType::UNDEFINED};
1778 } // namespace Dali::Graphics::GLES
1780 #endif //DALI_GRAPHICS_API_TYPES_H