Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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,732
  2. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    350
    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.