Mapped Vulkan Image with padding causes incorrect scalling when custom shaders are used
STR:
- Use Vulkan hwdec
- Use prescaler like Ravu
- Play 1080p file in mpv (1920x1088 one)
There are two related problems
- custom shaders operate on full texture size and are lied to about the width and height of the image. Causes not 1:1 pixel scaling. Also they possibly can sample outside valid image area and pull some data from padding area.
- since the texture size and display size mismatch anascaling will be inserted at the end
The one solution would be to implement input texture crop pass immediately after mapping input frame. Probably would resolve all issues.
I've actually seen the issue also with d3d11 (zero copy) some time ago and there was something iffy with calc of the sizes passed to custom shaders. One of the values was cropped, but not the other. But all those crop/un-crop shenanigans could be removed if it is cropped during mapping (or after) and all uses downstream works on proper sized VkImage.