Search Unity

Compute Shader #include bug?

Discussion in 'General Graphics' started by owen_proto, Mar 15, 2020.

  1. owen_proto

    owen_proto

    Joined:
    Mar 18, 2018
    Posts:
    120
    I'm trying to compile a compute shader with two #include statements. Only the first statement works. I tried switching them around and the top statement will always work and the second will fail. I tried looking around to see if there was a limitation to one #include, or if there is a different syntax for multiple include files. The files I'm attempting to import are .cginc files, if that makes a difference. The way I'm writing it is as below:

    Code (CSharp):
    1. #include "file1.cginc"
    2. #include "file2.cginc"
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,028
    I'm pretty sure multiple include files work. Why do you think only one works?
    Perhaps you have the same
    Code (CSharp):
    1. #ifndef FILE1
    2. #define FILE1
    3. ...
    4. // include contents
    5. ...
    6. #endif
    in both?
     
    owen_proto likes this.