MCPcopy Create free account
hub / github.com/TheRedDeveloper/ply-engine / set_source

Method set_source

src/renderer.rs:523–532  ·  view source on GitHub ↗

Store or update a named shader source. If the source changed compared to the previously stored value, the old compiled material is evicted from the cache so the next render pass recompiles automatically. No-ops if the source is unchanged.

(&mut self, name: &str, fragment: &str)

Source from the content-addressed store, hash-verified

521 /// compiled material is evicted from the cache so the next render pass
522 /// recompiles automatically. No-ops if the source is unchanged.
523 pub fn set_source(&mut self, name: &str, fragment: &str) {
524 if let Some(old_source) = self.shader_storage.get(name) {
525 if old_source == fragment {
526 return; // Unchanged — nothing to do
527 }
528 // Evict stale material keyed by the old source
529 self.materials.remove(old_source.as_str());
530 }
531 self.shader_storage.insert(name.to_string(), fragment.to_string());
532 }
533
534 /// Look up a stored shader source by name.
535 pub fn get_source(&self, name: &str) -> Option<&str> {

Callers 1

set_shader_sourceFunction · 0.80

Calls 3

getMethod · 0.80
removeMethod · 0.80
as_strMethod · 0.80

Tested by

no test coverage detected