Avoid unnecessarily re-allocating texture buffer when the size hasn't changed.
Avoid unnecessarily re-allocating texture buffer when the size hasn't changed.

v4:
Incorporated krh and anderco's comments.  Now adding newly allocated
buffer's dimensions to texture_damage

v3:
* Removed unnecessary parentheses
* Added check for switching from EGL image to SHM buffer
* Moved shader assignment out of IF condition

v2:
Fixed the wrong comparison

v1:
Depending on specific DRI driver implementation, glTexImage2D() with data
set to NULL may or may not re-allocate the texture buffer each time it is
called.  Unintended consequences happen if later glTexSubImage2D() is called
to only update a sub-region of the texture buffer.

I've explored moving glTexImage2D() from gl_renderer_attach() and simply
mark the texture dirty, but the current implemention seems cleaner because
I won't have to worry about calling ensure_textures() and re-assigning
gs->shader unnecessarily.

jonnylamb/weston,Gnurou/weston,mchalupa/weston,krezovic/weston,kwm81/weston,sir-murray/weston,Fantu/compositor-spice,jonnylamb/weston,xorgy/weston,Fantu/compositor-spice,Tarnyko/weston-xdg_surface_present,eyolfson/weston,krezovic/weston,mchalupa/weston,giucam/weston,Gnurou/weston,Fantu/compositor-spice,xorgy/weston,giucam/weston,eyolfson/weston,sir-murray/weston,kwm81/weston,Tarnyko/weston-xdg_surface_present,udoprog/weston,udoprog/weston