Hey!
I am currently reworking our shader library and would like to use DXC for some shaders to support various SM 6.x features (mostly wave intrinsics).
At the moment there is no way to force dxc for all shaders as far as I can tell so instead I would like to have a header file that is included everywhere where I define it.
Recently unity introduced #include_with_pragmas in combination with the custom shader preprocessor which should be what I want to use here. My test setup looks like this:
#pragma kernel CSBlit
Texture2D<float4> _Src;
RWTexture2D<float4> _Dst;
#include_with_pragmas "../Core/Compiler.hlsli"
[numthreads(8,8,1)]
void CSBlit (uint3 id : SV_DispatchThreadID)
{
_Dst[id.xy] = _Src[id.xy];
}
#ifndef HEADER_COMPILER
#define HEADER_COMPILER
#pragma use_dxc
#endif //HEADER_COMPILER
I am getting errors like:
Shader warning in 'Blit': 'use_dxc' : unknown pragma ignored at kernel CSBlit at Assets/Rendering/Shaders/Core/Compiler.hlsli(4) (on d3d11)
I thought it might just be the dxc pragma but it seems to happen for every other one as well. In addition to that the preprocessor seems to be buggy since the error doesn’t change even if I change the pragma and reimport both shader files.
Is this a known issue? I appreciate any help, thanks in advance!