Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Controlling whether "#pragma enable_d3d11_debug_symbols" gets added to all shaders?

Discussion in 'Shaders' started by ElliomanGames, May 23, 2019.

  1. ElliomanGames

    ElliomanGames

    Joined:
    Jul 26, 2016
    Posts:
    14
    Hey,

    I'm trying to find a sane way to include or remove "#pragma enable_d3d11_debug_symbols" in our shaders.

    What I don't want is to always go through the numerous shaders in the project and add the line to them everytime I need to debug the shaders in our game.

    So far I've tried using #define and a .cginc file but been unsuccessful.

    I need a simple approach to turn on/off the pragma in our shaders depending on whether I'm trying to debug.

    Any ideas? Is this possible?
     
  2. ElliomanGames

    ElliomanGames

    Joined:
    Jul 26, 2016
    Posts:
    14
    Bumping this once in hopes that someone has a solution. Otherwise this sounds like a feature request...
     
  3. ElliomanGames

    ElliomanGames

    Joined:
    Jul 26, 2016
    Posts:
    14
    Okay, where does one submit a feature request to Unity? Do I do it here or...?

    What I would like:
    Be able to have a .cginc file that can have "#define XXXX" commands and control how the shader gets build instead of just controlling the paths taken inside the vert, frag, surf functions.

    My use case here is that I want my shaders to have:

    Code (CSharp):
    1. #include "ShaderDebugDefines.cginc"
    2.  
    3. #ifdef DEBUG_ENABLE_SYMBOLS
    4. #pragma enable_d3d11_debug_symbols
    5. #endif
    where the ShaderDebugDefines.cginc would have defines useful for us when debugging/trying out new features.

    Right now when trying this, things outside of the functions will always be included in the shader no matter if it has been defined or not in the include file.