bjz/gfx-rs — pull request #95 by kvark (2014-07-12 03:55:37+00:00)
Title: Deferred resource loading

#### PR is provided for demonstration only, not ready to merge yet

Supposed to close #21. **Features**:
* render - device protocol is severely upgraded, now calls and casts are separated, and the backend does only need to cover all the casts (no need for `_ => fail()` clause)
* resource are `MaybeLoaded` on the render side, which has to make sure that they are actually loaded before using them

**Problems**:
1. `Token` type is shared between different calls. It should be different, but that would blow up a lot of (already big) generic type signatures...
2. Borrow checker does not allow to query for the resource and wait for it in the same function (see [gist](https://gist.github.com/kvark/476647d410f64e16234b)). As it is now, render has to guarantee the resources are ready using separate functions (see `prebind_mesh`), and this is very non-rustic/error-prone.
3. When loading programs, render waits for the objects to load first, which makes it a bit pointless. There should be a way around this.

**Potential improvements**:
* `ResourceCache` with its dependent types to be moved into a separate module
* Completely removing any assumptions of the synchronous device nature from the render