wgsl_reflect icon indicating copy to clipboard operation
wgsl_reflect copied to clipboard

Add overrides to entries's function info

Open alienself opened this issue 1 year ago • 2 comments
trafficstars

Hi again,

I have been using WGSL overrides quite a bit lately and realize that there is no way to currently determine in which entry function the overrides (OverrideInfo) are used. This is problematic for my use case since I don't know if I should assign the overrides to vertex and fragment or simply one of them. WebGPU will raise an error if pipeline constants are declared in pipelines descriptors but not used in the actual entry function.

alienself avatar Sep 27 '24 18:09 alienself

Yeah I can add that. I haven't used overrides much, so thanks for the testing. It might be a couple days before I can get to it, ping me if I forget.

brendan-duncan avatar Sep 27 '24 19:09 brendan-duncan

I added overrides to FunctionInfo. It will walk the function AST graphs to find usage of override variables, so you can get the list for each entry function.

What I still need to take into account is shadowing of override variables, where a local variable with the same name shadows an override variable. In the current code, the override would still be considered in use.

brendan-duncan avatar Sep 28 '24 18:09 brendan-duncan