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

Model rendering performance is slower than expected #32

Closed
walbourn opened this issue Apr 24, 2018 · 3 comments
Closed

Model rendering performance is slower than expected #32

walbourn opened this issue Apr 24, 2018 · 3 comments
Assignees
Labels
optimization xbox Related to Xbox One and/or Xbox Series X|S

Comments

@walbourn
Copy link
Member

The Model class renders a little slower than expected, which is particularly noticeable on Xbox One.

@walbourn
Copy link
Member Author

walbourn commented Apr 24, 2018

This issue was traced to the fact that ModelMeshPart uses GraphicsMemory for the VB/IB. This effectively means it uses "DYNAMIC" (GPU/CPU shared memory) rather than "STATIC" (GPU only accessible memory like VRAM) memory allocation. This works fine for PrimitiveBatch, SpriteBatch, Constant Buffers, etc. and simplifies the interface for GeometricPrimitive.

Given that most use of Model is for static rather than dynamic geometry, this issue should be fixed by making ModelMeshPart use ID3D12Resource pointers for VB and IB instead. This will require breaking changes to the existing Model loading API since it will now require a device instance as well as a ResourceUploadBatch to complete the transfer to GPU memory. This will also impact anyone doing their own custom loaders or drawing with the DirectX 12 version of Model.

@walbourn
Copy link
Member Author

Another option is to create a parallel StaticModel, StaticModelMesh, and StaticModelPart. Then there can be either an Optimize method on the Model class which converts to a StaticModel, or you can have direct loading of` StaticModel.

@walbourn walbourn self-assigned this May 30, 2018
@walbourn
Copy link
Member Author

See this pull request.

You can optionally call model->LoadBuffers(device, uploadBatch); to convert a model from a dynamic VB/IB to a static VB/IB for better performance.

@walbourn walbourn added the xbox Related to Xbox One and/or Xbox Series X|S label Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization xbox Related to Xbox One and/or Xbox Series X|S
Projects
None yet
Development

No branches or pull requests

1 participant