shader-slang / slang

Making it easier to work with shaders
MIT License
1.81k stars 161 forks source link

Avoid duplicating entry points in library #4279

Closed kaizhangNV closed 1 month ago

kaizhangNV commented 1 month ago

When compile a library module with other slang module together, if that library module already contains entry points, during the front-end process, we could add the entry points in library module again when scanning all the translation units. This will cause an issue that we will call linkIR twice on the exactly same entry point, and it will downgrade our performance heavily.

So, we will add a check in _discoverEntryPoints(), where if the entry points were added before, don't discover them again.