Load store and memoryless

metal html

https://developer.apple.com/library/archive/documentation/3DDrawing/Conceptual/MTLBestPracticesGuide/LoadandStoreActions.htmlios

https://docs.unity3d.com/ScriptReference/Rendering.RenderBufferLoadAction.htmlapi

當前rt選 load 會致使以前一個pass的內容 從system mem copy到 當前tile memapp

當前rt 選store 會致使當前pass 內容 從tile 到system mem copyless

 

dont care 沒有上述開銷ide

 

和msaa相關的有ui

storeAndMultisample 後面那 個flag涉及resolve相關會生成resolve texthis

multisample content和resolvecontent都會保存url

 

==============3d

rtt的 action 設置爲 clear/store 由於它以後會被採樣

還要往以前rt上畫的 action load/store (store之後會有對它的採樣

這樣 咱們管線裏應該儘可能去掉load

用clear /store (會被採樣

或者 clear/dontcare(不會作rtt被採樣

======================

memoryless就是字面意思 是rendertexture的一個屬性 關掉action store只有tile memory, rtt sample就會失效了

https://docs.unity3d.com/ScriptReference/RenderTextureDescriptor-memoryless.html

So basically what your script is doing (Without memoryless flag):
ViewCamera renders scene objects into renderTexture
- Camera does storeAction to save renderTexture from tile memory to system memory
- Then renderTexture system memory copy is used as shader resource for ViewMonitor
- Lastly some other camera renders ViewMonitor (Where u probably use for testing if it works or not)

Once u enable the memoryless flag, storeAction cannot be done as renderTexture doesn't have system memory for it. So that leads that renderTexture will stay to the color it was created (Most likely gray - internally we even ignore all memoryless rendertexture setting on materials as it is not valid).

https://docs.unity3d.com/ScriptReference/RenderTexture-memorylessMode.html

https://forum.unity.com/threads/how-to-use-memoryless.491167/

因此這個memoryless對日常的管線來講 若是不是作single pass deferred rendering這種是沒用的 只在tile上

或者msaa也能用到這個

Render texture color pixels are memoryless when RenderTexture.antiAliasing is set to 2, 4 or 8.

https://docs.unity3d.com/ScriptReference/RenderTextureMemoryless.MSAA.html

rendertexture.antialiasing是sample 數量

 ================

load action 

  • If all the render target pixels are rendered to, choose the DontCare action. There are no costs associated with this action, and texture data is always interpreted as undefined.

  • If the previous contents of the render target do not need to be preserved and only some of its pixels are rendered to, choose the Clear action. This action incurs the cost of writing a clear value to each pixel.

  • If the previous contents of the render target need to be preserved and only some of its pixels are rendered to, choose the Load action. This action incurs the cost of loading the previous contents.

因此這裏選Dont care 咱們把要load的rt都作掉了,擾動那些要選clear

store action

第一遍不處理msaa的狀況 這裏選store 由於都要被srv(以後只用tile的和msaa 只用resolve的會選其它action)

depth stencil選dont care

storage mode 

由於尚未作singlepass因此也不用memoryless 若是是memoryless意味着沒有gpu cpu mem 只有tile mem能省 footprint

=============對於msaa rt 有額外兩種 store action能夠 處理 resolve 前後的兩張rt 的store action

srotreAndMultisampleResolve會保存兩種 5x 帶寬

MultisampleResolve 1x帶寬

store 4x帶寬

因爲要用來作srv我們應該選2 把4x那張帶寬和footprint去掉 ios推薦4xmsaa A11

====================

剛剛作到了個很了不得的事情 很開心

我能夠設置 mrt 的兩張msaa targets和depth target 的load action 和store action

用event cmd --after depth 

中間發現個事情 mrt msaa 對應的depth target彷佛就是1 sample 不是我以前覺得的4

我剛剛降了2G的帶寬/s 80M/fra

相關文章
相關標籤/搜索