Open
Description
When writing functions in a separate hlsl
file and then using them as custom functions in shader graph Rider doesn't see the global properties defined in the graph. Also Rider complains about unresolved symbols for typical unity shader macros like SAMPLE_TEXTURE2D
.
One way to work around this is to pass all the shader graph properties as parameters to the function but it's annoying and still doesn't solve the problem with the macros.
Steps to reproduce:
- Create a shader graph and add a property - for example
SomeTexture
with typeTexture2D
- Create a
hlsl
file and write a function in it:
void TestFunction_float(out float3 color)
{
color = SAMPLE_TEXTURE2D(_SomeTexture, sampler_SomeTexture, float2(0, 0)).rgb;
}
- In the shader graph add a custom function node and set it up to use the file and function created in the previous step
- Connect the custom function node output to the shader base color
- The shader will compile fine but Rider will complain about unresolved symbols for
SAMPLE_TEXTURE2D
,_SomeTexture
andsampler_SomeTexture
I'm using Unity 6000.0.23f1 and Rider 2024.1.2
Metadata
Metadata
Assignees
Labels
No labels