Jump to content

GPU Optimization


quarks
 Share

Recommended Posts

I'm far from an expert on accelerated graphics. I'd like some help understanding some concepts and how they are implemented in Phaser to help me optimize a project I'm working on.

 

(NB: The function names below are just pseudocode, and do not correspond exactly with actual Phaser, PIXI, or GL functions.)

 

As I understand it, the GPU can cache textures. Given that, something like drawCachedTextureAt(textureReference, x, y) is a very fast operation. By contrast, drawUncachedTextureAt(textureData, x, y) is considerably slower, since the data has to be copied to the GPU. Is that basically correct?

 

If I have the above correct, the question is which Phaser operations cause textures to be copied to the GPU, and which use cached textures if available. To be more specific, I am trying to implement some animations "by hand", e.g. not using a spritesheet but generating the frames programatically. Is doing something like sprite.setTexture(frame) in update going to force the texture to be copied every time? If so, is there any way to precache it on the GPU?

 

Thanks.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...