texture handling optimized for memory