Is it possible to use SM4 shaders on Android?

Is it possible to set the shader model for the Android build to something other than ES2?

No. SM4 and SM5 are for Direct3D for Windows (and OpenGL 3+ for Mac/Linux) Mobile devices only use ES2 + Alot of extensions at the moment. I heard there is a plan to move to ES3 when more mobile devices support it.

Thanks Ehamloptiran. Yes, SM4/SM5 are DirectX. . .but I read somewhere that HLSL is converted to OpenGL, most likely for SM4 (DirectX9).

How do I set UE4 to use the full OpenGL, which ES 3.0 mimics, for testing purposes. That way I can start tracking down what works and what doesn’t.

You can open the editor in OpenGL mode by using the -opengl command. From a quick look. No tessellation (D3D11 only). GPU particles do work, which means Compute Shaders.

I’m anxious to try this. If I understand you correctly, pass the -opengl on the command line. Correct? Also, will this affect the build, which is targeted for Android?

There are “Mobile Preview” which simulates mobil GPU feature set, but it’s ES2. If current engin version support ES3 there probably way to turn on preview mode for that too

One note Shader Model is not for DirectX is a desktop GPU feature specification which can be used by any randerer :stuck_out_tongue: Mobile have it’s own league, so they don’t use Shader Model thing to describe GPU feature set

To clarify: SM4 is DX10, SM3 is DX9 (not currently used); we cross-compile (with hlslcc) hlsl → glsl and based off the shader model target; we currently generate glsl for GL3, GL4 & ES2.

Note: running with -opengl or -opengl3 is the same (GL3 level driver); you probably want to try -opengl4 which has a different code path for GL4.

@RCaloca, is there any other step we need to take other than adding the command line switch for the different OpenGL’s? When we build, will UE4 use the desired shaders then?

The -opengl option is for the editor/game (current exe you are running). Mobile Preview basically adds -featureleveles2 to the cmd line for the exe, but still, only the current exe (including the shaders needed for that exe/RHI). Both of those options don’t effect the cooker/packager/deployer, it knows you are targeting mobile, and it will only do ES2 (currently).