The fragment shader only has one function:
And I have tried to use the mali offline compier by following commands:
-n <NAME>, --name <NAME> Name the program entrypoint.
The malioc.exe tells me to use -n or --name, I have tried both, all without luck.
Can someone kindly points out what's going wrong? Thanks!
btw, the shader is generated by UE4.26.2
Thanks for the bug report.
Firstly, please can you download and try a newer version of Arm Mobile Studio. The latest Mali Offline Compiler in Mobile Studio 2022.2 is version 7.6.
If that doesn't solve it, if it's possible, please can you share the fragment shader or SPIR-V that reproduces this by emailing firstname.lastname@example.org? I've tried a shader here with that entry point name on 7.6 and it works fine by auto-detecting the correct entry point to use (no need to set it manually if only a single entry point is defined).
Kind regards, Pete
Hi Peter, Thansk for your quick response. I have tried the latest mali offline compier v7.6.0 (Build 72a3cc) and still encounter same error. I already send the shader file by email and look forward your feedback.
I'm not sure what I actually compiled last night, but I can confirm it doesn't work =)
We use glslangValidator for our GLSL to SPIR-V compilation, which strictly adheres to the Khronos specifications. For GLSL the entry point must be "void main()" - alternative names are out-of-spec. The shader in this case is trying to use "void main_00000000_00000000()" as the entry point which is incorrect and not accepted by glslangValidator, but accepted by some other front-ends such as DXC.
For this particular case, you can work around this issue with the preprocessor. However, this can be a little fragile in the general case as any instance of the string will get replaced, not just the entry point name.
malioc --vulkan -D main_00000000_00000000=main vulkan.frag
We will implement this workaround for Vulkan source compiles that set --name for a future offline compiler release.
Thanks, Peter! This workaround works great for me. Now I can use the mali offline compiler to analysis the vulkan shader.
btw it seems the UE4 also use the glslangValidator to compile the GLSL to SPIR-V.As far as I know, it will first use hlslcc to translate HLSL code to GLSL code, then use glslang to compile the GLSL to SPIR-V.
I just verified that when generate the shader from material, it's not using dxc but hlslcc and glslang.
Thanks for checking.
It's possible to override some of the syntax and semantic checks in glslangValidator by passing in the "-s" command line option, so it's quite possible that UE is using glslangValidator in a more relaxed mode. We don't do this by default as you get in to the realms of implementation-defined behavior.
To confirm - we've implement a workaround for cases where Vulkan source shaders use a custom "--name" and this will ship in the Arm Mobile Studio 2022.3 release due ~end of August.
Thanks again for the bug report - it's very useful for us to get these.
Great! Thanks for your quick response!
Mobile Studio 2022.3 is now available with the ability to set a custom name.