Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

About HLSLPROGRAM VS CGPROGRAM

Discussion in 'Shaders' started by akilar1002, Oct 9, 2018.

  1. akilar1002

    akilar1002

    Joined:
    Jul 18, 2016
    Posts:
    70
    I am currently developing my own SRP. I see that LWRP is currently using HLSLPROGRAM. Does this mean that HLSLPROGRAM is the main language, so I should start using HLSLPROGRAM for development. Don't use CGPROGRAM anymore?
     
    monsieur_alpha likes this.
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,366
    The SRPs have been trying to remove alot of the old references to Cg where it can. Things like CGPROGRAM and .cginc files are prime examples as the SRPs use HLSLPROGRAM and .hlsl files. In reality Unity removed any actual use of Cg long ago, and these two examples are 100% equivalent in terms of functionality. It's all been HLSL for the last several years.

    Curiously they still use #pragma fragment, which is another Cg-ism. HLSL and DirectX call this shader stage the pixel shader. I'm not sure why they didn't change that.
     
    Goularou, zwcloud, ModLunar and 2 others like this.
  3. akilar1002

    akilar1002

    Joined:
    Jul 18, 2016
    Posts:
    70
    OK! thanks for your response.