Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

When should I set RenderBufferStoreAction to STORE when I SetRenderTarget?

Discussion in 'General Graphics' started by EminemJ, Aug 12, 2021.

  1. EminemJ

    EminemJ

    Joined:
    Mar 10, 2020
    Posts:
    45
    I do not quite understand when should I set RenderBufferStoreAction to store when Setting RenderTarget.
    When postprocessing, I will Blit the current RenderTarget A to RenderTarget B, the RenderTarget B will be set as LoadAction.DontCare and StoreAction.Dontcare, am I right?
    And another scenario is that when doing forward rendering in RenderTarget A, I Blit A to another RenderTarget B, and I will change target to A to continue rendering and sampling Rendertexture B, in this case, RenderTarget A should be LoadAction.Load and StoreAction.Store, RenderTarget B should be LoadAction.DontCare and StoreAction.DontCare, am I right?
    So basically the StoreAction.Store is only used when there is a demand to Load this renderContent after RenderTarget changed?
     
  2. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    The LoadAction is realized when you switch to a render target, the StoreAction is realized after you are done with s render target and switch to a different one.

    Most likely you want to set the StoreAction to Store.

    In your second example RenderTarget B most likely needs Store at least for the color buffer.

    The typical use for StoreAction.DontCare is for the depth buffer if you don‘t need to preserve it.
     
  3. EminemJ

    EminemJ

    Joined:
    Mar 10, 2020
    Posts:
    45
    Thx for your reply. And another question is " Can I sample color from a RenderTexture in tile memory?",I'm not sure if I state right but in other words, if I set a RenderTexture to MemoryLess, this color buffer will not be copied from tile memory to system memory, can I still Sample this RenderTexture ?
     
  4. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    You can read the last value of the current fragment location in the fragment shader (via framebuffer fetch or using subpass inputs). But it‘s not trivial to use across platforms. You cannot sample is like a normal texture.
     
  5. RyanKeable

    RyanKeable

    Joined:
    Oct 16, 2013
    Posts:
    62
    Can you provie an example of how you could potentially sample a memory less texture on a tiled GPU please?
     
  6. EminemJ

    EminemJ

    Joined:
    Mar 10, 2020
    Posts:
    45
    It all makes clear to me now,Thx !