Skip to content

Implement a feature/variant system for materials #341

@adriengivry

Description

@adriengivry

Problem this feature should address
Our current material/shader system is quite limited. In many cases, we rely on booleans (int 0/1) to control branching in the shader code. While some of these booleans could be resolved at compilation time (e.g., toggling features through the material editor), the current implementation always resolves them at runtime by sending a uniform value.

Expected solution
We should implement a system to create shader variants, where a single instance of the Shader class can manage multiple underlying programs. Variants would represent a predefined set of feature toggles.

Feature Count Variants
0 2^0 = 1
1 2^1 = 2
2 2^2 = 4
3 2^3 = 8

Pre-compiled shader programs would significantly improve runtime performance by eliminating the need for branching.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GraphicsGraphical featureOptimizationOptimization related stuff

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions