Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    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,911
    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...