Skip to content

Reduce per draw material binding and uniform upload overhead #793

@Gopmyc

Description

@Gopmyc

Problem this feature should fix

The rendering path appears CPU-heavy per draw call due to repeated material bind/unbind and uniform updates:

  • Sources/OvRendering/src/OvRendering/Core/ABaseRenderer.cpp (DrawEntity)
  • Sources/OvRendering/src/OvRendering/Data/Material.cpp (Bind, Unbind)
  • Sources/OvRendering/src/OvRendering/HAL/OpenGL/GLShaderProgram.cpp (Bind, Unbind)

Potential overhead patterns:

  • Frequent glUseProgram changes.
  • Per-draw string-based uniform location lookup and variant dispatch.
  • Program unbind (glUseProgram(0)) after each draw.

Expected solution

Introduce a cached render-state strategy:

  • Cache currently bound shader/material states to avoid redundant binds.
  • Avoid per-draw program unbind when not required.
  • Add dirty flags for material property uploads.
  • Cache uniform locations and reduce dynamic dispatch overhead in hot path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions