View Single Post
06-25-16, 11:43 AM   #6
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Textures are handled differently in Legion to reduce demand on memory. It seems every time you explicitly hide a texture, it's freed from memory and will be reallocated once it's shown again. I'm not completely sure about this, but I think if you use GetTexture() on a hidden region, it'll return nil now, since it doesn't have a texture attached to it if it's hidden.

I had a similar problem (which was honestly just bad design) where I used a 1024x1024 gradient to backdrop a couple of tiny check buttons, which wasn't an issue on Live since they're only loaded once, but in Legion, it would take a second for the frame to draw all the objects when it was shown.

The threshold for frame drops seems to be relatively high on my mid-range system, but the only thing you can do is to be mindful of the amount of textures you're using and their original size. If you're able to, merge stuff as much as possible and remove any redundant regions that you're using out of convenience. Also, it's probably not a good idea to use texture coordinates for a crap ton of textures. Until we can store our own atlas textures through Blizzard's system, it's probably wise to just use small individual textures instead. Most importantly, don't refresh textures in an update script.

Edit: One thing I noticed from reading your code is that you're using separate textures for each button to draw different rarity borders around the reward icons. Why aren't you using a white border texture and setting vertex color to the item rarity instead? Hiding and re-showing all those textures is unnecessary, when you can just change the color of them instead. Each time you do this, you're forcing the game to reload your 512x512 atlas texture, crop it and resize it.

Lua Code:
  1. local color = ITEM_QUALITY_COLORS[rarity]
  2. self.border:SetVertexColor(color.r, color.g, color.b)

Edit 2: In comparison, look at this frame which doesn't cause any drop in frame rate:


It has quite a few individual textures drawn, and each spell icon is masked. However, the mask I'm using is tiny and meant for the circle buttons around the minimap. On top of that is a 32x32 pixel border. In fact, all custom textures that are repeatedly drawn in that screenshot are equal to or less than 64x64 pixels. I'm also using the atlas approach for some of the elements, but they are few in number.
__________________

Last edited by MunkDev : 06-25-16 at 12:39 PM.