Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Profiling] Fix performance regression in FastTextRenderer #2058

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

Eideren
Copy link
Collaborator

@Eideren Eideren commented Nov 20, 2023

PR Details

@manio143 found a performance regression introduced in #1896 - this PR fixes it.

Description

Mapped resources are typically uncached with write combining - so reading from the buffer is significantly slower.
Issue came up only when a debugger with a disable JIT on load flag is hooked to the process.
The pre JIT'ed assembly for GraphicsFastTextRendererGenerateVertices had unnecessary reads built in, the attached debugger prevented further optimization, leading to a bunch of extremely slow reads on the mapped resource.

This PR also:

  • Strips out Position.Z and Normals from the vertex buffer used to improve throughput.
  • Uses Numerics' vector for SIMD to build the vertex buffer.
  • Removes an unnecessary memory clear since everything that's shown on screen is assigned through the vertex buffer loop.
  • Removes the unintended public access modifier for GraphicsFastTextRendererGenerateVertices, it was internal before PR [Native] - Implement some existing C++ methods in C# #1896.
  • Move a couple of fields from class to function.
  • Introduce a new structure, Vertex2DPositionTexture

Related Issue

Supersedes PR #2049

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

@manio143 manio143 merged commit 47a8ef2 into stride3d:master Nov 21, 2023
1 check passed
@Eideren Eideren deleted the fastest_text branch November 21, 2023 15:50
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.

2 participants