[BZ395] Function only applicable for TEXTURE2D. Add some debug.