shader-slang / slang

Making it easier to work with shaders
MIT License
2.04k stars 175 forks source link

Capability System: Fully define all capabilities meant for a user with 2 representations `_Internal_atom`/`External_atom` #4676

Closed ArielG-NV closed 2 months ago

ArielG-NV commented 2 months ago

To reduce the complexity of a change (for easier PR reviews) the larger https://github.com/shader-slang/slang/issues/4347 task will be split into multiple smaller issues.

Problem: Currently when printing capabilities we have a problem, we print _capability atoms. Due to this printing, users attempt to solve capability problems using these _capability atoms.

Using _ has 2 problems for User Slang code written:

  1. _ atoms are normally designed to only work with 1 target
  2. _ atoms change in definition and can break user-code.

Solution:

  1. Enforce in the capability-generator during capability creation that all _myAtom capabilities must have a corresponding myAtom capability, myAtom should be fully defined on all targets with related features.
  2. During capability printing don't print _ if a atom is prefixed with a _
  3. [should be a new issue] Warn any-users using a _ prefixed capability since only non _ prefixed atoms should be used.
ArielG-NV commented 2 months ago

Note: this will likely require making all _internal atoms isolated to a target and all external atoms fully defined on all targets supporting a related feature.