Page 1 of 1

Shader compilation problems on Vulkan

PostPosted: Tue Jul 02, 2019 2:17 am
by Graf Zahl
Reporting because right now I cannot address this myself:

A user shader using 'texture2D' to look up a texture fails to compile with Vulkan. Manually changing 'texture2D' to 'texture' makes it work.
Discovered with Freaky Panties.

Re: Shader compilation problems on Vulkan

PostPosted: Tue Jul 02, 2019 2:33 am
by _mental_
The problem exists with Apple’s OpenGL too. But with Vulkan it affects all platforms.
I would solve this by adding texture?D functions to our shader header. This solution was already used for noise functions.

Re: Shader compilation problems on Vulkan

PostPosted: Tue Jul 02, 2019 4:04 am
by Graf Zahl
I don't think that's a good idea - on Windows 'texrture2D' is still a valid builtin function. So this has to be done platform specific or the text has to be replaced in-place before compilation.

Re: Shader compilation problems on Vulkan

PostPosted: Tue Jul 02, 2019 4:48 am
by _mental_
Our shader header is different for OpenGL and Vulkan.
I mentioned Apple’s OpenGL just for the sake of completeness. I have no plans to fix it.
With Vulkan renderer texture2D needs to be handled regardless of platform.

Re: Shader compilation problems on Vulkan

PostPosted: Tue Jul 02, 2019 5:05 am
by Graf Zahl
It also needs to get fixed on OpenGL, because if Apple fails here, there's no guarantee that other implementors also remove deprecated functionality.

Re: Shader compilation problems on Vulkan

PostPosted: Sun Aug 18, 2019 7:45 am
by Graf Zahl
I tried to fix it as a function override, but that doesn't work. It seems 'texture2d' is a token, not an identifier, so the only way to change it is to patch the shader source.