bjin / mpv-prescalers

prescalers for mpv, as user shaders
GNU Lesser General Public License v3.0
355 stars 34 forks source link

Vulkan-compatible versions of RAVU #20

Closed haasn closed 6 years ago

haasn commented 6 years ago

The RAVU weights texture currently uses rgba16f, which is an OpenGL-only texture format. For vulkan you need to use either rgba16hf (16-bit half float format) or just plain rgba16 (normalized integer).

bjin commented 6 years ago

Negative weights exist, so nornalized integer is not an option. The problem is that, the FORMAT string of user texture is implementation dependent, although cpu side format of rgba16f rgba16hf and rgba32f are all 32bit float (the format of user texture content)

However, with default options, ravu.py generates user texture with rgba32f format, which I believe is vulkan compatible.

As for the shaders in master branch, there is just too much options and all pre-generated are mainly meant to address common use cases on common setups. So I'm fine with generated shader incompatible with vulkan, at least at this moment.

haasn commented 6 years ago

although cpu side format of rgba16f rgba16hf and rgba32f are all 32bit float (the format of user texture content)

This is not true. The suffix identifies the CPU format. so rgba16f is 16-bit texture with 32-bit CPU floats, and rgba32f is 32-bit texture with 32-bit CPU floats. rgba16hf is 16-bit texture with 16-bit CPU floats.

The problem is that vulkan does not support bit depth conversion on upload, so you have to actually give it the same format as the resulting texture.

bjin commented 6 years ago

I see. Could you check if 4f229a44f70d49125e049f134424e4daa33ded20 fixed the problem? Just generate ravu/ravu-lite shader with --float-format float16vk. (I don't have environment to test vulkan support).

haasn commented 6 years ago

@bjin Yeah, that seems to solve it.

I'll still try and see if I can either get opengl to support 16hf or vulkan to support 16f eventually.