Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Let us know your feedback about the Global Illumination changes in the 2023.2 beta.
    Dismiss Notice
  3. Dismiss Notice

Compute Shader includes

Discussion in 'Unity 5 Pre-order Beta' started by braaad, Nov 21, 2014.

  1. braaad

    braaad

    Joined:
    Oct 4, 2012
    Posts:
    102
    Is the #include directive in compute shaders broken or the default search path changed in U5? I have tried both b9 and b13 and in both the compiler fails to find included files.

    e.g.

    Code (CSharp):
    1. #include "SomeShaderInclude.cginc"
    Will return a shader error of Shader error in 'SomeShader.compute': failed to open source file: 'SomeShaderInclude.cginc' at line 28 (on ) when the file is in the same directory. I have also tried it relative to /Assets and still no luck.

    I would submit a bug report but just checking I haven't missed something in the conversion docs etc.
     
    Last edited: Nov 22, 2014
  2. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    Just judging by the error message, have you tried removing the ".cginc" from the include statement?
     
  3. braaad

    braaad

    Joined:
    Oct 4, 2012
    Posts:
    102
    Oops, helps if I proof-read my post...that was a copy paste error when writing the post, I have fixed it up.
     
  4. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Yea, this seems broken still in b20.

    @braaad - did you file a bug report for this?
     
  5. braaad

    braaad

    Joined:
    Oct 4, 2012
    Posts:
    102
    Sorry, forgot to update this thread, includes in compute shaders and .cginc files now seem to require the full path eg, #include "Assets/Shaders/Example.cginc" even if they are at the same path.
     
    candycat likes this.
  6. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Ah, gotcha. Thanks!