Skip to content

Shader translation via HLSLcc #11

@0xf4b1

Description

@0xf4b1

According to Unity's Shader compilation documentation under "Different shader compilers": https://docs.unity3d.com/6000.1/Documentation/Manual/shader-compilation.html

Different platforms use different shader compilers for compilation as follows:

  • Platforms that use DirectX use Microsoft’s FXC HLSL compiler.
  • Platforms that use OpenGL (Core & ES) use Microsoft’s FXC HLSL compiler, followed by bytecode translation into GLSL using HLSLcc.
  • Platforms that use Metal use Microsoft’s FXC HLSL compiler, followed by bytecode translation into Metal, using HLSLcc.
  • Platforms that use Vulkan use Microsoft’s FXC HLSL compiler, followed by bytecode translation into SPIR-V, using HLSLcc.
  • Other platforms, such as console platforms, use their respective compilers.
  • Surface Shaders use HLSL and MojoShader for code generation analysis step.

Based on the description, shaders always get compiled via the Microsoft’s FXC HLSL compiler (DirectX) and if the target is not DirectX get further translated via HLSLcc (e.g. OpenGL, Vulkan), so may it be possible to translate games with DirectX shaders via HLSLcc to OpenGL or Vulkan? 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions