(D3D9) Refactor render_chain.cpp - isolate Cg code