VertexBuffer constructor takes a vertex format as it's argument, which
is a PropertyMap of key value pairs. Previously, it assumes that the
value is a property type enumeration cast to an INTEGER type.
However, if the Property::Map is instantiated using initializer lists,
e.g.
Property::Map format { {"aPosition", Property::VECTOR2},
{"aColor", Property::VECTOR4}};
VertexBuffer vertexBuffer(format);
then the enum is promoted to a Property::Value of that type, so the
vertex buffer doesn't see INTEGER type and asserts.
Modified the VertexBuffer constructor to utilize the value type
if it's not an INTEGER.
Change-Id: I85bc1d08603c31726eb06d786f44f0ca27a62ce9
Signed-off-by: David Steele <david.steele@samsung.com>
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
-int UtcDaliVertexBufferInvalidTypeN(void)
+int UtcDaliVertexBufferMapInitializerList(void)
+{
+ TestApplication application;
+
+ Property::Map texturedQuadVertexFormat = Property::Map{{"aPosition", Property::VECTOR2},
+ {"aTexCoord", Property::VECTOR2},
+ {"aColor", Property::VECTOR4}};
+
+ try
+ {
+ VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
+ tet_result(TET_PASS);
+ }
+ catch(Dali::DaliException& e)
+ {
+ // Shouldn't assert any more
+ tet_result(TET_FAIL);
+ }
+ END_TEST;
+}
+
+int UtcDaliVertexBufferInvalidTypeN01(void)
{
TestApplication application;
{
TestApplication application;
+int UtcDaliVertexBufferInvalidTypeN02(void)
+{
+ TestApplication application;
+
+ Property::Map texturedQuadVertexFormat = Property::Map{{"aPosition", Property::MAP},
+ {"aTexCoord", Property::STRING},
+ {"aColor", Property::VECTOR4}};
+
+ try
+ {
+ VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
+ tet_result(TET_FAIL);
+ }
+ catch(Dali::DaliException& e)
+ {
+ DALI_TEST_ASSERT(e, "Property::Type not supported in VertexBuffer", TEST_LOCATION);
+ }
+ END_TEST;
+}
+
int UtcDaliVertexBufferSetDataNegative(void)
{
TestApplication application;
int UtcDaliVertexBufferSetDataNegative(void)
{
TestApplication application;
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Property::Type type = Property::Type(component.second.Get<int>());
// Get the size and alignment
Property::Type type = Property::Type(component.second.Get<int>());
// Get the size and alignment
+ if(type == Property::NONE)
+ {
+ /* Note, Property::Value() has an explicit constructor using Property::Type enum,
+ * which will generate a property value of that type. This constructor is used when
+ * using C++ initializer lists.
+ */
+ type = component.second.GetType();
+ }
+
if((type == Property::NONE) ||
(type == Property::STRING) ||
(type == Property::ARRAY) ||
if((type == Property::NONE) ||
(type == Property::STRING) ||
(type == Property::ARRAY) ||
{
DALI_ABORT("Property::Type not supported in VertexBuffer");
}
{
DALI_ABORT("Property::Type not supported in VertexBuffer");
}
uint32_t elementSize = GetPropertyImplementationSize(type);
uint32_t elementAlignment = GetPropertyImplementationAlignment(type);
uint32_t elementSize = GetPropertyImplementationSize(type);
uint32_t elementAlignment = GetPropertyImplementationAlignment(type);