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 Graphics.SetRenderTarget(RenderTexture) takes way too long on GPU

Discussion in 'High Definition Render Pipeline' started by larsbertram1, Feb 4, 2020.

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,828
    i am working on rendering a custom mask map just before the frame start rendering.
    in my first attempt i chose:
    RenderPipelineManager.beginCameraRendering += RenderMask;
    within in the
    private void RenderMask(ScriptableRenderContext context, Camera camera) {}
    - i get a temporary render texture
    - and set it as render target using Graphics.SetRenderTarget(RenderTexture);
    - and render a mesh using Graphics.DrawMeshNow();
    according to the unity profiler this takes 0.26ms on the GPU.

    going with a
    CustomPass instead and using RTHandles, CoreUtils.SetRenderTarget() and HDUtils.DrawRendererList() does not give me any significant costs for setting the render target at all: 0.000ms.

    i would not expect this discrepancy and wonder if i do something completely wrong...