d3drm: Move mesh loading code into a separate function so it can be shared.