There was too much image texture specific stuff in device_memory, and too much code duplication between devices.