Files
aego/render/material/pending.go
T
sanspie a6822156cd
ci-platforms / windows amd64 smoke (push) Skipped
ci / release (push) Successful in 8m58s
ci-platforms / darwin amd64 smoke (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
ci / checks (push) Successful in 4m46s
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 13m28s
Finish Stage 12 editor fixes and refreshed platformer
2026-11-05 17:36:42 +03:00

33 lines
916 B
Go

package material
// Pending reports whether this material is waiting for a candidate to commit.
// Its Shader, values and Generation still describe the committed definition.
func (c *Cache) Pending(m *Material) bool {
if c == nil || m == nil {
return false
}
if c.isolated[m] != nil {
return true
}
_, tracked := c.mats[m]
return tracked && c.reloads[m.shader] != nil
}
// ClonePendingDefinition copies the latest queued material source on CPU so texture refresh preserves uncommitted edits; shader-only reloads return nil.
func (c *Cache) ClonePendingDefinition(m *Material) (*Material, error) {
if c == nil || m == nil {
return nil, nil
}
if r := c.isolated[m]; r != nil {
if def := r.definitions[m]; def != nil {
return def.CloneDefinition()
}
}
if r := c.reloads[m.shader]; r != nil {
if def := r.definitions[m]; def != nil {
return def.CloneDefinition()
}
}
return nil, nil
}