Skip to content
This repository has been archived by the owner on Jun 18, 2021. It is now read-only.

Graphics shaking on window resize #536

Closed
maitysubhasis opened this issue Aug 25, 2020 · 8 comments
Closed

Graphics shaking on window resize #536

maitysubhasis opened this issue Aug 25, 2020 · 8 comments
Labels
question Further information is requested

Comments

@maitysubhasis
Copy link

maitysubhasis commented Aug 25, 2020

I shifted the coordinate to 0,0 to the left, top.
Now the drawn graphics are shaking on resize.

ezgif com-video-to-gif

Any idea how to fix it.

It seems when the window is resized the window itself is trying to resize the graphics but on draw call the graphics is drawn again. Thats the reason for the shakiness.

Without the coordinate shift the shakiness does not occur.

@kvark kvark added the question Further information is requested label Aug 26, 2020
@cwfitzgerald
Copy link
Member

Is this using DX12 as a backend?

@maitysubhasis
Copy link
Author

maitysubhasis commented Aug 26, 2020

No, mac os.
Probably same as #786.

kejor pushed a commit to kejor/wgpu-rs that referenced this issue Nov 28, 2020
536: Update Support Platforms Table to Have a Key r=kvark a=cwfitzgerald

Closes gfx-rs#531 

I have added wording that I believe is accurate, but if there is better wording, feel free to propose it.

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
@mattmag
Copy link

mattmag commented Jan 31, 2021

@kvark
Copy link
Member

kvark commented Feb 1, 2021

I believe this is because the window is resized asynchronously from the rendering. So when you resize fast, at some point you window has width 5. Your frame is recorded for the viewport of 5. But by the time it's presented, the window is already of size 6. So CAMetalLayer scales the texture up from 5 to 6, and you see that your rectangle changes in size.

I don't know if anything could be done here.

@mattmag
Copy link

mattmag commented Feb 2, 2021

It happens even at slow resize speeds and is particularly distracting when text is involved.
I'll probably have to abandon my evaluation of wgpu-rs if nothing can be done about it, which is a bummer because I'm new to graphics programming and learning wgpu-rs has been fun and not too difficult.

resize-jitter-text

Here is the behavior that I think users would expect
sublime-resize

Should I start look looking into using gfx-rs directly?

@kvark
Copy link
Member

kvark commented Feb 2, 2021

Looks like a known problem - https://thume.ca/2019/06/19/glitchless-metal-window-resizing/
I made a patch following the documentation on presentsWithTransaction - gfx-rs/gfx#3627
It doesn't work for me. If you want to play with it, either the make quad in gfx-rs, or checkout out gfx-rs and uncommenting these lines would do.

@kvark
Copy link
Member

kvark commented Apr 13, 2021

Please try gfx-rs/gfx#3627 as an override to latest wgpu
There is also a similar issue - gfx-rs/wgpu#1168

@cwfitzgerald
Copy link
Member

Closing because there is an existing wgpu issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants