shader-slang / slang

Making it easier to work with shaders
MIT License
1.78k stars 158 forks source link

Capability System: Simplify capabilities before printing #4347

Open ArielG-NV opened 2 weeks ago

ArielG-NV commented 2 weeks ago
  1. All functions which print (or lead to printing) of capabilities should first ensure the printed capabilities remove any capabilities which are implied by another before printing.

Example:

  1. assume def _GL_ARB_gpu_shader5 : _GLSL_150; and def _GL_ARB_shader_texture_image_samples : _GLSL_150
  2. code currently prints: {glsl, _GLSL_130, _GLSL_140, _GLSL_150, _GL_ARB_gpu_shader5, _GL_ARB_shader_texture_image_samples}
  3. we should instead print {_GL_ARB_gpu_shader5, _GL_ARB_shader_texture_image_samples}
  1. print without the prefix of _ (_Internal_Atoms)

  2. all _Internal_Atoms should have an equivalent External_Atom so users have no need to touch _Internal_Atoms (this also allows us to ban/warn any use of _Internal_Atoms

csyonghe commented 1 week ago

Can we also make sure every _Internal_Atom has a corresponding External_Atom? that way we can simply remove the prefixing _ when printing, so the user can specify the intended capability instead of using the internal ones.

ArielG-NV commented 1 week ago

we certainly can print without the prefix of _, I will add it to the issue.

_Internal_Atom has a corresponding External_Atom

I can add this to the 'capabilities generator' as well to enforce this policy?

csyonghe commented 1 week ago

Yes we should have that validation check in the generator.