Skip to content

Preserve vertex-array rendering with default texture coordinates - #833

Open
Dikluwe wants to merge 5 commits into
coin3d:masterfrom
Dikluwe:codex/issue-722-texture-vbo
Open

Dikluwe wants to merge 5 commits into
coin3d:masterfrom
Dikluwe:codex/issue-722-texture-vbo

Conversation

@Dikluwe

@Dikluwe Dikluwe commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #722.

Keep eligible shapes on the vertex-array/VBO path when a single 2D texture on unit 0 uses default texture coordinates. Evaluate the existing default mapping into a temporary coordinate array, so both shaders using their own UVs and shaders reading the supplied texture coordinates retain the expected behavior.

Implementation

  • Share eligibility checks and temporary coordinate storage in the private SoVertexArrayTexCoordGuard. Restore the coordinate state after finishVertexArray() and before destroying the texture-coordinate bundle.
  • Apply the guard to SoIndexedFaceSet, SoFaceSet, SoPointSet, SoIndexedPointSet, SoIndexedLineSet, and SoVRMLIndexedFaceSet.
  • Keep immediate rendering for arbitrary coordinate functions and default multitexture configurations that cannot safely use arrays. Explicit arrays and GL texgen remain supported when the shape's bindings and indices permit them.
  • Diagnose missing texture arrays in SoShape::startVertexArray(), once per node type and texture unit. The return value continues to distinguish VBOs from CPU arrays.
  • Send procedural texture coordinates in the immediate SoIndexedPointSet path, and avoid arrays for SoFaceSet when generated normals do not cover a nonzero startIndex.
  • Document the rendering contracts and current behavior in Doxygen. No public headers or ABI changes.

Validation

Based on master ca247c1321bce07199ec0f034493977761b3218e.

  • Coin, CoinTextureArrayTest, and CoinTests build successfully.
  • CTest: TextureCoordinateArrayRendering and CoinTests pass (2/2).
  • Visual regression: 144 cases / 288 frames, covering six shapes, eight configurations, and immediate, CPU-array, and VBO rendering. Includes explicit coordinates, generated coordinates, normal-dependent functions, multitexture, GL texgen, generated normals, and nonzero SoFaceSet::startIndex. No missing-array diagnostics.
  • GDB path verification: 72 cases pass, checking array calls, VBO selection, and required fallbacks.
  • CoinTests: 419 tests / 307,739 checks pass.
  • git diff --check passes; all five commits are SSH-signed.

Local validation used Linux, Xvfb, and Mesa/llvmpipe. Other platforms and hardware drivers have not been validated locally.

Local performance measurement

For a textured SoIndexedFaceSet with explicit indexed normals and a shader using its own constant UVs:

Quad faces Forced immediate path Corrected VBO path
10,000 9.78 ms/frame 5.36 ms/frame
40,000 39.52 ms/frame 25.33 ms/frame
160,000 121.62 ms/frame 68.03 ms/frame

These compare rendering paths in the same corrected Debug library, rather than two separately built revisions. Each entry is the median of three 30-frame runs after five warmup frames. Rendering caches are disabled, and timings include glFinish(). The viewport is 128×128 and the renderer is llvmpipe (LLVM 20.1.2 / Mesa 25.2.8). Scene construction and final image readback are excluded. CPU arrays perform similarly to VBOs in this software renderer. The measured 36–45% reduction does not predict Release or physical-GPU performance.

This branch has not been deployed

No deployments
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.

VBO / vertex-array path lost when a SoTexture2 is bound under a GLSL shader that samples via its own uniform

1 participant