Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Custom Pass: RTHandle.Initialize should only be called once before allocating any Render Texture. Un

Discussion in 'High Definition Render Pipeline' started by Bordeaux_Fox, Feb 10, 2020.

  1. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Hello,

    I tried some of Unity's Custom Pass examples with Unity 2019.3.0f5 and HDRP 7.1.8 and I get that error in the console:

    RTHandle.Initialize should only be called once before allocating any Render Texture.
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)


    So could I assume the examples from Unity does not follow their own standards? Calling RT.Handle.Initialize multiple times.
     
  2. antoinel_unity

    antoinel_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    236
    Bordeaux_Fox likes this.
  3. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Hm, I still get this error in HDRP 7.2.0 and I just use the Unity custom pass examples as a template. Any idea?

    Also, the console says ProfilingSample is obsolete. So you may want to update that lines in your examples.
     

    Attached Files:

    Last edited: Feb 11, 2020
  4. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Bump, anyone?
     
    jparell likes this.
  5. antoinel_unity

    antoinel_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    236
    Hey, the fix have landed but there was also an issue in the custom pass samples (missing Release for the
    maskDepthBuffer RTHandle).
    I've updated the samples to fix this issue.
     
    Bordeaux_Fox likes this.
  6. mau_iida

    mau_iida

    Joined:
    Apr 2, 2020
    Posts:
    8
    Hi, this error is still happening in HDRP 7.2.1 with sample code TIPS_2 .

    RTHandle.Initialize should only be called once before allocating any Render Texture. This may be caused by an unreleased RTHandle resource.


    m_AutoSizedRTs.count is 38 left, so I don't think the reason is the custom pass sample code.

    I have tried to call "internal void Remove(RTHandle rth)" in "public void Release(RTHandle rth)".
    code like below. then the error is away now.
    Code (CSharp):
    1.        
    2.         public void Release(RTHandle rth)
    3.         {
    4.             if (rth != null)
    5.             {
    6.                 Remove(rth);  // <- here
    7.                 Assert.AreEqual(this, rth.m_Owner);
    8.                 rth.Release();
    9.             }
    10.         }
    11.  
    Is there any reason for don't call "Remove" in "Release"?
     
  7. MrCool92

    MrCool92

    Joined:
    Jul 13, 2015
    Posts:
    26
    Having an exact issue with 7.4.3 while changing quality settings during runtime.

    edit: think my error occurs cus of plugin not handling releasing textures

    edit 2: looks like RTHandleSystem.Initialize is called before CustomPostProcessVolumeComponent.Cleanup.. maybe that's the reason?
     
    Last edited: Sep 8, 2020
    starkr likes this.
  8. frosrain

    frosrain

    Joined:
    Sep 28, 2018
    Posts:
    1
    fixed ?, anyone?
     
  9. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,898
    Also get this error and cant see any apparent reason, any news ?
     
  10. StuwuStudio

    StuwuStudio

    Joined:
    Feb 4, 2015
    Posts:
    165
    Getting also random messages for RTHandles that are clearly taken care of.