bigwheels icon indicating copy to clipboard operation
bigwheels copied to clipboard

Require UINT32 type in Geometry::AppendIndicesU32

Open footballhead opened this issue 7 months ago • 0 comments

Unlike AppendIndex and friends, AppendIndicesU32 doesn't account for INDEX_TYPE_UNDEFINED. Consider:

Geometry geometry;
Geometry::Create(GeometryCreateInfo{}.IndexType(grfx::INDEX_TYPE_UNDEFINED).AddPosition(), &geometry);
std::array<uint32_t, 3> data = {0, 1, 2)
geometry.AppendIndicesU32(data.size(), data.data());
EXPECT_EQ(geometry.GetIndexBuffer()->GetSize(), 0);

This test would fail since the data would be written to the index buffer!

This seems like an oversight. The condition has been fixed and tests have been added.

footballhead avatar Jul 05 '24 19:07 footballhead