Skip to content

Moved matrices to 3x4#386

Merged
stramit merged 22 commits into
masterfrom
hybrid-instancing-3x4-gpu-matrices
Jun 11, 2020
Merged

Moved matrices to 3x4#386
stramit merged 22 commits into
masterfrom
hybrid-instancing-3x4-gpu-matrices

Conversation

@joeldevahl
Copy link
Copy Markdown
Contributor

@joeldevahl joeldevahl commented May 7, 2020

Purpose of this PR

Currently matrices are stored as 4x4 on the GPU. However we know that these are affine matrices so the last row is always (0, 0, 0, 1).

If we get rid of this row and make it explicit we will reduce matrix memory and bandwith requirements. It would also let the shader compiler constant fold better since last row will be explicitly known at compile time.

Testing status

Manual Tests

Tested with URP and HDRP hybrid test projects locally.

Automated Tests

No automated tests on Graphics side. But DOTS side PR contains edit mode tests to endure matrix uploads are correct.

Links

Yamato: (Select your branch) https://yamato.prd.cds.internal.unity3d.com/jobs/902-Graphics

Any test projects or documents to go with this to help reviewers?

Comments to reviewers

I will try to land this to both SRP and DOTS repos simultaneous. The DOTS repo will contain an if guard to ensure the code is only active there if the SRP version is something greater or equal to some preview version where we KNOW the SRP change will land.

@joeldevahl joeldevahl marked this pull request as ready for review May 18, 2020 06:48
@joeldevahl joeldevahl requested a review from sebbbi May 18, 2020 06:48
@joeldevahl joeldevahl requested a review from a team as a code owner May 20, 2020 06:53
@joeldevahl joeldevahl requested a review from pbbastian May 20, 2020 06:53
Comment thread com.unity.render-pipelines.core/Runtime/Unity.RenderPipelines.Core.Runtime.asmdef Outdated
Copy link
Copy Markdown
Contributor

@pbbastian pbbastian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

misclicked "Approve" before :< but LGTM, just want some clarification on that version, and then maybe a define change depending on answer

@cinight cinight self-requested a review June 4, 2020 13:48
Copy link
Copy Markdown
Contributor

@cinight cinight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Win DX11 & Mac Metal editor & player no visual regression.
CPU memory is improved.
*I've tested with Hybrid URP Template Project, it might be too small to see big FrameTime increase.

@TomasKiniulis TomasKiniulis self-requested a review June 5, 2020 10:11
Copy link
Copy Markdown
Contributor

@TomasKiniulis TomasKiniulis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No PR related visual issues found testing on Hybrid HDRP template on Dx11 and Metal editor and player.
I get significant memory usage decrease profiling player

@stramit stramit merged commit 343341f into master Jun 11, 2020
@stramit stramit deleted the hybrid-instancing-3x4-gpu-matrices branch June 11, 2020 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants