Search Unity

Resolved Load and Store action for RenderTexture

Discussion in 'General Graphics' started by bjefix, May 18, 2021.

  1. bjefix

    bjefix

    Joined:
    Mar 30, 2015
    Posts:
    9
    Hello everyone!

    I am optimizing the game for mobile platforms.
    The game has a minimap. A camera draws to targetTexture. I started profiling via xCode Frame Debugger and saw the following:
    1) For the minimap texture, the depth and stencil textures are generated.
    2) For these textures, Load and Store action are set as Load and Store, respectively.

    In order to set Load and Store action in DontCare I tried to do the following:
    1) mainCamera.targetTexture.DiscardContents (false, true);
    2) set Depth buffer to No depth buffer;
    3) set RenderTexture.memorylessMode = RenderTextureMemoryless.Depth;
    4) set Memoryless Depth in Player Settings to Forced.

    None of the above helped.

    Additional information:
    1) Unity version - 2019.4.16f1
    2) Render Pipeline - Built-in

    Can you please tell me how can I turn off the generation of depth and stencil textures for cameras that draw in targetTexture?
    And I would also like to know how to set the Load and Store action in DontCare for cameras that draw in targetTexture?

    Thanks in advance!
    Have a nice day!
     
    Last edited: May 19, 2021
  2. bjefix

    bjefix

    Joined:
    Mar 30, 2015
    Posts:
    9
    Issues resolved!

    The problem was that I forgot to rebuild the addressables.

    All 4 points, which are in the description of the question, helped to solve the problem.