This change introduces program-type aware shader code replacement (#2424)
in VShaderWrapper, allowing independent GLSL modifications for:
- stroke programs
- fill programs
- depth programs
Previously, `set_color_by_code()` relied on a single global
replacement mechanism. As a result:
- Multiple calls to `set_color_by_code()` would override each other.
- Applying different GLSL logic to stroke and fill was not possible.
- The last shader replacement always won.
This update solves that limitation by:
1. Storing shader code replacements per program type.
2. Applying replacements only to shaders matching the given program_type.
3. Preserving previously applied replacements for other program types.
4. Maintaining backward compatibility when program_type is None.
Now users can safely do:
set_color_by_code(..., program_type="stroke")
set_color_by_code(..., program_type="fill")
without one affecting the other.
This makes stroke and fill shader logic fully independent,
opening the door for:
- Different gradients for stroke and fill
- Custom sheen effects per layer
- Advanced shader experimentation
- Cleaner shader architecture
Backward compatibility:
If no program_type is provided, behavior falls back to the
original global replacement logic.
This improves flexibility without breaking existing scenes. S
Shavez committed
e14177036c069800f0e21cc253367cc22bacca25
Parent: 0d3b06d
Committed by GitHub <[email protected]>
on 3/26/2026, 2:37:11 PM