-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fix window resize jitter with Metal #17415
base: master
Are you sure you want to change the base?
Conversation
57cfb70
to
ae337aa
Compare
You can test this PR using the following package version. |
You can test this PR using the following package version. |
var session = _native.BeginDrawing(); | ||
return new MetalDrawingSession(session); | ||
} | ||
catch (COMException com) when (com.HResult == (int)AvnResultCodes.E_AVN_RENDER_TARGET_NOT_READY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor. But would it be possible to return HResult from BeginDrawing, instead of throwing COMException?
Just to avoid unfilterable exceptions noise.
Throwing RenderTargetNotReadyException exception is fine, as it can be easily filtered-out by the debugger by type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't have non-HRESULT returns for methods with out
object arguments. Not supported by MicroCOM and would require some extensive refactoring of the way argument marshaling works.
I tested Intel Core i9 + AMD Radeon Pro 5500M, macOS Sonoma 14.7 on this PR (cibuild jitter.movShould I enable or config something? |
@danipen I think we'll need a repro |
In 11.2.0 we're able to reproduce using the default application template:
resize.movI'm trying this PR now ... I'll post here if I'm able to reproduce too. |
Yes, same with nugets from this PR ( PR-repro.mov |
@danipen can you double check that .NET sdk didn't use any cached nugets? Or if built wasn't found and it fallback to another. Sandbox before this PR: Sandbox on this PR: |
Yes, it seems that build Just for the record, I'm getting the following error in the console:
|
Additionally, I feel the OpenGL renderer is more performant. When resizing the window, it follows the mouse better when resizing. Please see the attached video: (left is OpenGL and right is Metal). resize-perf.mov |
CAMetalLayer.presentsWithTransaction = YES;
and manually trigger[CAMetalDrawable present]
while wrapping it into aCATransaction
when drawing from a non-UI threadNote that this needs extensive testing on multiple machines first (both Mx and Intel with and without dedicated GPU), unless it can be done quickly we should switch back to OpenGL as our default renderer).
Tested platforms:
Still need to test on Intel without dedicated GPU.