marco redefinition UnityInstancing.hlsl Unity Matrix

Unity 2021.2.5 URP api 12.1.2

Hello

was wondering if anyone has opened a bug report yet concerning marco redefinition found in UnityInstancing.hlsl

Lines 403 and 404

            #define UNITY_MATRIX_I_M       UNITY_ACCESS_INSTANCED_PROP(UNITY_BUILTINS_WITH_WORLDTOOBJECTARRAY, unity_WorldToObjectArray)
            #define UNITY_PREV_MATRIX_M    UNITY_ACCESS_INSTANCED_PROP(unity_Builtins3, unity_PrevObjectToWorldArray)
    #ifndef UNITY_DONT_INSTANCE_OBJECT_MATRICES
        #undef UNITY_MATRIX_M
        #undef UNITY_MATRIX_I_M

        // Use #if instead of preprocessor concatenation to avoid really hard to debug
        // preprocessing issues in some cases.
        #if UNITY_WORLDTOOBJECTARRAY_CB == 0
            #define UNITY_BUILTINS_WITH_WORLDTOOBJECTARRAY unity_Builtins0
        #else
            #define UNITY_BUILTINS_WITH_WORLDTOOBJECTARRAY unity_Builtins1
        #endif

        #ifdef MODIFY_MATRIX_FOR_CAMERA_RELATIVE_RENDERING
            #define UNITY_MATRIX_M         ApplyCameraTranslationToMatrix(UNITY_ACCESS_INSTANCED_PROP(unity_Builtins0, unity_ObjectToWorldArray))
            #define UNITY_MATRIX_I_M       ApplyCameraTranslationToInverseMatrix(UNITY_ACCESS_INSTANCED_PROP(UNITY_BUILTINS_WITH_WORLDTOOBJECTARRAY, unity_WorldToObjectArray))
            #define UNITY_PREV_MATRIX_M    ApplyCameraTranslationToMatrix(UNITY_ACCESS_INSTANCED_PROP(unity_Builtins3, unity_PrevObjectToWorldArray))
            #define UNITY_PREV_MATRIX_I_M  ApplyCameraTranslationToInverseMatrix(UNITY_ACCESS_INSTANCED_PROP(unity_Builtins3, unity_PrevWorldToObjectArray))
        #else
            #define UNITY_MATRIX_M         UNITY_ACCESS_INSTANCED_PROP(unity_Builtins0, unity_ObjectToWorldArray)
            #define UNITY_MATRIX_I_M       UNITY_ACCESS_INSTANCED_PROP(UNITY_BUILTINS_WITH_WORLDTOOBJECTARRAY, unity_WorldToObjectArray)
            #define UNITY_PREV_MATRIX_M    UNITY_ACCESS_INSTANCED_PROP(unity_Builtins3, unity_PrevObjectToWorldArray)
            #define UNITY_PREV_MATRIX_I_M  UNITY_ACCESS_INSTANCED_PROP(unity_Builtins3, unity_PrevWorldToObjectArray)
        #endif
1 Like

found same issue already closed in 12.0.0
this has returned again in 12.1.1

Unity Issue Tracker - Macro redefinition warnings in the Inspector window when selecting a specific shader using URP 12.0.0 package version (unity3d.com)

1 Like

see also
Bug - (Case 1364927) URP 12 makes macro redefinition warnings - Unity Forum

1 Like

Is there any way to fix this? Is Unity fixing it?

Using 2021.2.4 (HDRP 12.1.1) at the moment.

i am working 12.1.4 and have not come across it again lately
been focused on other bugs to chase this one :wink:

7920499--1010749--upload_2022-2-23_8-57-37.png

1 Like

follow up
change log [14.0.1] - 2021-12-07
Graphics/CHANGELOG.md at 6fe79059dde8afda7a4848c391586df1856a3531 ยท Unity-Technologies/Graphics (github.com)

โ€“ Fixed a shader warning in UnityInstancing.hlsl

note
if you must get rid of this warning in a version not yet fixed by Unity it can be surprised with
#pragma warning(disable: 4005)