Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8230641

MTLRenderer_FillSpans method needs to be optimized by reducing total number of drawPrimitives calls

XMLWordPrintable

    • 2d
    • x86_64
    • os_x

      MTLRenderer_FillSpans method in MTLRenderer.m gets invoked for variety of 2D primitive draw and fill operations - especially with HiDPI.

      Span count and span data is passed to this method.
      It draws each span as a quad using MTLRenderCommandEncoder::drawPrimitives.
      There is 1:1 mapping between a span and MTLRenderCommandEncoder::drawPrimitives call.

      Usually, for filled 2d primitives or stroked 2d primitives - the spancount is high. It results in multiple MTLRenderCommandEncoder::drawPrimitives calls.
      It is observed that this slows down the rendering of these primitives.

      Solution :
      We can reduce the number of draw calls by buffering data and issuing one draw call when the buffer is full. Experimentation has shown good results for rendering of primitives that uses this method.

            aghaisas Ajit Ghaisas
            aghaisas Ajit Ghaisas
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: