GaijinEntertainment / DagorEngine

Dagor Engine and Tools source code from Gaijin Games KFT
Other
2.19k stars 273 forks source link

How to compile mobile shaders and use mobile renderer on PC #73

Open CodeLikeCXK opened 3 months ago

CodeLikeCXK commented 3 months ago

image Turning on mobile render(seems to be mobile deferred shading) in shaders_dx11 results in error. Setting to 1 is normal(mobile forward shading). Setting to 2 (mobile deferred shading) works on Vulkan only. image Also how to use mobile renderer while packaging for PC(just to see the pipeline)

NicSavichev commented 3 months ago

You should use SpirV (vulkan) shaders for android-based mobiles and Metal shaders for iOS-based mobiles. DX-based shaders cannot be built for mobiles in any way. Good news are that DX/SpirV/Metal is just selection for configs and shader compiler itself while shaders are written in common HLSL-like syntax (with generic dagor pre-shaders)

NicSavichev commented 3 months ago

The same, if we want to test mobile shader on PC we build SpirV and start application on PC with video{ driver:t="vulkan" to get similar results as with mobile targets.

CodeLikeCXK commented 3 months ago

The same, if we want to test mobile shader on PC we build SpirV and start application on PC with video{ driver:t="vulkan" to get similar results as with mobile targets.

I see. So how could I use mobile render pipeline on PC with dx11 or dx12, similar as mobile emulation pipeline?

NicSavichev commented 3 months ago

I'm afraid you have to patch common shaders (if it is possible) to compile and use it with DX. We don't use it in a such way so haven't checked compilability of shaders.

NicSavichev commented 3 months ago

Also this problem may be fixed in upcoming update to github (since previous sync is half-year old), but I don' have much hopes

CodeLikeCXK commented 3 months ago

Also this problem may be fixed in upcoming update to github (since previous sync is half-year old), but I don' have much hopes

I see. Other than shader, are there any differences in c++ part of renderer and any switch for that part?

CodeLikeCXK commented 3 months ago

Also this problem may be fixed in upcoming update to github (since previous sync is half-year old), but I don' have much hopes

Also, seems while using Vulkan, renderdoc result with mobile_render set to 0/1/2 are not so different. It's that normal?

MetalMaxMX commented 3 months ago

Also this problem may be fixed in upcoming update to github (since previous sync is half-year old), but I don' have much hopes

Any ETA on when the upcoming update is being synced? :eyes: