General Fixes and Improvements

This pull request will contain general fixes and cleanup.

* Implements texture_set_priority for Direct3D9