Author Topic: FrameBuffer.blit(RGBColor...)  (Read 2608 times)

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
FrameBuffer.blit(RGBColor...)
« on: January 23, 2013, 11:29:19 pm »
Please, could you add method FrameBuffer.blit(RGBColor col, int destX, int destY, int width, int height, boolean transparent)? This should be much faster than blit 8*8 white texture with additional color.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: FrameBuffer.blit(RGBColor...)
« Reply #1 on: January 24, 2013, 10:26:45 am »
Why should that be any faster? It's the same basic operation of rendering a quad... ???

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: FrameBuffer.blit(RGBColor...)
« Reply #2 on: January 24, 2013, 11:19:24 am »
I suppose, when is blitted texture with additional color, to every pixel of texture is added additional color, so on 1280*720 it is a lot of extra calculations... But I do not know what is hiding in the background.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: FrameBuffer.blit(RGBColor...)
« Reply #3 on: January 24, 2013, 12:34:17 pm »
On PowerVR this has no effect at all. On Mali and Tegra it's faster if you omit the texture and render the color only, but that's only noticable in a very artifical test case when you blit 100 times the same texture filling the whole screen. And why would you want to do that? A clear with some color would be much faster anyway...

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: FrameBuffer.blit(RGBColor...)
« Reply #4 on: January 24, 2013, 12:55:53 pm »
It is for menu. Everything are blitted with using colors, there are not needed any textures. How big differences are in speed?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: FrameBuffer.blit(RGBColor...)
« Reply #5 on: January 24, 2013, 12:59:23 pm »
When filling the screen (1280*800) on the Nexus 7 100times, it's half as fast when using the texture access then without it. But as said, that's a stupid test case. Nobody would do that and no menu would come even close to these numbers...

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: FrameBuffer.blit(RGBColor...)
« Reply #6 on: January 24, 2013, 01:12:57 pm »
Well, so I try optimize my code sometime in the future (fps drops down from 60 to 55 when is editor menu visible)... Thank you for testing ;)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: FrameBuffer.blit(RGBColor...)
« Reply #7 on: January 24, 2013, 01:19:29 pm »
If it ever becomes a problem, i can still try to detect your special case and optimize the shader for it, but i don't think that this will ever be needed. The drop you see comes from the additional rendering and state switches and such, not from the lack if fill rate.