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. Dismiss Notice

Question Unity shaders with external analyzers

Discussion in 'Shaders' started by VictorKs, Mar 3, 2023.

  1. VictorKs

    VictorKs

    Joined:
    Jun 2, 2013
    Posts:
    242
    So recently I started using Intel GPA and Nvidia NSight Graphics. While both programs work smoothly with Unity I have problems with shader debugging. I usually write surface shaders because I am not that good with PBR lighting. So is there a way to convert a surface shader to standard HLSL or even a vert/frag shader?

    Also I tried compiling with OpenGL API set as target and I get a weird shader with xlat variables is this like a pseudocode because it does not look like assembly.
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,845
    Yes, there's a button to take a look at the generated shader code.
    Keep in mind that you'll need to pick the right variant.

    Yes, we convert compiled HLSL code into GLSL.
     
    VictorKs likes this.
  3. VictorKs

    VictorKs

    Joined:
    Jun 2, 2013
    Posts:
    242
    I needed to include #pragma enable_d3d11_debug_symbols but for some stupid reason I added it to the wrong shader...
    Anyway thanks for helping out!

    Btw I've taken a look at a very simple Unlit fragment/Vertex shader and I notice too many data structures for Constant Buffer data (position etc...) I guess Unity injects all the app data and later the compiler strips the unnecessary data and creates the bytecode. Do you know if it is possible to modify this behavior or somehow control it?
     
  4. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,845
    That's correct.
    No.
     
    VictorKs likes this.
  5. VictorKs

    VictorKs

    Joined:
    Jun 2, 2013
    Posts:
    242
    Sounds reasonable :) Thanks again!