MCPcopy Create free account
hub / github.com/defold/defold / RunAllAttributeTest

Function RunAllAttributeTest

engine/graphics/src/test/test_graphics.cpp:807–830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

805}
806
807static void RunAllAttributeTest(float* values, uint32_t num_values, dmGraphics::VertexAttribute::SemanticType semantic_type, dmGraphics::VertexAttribute::DataType data_type, dmGraphics::VertexAttribute::VectorType value_vector_type, const VectorTypeContainer<float>& expected)
808{
809 dmGraphics::VertexAttributeInfos attribute_infos;
810 InitializeVertexAttributeInfos(attribute_infos, 7);
811
812 AddAttribute(attribute_infos, values, num_values, semantic_type, data_type, value_vector_type, dmGraphics::VertexAttribute::VECTOR_TYPE_SCALAR);
813 AddAttribute(attribute_infos, values, num_values, semantic_type, data_type, value_vector_type, dmGraphics::VertexAttribute::VECTOR_TYPE_VEC2);
814 AddAttribute(attribute_infos, values, num_values, semantic_type, data_type, value_vector_type, dmGraphics::VertexAttribute::VECTOR_TYPE_VEC3);
815 AddAttribute(attribute_infos, values, num_values, semantic_type, data_type, value_vector_type, dmGraphics::VertexAttribute::VECTOR_TYPE_VEC4);
816 AddAttribute(attribute_infos, values, num_values, semantic_type, data_type, value_vector_type, dmGraphics::VertexAttribute::VECTOR_TYPE_MAT2);
817 AddAttribute(attribute_infos, values, num_values, semantic_type, data_type, value_vector_type, dmGraphics::VertexAttribute::VECTOR_TYPE_MAT3);
818 AddAttribute(attribute_infos, values, num_values, semantic_type, data_type, value_vector_type, dmGraphics::VertexAttribute::VECTOR_TYPE_MAT4);
819 attribute_infos.m_VertexStride = sizeof(expected);
820
821 dmGraphics::WriteAttributeParams params = {};
822 params.m_VertexAttributeInfos = &attribute_infos;
823
824 VectorTypeContainer<float> actual;
825
826 dmGraphics::WriteAttributes((uint8_t*) &actual, 0, 1, params);
827 AssertVectorTypeContainerFloat(expected, actual);
828
829 DestroyVertexAttributeInfos(attribute_infos);
830}
831
832TEST_F(dmGraphicsTest, VertexAttributeDataTypeConversion)
833{

Callers 1

TEST_FFunction · 0.85

Calls 5

AddAttributeFunction · 0.85
WriteAttributesFunction · 0.85

Tested by

no test coverage detected