Author Topic: Same depth value results in multiple dracalls?  (Read 2443 times)

johns

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 16
    • View Profile
Same depth value results in multiple dracalls?
« on: May 19, 2014, 12:08:46 AM »
I'm trying to optimize the number of drawcalls using the drawcall tool.

The Panel itself has depth 0, and a few sprites within it also have a depth of 0. I expect all of them to get drawn at the same time however the drawcall tool shows that some of them are being batched and some of them are drawn separately. What is the reason and how can I make all of them get drawn at the same time?

Also I've noticed that widgets with different depth values are being grouped together. Is it the expected behaviour?

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Same depth value results in multiple dracalls?
« Reply #1 on: May 19, 2014, 12:36:16 PM »
Sharing the same depth doesn't mean it will be batched. Only the same material can be batched. If you use different materials (different atlases, dynamic fonts, textures, etc), then they obviously can't be batched.

It's generally not a good idea to have widgets share depth unless you know they will never overlap.

helmesjo

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 116
    • View Profile
Re: Same depth value results in multiple dracalls?
« Reply #2 on: May 22, 2014, 04:28:11 AM »
Sharing the same depth doesn't mean it will be batched. Only the same material can be batched. If you use different materials (different atlases, dynamic fonts, textures, etc), then they obviously can't be batched.

It's generally not a good idea to have widgets share depth unless you know they will never overlap.

Actually, I have this issue even though the widgets share the same atlas. When I go over all the draw calls, there is sometimes one to much for the same atlas, and usually it's just one or two widgets causing the issue. If I adjust their depth, then suddenly it's only one drawcall...

Edit. Actually, I just noticed why (and of course it makes sense). It's when I have dynamic fonts rendered in-between widgets... :) Since that will require additional draw calls for them to sandwich correctly.
« Last Edit: May 22, 2014, 03:29:45 PM by helmesjo »

johns

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 16
    • View Profile
Re: Same depth value results in multiple dracalls?
« Reply #3 on: July 02, 2014, 08:10:25 PM »
Yeah, same thing for me - getting rid of dynamic fonts solved the issue.