shader-slang / slang

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

Extraneous type conformances causes compiler error. #4486

Open tomas-davidovic opened 6 days ago

tomas-davidovic commented 6 days ago

After brief discussion with @csyonghe , I was told to file this for further investigation.

The effect is that when you define an unnecessary type conformance, e.g. FooImpl0 of interface type IFoo and it is not present in your module, the compiler errors out with:

Type 'FooImpl0' in type conformance was not found.

Since conformances are intended to narrow down types from "all types compiler found in the modules" to a subset that can actually be used, this feels unnecessary.

It also causes some issues, because it is not possible to just provide a list of all conformances used by the system/scene, it has to be specifically curated for each shader, based on what subset of interfaces is each shader actually using. Unless this brings some significant benefits in error checking, I believe this should be relaxed.