Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Bug 2022.3.12 breaks matrix4x4 override

Discussion in 'Graphics for ECS' started by tertle, Oct 31, 2023.

  1. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,797
  2. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    352
    Unfortunately there is a bug in a recent performance optimization that seems to cause this.

    As a local workaround, if you are willing to use a modified package, you should be able to edit the UnityDOTSInstancing.hlsl file in the com.unity.render-pipelines.core package, and add the following function around line 517:

    Code (CSharp):
    1. float4x4 LoadDOTSInstancedDataOverridden_float4x4(uint metadata)
    2. {
    3.     uint address = ComputeDOTSInstanceDataAddressOverridden(metadata, 4 * 16);
    4.     float4 p1 = asfloat(DOTSInstanceData_Load4(address + 0 * 16));
    5.     float4 p2 = asfloat(DOTSInstanceData_Load4(address + 1 * 16));
    6.     float4 p3 = asfloat(DOTSInstanceData_Load4(address + 2 * 16));
    7.     float4 p4 = asfloat(DOTSInstanceData_Load4(address + 3 * 16));
    8.     return float4x4(
    9.         p1.x, p2.x, p3.x, p4.x,
    10.         p1.y, p2.y, p3.y, p4.y,
    11.         p1.z, p2.z, p3.z, p4.z,
    12.         p1.w, p2.w, p3.w, p4.w);
    13. }
     
    tertle likes this.