Author Topic: GrayScale atlas drawcall  (Read 2986 times)

markofevil3

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 25
    • View Profile
GrayScale atlas drawcall
« on: August 12, 2014, 10:08:17 PM »
I'm using 2 atlas in same panel, 1 is normal atlas, 1 is grayscale atlas. The problem is each sprite using grayscale atlas cost 2 drawcall, not 1 drawcall for whole atlas.
hierarchy:
UIPanel
 - UIGrid
    - item1
      - background (normal atlas)
    - item2
      - background (grayscale atlas)
    - item3
      - background (grayscale atlas)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: GrayScale atlas drawcall
« Reply #1 on: August 13, 2014, 07:49:49 AM »
Adjust the widget depths so that you don't sandwich any of them. When UIPanel batches sprites into draw calls, it goes by depth. If you break the depth with a different material, it has to create a different draw call.

This should work fine and will create 2 draw calls:

item 1 (depth 0) -- normal atlas
item 2 (depth 1) -- grayscale atlas
item 3 (depth 2) -- grayscale atlas

...but this will result in 3 draw calls:

item 1 (depth 1) -- normal atlas
item 2 (depth 0) -- grayscale atlas
item 3 (depth 2) -- grayscale atlas