Search Issue Tracker

By Design



Found in






Issue ID




Custom shaders throw not enough actual parameters for macro UNITY_SAMPLE_TEX2D_SAMPLER_LOD error after Project is upgraded

Shader System


How to reproduce:
1. Open the attached project named "Case_1298568" with 2020.1.15f1
2. Open the SampleScene
3. Observe the Console window - no errors are thrown
4. Open the attached project with 2020.1.16f1
5. Open the SampleScene
6. Observe the Console window again

Expected results: Shaders do not throw errors as in the previous Editor version
Actual results: Shaders throw "not enough actual parameters for macro 'UNITY_SAMPLE_TEX2D_SAMPLER_LOD' at line 182 (on d3d11) error

Reproducible with: 2019.4.17f1, 2020.1.16f1, 2020.1.17f1, 2020.2.1f1, 2021.1.0a10
Not reproducible with: 2018.4.30f1, 2019.4.16f1, 2020.1.0a1, 2020.1.15f1

Graphics APIs tested - D3D11, D3D12, Vulkan, OpenGLCore

1. In 2020.2 and 2021.1 a different error message is thrown:
[ShaderName] 'UNITY_SAMPLE_TEX2D_SAMPLER_LOD': Too few arguments to a macro call. at {ShaderIncludeName]

  1. Response avatar

    Resolution Note:

    UNITY_SAMPLE_TEX2D_SAMPLER_LOD did not actually exist until recently. For some reason the user was still checking it with #ifdef and defining it theirself. However, the definition is mismatching with what was recently added to HLSLSupport.cginc

    To fix this the user shader either needs to be changed to match with how we define this macro in HLSLSupport.cginc or it must skip the #ifdef check and use their own naming for the macro.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.