Search Unity

Why UnityShaderCompiler (TCP)

Discussion in 'General Discussion' started by N1warhead, Dec 28, 2019.

  1. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Why does UnityShaderCompiler according to Windows Powershell, show active TCP connections for Shader compiling? I am doing network stuff for a type of server I'm designing and saw this by accident and made me wonder why this was even necessary.

    I mean I can understand why Unity.exe has TCP connections - to verify license files, etc.
    But Shader stuff??? "netstat -b" is the command in powershell I used.

    Not complaining, just honestly curious and would like to learn why this is happening.

    upload_2019-12-27_20-47-9.png
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,770
    Many application use networking solutions, to integrate components into the software. Looks like shader compilers is external application, which works independently. I suspect it opens port for receiving shader data, and send back compiled solution.

    Such solution allows to replace easily such component like shader compiler. Thing about it more like message system in Unity, where you have broadcasters and listeners. They don't care about each other, but care about data on the bus. ROS uses similar approach.

    Also, VS connects over TCP with Unity.

    At least these are most sensible reason, why you see TCP ports connections for shader compiler. Not sure only, why each time does that with new port.
     
    elmar1028, N1warhead and Ryiah like this.
  3. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    That makes sense.. Just always figured it was all built into Unity, never thought about them being various different little sub processes.
     
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,157
    Antypodish and iamthwee like this.
  5. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,770
  6. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    Using TCP to localhost is one of the possible ways to perform interprocess communication. In addition to shared memory, named pipes, and probably few other things I overlooked (shared files?).

    Socket communication is not necessarily FAST, but by going with networked communication, you gain ability to later move the other program to some other place (other computer and even different OS) and it will still keep working.

    Additionally sockets may be more OS agnostic than other ways of IPC.