gfx-rs / gfx_scene

deprecated
Apache License 2.0
15 stars 1 forks source link

Support for shader compositing #4

Open kvark opened 9 years ago

kvark commented 9 years ago

Technique interface assumes it's an immutable thing. With shader composting, we might not want to pre-compile all the programs in advance (even though it would work now, and it's not a bad idea to prevent hitches on the way). If a technique wants to link shader programs, it also probably wants to cache them.

It's just a matter of changing self on Technique::compile, we can do it in a backward-compatible manner later.

kvark commented 9 years ago

Alternatively, one can just use RefCell to cache programs inside the Technique implementation to hack around &self.

kvark commented 9 years ago

Another problem is that creating new programs on the fly requires &mut Factory, which is nowhere near. I need to ether change the interface to include it as a param (with &mut self), or find another way.