Skip to content

Support UINT8 indices in TriMesh and WireMesh#617

Open
AnouarMohamed wants to merge 1 commit intogoogle:mainfrom
AnouarMohamed:fix-uint8-tri-wire-mesh
Open

Support UINT8 indices in TriMesh and WireMesh#617
AnouarMohamed wants to merge 1 commit intogoogle:mainfrom
AnouarMohamed:fix-uint8-tri-wire-mesh

Conversation

@AnouarMohamed
Copy link
Copy Markdown
Contributor

@AnouarMohamed AnouarMohamed commented Apr 30, 2026

Summary

Fixes #514.

This adds first-class grfx::INDEX_TYPE_UINT8 support to the CPU-side mesh containers that were left out when UINT8 index buffers were introduced for Geometry.

The change updates TriMesh and WireMesh so they can construct, pack, read back, and count UINT8 index data directly. It also adds an IndexType(...) option to the mesh option builders, so primitive factories and OBJ loading can emit a requested index width while preserving the existing default of UINT32 for .Indices().

Details

  • Add GetDataIndicesU8() and internal UINT8 append paths for TriMesh and WireMesh.
  • Remove the temporary UINT8 constructor assertions and handle UINT8 in append/read/preallocation paths.
  • Add range assertions before narrowing to UINT8 or UINT16.
  • Keep GPU backend support unchanged; device-level UINT8 support and fallback behavior remain separate from these CPU mesh containers.
  • Add focused tests for direct mesh usage, primitive factory creation, Geometry::Create(...) conversion, and debug overflow assertions.

Testing

On Fedora 43 with GCC 15:

cmake -S . -B build -G Ninja \
  -DPPX_BUILD_PROJECTS=OFF \
  -DPPX_BUILD_BENCHMARKS=OFF \
  -DPPX_COPY_ASSETS=OFF \
  -DDXC_PATH=$HOME/sdk/dxc/bin/dxc \
  -DGLSLC_PATH=/usr/bin/glslc \
  -DVULKAN_INCLUDE_DIR=/usr/include \
  -DVULKAN_LIBRARY_DIR=/usr/lib64 \
  -DCMAKE_CXX_FLAGS=-Wno-error=stringop-overflow

cmake --build build --target build-tests
ctest --test-dir build --output-on-failure

ctest result: 230/230 tests passed.

The extra -Wno-error=stringop-overflow flag works around an unrelated GCC 15 warning in third_party/stb/stb_image.h that is promoted to an error by the repo-wide -Werror setting.

@AnouarMohamed AnouarMohamed marked this pull request as ready for review April 30, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support INDEX_TYPE_UINT8 in WireMesh and TriMesh

1 participant